module Google::Cloud

Public Class Methods

resource_manager(credentials = nil, scope: nil, retries: nil, timeout: nil) click to toggle source

Creates a new `Project` instance connected to the Resource Manager service. Each call creates a new connection.

For more information on connecting to Google Cloud see the {file:AUTHENTICATION.md Authentication Guide}.

@param [String, Hash, Google::Auth::Credentials] credentials The path to

the keyfile as a String, the contents of the keyfile as a Hash, or a
Google::Auth::Credentials object. (See {ResourceManager::Credentials})

@param [String, Array<String>] scope The OAuth 2.0 scopes controlling the

set of resources and operations that the connection can access. See
[Using OAuth 2.0 to Access Google
APIs](https://developers.google.com/identity/protocols/OAuth2).

The default scope is:

* `https://www.googleapis.com/auth/cloud-platform`

@param [Integer] retries Number of times to retry requests on server

error. The default value is `3`. Optional.

@param [Integer] timeout Default timeout to use in requests. Optional.

@return [Google::Cloud::ResourceManager::Manager]

@example

require "google/cloud"

resource_manager = Google::Cloud.resource_manager
resource_manager.projects.each do |project|
  puts projects.project_id
end
# File lib/google-cloud-resource_manager.rb, line 105
def self.resource_manager credentials = nil, scope: nil, retries: nil,
                          timeout: nil
  require "google/cloud/resource_manager"
  Google::Cloud::ResourceManager.new credentials: credentials, scope: scope,
                                     retries: retries, timeout: timeout
end

Public Instance Methods

resource_manager(scope: nil, retries: nil, timeout: nil) click to toggle source

Creates a new object for connecting to the Resource Manager service. Each call creates a new connection.

For more information on connecting to Google Cloud see the {file:AUTHENTICATION.md Authentication Guide}.

@param [String, Array<String>] scope The OAuth 2.0 scopes controlling the

set of resources and operations that the connection can access. See
[Using OAuth 2.0 to Access Google
APIs](https://developers.google.com/identity/protocols/OAuth2).

The default scope is:

* `https://www.googleapis.com/auth/cloud-platform`

@param [Integer] retries Number of times to retry requests on server

error. The default value is `3`. Optional.

@param [Integer] timeout Default timeout to use in requests. Optional.

@return [Google::Cloud::ResourceManager::Manager]

@example

require "google/cloud"

gcloud = Google::Cloud.new
resource_manager = gcloud.resource_manager
resource_manager.projects.each do |project|
  puts projects.project_id
end

@example The default scope can be overridden with the `scope` option:

require "google/cloud"

gcloud  = Google::Cloud.new
readonly_scope = \
  "https://www.googleapis.com/auth/cloudresourcemanager.readonly"
resource_manager = gcloud.resource_manager scope: readonly_scope
# File lib/google-cloud-resource_manager.rb, line 67
def resource_manager scope: nil, retries: nil, timeout: nil
  Google::Cloud.resource_manager @keyfile, scope: scope,
                                           retries: (retries || @retries),
                                           timeout: (timeout || @timeout)
end