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.
474 475 476 |
# File 'lib/aws-sdk-opsworkscm/client.rb', line 474 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.
2091 2092 2093 |
# File 'lib/aws-sdk-opsworkscm/client.rb', line 2091 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.
2094 2095 2096 |
# File 'lib/aws-sdk-opsworkscm/client.rb', line 2094 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.
555 556 557 558 |
# File 'lib/aws-sdk-opsworkscm/client.rb', line 555 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.
1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 |
# File 'lib/aws-sdk-opsworkscm/client.rb', line 1951 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.81.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.
653 654 655 656 |
# File 'lib/aws-sdk-opsworkscm/client.rb', line 653 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`.
983 984 985 986 |
# File 'lib/aws-sdk-opsworkscm/client.rb', line 983 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.
1013 1014 1015 1016 |
# File 'lib/aws-sdk-opsworkscm/client.rb', line 1013 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.
1046 1047 1048 1049 |
# File 'lib/aws-sdk-opsworkscm/client.rb', line 1046 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.
1070 1071 1072 1073 |
# File 'lib/aws-sdk-opsworkscm/client.rb', line 1070 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.
1148 1149 1150 1151 |
# File 'lib/aws-sdk-opsworkscm/client.rb', line 1148 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.
1210 1211 1212 1213 |
# File 'lib/aws-sdk-opsworkscm/client.rb', line 1210 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
1258 1259 1260 1261 |
# File 'lib/aws-sdk-opsworkscm/client.rb', line 1258 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.
1334 1335 1336 1337 |
# File 'lib/aws-sdk-opsworkscm/client.rb', line 1334 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.
1394 1395 1396 1397 |
# File 'lib/aws-sdk-opsworkscm/client.rb', line 1394 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.
1469 1470 1471 1472 |
# File 'lib/aws-sdk-opsworkscm/client.rb', line 1469 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.
1528 1529 1530 1531 |
# File 'lib/aws-sdk-opsworkscm/client.rb', line 1528 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.
1618 1619 1620 1621 |
# File 'lib/aws-sdk-opsworkscm/client.rb', line 1618 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.
1706 1707 1708 1709 |
# File 'lib/aws-sdk-opsworkscm/client.rb', line 1706 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.
1757 1758 1759 1760 |
# File 'lib/aws-sdk-opsworkscm/client.rb', line 1757 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.
1785 1786 1787 1788 |
# File 'lib/aws-sdk-opsworkscm/client.rb', line 1785 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.
1867 1868 1869 1870 |
# File 'lib/aws-sdk-opsworkscm/client.rb', line 1867 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.
1942 1943 1944 1945 |
# File 'lib/aws-sdk-opsworkscm/client.rb', line 1942 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 |
2057 2058 2059 2060 2061 |
# File 'lib/aws-sdk-opsworkscm/client.rb', line 2057 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.
2065 2066 2067 |
# File 'lib/aws-sdk-opsworkscm/client.rb', line 2065 def waiter_names waiters.keys end |