1
0
Fork 0
mirror of https://github.com/fog/fog-aws.git synced 2022-11-09 13:50:52 -05:00

Implement ELBV2 remove_tags endpoint

This commit is contained in:
KevinLoiseau 2019-11-12 15:43:08 +01:00
parent 2e7bb9aedf
commit d340b683a6
No known key found for this signature in database
GPG key ID: 709159A779B96CC3
2 changed files with 46 additions and 0 deletions

View file

@ -8,6 +8,7 @@ module Fog
request :add_tags request :add_tags
request :create_load_balancer request :create_load_balancer
request :describe_tags request :describe_tags
request :remove_tags
request :describe_load_balancers request :describe_load_balancers
request :describe_listeners request :describe_listeners

View file

@ -0,0 +1,45 @@
module Fog
module AWS
class ELBV2
class Real
require 'fog/aws/parsers/elbv2/empty'
# removes tags from an elastic load balancer instance
# http://docs.aws.amazon.com/ElasticLoadBalancing/latest/APIReference/API_RemoveTags.html
# ==== Parameters
# * resource_arn <~String> - ARN of the ELB instance whose tags are to be retrieved
# * keys <~Array> A list of String keys for the tags to remove
# ==== Returns
# * response<~Excon::Response>:
# * body<~Hash>:
def remove_tags(resource_arn, keys)
request(
{ 'Action' => 'RemoveTags',
'ResourceArns.member.1' => resource_arn,
:parser => Fog::Parsers::AWS::ELBV2::Empty.new,
}.merge(Fog::AWS.indexed_param('TagKeys.member.%d', keys))
)
end
end
class Mock
def remove_tags(resource_arn, keys)
response = Excon::Response.new
if self.data[:load_balancers_v2][resource_arn]
keys.each {|key| self.data[:tags][resource_arn].delete key}
response.status = 200
response.body = {
"ResponseMetadata"=>{ "RequestId"=> Fog::AWS::Mock.request_id }
}
response
else
raise Fog::AWS::ELBV2::NotFound.new("Elastic load balancer #{resource_arn} not found")
end
end
end
end
end
end