mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
Added IAM signing certificate support
This commit is contained in:
parent
a2a647fd96
commit
242595e919
6 changed files with 194 additions and 0 deletions
|
@ -13,18 +13,21 @@ module Fog
|
|||
request :delete_access_key
|
||||
request :delete_group
|
||||
request :delete_group_policy
|
||||
request :delete_signing_certificate
|
||||
request :delete_user
|
||||
request :delete_user_policy
|
||||
request :get_user
|
||||
request :list_access_keys
|
||||
request :list_groups
|
||||
request :list_group_policies
|
||||
request :list_signing_certificates
|
||||
request :list_user_policies
|
||||
request :list_users
|
||||
request :put_group_policy
|
||||
request :put_user_policy
|
||||
request :remove_user_from_group
|
||||
request :update_access_key
|
||||
request :upload_signing_certificate
|
||||
|
||||
class Mock
|
||||
|
||||
|
|
32
lib/fog/aws/parsers/iam/list_signing_certificates.rb
Normal file
32
lib/fog/aws/parsers/iam/list_signing_certificates.rb
Normal file
|
@ -0,0 +1,32 @@
|
|||
module Fog
|
||||
module Parsers
|
||||
module AWS
|
||||
module IAM
|
||||
|
||||
class ListSigningCertificates < Fog::Parsers::Base
|
||||
|
||||
def reset
|
||||
@signing_certificate = {}
|
||||
@response = { 'SigningCertificates' => [] }
|
||||
end
|
||||
|
||||
def end_element(name)
|
||||
case name
|
||||
when 'UserName', 'CertificateId', 'CertificateBody', 'Status'
|
||||
@signing_certificate[name] = @value
|
||||
when 'member'
|
||||
@response['SigningCertificates'] << @signing_certificate
|
||||
@signing_certificate = {}
|
||||
when 'IsTruncated'
|
||||
response[name] = (@value == 'true')
|
||||
when 'Marker', 'RequestId'
|
||||
response[name] = @value
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
26
lib/fog/aws/parsers/iam/upload_signing_certificate.rb
Normal file
26
lib/fog/aws/parsers/iam/upload_signing_certificate.rb
Normal file
|
@ -0,0 +1,26 @@
|
|||
module Fog
|
||||
module Parsers
|
||||
module AWS
|
||||
module IAM
|
||||
|
||||
class UploadSigningCertificate < Fog::Parsers::Base
|
||||
|
||||
def reset
|
||||
@response = { 'Certificate' => {} }
|
||||
end
|
||||
|
||||
def end_element(name)
|
||||
case name
|
||||
when 'CertificateId', 'UserName', 'CertificateBody', 'Status'
|
||||
@response['Certificate'][name] = @value
|
||||
when 'RequestId'
|
||||
@response[name] = @value
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
41
lib/fog/aws/requests/iam/delete_signing_certificate.rb
Normal file
41
lib/fog/aws/requests/iam/delete_signing_certificate.rb
Normal file
|
@ -0,0 +1,41 @@
|
|||
module Fog
|
||||
module AWS
|
||||
class IAM
|
||||
class Real
|
||||
|
||||
require 'fog/aws/parsers/iam/basic'
|
||||
|
||||
# Upload signing certificate for user (by default detects user from access credentials)
|
||||
#
|
||||
# ==== Parameters
|
||||
# * options<~Hash>:
|
||||
# * 'UserName'<~String> - name of the user to upload certificate for (do not include path)
|
||||
#
|
||||
# ==== Returns
|
||||
# * response<~Excon::Response>:
|
||||
# * body<~Hash>:
|
||||
# * 'RequestId'<~String> - Id of the request
|
||||
#
|
||||
# ==== See Also
|
||||
# http://docs.amazonwebservices.com/IAM/latest/APIReference/index.html?API_DeleteSigningCertificate.html
|
||||
#
|
||||
def delete_signing_certificate(certificate_id, options = {})
|
||||
request({
|
||||
'Action' => 'DeleteSigningCertificate',
|
||||
'CertificateId' => certificate_id,
|
||||
:parser => Fog::Parsers::AWS::IAM::Basic.new
|
||||
}.merge!(options))
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
class Mock
|
||||
|
||||
def delete_signing_certificate(user_name = nil)
|
||||
Fog::Mock.not_implemented
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
46
lib/fog/aws/requests/iam/list_signing_certificates.rb
Normal file
46
lib/fog/aws/requests/iam/list_signing_certificates.rb
Normal file
|
@ -0,0 +1,46 @@
|
|||
module Fog
|
||||
module AWS
|
||||
class IAM
|
||||
class Real
|
||||
|
||||
require 'fog/aws/parsers/iam/list_signing_certificates'
|
||||
|
||||
# List signing certificates for user (by default detects user from access credentials)
|
||||
#
|
||||
# ==== Parameters
|
||||
# * options<~Hash>:
|
||||
# * 'UserName'<~String> - name of the user to list certificates for (do not include path)
|
||||
#
|
||||
# ==== Returns
|
||||
# * response<~Excon::Response>:
|
||||
# * body<~Hash>:
|
||||
# * 'SigningCertificates'<~Array> - Matching signing certificates
|
||||
# * signing_certificate<~Hash>:
|
||||
# * CertificateId<~String> -
|
||||
# * Status<~String> -
|
||||
# * 'IsTruncated'<~Boolean> - Whether or not the results were truncated
|
||||
# * 'Marker'<~String> - appears when IsTruncated is true as the next marker to use
|
||||
# * 'RequestId'<~String> - Id of the request
|
||||
#
|
||||
# ==== See Also
|
||||
# http://docs.amazonwebservices.com/IAM/latest/APIReference/index.html?API_ListSigningCertificates.html
|
||||
#
|
||||
def list_signing_certificates(options = {})
|
||||
request({
|
||||
'Action' => 'ListSigningCertificates',
|
||||
:parser => Fog::Parsers::AWS::IAM::ListSigningCertificates.new
|
||||
}.merge!(options))
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
class Mock
|
||||
|
||||
def list_signing_certificates(user_name = nil)
|
||||
Fog::Mock.not_implemented
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
46
lib/fog/aws/requests/iam/upload_signing_certificate.rb
Normal file
46
lib/fog/aws/requests/iam/upload_signing_certificate.rb
Normal file
|
@ -0,0 +1,46 @@
|
|||
module Fog
|
||||
module AWS
|
||||
class IAM
|
||||
class Real
|
||||
|
||||
require 'fog/aws/parsers/iam/upload_signing_certificate'
|
||||
|
||||
# Upload signing certificate for user (by default detects user from access credentials)
|
||||
#
|
||||
# ==== Parameters
|
||||
# * options<~Hash>:
|
||||
# * 'UserName'<~String> - name of the user to upload certificate for (do not include path)
|
||||
#
|
||||
# ==== Returns
|
||||
# * response<~Excon::Response>:
|
||||
# * body<~Hash>:
|
||||
# * 'Certificate'<~Hash>:
|
||||
# * 'CertificateId'<~String> -
|
||||
# * 'UserName'<~String> -
|
||||
# * 'CertificateBody'<~String> -
|
||||
# * 'Status'<~String> -
|
||||
# * 'RequestId'<~String> - Id of the request
|
||||
#
|
||||
# ==== See Also
|
||||
# http://docs.amazonwebservices.com/IAM/latest/APIReference/index.html?API_UploadSigningCertificate.html
|
||||
#
|
||||
def upload_signing_certificate(certificate, options = {})
|
||||
request({
|
||||
'Action' => 'UploadSigningCertificate',
|
||||
'CertificateBody' => certificate,
|
||||
:parser => Fog::Parsers::AWS::IAM::UploadSigningCertificate.new
|
||||
}.merge!(options))
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
class Mock
|
||||
|
||||
def upload_signing_certificate(user_name = nil)
|
||||
Fog::Mock.not_implemented
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Add table
Reference in a new issue