Sha256: f72823bd2d86c9c6527f5593cefcaea13e0de92b8fabe49a0f827bacd66ca3d1

Contents?: true

Size: 1.41 KB

Versions: 41

Compression:

Stored size: 1.41 KB

Contents

require "fog/core/collection"
require "fog/google/models/monitoring/monitored_resource_descriptor"

module Fog
  module Google
    class Monitoring
      class MonitoredResourceDescriptors < Fog::Collection
        model Fog::Google::Monitoring::MonitoredResourceDescriptor

        ##
        # Lists all Monitored Resource Descriptors.
        #
        # @param filter [String] The monitoring filter used to search against existing descriptors.
        #   @see https://cloud.google.com/monitoring/api/v3/filters filter documentation
        # @param page_size [String]  Maximum number of metric descriptors per page. Used for pagination.
        # @param page_token [String]  The pagination token, which is used to page through large result sets.
        # @return [Array<Fog::Google::Monitoring::MetricDescriptor>] List of Monitored Resource Descriptors.
        def all(filter: nil, page_size: nil, page_token: nil)
          data = service.list_monitored_resource_descriptors(
            :filter => filter,
            :page_size => page_size,
            :page_token => page_token
          ).to_h[:resource_descriptors] || []
          load(data)
        end

        def get(resource_type)
          data = service.get_monitored_resource_descriptor(resource_type).to_h
          new(data)
        rescue ::Google::Apis::ClientError => e
          raise e unless e.status_code == 404
          nil
        end
      end
    end
  end
end

Version data entries

41 entries across 41 versions & 2 rubygems

Version Path
fog-google-1.24.1 lib/fog/google/models/monitoring/monitored_resource_descriptors.rb
fog-google-1.24.0 lib/fog/google/models/monitoring/monitored_resource_descriptors.rb
fog-google-1.23.0 lib/fog/google/models/monitoring/monitored_resource_descriptors.rb
fog-google-1.22.0 lib/fog/google/models/monitoring/monitored_resource_descriptors.rb
fog-google-1.21.1 lib/fog/google/models/monitoring/monitored_resource_descriptors.rb
fog-google-1.21.0 lib/fog/google/models/monitoring/monitored_resource_descriptors.rb
fog-google-1.20.0 lib/fog/google/models/monitoring/monitored_resource_descriptors.rb
fog-google-1.19.0 lib/fog/google/models/monitoring/monitored_resource_descriptors.rb
fog-google-1.18.0 lib/fog/google/models/monitoring/monitored_resource_descriptors.rb
fog-google-1.17.0 lib/fog/google/models/monitoring/monitored_resource_descriptors.rb
fog-google-1.16.1 lib/fog/google/models/monitoring/monitored_resource_descriptors.rb
fog-google-1.16.0 lib/fog/google/models/monitoring/monitored_resource_descriptors.rb
fog-google-1.15.0 lib/fog/google/models/monitoring/monitored_resource_descriptors.rb
fog-google-1.14.0 lib/fog/google/models/monitoring/monitored_resource_descriptors.rb
gitlab-fog-google-1.14.0 lib/fog/google/models/monitoring/monitored_resource_descriptors.rb
fog-google-1.13.0 lib/fog/google/models/monitoring/monitored_resource_descriptors.rb
gitlab-fog-google-1.13.0 lib/fog/google/models/monitoring/monitored_resource_descriptors.rb
fog-google-1.12.1 lib/fog/google/models/monitoring/monitored_resource_descriptors.rb
fog-google-1.12.0 lib/fog/google/models/monitoring/monitored_resource_descriptors.rb
fog-google-1.11.0 lib/fog/google/models/monitoring/monitored_resource_descriptors.rb