You are viewing documentation for version 2 of the AWS SDK for Ruby. Version 3 documentation can be found here.
Class: Aws::CodeDeploy::Client
- Inherits:
-
Seahorse::Client::Base
- Object
- Seahorse::Client::Base
- Aws::CodeDeploy::Client
- Defined in:
- (unknown)
Overview
An API client for AWS CodeDeploy. To construct a client, you need to configure a :region
and :credentials
.
codedeploy = Aws::CodeDeploy::Client.new(
region: region_name,
credentials: credentials,
# ...
)
See #initialize for a full list of supported configuration options.
Region
You can configure a default region in the following locations:
ENV['AWS_REGION']
Aws.config[:region]
Go here for a list of supported regions.
Credentials
Default credentials are loaded automatically from the following locations:
ENV['AWS_ACCESS_KEY_ID']
andENV['AWS_SECRET_ACCESS_KEY']
Aws.config[:credentials]
- The shared credentials ini file at
~/.aws/credentials
(more information) - From an instance profile when running on EC2
You can also construct a credentials object from one of the following classes:
Alternatively, you configure credentials with :access_key_id
and
:secret_access_key
:
# load credentials from disk
creds = YAML.load(File.read('/path/to/secrets'))
Aws::CodeDeploy::Client.new(
access_key_id: creds['access_key_id'],
secret_access_key: creds['secret_access_key']
)
Always load your credentials from outside your application. Avoid configuring credentials statically and never commit them to source control.
Instance Attribute Summary
Attributes inherited from Seahorse::Client::Base
Constructor collapse
-
#initialize(options = {}) ⇒ Aws::CodeDeploy::Client
constructor
Constructs an API client.
API Operations collapse
-
#add_tags_to_on_premises_instances(options = {}) ⇒ Struct
Adds tags to on-premises instances.
.
-
#batch_get_application_revisions(options = {}) ⇒ Types::BatchGetApplicationRevisionsOutput
Gets information about one or more application revisions.
-
#batch_get_applications(options = {}) ⇒ Types::BatchGetApplicationsOutput
Gets information about one or more applications.
-
#batch_get_deployment_groups(options = {}) ⇒ Types::BatchGetDeploymentGroupsOutput
Gets information about one or more deployment groups.
.
-
#batch_get_deployment_instances(options = {}) ⇒ Types::BatchGetDeploymentInstancesOutput
This method works, but is deprecated.
-
#batch_get_deployment_targets(options = {}) ⇒ Types::BatchGetDeploymentTargetsOutput
Returns an array of one or more targets associated with a deployment.
-
#batch_get_deployments(options = {}) ⇒ Types::BatchGetDeploymentsOutput
Gets information about one or more deployments.
-
#batch_get_on_premises_instances(options = {}) ⇒ Types::BatchGetOnPremisesInstancesOutput
Gets information about one or more on-premises instances.
-
#continue_deployment(options = {}) ⇒ Struct
For a blue/green deployment, starts the process of rerouting traffic from instances in the original environment to instances in the replacement environment without waiting for a specified wait time to elapse.
-
#create_application(options = {}) ⇒ Types::CreateApplicationOutput
Creates an application.
.
-
#create_deployment(options = {}) ⇒ Types::CreateDeploymentOutput
Deploys an application revision through the specified deployment group.
.
-
#create_deployment_config(options = {}) ⇒ Types::CreateDeploymentConfigOutput
Creates a deployment configuration.
-
#create_deployment_group(options = {}) ⇒ Types::CreateDeploymentGroupOutput
Creates a deployment group to which application revisions are deployed.
.
-
#delete_application(options = {}) ⇒ Struct
Deletes an application.
.
-
#delete_deployment_config(options = {}) ⇒ Struct
Deletes a deployment configuration.
A deployment configuration cannot be deleted if it is currently in use.
-
#delete_deployment_group(options = {}) ⇒ Types::DeleteDeploymentGroupOutput
Deletes a deployment group.
.
-
#delete_git_hub_account_token(options = {}) ⇒ Types::DeleteGitHubAccountTokenOutput
Deletes a GitHub account connection.
.
-
#delete_resources_by_external_id(options = {}) ⇒ Struct
Deletes resources linked to an external ID.
.
-
#deregister_on_premises_instance(options = {}) ⇒ Struct
Deregisters an on-premises instance.
.
-
#get_application(options = {}) ⇒ Types::GetApplicationOutput
Gets information about an application.
.
-
#get_application_revision(options = {}) ⇒ Types::GetApplicationRevisionOutput
Gets information about an application revision.
.
-
#get_deployment(options = {}) ⇒ Types::GetDeploymentOutput
Gets information about a deployment.
The
content
property of theappSpecContent
object in the returned revision is always null. -
#get_deployment_config(options = {}) ⇒ Types::GetDeploymentConfigOutput
Gets information about a deployment configuration.
.
-
#get_deployment_group(options = {}) ⇒ Types::GetDeploymentGroupOutput
Gets information about a deployment group.
.
-
#get_deployment_instance(options = {}) ⇒ Types::GetDeploymentInstanceOutput
Gets information about an instance as part of a deployment.
.
-
#get_deployment_target(options = {}) ⇒ Types::GetDeploymentTargetOutput
Returns information about a deployment target.
-
#get_on_premises_instance(options = {}) ⇒ Types::GetOnPremisesInstanceOutput
Gets information about an on-premises instance.
-
#list_application_revisions(options = {}) ⇒ Types::ListApplicationRevisionsOutput
Lists information about revisions for an application.
.
-
#list_applications(options = {}) ⇒ Types::ListApplicationsOutput
Lists the applications registered with the IAM user or AWS account.
.
-
#list_deployment_configs(options = {}) ⇒ Types::ListDeploymentConfigsOutput
Lists the deployment configurations with the IAM user or AWS account.
.
-
#list_deployment_groups(options = {}) ⇒ Types::ListDeploymentGroupsOutput
Lists the deployment groups for an application registered with the IAM user or AWS account.
.
-
#list_deployment_instances(options = {}) ⇒ Types::ListDeploymentInstancesOutput
The newer
BatchGetDeploymentTargets
should be used instead because it works with all compute types. -
#list_deployment_targets(options = {}) ⇒ Types::ListDeploymentTargetsOutput
Returns an array of target IDs that are associated a deployment.
-
#list_deployments(options = {}) ⇒ Types::ListDeploymentsOutput
Lists the deployments in a deployment group for an application registered with the IAM user or AWS account.
.
-
#list_git_hub_account_token_names(options = {}) ⇒ Types::ListGitHubAccountTokenNamesOutput
Lists the names of stored connections to GitHub accounts.
.
-
#list_on_premises_instances(options = {}) ⇒ Types::ListOnPremisesInstancesOutput
Gets a list of names for one or more on-premises instances.
Unless otherwise specified, both registered and deregistered on-premises instance names are listed.
-
#list_tags_for_resource(options = {}) ⇒ Types::ListTagsForResourceOutput
Returns a list of tags for the resource identified by a specified Amazon Resource Name (ARN).
-
#put_lifecycle_event_hook_execution_status(options = {}) ⇒ Types::PutLifecycleEventHookExecutionStatusOutput
Sets the result of a Lambda validation function.
-
#register_application_revision(options = {}) ⇒ Struct
Registers with AWS CodeDeploy a revision for the specified application.
.
-
#register_on_premises_instance(options = {}) ⇒ Struct
Registers an on-premises instance.
Only one IAM ARN (an IAM session ARN or IAM user ARN) is supported in the request.
-
#remove_tags_from_on_premises_instances(options = {}) ⇒ Struct
Removes one or more tags from one or more on-premises instances.
.
-
#skip_wait_time_for_instance_termination(options = {}) ⇒ Struct
In a blue/green deployment, overrides any specified wait time and starts terminating instances immediately after the traffic routing is complete.
.
-
#stop_deployment(options = {}) ⇒ Types::StopDeploymentOutput
Attempts to stop an ongoing deployment.
.
-
#tag_resource(options = {}) ⇒ Struct
Associates the list of tags in the input
Tags
parameter with the resource identified by theResourceArn
input parameter. -
#untag_resource(options = {}) ⇒ Struct
Disassociates a resource from a list of tags.
-
#update_application(options = {}) ⇒ Struct
Changes the name of an application.
.
-
#update_deployment_group(options = {}) ⇒ Types::UpdateDeploymentGroupOutput
Changes information about a deployment group.
.
Instance Method Summary collapse
-
#wait_until(waiter_name, params = {}) {|waiter| ... } ⇒ Boolean
Waiters polls an API operation until a resource enters a desired state.
-
#waiter_names ⇒ Array<Symbol>
Returns the list of supported waiters.
Methods inherited from Seahorse::Client::Base
add_plugin, api, #build_request, clear_plugins, define, new, #operation, #operation_names, plugins, remove_plugin, set_api, set_plugins
Methods included from Seahorse::Client::HandlerBuilder
#handle, #handle_request, #handle_response
Constructor Details
#initialize(options = {}) ⇒ Aws::CodeDeploy::Client
Constructs an API client.
Instance Method Details
#add_tags_to_on_premises_instances(options = {}) ⇒ Struct
Adds tags to on-premises instances.
#batch_get_application_revisions(options = {}) ⇒ Types::BatchGetApplicationRevisionsOutput
Gets information about one or more application revisions. The maximum number of application revisions that can be returned is 25.
#batch_get_applications(options = {}) ⇒ Types::BatchGetApplicationsOutput
Gets information about one or more applications. The maximum number of applications that can be returned is 100.
#batch_get_deployment_groups(options = {}) ⇒ Types::BatchGetDeploymentGroupsOutput
Gets information about one or more deployment groups.
#batch_get_deployment_instances(options = {}) ⇒ Types::BatchGetDeploymentInstancesOutput
This method works, but is deprecated. Use BatchGetDeploymentTargets
instead.
Returns an array of one or more instances associated with a deployment. This method works with EC2/On-premises and AWS Lambda compute platforms. The newer BatchGetDeploymentTargets
works with all compute platforms. The maximum number of instances that can be returned is 25.
#batch_get_deployment_targets(options = {}) ⇒ Types::BatchGetDeploymentTargetsOutput
Returns an array of one or more targets associated with a deployment. This method works with all compute types and should be used instead of the deprecated BatchGetDeploymentInstances
. The maximum number of targets that can be returned is 25.
The type of targets returned depends on the deployment's compute platform or deployment method:
-
EC2/On-premises: Information about EC2 instance targets.
-
AWS Lambda: Information about Lambda functions targets.
-
Amazon ECS: Information about Amazon ECS service targets.
-
CloudFormation: Information about targets of blue/green deployments initiated by a CloudFormation stack update.
#batch_get_deployments(options = {}) ⇒ Types::BatchGetDeploymentsOutput
Gets information about one or more deployments. The maximum number of deployments that can be returned is 25.
#batch_get_on_premises_instances(options = {}) ⇒ Types::BatchGetOnPremisesInstancesOutput
Gets information about one or more on-premises instances. The maximum number of on-premises instances that can be returned is 25.
#continue_deployment(options = {}) ⇒ Struct
For a blue/green deployment, starts the process of rerouting traffic from instances in the original environment to instances in the replacement environment without waiting for a specified wait time to elapse. (Traffic rerouting, which is achieved by registering instances in the replacement environment with the load balancer, can start as soon as all instances have a status of Ready.)
#create_application(options = {}) ⇒ Types::CreateApplicationOutput
Creates an application.
#create_deployment(options = {}) ⇒ Types::CreateDeploymentOutput
Deploys an application revision through the specified deployment group.
#create_deployment_config(options = {}) ⇒ Types::CreateDeploymentConfigOutput
Creates a deployment configuration.
#create_deployment_group(options = {}) ⇒ Types::CreateDeploymentGroupOutput
Creates a deployment group to which application revisions are deployed.
#delete_application(options = {}) ⇒ Struct
Deletes an application.
#delete_deployment_config(options = {}) ⇒ Struct
Deletes a deployment configuration.
A deployment configuration cannot be deleted if it is currently in use. Predefined configurations cannot be deleted.
#delete_deployment_group(options = {}) ⇒ Types::DeleteDeploymentGroupOutput
Deletes a deployment group.
#delete_git_hub_account_token(options = {}) ⇒ Types::DeleteGitHubAccountTokenOutput
Deletes a GitHub account connection.
#delete_resources_by_external_id(options = {}) ⇒ Struct
Deletes resources linked to an external ID.
#deregister_on_premises_instance(options = {}) ⇒ Struct
Deregisters an on-premises instance.
#get_application(options = {}) ⇒ Types::GetApplicationOutput
Gets information about an application.
#get_application_revision(options = {}) ⇒ Types::GetApplicationRevisionOutput
Gets information about an application revision.
#get_deployment(options = {}) ⇒ Types::GetDeploymentOutput
Gets information about a deployment.
The content
property of the appSpecContent
object in the returned revision is always null. Use GetApplicationRevision
and the sha256
property of the returned appSpecContent
object to get the content of the deployment’s AppSpec file.
#get_deployment_config(options = {}) ⇒ Types::GetDeploymentConfigOutput
Gets information about a deployment configuration.
#get_deployment_group(options = {}) ⇒ Types::GetDeploymentGroupOutput
Gets information about a deployment group.
#get_deployment_instance(options = {}) ⇒ Types::GetDeploymentInstanceOutput
Gets information about an instance as part of a deployment.
#get_deployment_target(options = {}) ⇒ Types::GetDeploymentTargetOutput
Returns information about a deployment target.
#get_on_premises_instance(options = {}) ⇒ Types::GetOnPremisesInstanceOutput
Gets information about an on-premises instance.
#list_application_revisions(options = {}) ⇒ Types::ListApplicationRevisionsOutput
Lists information about revisions for an application.
#list_applications(options = {}) ⇒ Types::ListApplicationsOutput
Lists the applications registered with the IAM user or AWS account.
#list_deployment_configs(options = {}) ⇒ Types::ListDeploymentConfigsOutput
Lists the deployment configurations with the IAM user or AWS account.
#list_deployment_groups(options = {}) ⇒ Types::ListDeploymentGroupsOutput
Lists the deployment groups for an application registered with the IAM user or AWS account.
#list_deployment_instances(options = {}) ⇒ Types::ListDeploymentInstancesOutput
The newer BatchGetDeploymentTargets
should be used instead because it works with all compute types. ListDeploymentInstances
throws an exception if it is used with a compute platform other than EC2/On-premises or AWS Lambda.
Lists the instance for a deployment associated with the IAM user or AWS account.
#list_deployment_targets(options = {}) ⇒ Types::ListDeploymentTargetsOutput
Returns an array of target IDs that are associated a deployment.
#list_deployments(options = {}) ⇒ Types::ListDeploymentsOutput
Lists the deployments in a deployment group for an application registered with the IAM user or AWS account.
#list_git_hub_account_token_names(options = {}) ⇒ Types::ListGitHubAccountTokenNamesOutput
Lists the names of stored connections to GitHub accounts.
#list_on_premises_instances(options = {}) ⇒ Types::ListOnPremisesInstancesOutput
Gets a list of names for one or more on-premises instances.
Unless otherwise specified, both registered and deregistered on-premises instance names are listed. To list only registered or deregistered on-premises instance names, use the registration status parameter.
#list_tags_for_resource(options = {}) ⇒ Types::ListTagsForResourceOutput
Returns a list of tags for the resource identified by a specified Amazon Resource Name (ARN). Tags are used to organize and categorize your CodeDeploy resources.
#put_lifecycle_event_hook_execution_status(options = {}) ⇒ Types::PutLifecycleEventHookExecutionStatusOutput
Sets the result of a Lambda validation function. The function validates lifecycle hooks during a deployment that uses the AWS Lambda or Amazon ECS compute platform. For AWS Lambda deployments, the available lifecycle hooks are BeforeAllowTraffic
and AfterAllowTraffic
. For Amazon ECS deployments, the available lifecycle hooks are BeforeInstall
, AfterInstall
, AfterAllowTestTraffic
, BeforeAllowTraffic
, and AfterAllowTraffic
. Lambda validation functions return Succeeded
or Failed
. For more information, see AppSpec 'hooks' Section for an AWS Lambda Deployment and AppSpec 'hooks' Section for an Amazon ECS Deployment.
#register_application_revision(options = {}) ⇒ Struct
Registers with AWS CodeDeploy a revision for the specified application.
#register_on_premises_instance(options = {}) ⇒ Struct
Registers an on-premises instance.
Only one IAM ARN (an IAM session ARN or IAM user ARN) is supported in the request. You cannot use both.
#remove_tags_from_on_premises_instances(options = {}) ⇒ Struct
Removes one or more tags from one or more on-premises instances.
#skip_wait_time_for_instance_termination(options = {}) ⇒ Struct
In a blue/green deployment, overrides any specified wait time and starts terminating instances immediately after the traffic routing is complete.
#stop_deployment(options = {}) ⇒ Types::StopDeploymentOutput
Attempts to stop an ongoing deployment.
#tag_resource(options = {}) ⇒ Struct
Associates the list of tags in the input Tags
parameter with the resource identified by the ResourceArn
input parameter.
#untag_resource(options = {}) ⇒ Struct
Disassociates a resource from a list of tags. The resource is identified by the ResourceArn
input parameter. The tags are identified by the list of keys in the TagKeys
input parameter.
#update_application(options = {}) ⇒ Struct
Changes the name of an application.
#update_deployment_group(options = {}) ⇒ Types::UpdateDeploymentGroupOutput
Changes information about a deployment group.
#wait_until(waiter_name, params = {}) {|waiter| ... } ⇒ Boolean
Waiters polls an API operation until a resource enters a desired state.
Basic Usage
Waiters will poll until they are succesful, they fail by entering a terminal state, or until a maximum number of attempts are made.
# polls in a loop, sleeping between attempts client.waiter_until(waiter_name, params)
Configuration
You can configure the maximum number of polling attempts, and the delay (in seconds) between each polling attempt. You configure waiters by passing a block to #wait_until:
# poll for ~25 seconds
client.wait_until(...) do |w|
w.max_attempts = 5
w.delay = 5
end
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(...) do |w|
# disable max attempts
w.max_attempts = nil
# poll for 1 hour, instead of a number of attempts
w.before_wait do |attempts, response|
throw :failure if Time.now - started_at > 3600
end
end
Handling Errors
When a waiter is successful, it returns true
. When a waiter
fails, it raises an error. All errors raised extend from
Waiters::Errors::WaiterFailed.
begin
client.wait_until(...)
rescue Aws::Waiters::Errors::WaiterFailed
# resource did not enter the desired state in time
end
#waiter_names ⇒ Array<Symbol>
Returns the list of supported waiters. The following table lists the supported waiters and the client method they call:
Waiter Name | Client Method | Default Delay: | Default Max Attempts: |
---|---|---|---|
:deployment_successful | #get_deployment | 15 | 120 |