Class: Gcloud::Logging::ResourceDescriptor::List
- Inherits:
-
Array
- Object
- Array
- Gcloud::Logging::ResourceDescriptor::List
- Defined in:
- lib/gcloud/logging/resource_descriptor/list.rb
Overview
ResourceDescriptor::List is a special case Array with additional values.
Instance Attribute Summary collapse
-
#token ⇒ Object
If not empty, indicates that there are more records that match the request and this value should be passed to continue.
Class Method Summary collapse
-
.from_grpc(grpc_list, service) ⇒ Object
Google::Logging::V2::ListMonitoredResourceDescriptorsResponse object.
Instance Method Summary collapse
-
#initialize(arr = []) ⇒ List
constructor
ResourceDescriptor instances.
-
#next ⇒ Object
Retrieve the next page of resource descriptors.
-
#next? ⇒ Boolean
Whether there is a next page of resource descriptors.
Constructor Details
#initialize(arr = []) ⇒ List
ResourceDescriptor instances.
32 33 34 |
# File 'lib/gcloud/logging/resource_descriptor/list.rb', line 32 def initialize arr = [] super arr end |
Instance Attribute Details
#token ⇒ Object
If not empty, indicates that there are more records that match the request and this value should be passed to continue.
27 28 29 |
# File 'lib/gcloud/logging/resource_descriptor/list.rb', line 27 def token @token end |
Class Method Details
.from_grpc(grpc_list, service) ⇒ Object
Google::Logging::V2::ListMonitoredResourceDescriptorsResponse object.
56 57 58 59 60 61 62 63 64 65 66 |
# File 'lib/gcloud/logging/resource_descriptor/list.rb', line 56 def self.from_grpc grpc_list, service sinks = new(Array(grpc_list.resource_descriptors).map do |grpc| ResourceDescriptor.from_grpc grpc end) sinks.instance_eval do @token = grpc_list.next_page_token @token = nil if @token == "" @service = service end sinks end |
Instance Method Details
#next ⇒ Object
Retrieve the next page of resource descriptors.
44 45 46 47 48 49 50 51 |
# File 'lib/gcloud/logging/resource_descriptor/list.rb', line 44 def next return nil unless next? ensure_service! list_grpc = @service.list_resource_descriptors token: token self.class.from_grpc list_grpc, @service rescue GRPC::BadStatus => e raise Gcloud::Error.from_error(e) end |
#next? ⇒ Boolean
Whether there is a next page of resource descriptors.
38 39 40 |
# File 'lib/gcloud/logging/resource_descriptor/list.rb', line 38 def next? !token.nil? end |