Class: Aws::OpsWorksCM::Client
- Inherits:
-
Seahorse::Client::Base
- Object
- Seahorse::Client::Base
- Aws::OpsWorksCM::Client
- Includes:
- ClientStubs
- Defined in:
- lib/aws-sdk-opsworkscm/client.rb
Overview
An API client for OpsWorksCM. To construct a client, you need to configure a ‘:region` and `:credentials`.
client = Aws::OpsWorksCM::Client.new(
region: region_name,
credentials: credentials,
# ...
)
For details on configuring region and credentials see the [developer guide](/sdk-for-ruby/v3/developer-guide/setup-config.html).
See #initialize for a full list of supported configuration options.
Class Attribute Summary collapse
- .identifier ⇒ Object readonly private
API Operations collapse
-
#associate_node(params = {}) ⇒ Types::AssociateNodeResponse
Associates a new node with the server.
-
#create_backup(params = {}) ⇒ Types::CreateBackupResponse
Creates an application-level backup of a server.
-
#create_server(params = {}) ⇒ Types::CreateServerResponse
Creates and immedately starts a new server.
-
#delete_backup(params = {}) ⇒ Struct
Deletes a backup.
-
#delete_server(params = {}) ⇒ Struct
Deletes the server and the underlying AWS CloudFormation stacks (including the server’s EC2 instance).
-
#describe_account_attributes(params = {}) ⇒ Types::DescribeAccountAttributesResponse
Describes your OpsWorks-CM account attributes.
-
#describe_backups(params = {}) ⇒ Types::DescribeBackupsResponse
Describes backups.
-
#describe_events(params = {}) ⇒ Types::DescribeEventsResponse
Describes events for a specified server.
-
#describe_node_association_status(params = {}) ⇒ Types::DescribeNodeAssociationStatusResponse
Returns the current status of an existing association or disassociation request.
-
#describe_servers(params = {}) ⇒ Types::DescribeServersResponse
Lists all configuration management servers that are identified with your account.
-
#disassociate_node(params = {}) ⇒ Types::DisassociateNodeResponse
Disassociates a node from an AWS OpsWorks CM server, and removes the node from the server’s managed nodes.
-
#export_server_engine_attribute(params = {}) ⇒ Types::ExportServerEngineAttributeResponse
Exports a specified server engine attribute as a base64-encoded string.
-
#list_tags_for_resource(params = {}) ⇒ Types::ListTagsForResourceResponse
Returns a list of tags that are applied to the specified AWS OpsWorks for Chef Automate or AWS OpsWorks for Puppet Enterprise servers or backups.
-
#restore_server(params = {}) ⇒ Types::RestoreServerResponse
Restores a backup to a server that is in a ‘CONNECTION_LOST`, `HEALTHY`, `RUNNING`, `UNHEALTHY`, or `TERMINATED` state.
-
#start_maintenance(params = {}) ⇒ Types::StartMaintenanceResponse
Manually starts server maintenance.
-
#tag_resource(params = {}) ⇒ Struct
Applies tags to an AWS OpsWorks for Chef Automate or AWS OpsWorks for Puppet Enterprise server, or to server backups.
-
#untag_resource(params = {}) ⇒ Struct
Removes specified tags from an AWS OpsWorks-CM server or backup.
-
#update_server(params = {}) ⇒ Types::UpdateServerResponse
Updates settings for a server.
-
#update_server_engine_attributes(params = {}) ⇒ Types::UpdateServerEngineAttributesResponse
Updates engine-specific attributes on a specified server.
Class Method Summary collapse
- .errors_module ⇒ Object private
Instance Method Summary collapse
- #build_request(operation_name, params = {}) ⇒ Object private
-
#initialize(options) ⇒ Client
constructor
A new instance of Client.
-
#wait_until(waiter_name, params = {}, options = {}) {|w.waiter| ... } ⇒ Boolean
Polls an API operation until a resource enters a desired state.
- #waiter_names ⇒ Object deprecated private Deprecated.
Constructor Details
#initialize(options) ⇒ Client
Returns a new instance of Client.
451 452 453 |
# File 'lib/aws-sdk-opsworkscm/client.rb', line 451 def initialize(*args) super end |
Class Attribute Details
.identifier ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
2068 2069 2070 |
# File 'lib/aws-sdk-opsworkscm/client.rb', line 2068 def identifier @identifier end |
Class Method Details
.errors_module ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
2071 2072 2073 |
# File 'lib/aws-sdk-opsworkscm/client.rb', line 2071 def errors_module Errors end |
Instance Method Details
#associate_node(params = {}) ⇒ Types::AssociateNodeResponse
Associates a new node with the server. For more information about how to disassociate a node, see DisassociateNode.
On a Chef server: This command is an alternative to ‘knife bootstrap`.
Example (Chef): ‘aws opsworks-cm associate-node –server-name MyServer –node-name MyManagedNode –engine-attributes “Name=CHEF_ORGANIZATION,Value=default” “Name=CHEF_NODE_PUBLIC_KEY,Value=public-key-pem”`
On a Puppet server, this command is an alternative to the ‘puppet cert sign` command that signs a Puppet node CSR.
Example (Puppet): ‘aws opsworks-cm associate-node –server-name MyServer –node-name MyManagedNode –engine-attributes “Name=PUPPET_NODE_CSR,Value=csr-pem”`
A node can can only be associated with servers that are in a ‘HEALTHY` state. Otherwise, an `InvalidStateException` is thrown. A `ResourceNotFoundException` is thrown when the server does not exist. A `ValidationException` is raised when parameters of the request are not valid. The AssociateNode API call can be integrated into Auto Scaling configurations, AWS Cloudformation templates, or the user data of a server’s instance.
532 533 534 535 |
# File 'lib/aws-sdk-opsworkscm/client.rb', line 532 def associate_node(params = {}, = {}) req = build_request(:associate_node, params) req.send_request() end |
#build_request(operation_name, params = {}) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 |
# File 'lib/aws-sdk-opsworkscm/client.rb', line 1928 def build_request(operation_name, params = {}) handlers = @handlers.for(operation_name) tracer = config.telemetry_provider.tracer_provider.tracer( Aws::Telemetry.module_to_tracer_name('Aws::OpsWorksCM') ) context = Seahorse::Client::RequestContext.new( operation_name: operation_name, operation: config.api.operation(operation_name), client: self, params: params, config: config, tracer: tracer ) context[:gem_name] = 'aws-sdk-opsworkscm' context[:gem_version] = '1.77.0' Seahorse::Client::Request.new(handlers, context) end |
#create_backup(params = {}) ⇒ Types::CreateBackupResponse
Creates an application-level backup of a server. While the server is in the ‘BACKING_UP` state, the server cannot be changed, and no additional backup can be created.
Backups can be created for servers in ‘RUNNING`, `HEALTHY`, and `UNHEALTHY` states. By default, you can create a maximum of 50 manual backups.
This operation is asynchronous.
A ‘LimitExceededException` is thrown when the maximum number of manual backups is reached. An `InvalidStateException` is thrown when the server is not in any of the following states: RUNNING, HEALTHY, or UNHEALTHY. A `ResourceNotFoundException` is thrown when the server is not found. A `ValidationException` is thrown when parameters of the request are not valid.
630 631 632 633 |
# File 'lib/aws-sdk-opsworkscm/client.rb', line 630 def create_backup(params = {}, = {}) req = build_request(:create_backup, params) req.send_request() end |
#create_server(params = {}) ⇒ Types::CreateServerResponse
Creates and immedately starts a new server. The server is ready to use when it is in the ‘HEALTHY` state. By default, you can create a maximum of 10 servers.
This operation is asynchronous.
A ‘LimitExceededException` is thrown when you have created the maximum number of servers (10). A `ResourceAlreadyExistsException` is thrown when a server with the same name already exists in the account. A `ResourceNotFoundException` is thrown when you specify a backup ID that is not valid or is for a backup that does not exist. A `ValidationException` is thrown when parameters of the request are not valid.
If you do not specify a security group by adding the ‘SecurityGroupIds` parameter, AWS OpsWorks creates a new security group.
*Chef Automate:* The default security group opens the Chef server to the world on TCP port 443. If a KeyName is present, AWS OpsWorks enables SSH access. SSH is also open to the world on TCP port 22.
*Puppet Enterprise:* The default security group opens TCP ports 22, 443, 4433, 8140, 8142, 8143, and 8170. If a KeyName is present, AWS OpsWorks enables SSH access. SSH is also open to the world on TCP port 22.
By default, your server is accessible from any IP address. We recommend that you update your security group rules to allow access from known IP addresses and address ranges only. To edit security group rules, open Security Groups in the navigation pane of the EC2 management console.
To specify your own domain for a server, and provide your own self-signed or CA-signed certificate and private key, specify values for ‘CustomDomain`, `CustomCertificate`, and `CustomPrivateKey`.
960 961 962 963 |
# File 'lib/aws-sdk-opsworkscm/client.rb', line 960 def create_server(params = {}, = {}) req = build_request(:create_server, params) req.send_request() end |
#delete_backup(params = {}) ⇒ Struct
Deletes a backup. You can delete both manual and automated backups. This operation is asynchronous.
An ‘InvalidStateException` is thrown when a backup deletion is already in progress. A `ResourceNotFoundException` is thrown when the backup does not exist. A `ValidationException` is thrown when parameters of the request are not valid.
990 991 992 993 |
# File 'lib/aws-sdk-opsworkscm/client.rb', line 990 def delete_backup(params = {}, = {}) req = build_request(:delete_backup, params) req.send_request() end |
#delete_server(params = {}) ⇒ Struct
Deletes the server and the underlying AWS CloudFormation stacks (including the server’s EC2 instance). When you run this command, the server state is updated to ‘DELETING`. After the server is deleted, it is no longer returned by `DescribeServer` requests. If the AWS CloudFormation stack cannot be deleted, the server cannot be deleted.
This operation is asynchronous.
An ‘InvalidStateException` is thrown when a server deletion is already in progress. A `ResourceNotFoundException` is thrown when the server does not exist. A `ValidationException` is raised when parameters of the request are not valid.
1023 1024 1025 1026 |
# File 'lib/aws-sdk-opsworkscm/client.rb', line 1023 def delete_server(params = {}, = {}) req = build_request(:delete_server, params) req.send_request() end |
#describe_account_attributes(params = {}) ⇒ Types::DescribeAccountAttributesResponse
Describes your OpsWorks-CM account attributes.
This operation is synchronous.
1047 1048 1049 1050 |
# File 'lib/aws-sdk-opsworkscm/client.rb', line 1047 def describe_account_attributes(params = {}, = {}) req = build_request(:describe_account_attributes, params) req.send_request() end |
#describe_backups(params = {}) ⇒ Types::DescribeBackupsResponse
Describes backups. The results are ordered by time, with newest backups first. If you do not specify a BackupId or ServerName, the command returns all backups.
This operation is synchronous.
A ‘ResourceNotFoundException` is thrown when the backup does not exist. A `ValidationException` is raised when parameters of the request are not valid.
The returned response is a pageable response and is Enumerable. For details on usage see PageableResponse.
1125 1126 1127 1128 |
# File 'lib/aws-sdk-opsworkscm/client.rb', line 1125 def describe_backups(params = {}, = {}) req = build_request(:describe_backups, params) req.send_request() end |
#describe_events(params = {}) ⇒ Types::DescribeEventsResponse
Describes events for a specified server. Results are ordered by time, with newest events first.
This operation is synchronous.
A ‘ResourceNotFoundException` is thrown when the server does not exist. A `ValidationException` is raised when parameters of the request are not valid.
The returned response is a pageable response and is Enumerable. For details on usage see PageableResponse.
1187 1188 1189 1190 |
# File 'lib/aws-sdk-opsworkscm/client.rb', line 1187 def describe_events(params = {}, = {}) req = build_request(:describe_events, params) req.send_request() end |
#describe_node_association_status(params = {}) ⇒ Types::DescribeNodeAssociationStatusResponse
Returns the current status of an existing association or disassociation request.
A ‘ResourceNotFoundException` is thrown when no recent association or disassociation request with the specified token is found, or when the server does not exist. A `ValidationException` is raised when parameters of the request are not valid.
The following waiters are defined for this operation (see #wait_until for detailed usage):
* node_associated
1235 1236 1237 1238 |
# File 'lib/aws-sdk-opsworkscm/client.rb', line 1235 def describe_node_association_status(params = {}, = {}) req = build_request(:describe_node_association_status, params) req.send_request() end |
#describe_servers(params = {}) ⇒ Types::DescribeServersResponse
Lists all configuration management servers that are identified with your account. Only the stored results from Amazon DynamoDB are returned. AWS OpsWorks CM does not query other services.
This operation is synchronous.
A ‘ResourceNotFoundException` is thrown when the server does not exist. A `ValidationException` is raised when parameters of the request are not valid.
The returned response is a pageable response and is Enumerable. For details on usage see PageableResponse.
1311 1312 1313 1314 |
# File 'lib/aws-sdk-opsworkscm/client.rb', line 1311 def describe_servers(params = {}, = {}) req = build_request(:describe_servers, params) req.send_request() end |
#disassociate_node(params = {}) ⇒ Types::DisassociateNodeResponse
Disassociates a node from an AWS OpsWorks CM server, and removes the node from the server’s managed nodes. After a node is disassociated, the node key pair is no longer valid for accessing the configuration manager’s API. For more information about how to associate a node, see AssociateNode.
A node can can only be disassociated from a server that is in a ‘HEALTHY` state. Otherwise, an `InvalidStateException` is thrown. A `ResourceNotFoundException` is thrown when the server does not exist. A `ValidationException` is raised when parameters of the request are not valid.
1371 1372 1373 1374 |
# File 'lib/aws-sdk-opsworkscm/client.rb', line 1371 def disassociate_node(params = {}, = {}) req = build_request(:disassociate_node, params) req.send_request() end |
#export_server_engine_attribute(params = {}) ⇒ Types::ExportServerEngineAttributeResponse
Exports a specified server engine attribute as a base64-encoded string. For example, you can export user data that you can use in EC2 to associate nodes with a server.
This operation is synchronous.
A ‘ValidationException` is raised when parameters of the request are not valid. A `ResourceNotFoundException` is thrown when the server does not exist. An `InvalidStateException` is thrown when the server is in any of the following states: CREATING, TERMINATED, FAILED or DELETING.
1446 1447 1448 1449 |
# File 'lib/aws-sdk-opsworkscm/client.rb', line 1446 def export_server_engine_attribute(params = {}, = {}) req = build_request(:export_server_engine_attribute, params) req.send_request() end |
#list_tags_for_resource(params = {}) ⇒ Types::ListTagsForResourceResponse
Returns a list of tags that are applied to the specified AWS OpsWorks for Chef Automate or AWS OpsWorks for Puppet Enterprise servers or backups.
The returned response is a pageable response and is Enumerable. For details on usage see PageableResponse.
1505 1506 1507 1508 |
# File 'lib/aws-sdk-opsworkscm/client.rb', line 1505 def (params = {}, = {}) req = build_request(:list_tags_for_resource, params) req.send_request() end |
#restore_server(params = {}) ⇒ Types::RestoreServerResponse
Restores a backup to a server that is in a ‘CONNECTION_LOST`, `HEALTHY`, `RUNNING`, `UNHEALTHY`, or `TERMINATED` state. When you run RestoreServer, the server’s EC2 instance is deleted, and a new EC2 instance is configured. RestoreServer maintains the existing server endpoint, so configuration management of the server’s client devices (nodes) should continue to work.
Restoring from a backup is performed by creating a new EC2 instance. If restoration is successful, and the server is in a ‘HEALTHY` state, AWS OpsWorks CM switches traffic over to the new instance. After restoration is finished, the old EC2 instance is maintained in a `Running` or `Stopped` state, but is eventually terminated.
This operation is asynchronous.
An ‘InvalidStateException` is thrown when the server is not in a valid state. A `ResourceNotFoundException` is thrown when the server does not exist. A `ValidationException` is raised when parameters of the request are not valid.
1595 1596 1597 1598 |
# File 'lib/aws-sdk-opsworkscm/client.rb', line 1595 def restore_server(params = {}, = {}) req = build_request(:restore_server, params) req.send_request() end |
#start_maintenance(params = {}) ⇒ Types::StartMaintenanceResponse
Manually starts server maintenance. This command can be useful if an earlier maintenance attempt failed, and the underlying cause of maintenance failure has been resolved. The server is in an ‘UNDER_MAINTENANCE` state while maintenance is in progress.
Maintenance can only be started on servers in ‘HEALTHY` and `UNHEALTHY` states. Otherwise, an `InvalidStateException` is thrown. A `ResourceNotFoundException` is thrown when the server does not exist. A `ValidationException` is raised when parameters of the request are not valid.
1683 1684 1685 1686 |
# File 'lib/aws-sdk-opsworkscm/client.rb', line 1683 def start_maintenance(params = {}, = {}) req = build_request(:start_maintenance, params) req.send_request() end |
#tag_resource(params = {}) ⇒ Struct
Applies tags to an AWS OpsWorks for Chef Automate or AWS OpsWorks for Puppet Enterprise server, or to server backups.
1734 1735 1736 1737 |
# File 'lib/aws-sdk-opsworkscm/client.rb', line 1734 def tag_resource(params = {}, = {}) req = build_request(:tag_resource, params) req.send_request() end |
#untag_resource(params = {}) ⇒ Struct
Removes specified tags from an AWS OpsWorks-CM server or backup.
1762 1763 1764 1765 |
# File 'lib/aws-sdk-opsworkscm/client.rb', line 1762 def untag_resource(params = {}, = {}) req = build_request(:untag_resource, params) req.send_request() end |
#update_server(params = {}) ⇒ Types::UpdateServerResponse
Updates settings for a server.
This operation is synchronous.
1844 1845 1846 1847 |
# File 'lib/aws-sdk-opsworkscm/client.rb', line 1844 def update_server(params = {}, = {}) req = build_request(:update_server, params) req.send_request() end |
#update_server_engine_attributes(params = {}) ⇒ Types::UpdateServerEngineAttributesResponse
Updates engine-specific attributes on a specified server. The server enters the ‘MODIFYING` state when this operation is in progress. Only one update can occur at a time. You can use this command to reset a Chef server’s public key (‘CHEF_PIVOTAL_KEY`) or a Puppet server’s admin password (‘PUPPET_ADMIN_PASSWORD`).
This operation is asynchronous.
This operation can only be called for servers in ‘HEALTHY` or `UNHEALTHY` states. Otherwise, an `InvalidStateException` is raised. A `ResourceNotFoundException` is thrown when the server does not exist. A `ValidationException` is raised when parameters of the request are not valid.
1919 1920 1921 1922 |
# File 'lib/aws-sdk-opsworkscm/client.rb', line 1919 def update_server_engine_attributes(params = {}, = {}) req = build_request(:update_server_engine_attributes, params) req.send_request() end |
#wait_until(waiter_name, params = {}, options = {}) {|w.waiter| ... } ⇒ Boolean
Polls an API operation until a resource enters a desired state.
## Basic Usage
A waiter will call an API operation until:
-
It is successful
-
It enters a terminal state
-
It makes the maximum number of attempts
In between attempts, the waiter will sleep.
# polls in a loop, sleeping between attempts
client.wait_until(waiter_name, params)
## Configuration
You can configure the maximum number of polling attempts, and the delay (in seconds) between each polling attempt. You can pass configuration as the final arguments hash.
# poll for ~25 seconds
client.wait_until(waiter_name, params, {
max_attempts: 5,
delay: 5,
})
## Callbacks
You can be notified before each polling attempt and before each delay. If you throw ‘:success` or `:failure` from these callbacks, it will terminate the waiter.
started_at = Time.now
client.wait_until(waiter_name, params, {
# disable max attempts
max_attempts: nil,
# poll for 1 hour, instead of a number of attempts
before_wait: -> (attempts, response) do
throw :failure if Time.now - started_at > 3600
end
})
## Handling Errors
When a waiter is unsuccessful, it will raise an error. All of the failure errors extend from Waiters::Errors::WaiterFailed.
begin
client.wait_until(...)
rescue Aws::Waiters::Errors::WaiterFailed
# resource did not enter the desired state in time
end
## Valid Waiters
The following table lists the valid waiter names, the operations they call, and the default ‘:delay` and `:max_attempts` values.
| waiter_name | params | :delay | :max_attempts | | ————— | —————————————– | ——– | ————- | | node_associated | #describe_node_association_status | 15 | 15 |
2034 2035 2036 2037 2038 |
# File 'lib/aws-sdk-opsworkscm/client.rb', line 2034 def wait_until(waiter_name, params = {}, = {}) w = waiter(waiter_name, ) yield(w.waiter) if block_given? # deprecated w.wait(params) end |
#waiter_names ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
2042 2043 2044 |
# File 'lib/aws-sdk-opsworkscm/client.rb', line 2042 def waiter_names waiters.keys end |