Class: Hashicorptools::RegionDeployment
- Inherits:
-
Object
- Object
- Hashicorptools::RegionDeployment
- Defined in:
- lib/hashicorptools/code_deploy.rb
Instance Attribute Summary collapse
-
#aws_region ⇒ Object
Returns the value of attribute aws_region.
-
#environment ⇒ Object
Returns the value of attribute environment.
Instance Method Summary collapse
- #create_deployment(commit_id, commit_message) ⇒ Object
-
#initialize(aws_region:, environment:) ⇒ RegionDeployment
constructor
A new instance of RegionDeployment.
Constructor Details
#initialize(aws_region:, environment:) ⇒ RegionDeployment
Returns a new instance of RegionDeployment.
13 14 15 16 |
# File 'lib/hashicorptools/code_deploy.rb', line 13 def initialize(aws_region:, environment:) @aws_region = aws_region @environment = environment end |
Instance Attribute Details
#aws_region ⇒ Object
Returns the value of attribute aws_region.
11 12 13 |
# File 'lib/hashicorptools/code_deploy.rb', line 11 def aws_region @aws_region end |
#environment ⇒ Object
Returns the value of attribute environment.
11 12 13 |
# File 'lib/hashicorptools/code_deploy.rb', line 11 def environment @environment end |
Instance Method Details
#create_deployment(commit_id, commit_message) ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/hashicorptools/code_deploy.rb', line 18 def create_deployment(commit_id, ) client = Aws::CodeDeploy::Client.new(region: aws_region) response = client.create_deployment({ application_name: application_name, deployment_group_name: "#{application_name}-#{@environment}", revision: { revision_type: 'GitHub', git_hub_location: { repository: "controlshift/#{application_name}", commit_id: commit_id } }, description: ( || "commit #{commit_id}").slice(0,99) }) output "created deployment #{response.deployment_id}" output "https://console.aws.amazon.com/codedeploy/home?region=#{aws_region}#/deployments/#{response.deployment_id}" end |