File: list_server_certificates.rb

package info (click to toggle)
ruby-fog-aws 3.18.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 8,140 kB
  • sloc: ruby: 73,328; javascript: 14; makefile: 9; sh: 4
file content (54 lines) | stat: -rw-r--r-- 2,005 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
module Fog
  module AWS
    class IAM
      class Real
        require 'fog/aws/parsers/iam/list_server_certificates'

        # List server certificates
        #
        # ==== Parameters
        # * options<~Hash>:
        #   * 'Marker'<~String> - The marker from the previous result (for pagination)
        #   * 'MaxItems'<~String> - The maximum number of server certificates you want in the response
        #   * 'PathPrefix'<~String> - The path prefix for filtering the results
        #
        # ==== Returns
        # * response<~Excon::Response>:
        #   * body<~Hash>:
        #     * 'Certificates'<~Array> - Matching server certificates
        #       * server_certificate<~Hash>:
        #         * Arn<~String> -
        #         * Path<~String> -
        #         * ServerCertificateId<~String> -
        #         * ServerCertificateName<~String> -
        #         * UploadDate<~Time> -
        #       * 'IsTruncated'<~Boolean> - Whether or not the results were truncated
        #       * 'Marker'<~String> - appears when IsTruncated is true as the next marker to use
        #
        # ==== See Also
        # http://docs.amazonwebservices.com/IAM/latest/APIReference/index.html?API_ListServerCertificates.html
        #
        def list_server_certificates(options = {})
          request({
            'Action'  => 'ListServerCertificates',
            :parser   => Fog::Parsers::AWS::IAM::ListServerCertificates.new
          }.merge!(options))
        end
      end

      class Mock
        def list_server_certificates(options = {})
          certificates = self.data[:server_certificates].values
          certificates = certificates.select { |certificate| certificate['Path'] =~ Regexp.new("^#{options['PathPrefix']}") } if options['PathPrefix']
          response = Excon::Response.new
          response.status = 200
          response.body = {
            'Certificates' => certificates
          }

          response
        end
      end
    end
  end
end