class Google::Cloud::ResourceManager::Resource
# Resource
A container to reference an id for any resource type. A `resource` in Google
Cloud
Platform is a generic term for something a developer may want to interact with through an API. Some examples are an App Engine app, a Compute Engine instance, a Cloud
SQL database, and so on. (See {Manager#resource}.)
@example
require "google/cloud/resource_manager" resource_manager = Google::Cloud::ResourceManager.new project = resource_manager.project "tokyo-rain-123" folder = Google::Cloud::ResourceManager::Resource.new "folder", "1234" project.parent = folder
Attributes
Required field for the type-specific id. This should correspond to the id used in the type-specific API's. @return [String]
Required field representing the resource type this id is for. At present, the valid types are: “organization” and “folder”. @return [String]
Public Class Methods
Create a Resource
object with type `folder`.
@param [String] id The type-specific id. This should correspond to the
id used in the type-specific API's.
@return [Resource]
# File lib/google/cloud/resource_manager/resource.rb, line 86 def self.folder id new "folder", id end
Create a Resource
object.
@param [String] type The resource type this id is for. At present, the
valid types are: "organization" and "folder".
@param [String] id The type-specific id. This should correspond to the
id used in the type-specific API's.
# File lib/google/cloud/resource_manager/resource.rb, line 44 def initialize type, id raise ArgumentError, "type is required" if type.nil? raise ArgumentError, "id is required" if id.nil? @type = type @id = id end
Create a Resource
object with type `organization`.
@param [String] id The type-specific id. This should correspond to the
id used in the type-specific API's.
@return [Resource]
# File lib/google/cloud/resource_manager/resource.rb, line 96 def self.organization id new "organization", id end
Public Instance Methods
Checks if the type is `folder`. @return [Boolean]
# File lib/google/cloud/resource_manager/resource.rb, line 67 def folder? return false if type.nil? "folder".casecmp(type).zero? end
Checks if the type is `organization`. @return [Boolean]
# File lib/google/cloud/resource_manager/resource.rb, line 75 def organization? return false if type.nil? "organization".casecmp(type).zero? end