
code
stringlengths 25
124k
| docstring
stringlengths 20
17.4k
| func_name
stringlengths 1
115
| language
stringclasses 1
value | repo
stringlengths 5
61
| path
stringlengths 5
217
| url
stringlengths 47
280
| license
stringclasses 4
values |
---|---|---|---|---|---|---|---|
def update_conversion_source
# Create a client object. The client can be reused for multiple calls.
client = Google::Shopping::Merchant::Conversions::V1beta::ConversionSourcesService::Client.new
# Create a request. To set request fields, pass in keyword arguments.
request = Google::Shopping::Merchant::Conversions::V1beta::UpdateConversionSourceRequest.new
# Call the update_conversion_source method.
result = client.update_conversion_source request
# The returned object is of type Google::Shopping::Merchant::Conversions::V1beta::ConversionSource.
p result
end | Snippet for the update_conversion_source call in the ConversionSourcesService service
This snippet has been automatically generated and should be regarded as a code
template only. It will require modifications to work:
- It may require correct/in-range values for request initialization.
- It may require specifying regional endpoints when creating the service
client as shown in https://cloud.google.com/ruby/docs/reference.
This is an auto-generated example demonstrating basic usage of
Google::Shopping::Merchant::Conversions::V1beta::ConversionSourcesService::Client#update_conversion_source. | update_conversion_source | ruby | googleapis/google-cloud-ruby | google-shopping-merchant-conversions-v1beta/snippets/conversion_sources_service/update_conversion_source.rb | https://github.com/googleapis/google-cloud-ruby/blob/master/google-shopping-merchant-conversions-v1beta/snippets/conversion_sources_service/update_conversion_source.rb | Apache-2.0 |
def self.certificate_manager version: :v1, transport: :grpc, &block
require "google/cloud/certificate_manager/#{version.to_s.downcase}"
package_name = Google::Cloud::CertificateManager
.constants
.select { |sym| sym.to_s.downcase == version.to_s.downcase.tr("_", "") }
.first
service_module = Google::Cloud::CertificateManager.const_get(package_name).const_get(:CertificateManager)
service_module = service_module.const_get(:Rest) if transport == :rest
service_module.const_get(:Client).new(&block)
end | Create a new client object for CertificateManager.
By default, this returns an instance of
[Google::Cloud::CertificateManager::V1::CertificateManager::Client](https://cloud.google.com/ruby/docs/reference/google-cloud-certificate_manager-v1/latest/Google-Cloud-CertificateManager-V1-CertificateManager-Client)
for a gRPC client for version V1 of the API.
However, you can specify a different API version by passing it in the
`version` parameter. If the CertificateManager service is
supported by that API version, and the corresponding gem is available, the
appropriate versioned client will be returned.
You can also specify a different transport by passing `:rest` or `:grpc` in
the `transport` parameter.
Raises an exception if the currently installed versioned client gem for the
given API version does not support the given transport of the CertificateManager service.
You can determine whether the method will succeed by calling
{Google::Cloud::CertificateManager.certificate_manager_available?}.
## About CertificateManager
API Overview
Certificates Manager API allows customers to see and manage all their TLS
certificates.
Certificates Manager API service provides methods to manage certificates,
group them into collections, and create serving configuration that can be
easily applied to other Cloud resources e.g. Target Proxies.
Data Model
The Certificates Manager service exposes the following resources:
* `Certificate` that describes a single TLS certificate.
* `CertificateMap` that describes a collection of certificates that can be
attached to a target resource.
* `CertificateMapEntry` that describes a single configuration entry that
consists of a SNI and a group of certificates. It's a subresource of
CertificateMap.
Certificate, CertificateMap and CertificateMapEntry IDs
have to fully match the regexp `[a-z0-9-]{1,63}`. In other words,
- only lower case letters, digits, and hyphen are allowed
- length of the resource ID has to be in [1,63] range.
Provides methods to manage Cloud Certificate Manager entities.
@param version [::String, ::Symbol] The API version to connect to. Optional.
Defaults to `:v1`.
@param transport [:grpc, :rest] The transport to use. Defaults to `:grpc`.
@return [::Object] A client object for the specified version. | self.certificate_manager | ruby | googleapis/google-cloud-ruby | google-cloud-certificate_manager/lib/google/cloud/certificate_manager.rb | https://github.com/googleapis/google-cloud-ruby/blob/master/google-cloud-certificate_manager/lib/google/cloud/certificate_manager.rb | Apache-2.0 |
def self.certificate_manager_available? version: :v1, transport: :grpc
require "google/cloud/certificate_manager/#{version.to_s.downcase}"
package_name = Google::Cloud::CertificateManager
.constants
.select { |sym| sym.to_s.downcase == version.to_s.downcase.tr("_", "") }
.first
return false unless package_name
service_module = Google::Cloud::CertificateManager.const_get package_name
return false unless service_module.const_defined? :CertificateManager
service_module = service_module.const_get :CertificateManager
if transport == :rest
return false unless service_module.const_defined? :Rest
service_module = service_module.const_get :Rest
end | Determines whether the CertificateManager service is supported by the current client.
If true, you can retrieve a client object by calling {Google::Cloud::CertificateManager.certificate_manager}.
If false, that method will raise an exception. This could happen if the given
API version does not exist or does not support the CertificateManager service,
or if the versioned client gem needs an update to support the CertificateManager service.
@param version [::String, ::Symbol] The API version to connect to. Optional.
Defaults to `:v1`.
@param transport [:grpc, :rest] The transport to use. Defaults to `:grpc`.
@return [boolean] Whether the service is available. | self.certificate_manager_available? | ruby | googleapis/google-cloud-ruby | google-cloud-certificate_manager/lib/google/cloud/certificate_manager.rb | https://github.com/googleapis/google-cloud-ruby/blob/master/google-cloud-certificate_manager/lib/google/cloud/certificate_manager.rb | Apache-2.0 |
def self.configure
yield ::Google::Cloud.configure.certificate_manager if block_given?
::Google::Cloud.configure.certificate_manager
end | Configure the google-cloud-certificate_manager library.
The following configuration parameters are supported:
* `credentials` (*type:* `String, Hash, Google::Auth::Credentials`) -
The path to the keyfile as a String, the contents of the keyfile as a
Hash, or a Google::Auth::Credentials object.
* `lib_name` (*type:* `String`) -
The library name as recorded in instrumentation and logging.
* `lib_version` (*type:* `String`) -
The library version as recorded in instrumentation and logging.
* `interceptors` (*type:* `Array<GRPC::ClientInterceptor>`) -
An array of interceptors that are run before calls are executed.
* `timeout` (*type:* `Numeric`) -
Default timeout in seconds.
* `metadata` (*type:* `Hash{Symbol=>String}`) -
Additional headers to be sent with the call.
* `retry_policy` (*type:* `Hash`) -
The retry policy. The value is a hash with the following keys:
* `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
* `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
* `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
* `:retry_codes` (*type:* `Array<String>`) -
The error codes that should trigger a retry.
@return [::Google::Cloud::Config] The default configuration used by this library | self.configure | ruby | googleapis/google-cloud-ruby | google-cloud-certificate_manager/lib/google/cloud/certificate_manager.rb | https://github.com/googleapis/google-cloud-ruby/blob/master/google-cloud-certificate_manager/lib/google/cloud/certificate_manager.rb | Apache-2.0 |
def self.configure
@configure ||= begin
namespace = ["Google", "Iam", "V2"]
parent_config = while namespace.any?
parent_name = namespace.join "::"
parent_const = const_get parent_name
break parent_const.configure if parent_const.respond_to? :configure
namespace.pop
end | Configure the Policies Client class.
See {::Google::Iam::V2::Policies::Client::Configuration}
for a description of the configuration fields.
@example
# Modify the configuration for all Policies clients
::Google::Iam::V2::Policies::Client.configure do |config|
config.timeout = 10.0
end
@yield [config] Configure the Client client.
@yieldparam config [Client::Configuration]
@return [Client::Configuration] | self.configure | ruby | googleapis/google-cloud-ruby | google-iam-v2/lib/google/iam/v2/policies/client.rb | https://github.com/googleapis/google-cloud-ruby/blob/master/google-iam-v2/lib/google/iam/v2/policies/client.rb | Apache-2.0 |
def configure
yield @config if block_given?
@config
end | Configure the Policies Client instance.
The configuration is set to the derived mode, meaning that values can be changed,
but structural changes (adding new fields, etc.) are not allowed. Structural changes
should be made on {Client.configure}.
See {::Google::Iam::V2::Policies::Client::Configuration}
for a description of the configuration fields.
@yield [config] Configure the Client client.
@yieldparam config [Client::Configuration]
@return [Client::Configuration] | configure | ruby | googleapis/google-cloud-ruby | google-iam-v2/lib/google/iam/v2/policies/client.rb | https://github.com/googleapis/google-cloud-ruby/blob/master/google-iam-v2/lib/google/iam/v2/policies/client.rb | Apache-2.0 |
def universe_domain
@policies_stub.universe_domain
end | The effective universe domain
@return [String] | universe_domain | ruby | googleapis/google-cloud-ruby | google-iam-v2/lib/google/iam/v2/policies/client.rb | https://github.com/googleapis/google-cloud-ruby/blob/master/google-iam-v2/lib/google/iam/v2/policies/client.rb | Apache-2.0 |
def initialize
# These require statements are intentionally placed here to initialize
# the gRPC module only when it's required.
# See https://github.com/googleapis/toolkit/issues/446
require "gapic/grpc"
require "google/iam/v2/policy_services_pb"
# Create the configuration object
@config = Configuration.new Client.configure
# Yield the configuration if needed
yield @config if block_given?
# Create credentials
credentials = @config.credentials
# Use self-signed JWT if the endpoint is unchanged from default,
# but only if the default endpoint does not have a region prefix.
enable_self_signed_jwt = @config.endpoint.nil? ||
(@config.endpoint == Configuration::DEFAULT_ENDPOINT &&
[email protected](".").first.include?("-"))
credentials ||= Credentials.default scope: @config.scope,
enable_self_signed_jwt: enable_self_signed_jwt
if credentials.is_a?(::String) || credentials.is_a?(::Hash)
credentials = Credentials.new credentials, scope: @config.scope
end | Create a new Policies client object.
@example
# Create a client using the default configuration
client = ::Google::Iam::V2::Policies::Client.new
# Create a client using a custom configuration
client = ::Google::Iam::V2::Policies::Client.new do |config|
config.timeout = 10.0
end
@yield [config] Configure the Policies client.
@yieldparam config [Client::Configuration] | initialize | ruby | googleapis/google-cloud-ruby | google-iam-v2/lib/google/iam/v2/policies/client.rb | https://github.com/googleapis/google-cloud-ruby/blob/master/google-iam-v2/lib/google/iam/v2/policies/client.rb | Apache-2.0 |
def logger
@policies_stub.logger
end | The logger used for request/response debug logging.
@return [Logger] | logger | ruby | googleapis/google-cloud-ruby | google-iam-v2/lib/google/iam/v2/policies/client.rb | https://github.com/googleapis/google-cloud-ruby/blob/master/google-iam-v2/lib/google/iam/v2/policies/client.rb | Apache-2.0 |
def list_policies request, options = nil
raise ::ArgumentError, "request must be provided" if request.nil?
request = ::Gapic::Protobuf.coerce request, to: ::Google::Iam::V2::ListPoliciesRequest
# Converts hash and nil to an options object
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
# Customize the options with defaults
metadata = @config.rpcs.list_policies.metadata.to_h
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
lib_name: @config.lib_name, lib_version: @config.lib_version,
gapic_version: ::Google::Iam::V2::VERSION
metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
header_params = {}
if request.parent
header_params["parent"] = request.parent
end | Service calls
Retrieves the policies of the specified kind that are attached to a
resource.
The response lists only policy metadata. In particular, policy rules are
omitted.
@overload list_policies(request, options = nil)
Pass arguments to `list_policies` via a request object, either of type
{::Google::Iam::V2::ListPoliciesRequest} or an equivalent Hash.
@param request [::Google::Iam::V2::ListPoliciesRequest, ::Hash]
A request object representing the call parameters. Required. To specify no
parameters, or to keep all the default parameter values, pass an empty Hash.
@param options [::Gapic::CallOptions, ::Hash]
Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
@overload list_policies(parent: nil, page_size: nil, page_token: nil)
Pass arguments to `list_policies` via keyword arguments. Note that at
least one keyword argument is required. To specify no parameters, or to keep all
the default parameter values, pass an empty Hash as a request object (see above).
@param parent [::String]
Required. The resource that the policy is attached to, along with the kind of policy
to list. Format:
`policies/{attachment_point}/denypolicies`
The attachment point is identified by its URL-encoded full resource name,
which means that the forward-slash character, `/`, must be written as
`%2F`. For example,
`policies/cloudresourcemanager.googleapis.com%2Fprojects%2Fmy-project/denypolicies`.
For organizations and folders, use the numeric ID in the full resource
name. For projects, you can use the alphanumeric or the numeric ID.
@param page_size [::Integer]
The maximum number of policies to return. IAM ignores this value and uses
the value 1000.
@param page_token [::String]
A page token received in a {::Google::Iam::V2::ListPoliciesResponse ListPoliciesResponse}. Provide this token to
retrieve the next page.
@yield [response, operation] Access the result along with the RPC operation
@yieldparam response [::Gapic::PagedEnumerable<::Google::Iam::V2::Policy>]
@yieldparam operation [::GRPC::ActiveCall::Operation]
@return [::Gapic::PagedEnumerable<::Google::Iam::V2::Policy>]
@raise [::Google::Cloud::Error] if the RPC is aborted.
@example Basic example
require "google/iam/v2"
# Create a client object. The client can be reused for multiple calls.
client = Google::Iam::V2::Policies::Client.new
# Create a request. To set request fields, pass in keyword arguments.
request = Google::Iam::V2::ListPoliciesRequest.new
# Call the list_policies method.
result = client.list_policies request
# The returned object is of type Gapic::PagedEnumerable. You can iterate
# over elements, and API calls will be issued to fetch pages as needed.
result.each do |item|
# Each element is of type ::Google::Iam::V2::Policy.
p item
end | list_policies | ruby | googleapis/google-cloud-ruby | google-iam-v2/lib/google/iam/v2/policies/client.rb | https://github.com/googleapis/google-cloud-ruby/blob/master/google-iam-v2/lib/google/iam/v2/policies/client.rb | Apache-2.0 |
def get_policy request, options = nil
raise ::ArgumentError, "request must be provided" if request.nil?
request = ::Gapic::Protobuf.coerce request, to: ::Google::Iam::V2::GetPolicyRequest
# Converts hash and nil to an options object
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
# Customize the options with defaults
metadata = @config.rpcs.get_policy.metadata.to_h
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
lib_name: @config.lib_name, lib_version: @config.lib_version,
gapic_version: ::Google::Iam::V2::VERSION
metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
header_params = {}
if request.name
header_params["name"] = request.name
end | Gets a policy.
@overload get_policy(request, options = nil)
Pass arguments to `get_policy` via a request object, either of type
{::Google::Iam::V2::GetPolicyRequest} or an equivalent Hash.
@param request [::Google::Iam::V2::GetPolicyRequest, ::Hash]
A request object representing the call parameters. Required. To specify no
parameters, or to keep all the default parameter values, pass an empty Hash.
@param options [::Gapic::CallOptions, ::Hash]
Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
@overload get_policy(name: nil)
Pass arguments to `get_policy` via keyword arguments. Note that at
least one keyword argument is required. To specify no parameters, or to keep all
the default parameter values, pass an empty Hash as a request object (see above).
@param name [::String]
Required. The resource name of the policy to retrieve. Format:
`policies/{attachment_point}/denypolicies/{policy_id}`
Use the URL-encoded full resource name, which means that the forward-slash
character, `/`, must be written as `%2F`. For example,
`policies/cloudresourcemanager.googleapis.com%2Fprojects%2Fmy-project/denypolicies/my-policy`.
For organizations and folders, use the numeric ID in the full resource
name. For projects, you can use the alphanumeric or the numeric ID.
@yield [response, operation] Access the result along with the RPC operation
@yieldparam response [::Google::Iam::V2::Policy]
@yieldparam operation [::GRPC::ActiveCall::Operation]
@return [::Google::Iam::V2::Policy]
@raise [::Google::Cloud::Error] if the RPC is aborted.
@example Basic example
require "google/iam/v2"
# Create a client object. The client can be reused for multiple calls.
client = Google::Iam::V2::Policies::Client.new
# Create a request. To set request fields, pass in keyword arguments.
request = Google::Iam::V2::GetPolicyRequest.new
# Call the get_policy method.
result = client.get_policy request
# The returned object is of type Google::Iam::V2::Policy.
p result | get_policy | ruby | googleapis/google-cloud-ruby | google-iam-v2/lib/google/iam/v2/policies/client.rb | https://github.com/googleapis/google-cloud-ruby/blob/master/google-iam-v2/lib/google/iam/v2/policies/client.rb | Apache-2.0 |
def create_policy request, options = nil
raise ::ArgumentError, "request must be provided" if request.nil?
request = ::Gapic::Protobuf.coerce request, to: ::Google::Iam::V2::CreatePolicyRequest
# Converts hash and nil to an options object
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
# Customize the options with defaults
metadata = @config.rpcs.create_policy.metadata.to_h
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
lib_name: @config.lib_name, lib_version: @config.lib_version,
gapic_version: ::Google::Iam::V2::VERSION
metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
header_params = {}
if request.parent
header_params["parent"] = request.parent
end | Creates a policy.
@overload create_policy(request, options = nil)
Pass arguments to `create_policy` via a request object, either of type
{::Google::Iam::V2::CreatePolicyRequest} or an equivalent Hash.
@param request [::Google::Iam::V2::CreatePolicyRequest, ::Hash]
A request object representing the call parameters. Required. To specify no
parameters, or to keep all the default parameter values, pass an empty Hash.
@param options [::Gapic::CallOptions, ::Hash]
Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
@overload create_policy(parent: nil, policy: nil, policy_id: nil)
Pass arguments to `create_policy` via keyword arguments. Note that at
least one keyword argument is required. To specify no parameters, or to keep all
the default parameter values, pass an empty Hash as a request object (see above).
@param parent [::String]
Required. The resource that the policy is attached to, along with the kind of policy
to create. Format: `policies/{attachment_point}/denypolicies`
The attachment point is identified by its URL-encoded full resource name,
which means that the forward-slash character, `/`, must be written as
`%2F`. For example,
`policies/cloudresourcemanager.googleapis.com%2Fprojects%2Fmy-project/denypolicies`.
For organizations and folders, use the numeric ID in the full resource
name. For projects, you can use the alphanumeric or the numeric ID.
@param policy [::Google::Iam::V2::Policy, ::Hash]
Required. The policy to create.
@param policy_id [::String]
The ID to use for this policy, which will become the final component of
the policy's resource name. The ID must contain 3 to 63 characters. It can
contain lowercase letters and numbers, as well as dashes (`-`) and periods
(`.`). The first character must be a lowercase letter.
@yield [response, operation] Access the result along with the RPC operation
@yieldparam response [::Gapic::Operation]
@yieldparam operation [::GRPC::ActiveCall::Operation]
@return [::Gapic::Operation]
@raise [::Google::Cloud::Error] if the RPC is aborted.
@example Basic example
require "google/iam/v2"
# Create a client object. The client can be reused for multiple calls.
client = Google::Iam::V2::Policies::Client.new
# Create a request. To set request fields, pass in keyword arguments.
request = Google::Iam::V2::CreatePolicyRequest.new
# Call the create_policy method.
result = client.create_policy request
# The returned object is of type Gapic::Operation. You can use it to
# check the status of an operation, cancel it, or wait for results.
# Here is how to wait for a response.
result.wait_until_done! timeout: 60
if result.response?
p result.response
else
puts "No response received."
end | create_policy | ruby | googleapis/google-cloud-ruby | google-iam-v2/lib/google/iam/v2/policies/client.rb | https://github.com/googleapis/google-cloud-ruby/blob/master/google-iam-v2/lib/google/iam/v2/policies/client.rb | Apache-2.0 |
def update_policy request, options = nil
raise ::ArgumentError, "request must be provided" if request.nil?
request = ::Gapic::Protobuf.coerce request, to: ::Google::Iam::V2::UpdatePolicyRequest
# Converts hash and nil to an options object
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
# Customize the options with defaults
metadata = @config.rpcs.update_policy.metadata.to_h
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
lib_name: @config.lib_name, lib_version: @config.lib_version,
gapic_version: ::Google::Iam::V2::VERSION
metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
header_params = {}
if request.policy&.name
header_params["policy.name"] = request.policy.name
end | Updates the specified policy.
You can update only the rules and the display name for the policy.
To update a policy, you should use a read-modify-write loop:
1. Use {::Google::Iam::V2::Policies::Client#get_policy GetPolicy} to read the current version of the policy.
2. Modify the policy as needed.
3. Use `UpdatePolicy` to write the updated policy.
This pattern helps prevent conflicts between concurrent updates.
@overload update_policy(request, options = nil)
Pass arguments to `update_policy` via a request object, either of type
{::Google::Iam::V2::UpdatePolicyRequest} or an equivalent Hash.
@param request [::Google::Iam::V2::UpdatePolicyRequest, ::Hash]
A request object representing the call parameters. Required. To specify no
parameters, or to keep all the default parameter values, pass an empty Hash.
@param options [::Gapic::CallOptions, ::Hash]
Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
@overload update_policy(policy: nil)
Pass arguments to `update_policy` via keyword arguments. Note that at
least one keyword argument is required. To specify no parameters, or to keep all
the default parameter values, pass an empty Hash as a request object (see above).
@param policy [::Google::Iam::V2::Policy, ::Hash]
Required. The policy to update.
To prevent conflicting updates, the `etag` value must match the value that
is stored in IAM. If the `etag` values do not match, the request fails with
a `409` error code and `ABORTED` status.
@yield [response, operation] Access the result along with the RPC operation
@yieldparam response [::Gapic::Operation]
@yieldparam operation [::GRPC::ActiveCall::Operation]
@return [::Gapic::Operation]
@raise [::Google::Cloud::Error] if the RPC is aborted.
@example Basic example
require "google/iam/v2"
# Create a client object. The client can be reused for multiple calls.
client = Google::Iam::V2::Policies::Client.new
# Create a request. To set request fields, pass in keyword arguments.
request = Google::Iam::V2::UpdatePolicyRequest.new
# Call the update_policy method.
result = client.update_policy request
# The returned object is of type Gapic::Operation. You can use it to
# check the status of an operation, cancel it, or wait for results.
# Here is how to wait for a response.
result.wait_until_done! timeout: 60
if result.response?
p result.response
else
puts "No response received."
end | update_policy | ruby | googleapis/google-cloud-ruby | google-iam-v2/lib/google/iam/v2/policies/client.rb | https://github.com/googleapis/google-cloud-ruby/blob/master/google-iam-v2/lib/google/iam/v2/policies/client.rb | Apache-2.0 |
def delete_policy request, options = nil
raise ::ArgumentError, "request must be provided" if request.nil?
request = ::Gapic::Protobuf.coerce request, to: ::Google::Iam::V2::DeletePolicyRequest
# Converts hash and nil to an options object
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
# Customize the options with defaults
metadata = @config.rpcs.delete_policy.metadata.to_h
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
lib_name: @config.lib_name, lib_version: @config.lib_version,
gapic_version: ::Google::Iam::V2::VERSION
metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
header_params = {}
if request.name
header_params["name"] = request.name
end | Deletes a policy. This action is permanent.
@overload delete_policy(request, options = nil)
Pass arguments to `delete_policy` via a request object, either of type
{::Google::Iam::V2::DeletePolicyRequest} or an equivalent Hash.
@param request [::Google::Iam::V2::DeletePolicyRequest, ::Hash]
A request object representing the call parameters. Required. To specify no
parameters, or to keep all the default parameter values, pass an empty Hash.
@param options [::Gapic::CallOptions, ::Hash]
Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
@overload delete_policy(name: nil, etag: nil)
Pass arguments to `delete_policy` via keyword arguments. Note that at
least one keyword argument is required. To specify no parameters, or to keep all
the default parameter values, pass an empty Hash as a request object (see above).
@param name [::String]
Required. The resource name of the policy to delete. Format:
`policies/{attachment_point}/denypolicies/{policy_id}`
Use the URL-encoded full resource name, which means that the forward-slash
character, `/`, must be written as `%2F`. For example,
`policies/cloudresourcemanager.googleapis.com%2Fprojects%2Fmy-project/denypolicies/my-policy`.
For organizations and folders, use the numeric ID in the full resource
name. For projects, you can use the alphanumeric or the numeric ID.
@param etag [::String]
Optional. The expected `etag` of the policy to delete. If the value does not match
the value that is stored in IAM, the request fails with a `409` error code
and `ABORTED` status.
If you omit this field, the policy is deleted regardless of its current
`etag`.
@yield [response, operation] Access the result along with the RPC operation
@yieldparam response [::Gapic::Operation]
@yieldparam operation [::GRPC::ActiveCall::Operation]
@return [::Gapic::Operation]
@raise [::Google::Cloud::Error] if the RPC is aborted.
@example Basic example
require "google/iam/v2"
# Create a client object. The client can be reused for multiple calls.
client = Google::Iam::V2::Policies::Client.new
# Create a request. To set request fields, pass in keyword arguments.
request = Google::Iam::V2::DeletePolicyRequest.new
# Call the delete_policy method.
result = client.delete_policy request
# The returned object is of type Gapic::Operation. You can use it to
# check the status of an operation, cancel it, or wait for results.
# Here is how to wait for a response.
result.wait_until_done! timeout: 60
if result.response?
p result.response
else
puts "No response received."
end | delete_policy | ruby | googleapis/google-cloud-ruby | google-iam-v2/lib/google/iam/v2/policies/client.rb | https://github.com/googleapis/google-cloud-ruby/blob/master/google-iam-v2/lib/google/iam/v2/policies/client.rb | Apache-2.0 |
def rpcs
@rpcs ||= begin
parent_rpcs = nil
parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
Rpcs.new parent_rpcs
end | Configurations for individual RPCs
@return [Rpcs] | rpcs | ruby | googleapis/google-cloud-ruby | google-iam-v2/lib/google/iam/v2/policies/client.rb | https://github.com/googleapis/google-cloud-ruby/blob/master/google-iam-v2/lib/google/iam/v2/policies/client.rb | Apache-2.0 |
def channel_pool
@channel_pool ||= ::Gapic::ServiceStub::ChannelPool::Configuration.new
end | Configuration for the channel pool
@return [::Gapic::ServiceStub::ChannelPool::Configuration] | channel_pool | ruby | googleapis/google-cloud-ruby | google-iam-v2/lib/google/iam/v2/policies/client.rb | https://github.com/googleapis/google-cloud-ruby/blob/master/google-iam-v2/lib/google/iam/v2/policies/client.rb | Apache-2.0 |
def endpoint
@client_stub.endpoint
end | The effective endpoint
@return [String] | endpoint | ruby | googleapis/google-cloud-ruby | google-cloud-firestore-v1/lib/google/cloud/firestore/v1/firestore/rest/service_stub.rb | https://github.com/googleapis/google-cloud-ruby/blob/master/google-cloud-firestore-v1/lib/google/cloud/firestore/v1/firestore/rest/service_stub.rb | Apache-2.0 |
def get_document request_pb, options = nil
raise ::ArgumentError, "request must be provided" if request_pb.nil?
verb, uri, query_string_params, body = ServiceStub.transcode_get_document_request request_pb
query_string_params = if query_string_params.any?
query_string_params.to_h { |p| p.split "=", 2 }
else
{}
end | Baseline implementation for the get_document REST call
@param request_pb [::Google::Cloud::Firestore::V1::GetDocumentRequest]
A request object representing the call parameters. Required.
@param options [::Gapic::CallOptions]
Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
@yield [result, operation] Access the result along with the TransportOperation object
@yieldparam result [::Google::Cloud::Firestore::V1::Document]
@yieldparam operation [::Gapic::Rest::TransportOperation]
@return [::Google::Cloud::Firestore::V1::Document]
A result object deserialized from the server's reply | get_document | ruby | googleapis/google-cloud-ruby | google-cloud-firestore-v1/lib/google/cloud/firestore/v1/firestore/rest/service_stub.rb | https://github.com/googleapis/google-cloud-ruby/blob/master/google-cloud-firestore-v1/lib/google/cloud/firestore/v1/firestore/rest/service_stub.rb | Apache-2.0 |
def list_documents request_pb, options = nil
raise ::ArgumentError, "request must be provided" if request_pb.nil?
verb, uri, query_string_params, body = ServiceStub.transcode_list_documents_request request_pb
query_string_params = if query_string_params.any?
query_string_params.to_h { |p| p.split "=", 2 }
else
{}
end | Baseline implementation for the list_documents REST call
@param request_pb [::Google::Cloud::Firestore::V1::ListDocumentsRequest]
A request object representing the call parameters. Required.
@param options [::Gapic::CallOptions]
Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
@yield [result, operation] Access the result along with the TransportOperation object
@yieldparam result [::Google::Cloud::Firestore::V1::ListDocumentsResponse]
@yieldparam operation [::Gapic::Rest::TransportOperation]
@return [::Google::Cloud::Firestore::V1::ListDocumentsResponse]
A result object deserialized from the server's reply | list_documents | ruby | googleapis/google-cloud-ruby | google-cloud-firestore-v1/lib/google/cloud/firestore/v1/firestore/rest/service_stub.rb | https://github.com/googleapis/google-cloud-ruby/blob/master/google-cloud-firestore-v1/lib/google/cloud/firestore/v1/firestore/rest/service_stub.rb | Apache-2.0 |
def update_document request_pb, options = nil
raise ::ArgumentError, "request must be provided" if request_pb.nil?
verb, uri, query_string_params, body = ServiceStub.transcode_update_document_request request_pb
query_string_params = if query_string_params.any?
query_string_params.to_h { |p| p.split "=", 2 }
else
{}
end | Baseline implementation for the update_document REST call
@param request_pb [::Google::Cloud::Firestore::V1::UpdateDocumentRequest]
A request object representing the call parameters. Required.
@param options [::Gapic::CallOptions]
Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
@yield [result, operation] Access the result along with the TransportOperation object
@yieldparam result [::Google::Cloud::Firestore::V1::Document]
@yieldparam operation [::Gapic::Rest::TransportOperation]
@return [::Google::Cloud::Firestore::V1::Document]
A result object deserialized from the server's reply | update_document | ruby | googleapis/google-cloud-ruby | google-cloud-firestore-v1/lib/google/cloud/firestore/v1/firestore/rest/service_stub.rb | https://github.com/googleapis/google-cloud-ruby/blob/master/google-cloud-firestore-v1/lib/google/cloud/firestore/v1/firestore/rest/service_stub.rb | Apache-2.0 |
def delete_document request_pb, options = nil
raise ::ArgumentError, "request must be provided" if request_pb.nil?
verb, uri, query_string_params, body = ServiceStub.transcode_delete_document_request request_pb
query_string_params = if query_string_params.any?
query_string_params.to_h { |p| p.split "=", 2 }
else
{}
end | Baseline implementation for the delete_document REST call
@param request_pb [::Google::Cloud::Firestore::V1::DeleteDocumentRequest]
A request object representing the call parameters. Required.
@param options [::Gapic::CallOptions]
Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
@yield [result, operation] Access the result along with the TransportOperation object
@yieldparam result [::Google::Protobuf::Empty]
@yieldparam operation [::Gapic::Rest::TransportOperation]
@return [::Google::Protobuf::Empty]
A result object deserialized from the server's reply | delete_document | ruby | googleapis/google-cloud-ruby | google-cloud-firestore-v1/lib/google/cloud/firestore/v1/firestore/rest/service_stub.rb | https://github.com/googleapis/google-cloud-ruby/blob/master/google-cloud-firestore-v1/lib/google/cloud/firestore/v1/firestore/rest/service_stub.rb | Apache-2.0 |
def batch_get_documents request_pb, options = nil, &block
raise ::ArgumentError, "request must be provided" if request_pb.nil?
verb, uri, query_string_params, body = ServiceStub.transcode_batch_get_documents_request request_pb
query_string_params = if query_string_params.any?
query_string_params.to_h { |p| p.split "=", 2 }
else
{}
end | Baseline implementation for the batch_get_documents REST call
@param request_pb [::Google::Cloud::Firestore::V1::BatchGetDocumentsRequest]
A request object representing the call parameters. Required.
@param options [::Gapic::CallOptions]
Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
@yieldparam chunk [::String] The chunk of data received during server streaming.
@return [::Gapic::Rest::TransportOperation] | batch_get_documents | ruby | googleapis/google-cloud-ruby | google-cloud-firestore-v1/lib/google/cloud/firestore/v1/firestore/rest/service_stub.rb | https://github.com/googleapis/google-cloud-ruby/blob/master/google-cloud-firestore-v1/lib/google/cloud/firestore/v1/firestore/rest/service_stub.rb | Apache-2.0 |
def begin_transaction request_pb, options = nil
raise ::ArgumentError, "request must be provided" if request_pb.nil?
verb, uri, query_string_params, body = ServiceStub.transcode_begin_transaction_request request_pb
query_string_params = if query_string_params.any?
query_string_params.to_h { |p| p.split "=", 2 }
else
{}
end | Baseline implementation for the begin_transaction REST call
@param request_pb [::Google::Cloud::Firestore::V1::BeginTransactionRequest]
A request object representing the call parameters. Required.
@param options [::Gapic::CallOptions]
Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
@yield [result, operation] Access the result along with the TransportOperation object
@yieldparam result [::Google::Cloud::Firestore::V1::BeginTransactionResponse]
@yieldparam operation [::Gapic::Rest::TransportOperation]
@return [::Google::Cloud::Firestore::V1::BeginTransactionResponse]
A result object deserialized from the server's reply | begin_transaction | ruby | googleapis/google-cloud-ruby | google-cloud-firestore-v1/lib/google/cloud/firestore/v1/firestore/rest/service_stub.rb | https://github.com/googleapis/google-cloud-ruby/blob/master/google-cloud-firestore-v1/lib/google/cloud/firestore/v1/firestore/rest/service_stub.rb | Apache-2.0 |
def commit request_pb, options = nil
raise ::ArgumentError, "request must be provided" if request_pb.nil?
verb, uri, query_string_params, body = ServiceStub.transcode_commit_request request_pb
query_string_params = if query_string_params.any?
query_string_params.to_h { |p| p.split "=", 2 }
else
{}
end | Baseline implementation for the commit REST call
@param request_pb [::Google::Cloud::Firestore::V1::CommitRequest]
A request object representing the call parameters. Required.
@param options [::Gapic::CallOptions]
Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
@yield [result, operation] Access the result along with the TransportOperation object
@yieldparam result [::Google::Cloud::Firestore::V1::CommitResponse]
@yieldparam operation [::Gapic::Rest::TransportOperation]
@return [::Google::Cloud::Firestore::V1::CommitResponse]
A result object deserialized from the server's reply | commit | ruby | googleapis/google-cloud-ruby | google-cloud-firestore-v1/lib/google/cloud/firestore/v1/firestore/rest/service_stub.rb | https://github.com/googleapis/google-cloud-ruby/blob/master/google-cloud-firestore-v1/lib/google/cloud/firestore/v1/firestore/rest/service_stub.rb | Apache-2.0 |
def rollback request_pb, options = nil
raise ::ArgumentError, "request must be provided" if request_pb.nil?
verb, uri, query_string_params, body = ServiceStub.transcode_rollback_request request_pb
query_string_params = if query_string_params.any?
query_string_params.to_h { |p| p.split "=", 2 }
else
{}
end | Baseline implementation for the rollback REST call
@param request_pb [::Google::Cloud::Firestore::V1::RollbackRequest]
A request object representing the call parameters. Required.
@param options [::Gapic::CallOptions]
Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
@yield [result, operation] Access the result along with the TransportOperation object
@yieldparam result [::Google::Protobuf::Empty]
@yieldparam operation [::Gapic::Rest::TransportOperation]
@return [::Google::Protobuf::Empty]
A result object deserialized from the server's reply | rollback | ruby | googleapis/google-cloud-ruby | google-cloud-firestore-v1/lib/google/cloud/firestore/v1/firestore/rest/service_stub.rb | https://github.com/googleapis/google-cloud-ruby/blob/master/google-cloud-firestore-v1/lib/google/cloud/firestore/v1/firestore/rest/service_stub.rb | Apache-2.0 |
def run_query request_pb, options = nil, &block
raise ::ArgumentError, "request must be provided" if request_pb.nil?
verb, uri, query_string_params, body = ServiceStub.transcode_run_query_request request_pb
query_string_params = if query_string_params.any?
query_string_params.to_h { |p| p.split "=", 2 }
else
{}
end | Baseline implementation for the run_query REST call
@param request_pb [::Google::Cloud::Firestore::V1::RunQueryRequest]
A request object representing the call parameters. Required.
@param options [::Gapic::CallOptions]
Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
@yieldparam chunk [::String] The chunk of data received during server streaming.
@return [::Gapic::Rest::TransportOperation] | run_query | ruby | googleapis/google-cloud-ruby | google-cloud-firestore-v1/lib/google/cloud/firestore/v1/firestore/rest/service_stub.rb | https://github.com/googleapis/google-cloud-ruby/blob/master/google-cloud-firestore-v1/lib/google/cloud/firestore/v1/firestore/rest/service_stub.rb | Apache-2.0 |
def run_aggregation_query request_pb, options = nil, &block
raise ::ArgumentError, "request must be provided" if request_pb.nil?
verb, uri, query_string_params, body = ServiceStub.transcode_run_aggregation_query_request request_pb
query_string_params = if query_string_params.any?
query_string_params.to_h { |p| p.split "=", 2 }
else
{}
end | Baseline implementation for the run_aggregation_query REST call
@param request_pb [::Google::Cloud::Firestore::V1::RunAggregationQueryRequest]
A request object representing the call parameters. Required.
@param options [::Gapic::CallOptions]
Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
@yieldparam chunk [::String] The chunk of data received during server streaming.
@return [::Gapic::Rest::TransportOperation] | run_aggregation_query | ruby | googleapis/google-cloud-ruby | google-cloud-firestore-v1/lib/google/cloud/firestore/v1/firestore/rest/service_stub.rb | https://github.com/googleapis/google-cloud-ruby/blob/master/google-cloud-firestore-v1/lib/google/cloud/firestore/v1/firestore/rest/service_stub.rb | Apache-2.0 |
def partition_query request_pb, options = nil
raise ::ArgumentError, "request must be provided" if request_pb.nil?
verb, uri, query_string_params, body = ServiceStub.transcode_partition_query_request request_pb
query_string_params = if query_string_params.any?
query_string_params.to_h { |p| p.split "=", 2 }
else
{}
end | Baseline implementation for the partition_query REST call
@param request_pb [::Google::Cloud::Firestore::V1::PartitionQueryRequest]
A request object representing the call parameters. Required.
@param options [::Gapic::CallOptions]
Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
@yield [result, operation] Access the result along with the TransportOperation object
@yieldparam result [::Google::Cloud::Firestore::V1::PartitionQueryResponse]
@yieldparam operation [::Gapic::Rest::TransportOperation]
@return [::Google::Cloud::Firestore::V1::PartitionQueryResponse]
A result object deserialized from the server's reply | partition_query | ruby | googleapis/google-cloud-ruby | google-cloud-firestore-v1/lib/google/cloud/firestore/v1/firestore/rest/service_stub.rb | https://github.com/googleapis/google-cloud-ruby/blob/master/google-cloud-firestore-v1/lib/google/cloud/firestore/v1/firestore/rest/service_stub.rb | Apache-2.0 |
def list_collection_ids request_pb, options = nil
raise ::ArgumentError, "request must be provided" if request_pb.nil?
verb, uri, query_string_params, body = ServiceStub.transcode_list_collection_ids_request request_pb
query_string_params = if query_string_params.any?
query_string_params.to_h { |p| p.split "=", 2 }
else
{}
end | Baseline implementation for the list_collection_ids REST call
@param request_pb [::Google::Cloud::Firestore::V1::ListCollectionIdsRequest]
A request object representing the call parameters. Required.
@param options [::Gapic::CallOptions]
Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
@yield [result, operation] Access the result along with the TransportOperation object
@yieldparam result [::Google::Cloud::Firestore::V1::ListCollectionIdsResponse]
@yieldparam operation [::Gapic::Rest::TransportOperation]
@return [::Google::Cloud::Firestore::V1::ListCollectionIdsResponse]
A result object deserialized from the server's reply | list_collection_ids | ruby | googleapis/google-cloud-ruby | google-cloud-firestore-v1/lib/google/cloud/firestore/v1/firestore/rest/service_stub.rb | https://github.com/googleapis/google-cloud-ruby/blob/master/google-cloud-firestore-v1/lib/google/cloud/firestore/v1/firestore/rest/service_stub.rb | Apache-2.0 |
def batch_write request_pb, options = nil
raise ::ArgumentError, "request must be provided" if request_pb.nil?
verb, uri, query_string_params, body = ServiceStub.transcode_batch_write_request request_pb
query_string_params = if query_string_params.any?
query_string_params.to_h { |p| p.split "=", 2 }
else
{}
end | Baseline implementation for the batch_write REST call
@param request_pb [::Google::Cloud::Firestore::V1::BatchWriteRequest]
A request object representing the call parameters. Required.
@param options [::Gapic::CallOptions]
Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
@yield [result, operation] Access the result along with the TransportOperation object
@yieldparam result [::Google::Cloud::Firestore::V1::BatchWriteResponse]
@yieldparam operation [::Gapic::Rest::TransportOperation]
@return [::Google::Cloud::Firestore::V1::BatchWriteResponse]
A result object deserialized from the server's reply | batch_write | ruby | googleapis/google-cloud-ruby | google-cloud-firestore-v1/lib/google/cloud/firestore/v1/firestore/rest/service_stub.rb | https://github.com/googleapis/google-cloud-ruby/blob/master/google-cloud-firestore-v1/lib/google/cloud/firestore/v1/firestore/rest/service_stub.rb | Apache-2.0 |
def create_document request_pb, options = nil
raise ::ArgumentError, "request must be provided" if request_pb.nil?
verb, uri, query_string_params, body = ServiceStub.transcode_create_document_request request_pb
query_string_params = if query_string_params.any?
query_string_params.to_h { |p| p.split "=", 2 }
else
{}
end | Baseline implementation for the create_document REST call
@param request_pb [::Google::Cloud::Firestore::V1::CreateDocumentRequest]
A request object representing the call parameters. Required.
@param options [::Gapic::CallOptions]
Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
@yield [result, operation] Access the result along with the TransportOperation object
@yieldparam result [::Google::Cloud::Firestore::V1::Document]
@yieldparam operation [::Gapic::Rest::TransportOperation]
@return [::Google::Cloud::Firestore::V1::Document]
A result object deserialized from the server's reply | create_document | ruby | googleapis/google-cloud-ruby | google-cloud-firestore-v1/lib/google/cloud/firestore/v1/firestore/rest/service_stub.rb | https://github.com/googleapis/google-cloud-ruby/blob/master/google-cloud-firestore-v1/lib/google/cloud/firestore/v1/firestore/rest/service_stub.rb | Apache-2.0 |
def self.transcode_get_document_request request_pb
transcoder = Gapic::Rest::GrpcTranscoder.new
.with_bindings(
uri_method: :get,
uri_template: "/v1/{name}",
matches: [
["name", %r{^projects/[^/]+/databases/[^/]+/documents/[^/]+(?:/.*)?$}, true]
]
)
transcoder.transcode request_pb
end | @private
GRPC transcoding helper method for the get_document REST call
@param request_pb [::Google::Cloud::Firestore::V1::GetDocumentRequest]
A request object representing the call parameters. Required.
@return [Array(String, [String, nil], Hash{String => String})]
Uri, Body, Query string parameters | self.transcode_get_document_request | ruby | googleapis/google-cloud-ruby | google-cloud-firestore-v1/lib/google/cloud/firestore/v1/firestore/rest/service_stub.rb | https://github.com/googleapis/google-cloud-ruby/blob/master/google-cloud-firestore-v1/lib/google/cloud/firestore/v1/firestore/rest/service_stub.rb | Apache-2.0 |
def self.transcode_list_documents_request request_pb
transcoder = Gapic::Rest::GrpcTranscoder.new
.with_bindings(
uri_method: :get,
uri_template: "/v1/{parent}/{collection_id}",
matches: [
["parent", %r{^projects/[^/]+/databases/[^/]+/documents/[^/]+(?:/.*)?$}, true],
["collection_id", %r{^[^/]+/?$}, false]
]
)
.with_bindings(
uri_method: :get,
uri_template: "/v1/{parent}/{collection_id}",
matches: [
["parent", %r{^projects/[^/]+/databases/[^/]+/documents/?$}, false],
["collection_id", %r{^[^/]+/?$}, false]
]
)
transcoder.transcode request_pb
end | @private
GRPC transcoding helper method for the list_documents REST call
@param request_pb [::Google::Cloud::Firestore::V1::ListDocumentsRequest]
A request object representing the call parameters. Required.
@return [Array(String, [String, nil], Hash{String => String})]
Uri, Body, Query string parameters | self.transcode_list_documents_request | ruby | googleapis/google-cloud-ruby | google-cloud-firestore-v1/lib/google/cloud/firestore/v1/firestore/rest/service_stub.rb | https://github.com/googleapis/google-cloud-ruby/blob/master/google-cloud-firestore-v1/lib/google/cloud/firestore/v1/firestore/rest/service_stub.rb | Apache-2.0 |
def self.transcode_update_document_request request_pb
transcoder = Gapic::Rest::GrpcTranscoder.new
.with_bindings(
uri_method: :patch,
uri_template: "/v1/{document.name}",
body: "document",
matches: [
["document.name", %r{^projects/[^/]+/databases/[^/]+/documents/[^/]+(?:/.*)?$}, true]
]
)
transcoder.transcode request_pb
end | @private
GRPC transcoding helper method for the update_document REST call
@param request_pb [::Google::Cloud::Firestore::V1::UpdateDocumentRequest]
A request object representing the call parameters. Required.
@return [Array(String, [String, nil], Hash{String => String})]
Uri, Body, Query string parameters | self.transcode_update_document_request | ruby | googleapis/google-cloud-ruby | google-cloud-firestore-v1/lib/google/cloud/firestore/v1/firestore/rest/service_stub.rb | https://github.com/googleapis/google-cloud-ruby/blob/master/google-cloud-firestore-v1/lib/google/cloud/firestore/v1/firestore/rest/service_stub.rb | Apache-2.0 |
def self.transcode_delete_document_request request_pb
transcoder = Gapic::Rest::GrpcTranscoder.new
.with_bindings(
uri_method: :delete,
uri_template: "/v1/{name}",
matches: [
["name", %r{^projects/[^/]+/databases/[^/]+/documents/[^/]+(?:/.*)?$}, true]
]
)
transcoder.transcode request_pb
end | @private
GRPC transcoding helper method for the delete_document REST call
@param request_pb [::Google::Cloud::Firestore::V1::DeleteDocumentRequest]
A request object representing the call parameters. Required.
@return [Array(String, [String, nil], Hash{String => String})]
Uri, Body, Query string parameters | self.transcode_delete_document_request | ruby | googleapis/google-cloud-ruby | google-cloud-firestore-v1/lib/google/cloud/firestore/v1/firestore/rest/service_stub.rb | https://github.com/googleapis/google-cloud-ruby/blob/master/google-cloud-firestore-v1/lib/google/cloud/firestore/v1/firestore/rest/service_stub.rb | Apache-2.0 |
def self.transcode_batch_get_documents_request request_pb
transcoder = Gapic::Rest::GrpcTranscoder.new
.with_bindings(
uri_method: :post,
uri_template: "/v1/{database}/documents:batchGet",
body: "*",
matches: [
["database", %r{^projects/[^/]+/databases/[^/]+/?$}, false]
]
)
transcoder.transcode request_pb
end | @private
GRPC transcoding helper method for the batch_get_documents REST call
@param request_pb [::Google::Cloud::Firestore::V1::BatchGetDocumentsRequest]
A request object representing the call parameters. Required.
@return [Array(String, [String, nil], Hash{String => String})]
Uri, Body, Query string parameters | self.transcode_batch_get_documents_request | ruby | googleapis/google-cloud-ruby | google-cloud-firestore-v1/lib/google/cloud/firestore/v1/firestore/rest/service_stub.rb | https://github.com/googleapis/google-cloud-ruby/blob/master/google-cloud-firestore-v1/lib/google/cloud/firestore/v1/firestore/rest/service_stub.rb | Apache-2.0 |
def self.transcode_begin_transaction_request request_pb
transcoder = Gapic::Rest::GrpcTranscoder.new
.with_bindings(
uri_method: :post,
uri_template: "/v1/{database}/documents:beginTransaction",
body: "*",
matches: [
["database", %r{^projects/[^/]+/databases/[^/]+/?$}, false]
]
)
transcoder.transcode request_pb
end | @private
GRPC transcoding helper method for the begin_transaction REST call
@param request_pb [::Google::Cloud::Firestore::V1::BeginTransactionRequest]
A request object representing the call parameters. Required.
@return [Array(String, [String, nil], Hash{String => String})]
Uri, Body, Query string parameters | self.transcode_begin_transaction_request | ruby | googleapis/google-cloud-ruby | google-cloud-firestore-v1/lib/google/cloud/firestore/v1/firestore/rest/service_stub.rb | https://github.com/googleapis/google-cloud-ruby/blob/master/google-cloud-firestore-v1/lib/google/cloud/firestore/v1/firestore/rest/service_stub.rb | Apache-2.0 |
def self.transcode_commit_request request_pb
transcoder = Gapic::Rest::GrpcTranscoder.new
.with_bindings(
uri_method: :post,
uri_template: "/v1/{database}/documents:commit",
body: "*",
matches: [
["database", %r{^projects/[^/]+/databases/[^/]+/?$}, false]
]
)
transcoder.transcode request_pb
end | @private
GRPC transcoding helper method for the commit REST call
@param request_pb [::Google::Cloud::Firestore::V1::CommitRequest]
A request object representing the call parameters. Required.
@return [Array(String, [String, nil], Hash{String => String})]
Uri, Body, Query string parameters | self.transcode_commit_request | ruby | googleapis/google-cloud-ruby | google-cloud-firestore-v1/lib/google/cloud/firestore/v1/firestore/rest/service_stub.rb | https://github.com/googleapis/google-cloud-ruby/blob/master/google-cloud-firestore-v1/lib/google/cloud/firestore/v1/firestore/rest/service_stub.rb | Apache-2.0 |
def self.transcode_rollback_request request_pb
transcoder = Gapic::Rest::GrpcTranscoder.new
.with_bindings(
uri_method: :post,
uri_template: "/v1/{database}/documents:rollback",
body: "*",
matches: [
["database", %r{^projects/[^/]+/databases/[^/]+/?$}, false]
]
)
transcoder.transcode request_pb
end | @private
GRPC transcoding helper method for the rollback REST call
@param request_pb [::Google::Cloud::Firestore::V1::RollbackRequest]
A request object representing the call parameters. Required.
@return [Array(String, [String, nil], Hash{String => String})]
Uri, Body, Query string parameters | self.transcode_rollback_request | ruby | googleapis/google-cloud-ruby | google-cloud-firestore-v1/lib/google/cloud/firestore/v1/firestore/rest/service_stub.rb | https://github.com/googleapis/google-cloud-ruby/blob/master/google-cloud-firestore-v1/lib/google/cloud/firestore/v1/firestore/rest/service_stub.rb | Apache-2.0 |
def self.transcode_run_query_request request_pb
transcoder = Gapic::Rest::GrpcTranscoder.new
.with_bindings(
uri_method: :post,
uri_template: "/v1/{parent}:runQuery",
body: "*",
matches: [
["parent", %r{^projects/[^/]+/databases/[^/]+/documents/?$}, false]
]
)
.with_bindings(
uri_method: :post,
uri_template: "/v1/{parent}:runQuery",
body: "*",
matches: [
["parent", %r{^projects/[^/]+/databases/[^/]+/documents/[^/]+(?:/.*)?$}, true]
]
)
transcoder.transcode request_pb
end | @private
GRPC transcoding helper method for the run_query REST call
@param request_pb [::Google::Cloud::Firestore::V1::RunQueryRequest]
A request object representing the call parameters. Required.
@return [Array(String, [String, nil], Hash{String => String})]
Uri, Body, Query string parameters | self.transcode_run_query_request | ruby | googleapis/google-cloud-ruby | google-cloud-firestore-v1/lib/google/cloud/firestore/v1/firestore/rest/service_stub.rb | https://github.com/googleapis/google-cloud-ruby/blob/master/google-cloud-firestore-v1/lib/google/cloud/firestore/v1/firestore/rest/service_stub.rb | Apache-2.0 |
def self.transcode_run_aggregation_query_request request_pb
transcoder = Gapic::Rest::GrpcTranscoder.new
.with_bindings(
uri_method: :post,
uri_template: "/v1/{parent}:runAggregationQuery",
body: "*",
matches: [
["parent", %r{^projects/[^/]+/databases/[^/]+/documents/?$}, false]
]
)
.with_bindings(
uri_method: :post,
uri_template: "/v1/{parent}:runAggregationQuery",
body: "*",
matches: [
["parent", %r{^projects/[^/]+/databases/[^/]+/documents/[^/]+(?:/.*)?$}, true]
]
)
transcoder.transcode request_pb
end | @private
GRPC transcoding helper method for the run_aggregation_query REST call
@param request_pb [::Google::Cloud::Firestore::V1::RunAggregationQueryRequest]
A request object representing the call parameters. Required.
@return [Array(String, [String, nil], Hash{String => String})]
Uri, Body, Query string parameters | self.transcode_run_aggregation_query_request | ruby | googleapis/google-cloud-ruby | google-cloud-firestore-v1/lib/google/cloud/firestore/v1/firestore/rest/service_stub.rb | https://github.com/googleapis/google-cloud-ruby/blob/master/google-cloud-firestore-v1/lib/google/cloud/firestore/v1/firestore/rest/service_stub.rb | Apache-2.0 |
def self.transcode_partition_query_request request_pb
transcoder = Gapic::Rest::GrpcTranscoder.new
.with_bindings(
uri_method: :post,
uri_template: "/v1/{parent}:partitionQuery",
body: "*",
matches: [
["parent", %r{^projects/[^/]+/databases/[^/]+/documents/?$}, false]
]
)
.with_bindings(
uri_method: :post,
uri_template: "/v1/{parent}:partitionQuery",
body: "*",
matches: [
["parent", %r{^projects/[^/]+/databases/[^/]+/documents/[^/]+(?:/.*)?$}, true]
]
)
transcoder.transcode request_pb
end | @private
GRPC transcoding helper method for the partition_query REST call
@param request_pb [::Google::Cloud::Firestore::V1::PartitionQueryRequest]
A request object representing the call parameters. Required.
@return [Array(String, [String, nil], Hash{String => String})]
Uri, Body, Query string parameters | self.transcode_partition_query_request | ruby | googleapis/google-cloud-ruby | google-cloud-firestore-v1/lib/google/cloud/firestore/v1/firestore/rest/service_stub.rb | https://github.com/googleapis/google-cloud-ruby/blob/master/google-cloud-firestore-v1/lib/google/cloud/firestore/v1/firestore/rest/service_stub.rb | Apache-2.0 |
def self.transcode_list_collection_ids_request request_pb
transcoder = Gapic::Rest::GrpcTranscoder.new
.with_bindings(
uri_method: :post,
uri_template: "/v1/{parent}:listCollectionIds",
body: "*",
matches: [
["parent", %r{^projects/[^/]+/databases/[^/]+/documents/?$}, false]
]
)
.with_bindings(
uri_method: :post,
uri_template: "/v1/{parent}:listCollectionIds",
body: "*",
matches: [
["parent", %r{^projects/[^/]+/databases/[^/]+/documents/[^/]+(?:/.*)?$}, true]
]
)
transcoder.transcode request_pb
end | @private
GRPC transcoding helper method for the list_collection_ids REST call
@param request_pb [::Google::Cloud::Firestore::V1::ListCollectionIdsRequest]
A request object representing the call parameters. Required.
@return [Array(String, [String, nil], Hash{String => String})]
Uri, Body, Query string parameters | self.transcode_list_collection_ids_request | ruby | googleapis/google-cloud-ruby | google-cloud-firestore-v1/lib/google/cloud/firestore/v1/firestore/rest/service_stub.rb | https://github.com/googleapis/google-cloud-ruby/blob/master/google-cloud-firestore-v1/lib/google/cloud/firestore/v1/firestore/rest/service_stub.rb | Apache-2.0 |
def self.transcode_batch_write_request request_pb
transcoder = Gapic::Rest::GrpcTranscoder.new
.with_bindings(
uri_method: :post,
uri_template: "/v1/{database}/documents:batchWrite",
body: "*",
matches: [
["database", %r{^projects/[^/]+/databases/[^/]+/?$}, false]
]
)
transcoder.transcode request_pb
end | @private
GRPC transcoding helper method for the batch_write REST call
@param request_pb [::Google::Cloud::Firestore::V1::BatchWriteRequest]
A request object representing the call parameters. Required.
@return [Array(String, [String, nil], Hash{String => String})]
Uri, Body, Query string parameters | self.transcode_batch_write_request | ruby | googleapis/google-cloud-ruby | google-cloud-firestore-v1/lib/google/cloud/firestore/v1/firestore/rest/service_stub.rb | https://github.com/googleapis/google-cloud-ruby/blob/master/google-cloud-firestore-v1/lib/google/cloud/firestore/v1/firestore/rest/service_stub.rb | Apache-2.0 |
def self.transcode_create_document_request request_pb
transcoder = Gapic::Rest::GrpcTranscoder.new
.with_bindings(
uri_method: :post,
uri_template: "/v1/{parent}/{collection_id}",
body: "document",
matches: [
["parent", %r{^projects/[^/]+/databases/[^/]+/documents(?:/.*)?$}, true],
["collection_id", %r{^[^/]+/?$}, false]
]
)
transcoder.transcode request_pb
end | @private
GRPC transcoding helper method for the create_document REST call
@param request_pb [::Google::Cloud::Firestore::V1::CreateDocumentRequest]
A request object representing the call parameters. Required.
@return [Array(String, [String, nil], Hash{String => String})]
Uri, Body, Query string parameters | self.transcode_create_document_request | ruby | googleapis/google-cloud-ruby | google-cloud-firestore-v1/lib/google/cloud/firestore/v1/firestore/rest/service_stub.rb | https://github.com/googleapis/google-cloud-ruby/blob/master/google-cloud-firestore-v1/lib/google/cloud/firestore/v1/firestore/rest/service_stub.rb | Apache-2.0 |
def delete_cluster
# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Redis::Cluster::V1beta1::CloudRedisCluster::Client.new
# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Redis::Cluster::V1beta1::DeleteClusterRequest.new
# Call the delete_cluster method.
result = client.delete_cluster request
# The returned object is of type Gapic::Operation. You can use it to
# check the status of an operation, cancel it, or wait for results.
# Here is how to wait for a response.
result.wait_until_done! timeout: 60
if result.response?
p result.response
else
puts "No response received."
end | Snippet for the delete_cluster call in the CloudRedisCluster service
This snippet has been automatically generated and should be regarded as a code
template only. It will require modifications to work:
- It may require correct/in-range values for request initialization.
- It may require specifying regional endpoints when creating the service
client as shown in https://cloud.google.com/ruby/docs/reference.
This is an auto-generated example demonstrating basic usage of
Google::Cloud::Redis::Cluster::V1beta1::CloudRedisCluster::Client#delete_cluster. | delete_cluster | ruby | googleapis/google-cloud-ruby | google-cloud-redis-cluster-v1beta1/snippets/cloud_redis_cluster/delete_cluster.rb | https://github.com/googleapis/google-cloud-ruby/blob/master/google-cloud-redis-cluster-v1beta1/snippets/cloud_redis_cluster/delete_cluster.rb | Apache-2.0 |
def update_service
# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Metastore::V1beta::DataprocMetastore::Client.new
# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Metastore::V1beta::UpdateServiceRequest.new
# Call the update_service method.
result = client.update_service request
# The returned object is of type Gapic::Operation. You can use it to
# check the status of an operation, cancel it, or wait for results.
# Here is how to wait for a response.
result.wait_until_done! timeout: 60
if result.response?
p result.response
else
puts "No response received."
end | Snippet for the update_service call in the DataprocMetastore service
This snippet has been automatically generated and should be regarded as a code
template only. It will require modifications to work:
- It may require correct/in-range values for request initialization.
- It may require specifying regional endpoints when creating the service
client as shown in https://cloud.google.com/ruby/docs/reference.
This is an auto-generated example demonstrating basic usage of
Google::Cloud::Metastore::V1beta::DataprocMetastore::Client#update_service. | update_service | ruby | googleapis/google-cloud-ruby | google-cloud-metastore-v1beta/snippets/dataproc_metastore/update_service.rb | https://github.com/googleapis/google-cloud-ruby/blob/master/google-cloud-metastore-v1beta/snippets/dataproc_metastore/update_service.rb | Apache-2.0 |
def data_exchange_path project:, location:, data_exchange:
raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/"
"projects/#{project}/locations/#{location}/dataExchanges/#{data_exchange}"
end | Create a fully-qualified DataExchange resource string.
The resource will be in the following format:
`projects/{project}/locations/{location}/dataExchanges/{data_exchange}`
@param project [String]
@param location [String]
@param data_exchange [String]
@return [::String] | data_exchange_path | ruby | googleapis/google-cloud-ruby | google-cloud-bigquery-analytics_hub-v1/lib/google/cloud/bigquery/analytics_hub/v1/analytics_hub_service/paths.rb | https://github.com/googleapis/google-cloud-ruby/blob/master/google-cloud-bigquery-analytics_hub-v1/lib/google/cloud/bigquery/analytics_hub/v1/analytics_hub_service/paths.rb | Apache-2.0 |
def dataset_path project:, dataset:
raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
"projects/#{project}/datasets/#{dataset}"
end | Create a fully-qualified Dataset resource string.
The resource will be in the following format:
`projects/{project}/datasets/{dataset}`
@param project [String]
@param dataset [String]
@return [::String] | dataset_path | ruby | googleapis/google-cloud-ruby | google-cloud-bigquery-analytics_hub-v1/lib/google/cloud/bigquery/analytics_hub/v1/analytics_hub_service/paths.rb | https://github.com/googleapis/google-cloud-ruby/blob/master/google-cloud-bigquery-analytics_hub-v1/lib/google/cloud/bigquery/analytics_hub/v1/analytics_hub_service/paths.rb | Apache-2.0 |
def listing_path project:, location:, data_exchange:, listing:
raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/"
raise ::ArgumentError, "data_exchange cannot contain /" if data_exchange.to_s.include? "/"
"projects/#{project}/locations/#{location}/dataExchanges/#{data_exchange}/listings/#{listing}"
end | Create a fully-qualified Listing resource string.
The resource will be in the following format:
`projects/{project}/locations/{location}/dataExchanges/{data_exchange}/listings/{listing}`
@param project [String]
@param location [String]
@param data_exchange [String]
@param listing [String]
@return [::String] | listing_path | ruby | googleapis/google-cloud-ruby | google-cloud-bigquery-analytics_hub-v1/lib/google/cloud/bigquery/analytics_hub/v1/analytics_hub_service/paths.rb | https://github.com/googleapis/google-cloud-ruby/blob/master/google-cloud-bigquery-analytics_hub-v1/lib/google/cloud/bigquery/analytics_hub/v1/analytics_hub_service/paths.rb | Apache-2.0 |
def location_path project:, location:
raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
"projects/#{project}/locations/#{location}"
end | Create a fully-qualified Location resource string.
The resource will be in the following format:
`projects/{project}/locations/{location}`
@param project [String]
@param location [String]
@return [::String] | location_path | ruby | googleapis/google-cloud-ruby | google-cloud-bigquery-analytics_hub-v1/lib/google/cloud/bigquery/analytics_hub/v1/analytics_hub_service/paths.rb | https://github.com/googleapis/google-cloud-ruby/blob/master/google-cloud-bigquery-analytics_hub-v1/lib/google/cloud/bigquery/analytics_hub/v1/analytics_hub_service/paths.rb | Apache-2.0 |
def subscription_path project:, location:, subscription:
raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/"
"projects/#{project}/locations/#{location}/subscriptions/#{subscription}"
end | Create a fully-qualified Subscription resource string.
The resource will be in the following format:
`projects/{project}/locations/{location}/subscriptions/{subscription}`
@param project [String]
@param location [String]
@param subscription [String]
@return [::String] | subscription_path | ruby | googleapis/google-cloud-ruby | google-cloud-bigquery-analytics_hub-v1/lib/google/cloud/bigquery/analytics_hub/v1/analytics_hub_service/paths.rb | https://github.com/googleapis/google-cloud-ruby/blob/master/google-cloud-bigquery-analytics_hub-v1/lib/google/cloud/bigquery/analytics_hub/v1/analytics_hub_service/paths.rb | Apache-2.0 |
def table_path project:, dataset:, table:
raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
raise ::ArgumentError, "dataset cannot contain /" if dataset.to_s.include? "/"
"projects/#{project}/datasets/#{dataset}/tables/#{table}"
end | Create a fully-qualified Table resource string.
The resource will be in the following format:
`projects/{project}/datasets/{dataset}/tables/{table}`
@param project [String]
@param dataset [String]
@param table [String]
@return [::String] | table_path | ruby | googleapis/google-cloud-ruby | google-cloud-bigquery-analytics_hub-v1/lib/google/cloud/bigquery/analytics_hub/v1/analytics_hub_service/paths.rb | https://github.com/googleapis/google-cloud-ruby/blob/master/google-cloud-bigquery-analytics_hub-v1/lib/google/cloud/bigquery/analytics_hub/v1/analytics_hub_service/paths.rb | Apache-2.0 |
def topic_path project:, topic:
raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
"projects/#{project}/topics/#{topic}"
end | Create a fully-qualified Topic resource string.
The resource will be in the following format:
`projects/{project}/topics/{topic}`
@param project [String]
@param topic [String]
@return [::String] | topic_path | ruby | googleapis/google-cloud-ruby | google-cloud-bigquery-analytics_hub-v1/lib/google/cloud/bigquery/analytics_hub/v1/analytics_hub_service/paths.rb | https://github.com/googleapis/google-cloud-ruby/blob/master/google-cloud-bigquery-analytics_hub-v1/lib/google/cloud/bigquery/analytics_hub/v1/analytics_hub_service/paths.rb | Apache-2.0 |
def grafeas_client
return @grafeas_client if defined?(@grafeas_client) && !block_given?
client = ::Grafeas::V1::Grafeas::Client.new do |config|
grpc_stub = @container_analysis_stub.grpc_stub
config.endpoint = grpc_stub.instance_variable_get :@host
config.credentials = grpc_stub.instance_variable_get :@ch
config.quota_project = @quota_project_id
yield config if block_given?
end | Return a Grafeas client for Container Analysis.
By default, the client uses the same connection and settings as
the underlying ContainerAnalysis client. You can optionally
customize the settings by passing a configuration block.
## Examples
To create a new Grafeas client with the same configuration as the
ContainerAnalysis client:
grafeas_client = container_analysis_client.grafeas_client
To create a new Grafeas client with a custom configuration:
grafeas_client = container_analysis_client.grafeas_client do |config|
config.timeout = 10.0
end
@yield [config] Configure the ContainerAnalysis client.
@yieldparam config [Client::Configuration]
@return [Grafeas::V1::Grafeas::Client] | grafeas_client | ruby | googleapis/google-cloud-ruby | google-cloud-container_analysis-v1/lib/google/cloud/container_analysis/v1/container_analysis/helpers.rb | https://github.com/googleapis/google-cloud-ruby/blob/master/google-cloud-container_analysis-v1/lib/google/cloud/container_analysis/v1/container_analysis/helpers.rb | Apache-2.0 |
def list_connections
# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Build::V2::RepositoryManager::Client.new
# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Build::V2::ListConnectionsRequest.new
# Call the list_connections method.
result = client.list_connections request
# The returned object is of type Gapic::PagedEnumerable. You can iterate
# over elements, and API calls will be issued to fetch pages as needed.
result.each do |item|
# Each element is of type ::Google::Cloud::Build::V2::Connection.
p item
end | Snippet for the list_connections call in the RepositoryManager service
This snippet has been automatically generated and should be regarded as a code
template only. It will require modifications to work:
- It may require correct/in-range values for request initialization.
- It may require specifying regional endpoints when creating the service
client as shown in https://cloud.google.com/ruby/docs/reference.
This is an auto-generated example demonstrating basic usage of
Google::Cloud::Build::V2::RepositoryManager::Client#list_connections. | list_connections | ruby | googleapis/google-cloud-ruby | google-cloud-build-v2/snippets/repository_manager/list_connections.rb | https://github.com/googleapis/google-cloud-ruby/blob/master/google-cloud-build-v2/snippets/repository_manager/list_connections.rb | Apache-2.0 |
def list_realms
# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Gaming::V1::RealmsService::Client.new
# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Gaming::V1::ListRealmsRequest.new
# Call the list_realms method.
result = client.list_realms request
# The returned object is of type Gapic::PagedEnumerable. You can iterate
# over elements, and API calls will be issued to fetch pages as needed.
result.each do |item|
# Each element is of type ::Google::Cloud::Gaming::V1::Realm.
p item
end | Snippet for the list_realms call in the RealmsService service
This is an auto-generated example demonstrating basic usage of
Google::Cloud::Gaming::V1::RealmsService::Client#list_realms. It may require
modification in order to execute successfully. | list_realms | ruby | googleapis/google-cloud-ruby | obsolete/google-cloud-gaming-v1/snippets/realms_service/list_realms.rb | https://github.com/googleapis/google-cloud-ruby/blob/master/obsolete/google-cloud-gaming-v1/snippets/realms_service/list_realms.rb | Apache-2.0 |
def self.configure
@configure ||= begin
namespace = ["Google", "Cloud", "TelcoAutomation"]
parent_config = while namespace.any?
parent_name = namespace.join "::"
parent_const = const_get parent_name
break parent_const.configure if parent_const.respond_to? :configure
namespace.pop
end | @private
Initialize the mixin bindings configuration | self.configure | ruby | googleapis/google-cloud-ruby | google-cloud-telco_automation-v1/lib/google/cloud/telco_automation/v1/bindings_override.rb | https://github.com/googleapis/google-cloud-ruby/blob/master/google-cloud-telco_automation-v1/lib/google/cloud/telco_automation/v1/bindings_override.rb | Apache-2.0 |
def get_user request_pb, options = nil
raise ::ArgumentError, "request must be provided" if request_pb.nil?
verb, uri, query_string_params, body = ServiceStub.transcode_get_user_request request_pb
query_string_params = if query_string_params.any?
query_string_params.to_h { |p| p.split "=", 2 }
else
{}
end | Baseline implementation for the get_user REST call
@param request_pb [::Google::Shopping::Merchant::Accounts::V1beta::GetUserRequest]
A request object representing the call parameters. Required.
@param options [::Gapic::CallOptions]
Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
@yield [result, operation] Access the result along with the TransportOperation object
@yieldparam result [::Google::Shopping::Merchant::Accounts::V1beta::User]
@yieldparam operation [::Gapic::Rest::TransportOperation]
@return [::Google::Shopping::Merchant::Accounts::V1beta::User]
A result object deserialized from the server's reply | get_user | ruby | googleapis/google-cloud-ruby | google-shopping-merchant-accounts-v1beta/lib/google/shopping/merchant/accounts/v1beta/user_service/rest/service_stub.rb | https://github.com/googleapis/google-cloud-ruby/blob/master/google-shopping-merchant-accounts-v1beta/lib/google/shopping/merchant/accounts/v1beta/user_service/rest/service_stub.rb | Apache-2.0 |
def create_user request_pb, options = nil
raise ::ArgumentError, "request must be provided" if request_pb.nil?
verb, uri, query_string_params, body = ServiceStub.transcode_create_user_request request_pb
query_string_params = if query_string_params.any?
query_string_params.to_h { |p| p.split "=", 2 }
else
{}
end | Baseline implementation for the create_user REST call
@param request_pb [::Google::Shopping::Merchant::Accounts::V1beta::CreateUserRequest]
A request object representing the call parameters. Required.
@param options [::Gapic::CallOptions]
Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
@yield [result, operation] Access the result along with the TransportOperation object
@yieldparam result [::Google::Shopping::Merchant::Accounts::V1beta::User]
@yieldparam operation [::Gapic::Rest::TransportOperation]
@return [::Google::Shopping::Merchant::Accounts::V1beta::User]
A result object deserialized from the server's reply | create_user | ruby | googleapis/google-cloud-ruby | google-shopping-merchant-accounts-v1beta/lib/google/shopping/merchant/accounts/v1beta/user_service/rest/service_stub.rb | https://github.com/googleapis/google-cloud-ruby/blob/master/google-shopping-merchant-accounts-v1beta/lib/google/shopping/merchant/accounts/v1beta/user_service/rest/service_stub.rb | Apache-2.0 |
def delete_user request_pb, options = nil
raise ::ArgumentError, "request must be provided" if request_pb.nil?
verb, uri, query_string_params, body = ServiceStub.transcode_delete_user_request request_pb
query_string_params = if query_string_params.any?
query_string_params.to_h { |p| p.split "=", 2 }
else
{}
end | Baseline implementation for the delete_user REST call
@param request_pb [::Google::Shopping::Merchant::Accounts::V1beta::DeleteUserRequest]
A request object representing the call parameters. Required.
@param options [::Gapic::CallOptions]
Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
@yield [result, operation] Access the result along with the TransportOperation object
@yieldparam result [::Google::Protobuf::Empty]
@yieldparam operation [::Gapic::Rest::TransportOperation]
@return [::Google::Protobuf::Empty]
A result object deserialized from the server's reply | delete_user | ruby | googleapis/google-cloud-ruby | google-shopping-merchant-accounts-v1beta/lib/google/shopping/merchant/accounts/v1beta/user_service/rest/service_stub.rb | https://github.com/googleapis/google-cloud-ruby/blob/master/google-shopping-merchant-accounts-v1beta/lib/google/shopping/merchant/accounts/v1beta/user_service/rest/service_stub.rb | Apache-2.0 |
def update_user request_pb, options = nil
raise ::ArgumentError, "request must be provided" if request_pb.nil?
verb, uri, query_string_params, body = ServiceStub.transcode_update_user_request request_pb
query_string_params = if query_string_params.any?
query_string_params.to_h { |p| p.split "=", 2 }
else
{}
end | Baseline implementation for the update_user REST call
@param request_pb [::Google::Shopping::Merchant::Accounts::V1beta::UpdateUserRequest]
A request object representing the call parameters. Required.
@param options [::Gapic::CallOptions]
Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
@yield [result, operation] Access the result along with the TransportOperation object
@yieldparam result [::Google::Shopping::Merchant::Accounts::V1beta::User]
@yieldparam operation [::Gapic::Rest::TransportOperation]
@return [::Google::Shopping::Merchant::Accounts::V1beta::User]
A result object deserialized from the server's reply | update_user | ruby | googleapis/google-cloud-ruby | google-shopping-merchant-accounts-v1beta/lib/google/shopping/merchant/accounts/v1beta/user_service/rest/service_stub.rb | https://github.com/googleapis/google-cloud-ruby/blob/master/google-shopping-merchant-accounts-v1beta/lib/google/shopping/merchant/accounts/v1beta/user_service/rest/service_stub.rb | Apache-2.0 |
def list_users request_pb, options = nil
raise ::ArgumentError, "request must be provided" if request_pb.nil?
verb, uri, query_string_params, body = ServiceStub.transcode_list_users_request request_pb
query_string_params = if query_string_params.any?
query_string_params.to_h { |p| p.split "=", 2 }
else
{}
end | Baseline implementation for the list_users REST call
@param request_pb [::Google::Shopping::Merchant::Accounts::V1beta::ListUsersRequest]
A request object representing the call parameters. Required.
@param options [::Gapic::CallOptions]
Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
@yield [result, operation] Access the result along with the TransportOperation object
@yieldparam result [::Google::Shopping::Merchant::Accounts::V1beta::ListUsersResponse]
@yieldparam operation [::Gapic::Rest::TransportOperation]
@return [::Google::Shopping::Merchant::Accounts::V1beta::ListUsersResponse]
A result object deserialized from the server's reply | list_users | ruby | googleapis/google-cloud-ruby | google-shopping-merchant-accounts-v1beta/lib/google/shopping/merchant/accounts/v1beta/user_service/rest/service_stub.rb | https://github.com/googleapis/google-cloud-ruby/blob/master/google-shopping-merchant-accounts-v1beta/lib/google/shopping/merchant/accounts/v1beta/user_service/rest/service_stub.rb | Apache-2.0 |
def self.transcode_get_user_request request_pb
transcoder = Gapic::Rest::GrpcTranscoder.new
.with_bindings(
uri_method: :get,
uri_template: "/accounts/v1beta/{name}",
matches: [
["name", %r{^accounts/[^/]+/users/[^/]+/?$}, false]
]
)
transcoder.transcode request_pb
end | @private
GRPC transcoding helper method for the get_user REST call
@param request_pb [::Google::Shopping::Merchant::Accounts::V1beta::GetUserRequest]
A request object representing the call parameters. Required.
@return [Array(String, [String, nil], Hash{String => String})]
Uri, Body, Query string parameters | self.transcode_get_user_request | ruby | googleapis/google-cloud-ruby | google-shopping-merchant-accounts-v1beta/lib/google/shopping/merchant/accounts/v1beta/user_service/rest/service_stub.rb | https://github.com/googleapis/google-cloud-ruby/blob/master/google-shopping-merchant-accounts-v1beta/lib/google/shopping/merchant/accounts/v1beta/user_service/rest/service_stub.rb | Apache-2.0 |
def self.transcode_create_user_request request_pb
transcoder = Gapic::Rest::GrpcTranscoder.new
.with_bindings(
uri_method: :post,
uri_template: "/accounts/v1beta/{parent}/users",
body: "user",
matches: [
["parent", %r{^accounts/[^/]+/?$}, false]
]
)
transcoder.transcode request_pb
end | @private
GRPC transcoding helper method for the create_user REST call
@param request_pb [::Google::Shopping::Merchant::Accounts::V1beta::CreateUserRequest]
A request object representing the call parameters. Required.
@return [Array(String, [String, nil], Hash{String => String})]
Uri, Body, Query string parameters | self.transcode_create_user_request | ruby | googleapis/google-cloud-ruby | google-shopping-merchant-accounts-v1beta/lib/google/shopping/merchant/accounts/v1beta/user_service/rest/service_stub.rb | https://github.com/googleapis/google-cloud-ruby/blob/master/google-shopping-merchant-accounts-v1beta/lib/google/shopping/merchant/accounts/v1beta/user_service/rest/service_stub.rb | Apache-2.0 |
def self.transcode_delete_user_request request_pb
transcoder = Gapic::Rest::GrpcTranscoder.new
.with_bindings(
uri_method: :delete,
uri_template: "/accounts/v1beta/{name}",
matches: [
["name", %r{^accounts/[^/]+/users/[^/]+/?$}, false]
]
)
transcoder.transcode request_pb
end | @private
GRPC transcoding helper method for the delete_user REST call
@param request_pb [::Google::Shopping::Merchant::Accounts::V1beta::DeleteUserRequest]
A request object representing the call parameters. Required.
@return [Array(String, [String, nil], Hash{String => String})]
Uri, Body, Query string parameters | self.transcode_delete_user_request | ruby | googleapis/google-cloud-ruby | google-shopping-merchant-accounts-v1beta/lib/google/shopping/merchant/accounts/v1beta/user_service/rest/service_stub.rb | https://github.com/googleapis/google-cloud-ruby/blob/master/google-shopping-merchant-accounts-v1beta/lib/google/shopping/merchant/accounts/v1beta/user_service/rest/service_stub.rb | Apache-2.0 |
def self.transcode_update_user_request request_pb
transcoder = Gapic::Rest::GrpcTranscoder.new
.with_bindings(
uri_method: :patch,
uri_template: "/accounts/v1beta/{user.name}",
body: "user",
matches: [
["user.name", %r{^accounts/[^/]+/users/[^/]+/?$}, false]
]
)
transcoder.transcode request_pb
end | @private
GRPC transcoding helper method for the update_user REST call
@param request_pb [::Google::Shopping::Merchant::Accounts::V1beta::UpdateUserRequest]
A request object representing the call parameters. Required.
@return [Array(String, [String, nil], Hash{String => String})]
Uri, Body, Query string parameters | self.transcode_update_user_request | ruby | googleapis/google-cloud-ruby | google-shopping-merchant-accounts-v1beta/lib/google/shopping/merchant/accounts/v1beta/user_service/rest/service_stub.rb | https://github.com/googleapis/google-cloud-ruby/blob/master/google-shopping-merchant-accounts-v1beta/lib/google/shopping/merchant/accounts/v1beta/user_service/rest/service_stub.rb | Apache-2.0 |
def self.transcode_list_users_request request_pb
transcoder = Gapic::Rest::GrpcTranscoder.new
.with_bindings(
uri_method: :get,
uri_template: "/accounts/v1beta/{parent}/users",
matches: [
["parent", %r{^accounts/[^/]+/?$}, false]
]
)
transcoder.transcode request_pb
end | @private
GRPC transcoding helper method for the list_users REST call
@param request_pb [::Google::Shopping::Merchant::Accounts::V1beta::ListUsersRequest]
A request object representing the call parameters. Required.
@return [Array(String, [String, nil], Hash{String => String})]
Uri, Body, Query string parameters | self.transcode_list_users_request | ruby | googleapis/google-cloud-ruby | google-shopping-merchant-accounts-v1beta/lib/google/shopping/merchant/accounts/v1beta/user_service/rest/service_stub.rb | https://github.com/googleapis/google-cloud-ruby/blob/master/google-shopping-merchant-accounts-v1beta/lib/google/shopping/merchant/accounts/v1beta/user_service/rest/service_stub.rb | Apache-2.0 |
def self.configure
@configure ||= Operations::Configuration.new
yield @configure if block_given?
@configure
end | Configuration for the CloudFilestoreManager Operations API.
@yield [config] Configure the Operations client.
@yieldparam config [Operations::Configuration]
@return [Operations::Configuration] | self.configure | ruby | googleapis/google-cloud-ruby | google-cloud-filestore-v1/lib/google/cloud/filestore/v1/cloud_filestore_manager/operations.rb | https://github.com/googleapis/google-cloud-ruby/blob/master/google-cloud-filestore-v1/lib/google/cloud/filestore/v1/cloud_filestore_manager/operations.rb | Apache-2.0 |
def configure
yield @config if block_given?
@config
end | Configure the CloudFilestoreManager Operations instance.
The configuration is set to the derived mode, meaning that values can be changed,
but structural changes (adding new fields, etc.) are not allowed. Structural changes
should be made on {Operations.configure}.
@yield [config] Configure the Operations client.
@yieldparam config [Operations::Configuration]
@return [Operations::Configuration] | configure | ruby | googleapis/google-cloud-ruby | google-cloud-filestore-v1/lib/google/cloud/filestore/v1/cloud_filestore_manager/operations.rb | https://github.com/googleapis/google-cloud-ruby/blob/master/google-cloud-filestore-v1/lib/google/cloud/filestore/v1/cloud_filestore_manager/operations.rb | Apache-2.0 |
def initialize
# These require statements are intentionally placed here to initialize
# the gRPC module only when it's required.
# See https://github.com/googleapis/toolkit/issues/446
require "gapic/grpc"
require "google/longrunning/operations_services_pb"
# Create the configuration object
@config = Configuration.new Operations.configure
# Yield the configuration if needed
yield @config if block_given?
# Create credentials
credentials = @config.credentials
credentials ||= Credentials.default scope: @config.scope
if credentials.is_a?(::String) || credentials.is_a?(::Hash)
credentials = Credentials.new credentials, scope: @config.scope
end | Create a new Operations client object.
@yield [config] Configure the Client client.
@yieldparam config [Operations::Configuration] | initialize | ruby | googleapis/google-cloud-ruby | google-cloud-filestore-v1/lib/google/cloud/filestore/v1/cloud_filestore_manager/operations.rb | https://github.com/googleapis/google-cloud-ruby/blob/master/google-cloud-filestore-v1/lib/google/cloud/filestore/v1/cloud_filestore_manager/operations.rb | Apache-2.0 |
def list_operations request, options = nil
raise ::ArgumentError, "request must be provided" if request.nil?
request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::ListOperationsRequest
# Converts hash and nil to an options object
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
# Customize the options with defaults
metadata = @config.rpcs.list_operations.metadata.to_h
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
lib_name: @config.lib_name, lib_version: @config.lib_version,
gapic_version: ::Google::Cloud::Filestore::V1::VERSION
metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
header_params = {}
if request.name
header_params["name"] = request.name
end | Service calls
Lists operations that match the specified filter in the request. If the
server doesn't support this method, it returns `UNIMPLEMENTED`.
@overload list_operations(request, options = nil)
Pass arguments to `list_operations` via a request object, either of type
{::Google::Longrunning::ListOperationsRequest} or an equivalent Hash.
@param request [::Google::Longrunning::ListOperationsRequest, ::Hash]
A request object representing the call parameters. Required. To specify no
parameters, or to keep all the default parameter values, pass an empty Hash.
@param options [::Gapic::CallOptions, ::Hash]
Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
@overload list_operations(name: nil, filter: nil, page_size: nil, page_token: nil)
Pass arguments to `list_operations` via keyword arguments. Note that at
least one keyword argument is required. To specify no parameters, or to keep all
the default parameter values, pass an empty Hash as a request object (see above).
@param name [::String]
The name of the operation's parent resource.
@param filter [::String]
The standard list filter.
@param page_size [::Integer]
The standard list page size.
@param page_token [::String]
The standard list page token.
@yield [response, operation] Access the result along with the RPC operation
@yieldparam response [::Gapic::PagedEnumerable<::Gapic::Operation>]
@yieldparam operation [::GRPC::ActiveCall::Operation]
@return [::Gapic::PagedEnumerable<::Gapic::Operation>]
@raise [::Google::Cloud::Error] if the RPC is aborted.
@example Basic example
require "google/longrunning"
# Create a client object. The client can be reused for multiple calls.
client = Google::Longrunning::Operations::Client.new
# Create a request. To set request fields, pass in keyword arguments.
request = Google::Longrunning::ListOperationsRequest.new
# Call the list_operations method.
result = client.list_operations request
# The returned object is of type Gapic::PagedEnumerable. You can iterate
# over elements, and API calls will be issued to fetch pages as needed.
result.each do |item|
# Each element is of type ::Google::Longrunning::Operation.
p item
end | list_operations | ruby | googleapis/google-cloud-ruby | google-cloud-filestore-v1/lib/google/cloud/filestore/v1/cloud_filestore_manager/operations.rb | https://github.com/googleapis/google-cloud-ruby/blob/master/google-cloud-filestore-v1/lib/google/cloud/filestore/v1/cloud_filestore_manager/operations.rb | Apache-2.0 |
def get_operation request, options = nil
raise ::ArgumentError, "request must be provided" if request.nil?
request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::GetOperationRequest
# Converts hash and nil to an options object
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
# Customize the options with defaults
metadata = @config.rpcs.get_operation.metadata.to_h
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
lib_name: @config.lib_name, lib_version: @config.lib_version,
gapic_version: ::Google::Cloud::Filestore::V1::VERSION
metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
header_params = {}
if request.name
header_params["name"] = request.name
end | Gets the latest state of a long-running operation. Clients can use this
method to poll the operation result at intervals as recommended by the API
service.
@overload get_operation(request, options = nil)
Pass arguments to `get_operation` via a request object, either of type
{::Google::Longrunning::GetOperationRequest} or an equivalent Hash.
@param request [::Google::Longrunning::GetOperationRequest, ::Hash]
A request object representing the call parameters. Required. To specify no
parameters, or to keep all the default parameter values, pass an empty Hash.
@param options [::Gapic::CallOptions, ::Hash]
Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
@overload get_operation(name: nil)
Pass arguments to `get_operation` via keyword arguments. Note that at
least one keyword argument is required. To specify no parameters, or to keep all
the default parameter values, pass an empty Hash as a request object (see above).
@param name [::String]
The name of the operation resource.
@yield [response, operation] Access the result along with the RPC operation
@yieldparam response [::Gapic::Operation]
@yieldparam operation [::GRPC::ActiveCall::Operation]
@return [::Gapic::Operation]
@raise [::Google::Cloud::Error] if the RPC is aborted.
@example Basic example
require "google/longrunning"
# Create a client object. The client can be reused for multiple calls.
client = Google::Longrunning::Operations::Client.new
# Create a request. To set request fields, pass in keyword arguments.
request = Google::Longrunning::GetOperationRequest.new
# Call the get_operation method.
result = client.get_operation request
# The returned object is of type Gapic::Operation. You can use it to
# check the status of an operation, cancel it, or wait for results.
# Here is how to wait for a response.
result.wait_until_done! timeout: 60
if result.response?
p result.response
else
puts "No response received."
end | get_operation | ruby | googleapis/google-cloud-ruby | google-cloud-filestore-v1/lib/google/cloud/filestore/v1/cloud_filestore_manager/operations.rb | https://github.com/googleapis/google-cloud-ruby/blob/master/google-cloud-filestore-v1/lib/google/cloud/filestore/v1/cloud_filestore_manager/operations.rb | Apache-2.0 |
def delete_operation request, options = nil
raise ::ArgumentError, "request must be provided" if request.nil?
request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::DeleteOperationRequest
# Converts hash and nil to an options object
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
# Customize the options with defaults
metadata = @config.rpcs.delete_operation.metadata.to_h
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
lib_name: @config.lib_name, lib_version: @config.lib_version,
gapic_version: ::Google::Cloud::Filestore::V1::VERSION
metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
header_params = {}
if request.name
header_params["name"] = request.name
end | Deletes a long-running operation. This method indicates that the client is
no longer interested in the operation result. It does not cancel the
operation. If the server doesn't support this method, it returns
`google.rpc.Code.UNIMPLEMENTED`.
@overload delete_operation(request, options = nil)
Pass arguments to `delete_operation` via a request object, either of type
{::Google::Longrunning::DeleteOperationRequest} or an equivalent Hash.
@param request [::Google::Longrunning::DeleteOperationRequest, ::Hash]
A request object representing the call parameters. Required. To specify no
parameters, or to keep all the default parameter values, pass an empty Hash.
@param options [::Gapic::CallOptions, ::Hash]
Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
@overload delete_operation(name: nil)
Pass arguments to `delete_operation` via keyword arguments. Note that at
least one keyword argument is required. To specify no parameters, or to keep all
the default parameter values, pass an empty Hash as a request object (see above).
@param name [::String]
The name of the operation resource to be deleted.
@yield [response, operation] Access the result along with the RPC operation
@yieldparam response [::Google::Protobuf::Empty]
@yieldparam operation [::GRPC::ActiveCall::Operation]
@return [::Google::Protobuf::Empty]
@raise [::Google::Cloud::Error] if the RPC is aborted.
@example Basic example
require "google/longrunning"
# Create a client object. The client can be reused for multiple calls.
client = Google::Longrunning::Operations::Client.new
# Create a request. To set request fields, pass in keyword arguments.
request = Google::Longrunning::DeleteOperationRequest.new
# Call the delete_operation method.
result = client.delete_operation request
# The returned object is of type Google::Protobuf::Empty.
p result | delete_operation | ruby | googleapis/google-cloud-ruby | google-cloud-filestore-v1/lib/google/cloud/filestore/v1/cloud_filestore_manager/operations.rb | https://github.com/googleapis/google-cloud-ruby/blob/master/google-cloud-filestore-v1/lib/google/cloud/filestore/v1/cloud_filestore_manager/operations.rb | Apache-2.0 |
def cancel_operation request, options = nil
raise ::ArgumentError, "request must be provided" if request.nil?
request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::CancelOperationRequest
# Converts hash and nil to an options object
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
# Customize the options with defaults
metadata = @config.rpcs.cancel_operation.metadata.to_h
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
lib_name: @config.lib_name, lib_version: @config.lib_version,
gapic_version: ::Google::Cloud::Filestore::V1::VERSION
metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
header_params = {}
if request.name
header_params["name"] = request.name
end | Starts asynchronous cancellation on a long-running operation. The server
makes a best effort to cancel the operation, but success is not
guaranteed. If the server doesn't support this method, it returns
`google.rpc.Code.UNIMPLEMENTED`. Clients can use
Operations.GetOperation or
other methods to check whether the cancellation succeeded or whether the
operation completed despite cancellation. On successful cancellation,
the operation is not deleted; instead, it becomes an operation with
an {::Google::Longrunning::Operation#error Operation.error} value with a
{::Google::Rpc::Status#code google.rpc.Status.code} of `1`, corresponding to
`Code.CANCELLED`.
@overload cancel_operation(request, options = nil)
Pass arguments to `cancel_operation` via a request object, either of type
{::Google::Longrunning::CancelOperationRequest} or an equivalent Hash.
@param request [::Google::Longrunning::CancelOperationRequest, ::Hash]
A request object representing the call parameters. Required. To specify no
parameters, or to keep all the default parameter values, pass an empty Hash.
@param options [::Gapic::CallOptions, ::Hash]
Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
@overload cancel_operation(name: nil)
Pass arguments to `cancel_operation` via keyword arguments. Note that at
least one keyword argument is required. To specify no parameters, or to keep all
the default parameter values, pass an empty Hash as a request object (see above).
@param name [::String]
The name of the operation resource to be cancelled.
@yield [response, operation] Access the result along with the RPC operation
@yieldparam response [::Google::Protobuf::Empty]
@yieldparam operation [::GRPC::ActiveCall::Operation]
@return [::Google::Protobuf::Empty]
@raise [::Google::Cloud::Error] if the RPC is aborted.
@example Basic example
require "google/longrunning"
# Create a client object. The client can be reused for multiple calls.
client = Google::Longrunning::Operations::Client.new
# Create a request. To set request fields, pass in keyword arguments.
request = Google::Longrunning::CancelOperationRequest.new
# Call the cancel_operation method.
result = client.cancel_operation request
# The returned object is of type Google::Protobuf::Empty.
p result | cancel_operation | ruby | googleapis/google-cloud-ruby | google-cloud-filestore-v1/lib/google/cloud/filestore/v1/cloud_filestore_manager/operations.rb | https://github.com/googleapis/google-cloud-ruby/blob/master/google-cloud-filestore-v1/lib/google/cloud/filestore/v1/cloud_filestore_manager/operations.rb | Apache-2.0 |
def wait_operation request, options = nil
raise ::ArgumentError, "request must be provided" if request.nil?
request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::WaitOperationRequest
# Converts hash and nil to an options object
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
# Customize the options with defaults
metadata = @config.rpcs.wait_operation.metadata.to_h
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
lib_name: @config.lib_name, lib_version: @config.lib_version,
gapic_version: ::Google::Cloud::Filestore::V1::VERSION
metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
options.apply_defaults timeout: @config.rpcs.wait_operation.timeout,
metadata: metadata,
retry_policy: @config.rpcs.wait_operation.retry_policy
options.apply_defaults timeout: @config.timeout,
metadata: @config.metadata,
retry_policy: @config.retry_policy
@operations_stub.call_rpc :wait_operation, request, options: options do |response, operation|
response = ::Gapic::Operation.new response, @operations_client, options: options
yield response, operation if block_given?
throw :response, response
end | Waits until the specified long-running operation is done or reaches at most
a specified timeout, returning the latest state. If the operation is
already done, the latest state is immediately returned. If the timeout
specified is greater than the default HTTP/RPC timeout, the HTTP/RPC
timeout is used. If the server does not support this method, it returns
`google.rpc.Code.UNIMPLEMENTED`.
Note that this method is on a best-effort basis. It may return the latest
state before the specified timeout (including immediately), meaning even an
immediate response is no guarantee that the operation is done.
@overload wait_operation(request, options = nil)
Pass arguments to `wait_operation` via a request object, either of type
{::Google::Longrunning::WaitOperationRequest} or an equivalent Hash.
@param request [::Google::Longrunning::WaitOperationRequest, ::Hash]
A request object representing the call parameters. Required. To specify no
parameters, or to keep all the default parameter values, pass an empty Hash.
@param options [::Gapic::CallOptions, ::Hash]
Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
@overload wait_operation(name: nil, timeout: nil)
Pass arguments to `wait_operation` via keyword arguments. Note that at
least one keyword argument is required. To specify no parameters, or to keep all
the default parameter values, pass an empty Hash as a request object (see above).
@param name [::String]
The name of the operation resource to wait on.
@param timeout [::Google::Protobuf::Duration, ::Hash]
The maximum duration to wait before timing out. If left blank, the wait
will be at most the time permitted by the underlying HTTP/RPC protocol.
If RPC context deadline is also specified, the shorter one will be used.
@yield [response, operation] Access the result along with the RPC operation
@yieldparam response [::Gapic::Operation]
@yieldparam operation [::GRPC::ActiveCall::Operation]
@return [::Gapic::Operation]
@raise [::Google::Cloud::Error] if the RPC is aborted.
@example Basic example
require "google/longrunning"
# Create a client object. The client can be reused for multiple calls.
client = Google::Longrunning::Operations::Client.new
# Create a request. To set request fields, pass in keyword arguments.
request = Google::Longrunning::WaitOperationRequest.new
# Call the wait_operation method.
result = client.wait_operation request
# The returned object is of type Gapic::Operation. You can use it to
# check the status of an operation, cancel it, or wait for results.
# Here is how to wait for a response.
result.wait_until_done! timeout: 60
if result.response?
p result.response
else
puts "No response received."
end | wait_operation | ruby | googleapis/google-cloud-ruby | google-cloud-filestore-v1/lib/google/cloud/filestore/v1/cloud_filestore_manager/operations.rb | https://github.com/googleapis/google-cloud-ruby/blob/master/google-cloud-filestore-v1/lib/google/cloud/filestore/v1/cloud_filestore_manager/operations.rb | Apache-2.0 |
def list_python_packages
# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::ArtifactRegistry::V1::ArtifactRegistry::Client.new
# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::ArtifactRegistry::V1::ListPythonPackagesRequest.new
# Call the list_python_packages method.
result = client.list_python_packages request
# The returned object is of type Gapic::PagedEnumerable. You can iterate
# over elements, and API calls will be issued to fetch pages as needed.
result.each do |item|
# Each element is of type ::Google::Cloud::ArtifactRegistry::V1::PythonPackage.
p item
end | Snippet for the list_python_packages call in the ArtifactRegistry service
This snippet has been automatically generated and should be regarded as a code
template only. It will require modifications to work:
- It may require correct/in-range values for request initialization.
- It may require specifying regional endpoints when creating the service
client as shown in https://cloud.google.com/ruby/docs/reference.
This is an auto-generated example demonstrating basic usage of
Google::Cloud::ArtifactRegistry::V1::ArtifactRegistry::Client#list_python_packages. | list_python_packages | ruby | googleapis/google-cloud-ruby | google-cloud-artifact_registry-v1/snippets/artifact_registry/list_python_packages.rb | https://github.com/googleapis/google-cloud-ruby/blob/master/google-cloud-artifact_registry-v1/snippets/artifact_registry/list_python_packages.rb | Apache-2.0 |
def attribute_path project:, location:, attribute:
raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/"
"projects/#{project}/locations/#{location}/attributes/#{attribute}"
end | Create a fully-qualified Attribute resource string.
The resource will be in the following format:
`projects/{project}/locations/{location}/attributes/{attribute}`
@param project [String]
@param location [String]
@param attribute [String]
@return [::String] | attribute_path | ruby | googleapis/google-cloud-ruby | google-cloud-api_hub-v1/lib/google/cloud/api_hub/v1/api_hub_dependencies/paths.rb | https://github.com/googleapis/google-cloud-ruby/blob/master/google-cloud-api_hub-v1/lib/google/cloud/api_hub/v1/api_hub_dependencies/paths.rb | Apache-2.0 |
def dependency_path project:, location:, dependency:
raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/"
"projects/#{project}/locations/#{location}/dependencies/#{dependency}"
end | Create a fully-qualified Dependency resource string.
The resource will be in the following format:
`projects/{project}/locations/{location}/dependencies/{dependency}`
@param project [String]
@param location [String]
@param dependency [String]
@return [::String] | dependency_path | ruby | googleapis/google-cloud-ruby | google-cloud-api_hub-v1/lib/google/cloud/api_hub/v1/api_hub_dependencies/paths.rb | https://github.com/googleapis/google-cloud-ruby/blob/master/google-cloud-api_hub-v1/lib/google/cloud/api_hub/v1/api_hub_dependencies/paths.rb | Apache-2.0 |
def create_data_source
# Create a client object. The client can be reused for multiple calls.
client = Google::Shopping::Merchant::DataSources::V1beta::DataSourcesService::Client.new
# Create a request. To set request fields, pass in keyword arguments.
request = Google::Shopping::Merchant::DataSources::V1beta::CreateDataSourceRequest.new
# Call the create_data_source method.
result = client.create_data_source request
# The returned object is of type Google::Shopping::Merchant::DataSources::V1beta::DataSource.
p result
end | Snippet for the create_data_source call in the DataSourcesService service
This snippet has been automatically generated and should be regarded as a code
template only. It will require modifications to work:
- It may require correct/in-range values for request initialization.
- It may require specifying regional endpoints when creating the service
client as shown in https://cloud.google.com/ruby/docs/reference.
This is an auto-generated example demonstrating basic usage of
Google::Shopping::Merchant::DataSources::V1beta::DataSourcesService::Client#create_data_source. | create_data_source | ruby | googleapis/google-cloud-ruby | google-shopping-merchant-data_sources-v1beta/snippets/data_sources_service/create_data_source.rb | https://github.com/googleapis/google-cloud-ruby/blob/master/google-shopping-merchant-data_sources-v1beta/snippets/data_sources_service/create_data_source.rb | Apache-2.0 |
def update_view
# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Logging::V2::ConfigService::Client.new
# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Logging::V2::UpdateViewRequest.new
# Call the update_view method.
result = client.update_view request
# The returned object is of type Google::Cloud::Logging::V2::LogView.
p result
end | Snippet for the update_view call in the ConfigService service
This snippet has been automatically generated and should be regarded as a code
template only. It will require modifications to work:
- It may require correct/in-range values for request initialization.
- It may require specifying regional endpoints when creating the service
client as shown in https://cloud.google.com/ruby/docs/reference.
This is an auto-generated example demonstrating basic usage of
Google::Cloud::Logging::V2::ConfigService::Client#update_view. | update_view | ruby | googleapis/google-cloud-ruby | google-cloud-logging-v2/snippets/config_service/update_view.rb | https://github.com/googleapis/google-cloud-ruby/blob/master/google-cloud-logging-v2/snippets/config_service/update_view.rb | Apache-2.0 |
def initialize trace_id: nil, is_new: nil, span_id: nil, sampled: nil,
capture_stack: false
@trace_id = trace_id || new_random_trace_id
@is_new = is_new.nil? ? !trace_id : !!is_new
@span_id = span_id&.to_i
@sampled = sampled
if @sampled.nil?
@capture_stack = nil
else
@sampled = !!@sampled
@capture_stack = capture_stack && @sampled
end | Create a new TraceContext instance.
@param [String] trace_id The trace ID as a hex string. If nil or
omitted, a new random Trace ID will be generated, and this
TraceContext will be marked as new.
@param [Boolean] is_new Whether this trace context should be flagged
as newly created. Optional: if unset, will reflect whether a new
trace_id was generated when this object was created.
@param [Integer] span_id The context parent span ID as a 64-bit int.
If nil or omitted, the context will specify no parent span.
@param [Boolean] sampled Whether the context has decided to sample
this trace or not, or nil if the context does not specify a
sampling decision.
@param [Boolean] capture_stack Whether the the context has decided to
capture stack traces. Ignored if sampled is not true.
@example
require "stackdriver/core"
trace_id = "0123456789abcdef0123456789abcdef"
ctx = Stackdriver::Core::TraceContext.new trace_id: trace_id,
sampled: true | initialize | ruby | googleapis/google-cloud-ruby | stackdriver-core/lib/stackdriver/core/trace_context.rb | https://github.com/googleapis/google-cloud-ruby/blob/master/stackdriver-core/lib/stackdriver/core/trace_context.rb | Apache-2.0 |
def sampled?
@sampled
end | Returns `true` if the context wants to sample, `false` if the context
wants explicitly to disable sampling, or `nil` if the context does
not specify.
@return [Boolean, nil] | sampled? | ruby | googleapis/google-cloud-ruby | stackdriver-core/lib/stackdriver/core/trace_context.rb | https://github.com/googleapis/google-cloud-ruby/blob/master/stackdriver-core/lib/stackdriver/core/trace_context.rb | Apache-2.0 |
def capture_stack?
@capture_stack
end | Returns `true` if the context wants to capture stack traces, `false` if
the context does not, or `nil` if the context does not specify a
sampling decision.
@return [Boolean, nil] | capture_stack? | ruby | googleapis/google-cloud-ruby | stackdriver-core/lib/stackdriver/core/trace_context.rb | https://github.com/googleapis/google-cloud-ruby/blob/master/stackdriver-core/lib/stackdriver/core/trace_context.rb | Apache-2.0 |
def new?
@is_new
end | Returns `true` if this trace includes a newly generated trace_id.
@return [Boolean] | new? | ruby | googleapis/google-cloud-ruby | stackdriver-core/lib/stackdriver/core/trace_context.rb | https://github.com/googleapis/google-cloud-ruby/blob/master/stackdriver-core/lib/stackdriver/core/trace_context.rb | Apache-2.0 |
def eql? other
other.is_a?(TraceContext) &&
trace_id == other.trace_id &&
new? == other.new? &&
span_id == other.span_id &&
sampled? == other.sampled? &&
capture_stack? == other.capture_stack?
end | Standard value equality check for this object.
@param [Object] other An object to compare with.
@return [Boolean] | eql? | ruby | googleapis/google-cloud-ruby | stackdriver-core/lib/stackdriver/core/trace_context.rb | https://github.com/googleapis/google-cloud-ruby/blob/master/stackdriver-core/lib/stackdriver/core/trace_context.rb | Apache-2.0 |
def hash
@hash ||= [@trace_id, @is_new, @span_id, @sampled, @capture_stack].hash
end | Generate standard hash code for this object.
@return [Integer] | hash | ruby | googleapis/google-cloud-ruby | stackdriver-core/lib/stackdriver/core/trace_context.rb | https://github.com/googleapis/google-cloud-ruby/blob/master/stackdriver-core/lib/stackdriver/core/trace_context.rb | Apache-2.0 |
def with trace_id: UNCHANGED, is_new: UNCHANGED, span_id: UNCHANGED,
sampled: UNCHANGED, capture_stack: UNCHANGED
trace_id = @trace_id if trace_id == UNCHANGED
is_new = @is_new if is_new == UNCHANGED
span_id = @span_id if span_id == UNCHANGED
sampled = @sampled if sampled == UNCHANGED
capture_stack = @capture_stack if capture_stack == UNCHANGED
TraceContext.new trace_id: trace_id, is_new: is_new, span_id: span_id,
sampled: sampled, capture_stack: capture_stack
end | Returns a new TraceContext instance that is identical to this instance
except for the given changes. All parameters are optional. See
{TraceContext#initialize} for more details on each parameter.
@param [String] trace_id New trace ID.
@param [Boolean] is_new New setting for newness indicator.
@param [Integer] span_id New parent span ID.
@param [Boolean] sampled New sampling decision.
@param [Boolean] capture_stack New stack capture decision.
@return [TraceContext]
@example
require "stackdriver/core"
trace_id = "0123456789abcdef0123456789abcdef"
orig_ctx = Stackdriver::Core::TraceContext.new trace_id: trace_id,
sampled_ctx = orig_ctx.with sampled: true | with | ruby | googleapis/google-cloud-ruby | stackdriver-core/lib/stackdriver/core/trace_context.rb | https://github.com/googleapis/google-cloud-ruby/blob/master/stackdriver-core/lib/stackdriver/core/trace_context.rb | Apache-2.0 |
def to_string
str = trace_id
str += "/#{span_id}" if span_id
unless sampled?.nil?
options = 0
options |= 1 if sampled?
options |= 2 if capture_stack?
str += ";o=#{options}"
end | Returns a string representation of this trace context, in the form
`<traceid>[/<spanid>][;o=<options>]`. This form is suitable for
setting the trace context header.
@return [String] | to_string | ruby | googleapis/google-cloud-ruby | stackdriver-core/lib/stackdriver/core/trace_context.rb | https://github.com/googleapis/google-cloud-ruby/blob/master/stackdriver-core/lib/stackdriver/core/trace_context.rb | Apache-2.0 |
def self.parse_string str
match = %r|^(\w{32})(/(\d+))?(;o=(\d+))?|.match str
return unless match
trace_id = match[1]
span_id = match[3]&.to_i
options = match[5]&.to_i
if options.nil?
sampled = capture_stack = nil
else
sampled = options & 1 != 0
capture_stack = options & 2 != 0
end | Attempts to parse the given string as a trace context representation.
Expects the form `<traceid>[/<spanid>][;o=<options>]`, which is the
form used in the trace context header. Returns either the parsed
trace context, or `nil` if the string was malformed.
@param [String] str The string to parse.
@return [TraceContext, nil]
@example
require "stackdriver/core"
str = "0123456789abcdef0123456789abcdef/12345;o=1"
ctx = Stackdriver::Core::TraceContext.parse_string str | self.parse_string | ruby | googleapis/google-cloud-ruby | stackdriver-core/lib/stackdriver/core/trace_context.rb | https://github.com/googleapis/google-cloud-ruby/blob/master/stackdriver-core/lib/stackdriver/core/trace_context.rb | Apache-2.0 |
def self.parse_rack_env env
trace_context = env[MEMO_RACK_KEY] ||
parse_string(env[HEADER_RACK_KEY].to_s) ||
new
trace_context = yield trace_context, env if block_given?
env[MEMO_RACK_KEY] = trace_context
end | Obtains a TraceContext from the given Rack environment. This should
be used by any service that wants to obtain the TraceContext for a
Rack request. If a new trace context is generated in the process, it
is memoized into the Rack environment so subsequent services will get
the same context.
Specifically, the following steps are attempted in order:
1. Attempts to use any memoized context previously obtained.
2. Attempts to parse the trace context header.
3. Creates a new trace context with a random trace ID.
Furthermore, if a block is given, it is provided with an opportunity
to modify the trace context. The current trace context and the Rack
environment is passed to the block, and its result is used as the
final trace context. The final context is memoized back into the
Rack environment.
@param [Hash] env The Rack environment hash
@return [TraceContext]
@example
require "stackdriver/core"
class MyMiddleware
def initialize app
@app = app
end
def call env
ctx = Stackdriver::Core::TraceContext.parse_rack_env env
do_something_with ctx
@app.call env
end
end | self.parse_rack_env | ruby | googleapis/google-cloud-ruby | stackdriver-core/lib/stackdriver/core/trace_context.rb | https://github.com/googleapis/google-cloud-ruby/blob/master/stackdriver-core/lib/stackdriver/core/trace_context.rb | Apache-2.0 |
def self.set trace_context
Thread.current[THREAD_KEY] = trace_context
trace_context
end | Set the current thread's trace context, and returns the context.
@param [TraceContext, nil] trace_context The trace context to
set for the current thread. May be `nil`.
@return [TraceContext, nil] The context set.
@example
require "stackdriver/core"
ctx = Stackdriver::Core::TraceContext.new
Stackdriver::Core::TraceContext.set ctx
same_ctx = Stackdriver::Core::TraceContext.get | self.set | ruby | googleapis/google-cloud-ruby | stackdriver-core/lib/stackdriver/core/trace_context.rb | https://github.com/googleapis/google-cloud-ruby/blob/master/stackdriver-core/lib/stackdriver/core/trace_context.rb | Apache-2.0 |
def self.get
Thread.current[THREAD_KEY]
end | Returns the current thread's trace context, or `nil` if no trace
context has been set.
@return [TraceContext, nil]
@example
require "stackdriver/core"
ctx = Stackdriver::Core::TraceContext.new
Stackdriver::Core::TraceContext.set ctx
same_ctx = Stackdriver::Core::TraceContext.get | self.get | ruby | googleapis/google-cloud-ruby | stackdriver-core/lib/stackdriver/core/trace_context.rb | https://github.com/googleapis/google-cloud-ruby/blob/master/stackdriver-core/lib/stackdriver/core/trace_context.rb | Apache-2.0 |
def new_random_trace_id
val = rand 0x100000000000000000000000000000000
val &= 0xffffffffffff0fffcfffffffffffffff
val |= 0x00000000000040008000000000000000
format "%032x", val
end | Returns a random trace ID (as a random type 4 UUID).
@private
@return [String] | new_random_trace_id | ruby | googleapis/google-cloud-ruby | stackdriver-core/lib/stackdriver/core/trace_context.rb | https://github.com/googleapis/google-cloud-ruby/blob/master/stackdriver-core/lib/stackdriver/core/trace_context.rb | Apache-2.0 |
def self.configure
@configure ||= begin
namespace = ["Google", "Cloud", "Dialogflow", "V2"]
parent_config = while namespace.any?
parent_name = namespace.join "::"
parent_const = const_get parent_name
break parent_const.configure if parent_const.respond_to? :configure
namespace.pop
end | Configure the EntityTypes Client class.
See {::Google::Cloud::Dialogflow::V2::EntityTypes::Rest::Client::Configuration}
for a description of the configuration fields.
@example
# Modify the configuration for all EntityTypes clients
::Google::Cloud::Dialogflow::V2::EntityTypes::Rest::Client.configure do |config|
config.timeout = 10.0
end
@yield [config] Configure the Client client.
@yieldparam config [Client::Configuration]
@return [Client::Configuration] | self.configure | ruby | googleapis/google-cloud-ruby | google-cloud-dialogflow-v2/lib/google/cloud/dialogflow/v2/entity_types/rest/client.rb | https://github.com/googleapis/google-cloud-ruby/blob/master/google-cloud-dialogflow-v2/lib/google/cloud/dialogflow/v2/entity_types/rest/client.rb | Apache-2.0 |
def configure
yield @config if block_given?
@config
end | Configure the EntityTypes Client instance.
The configuration is set to the derived mode, meaning that values can be changed,
but structural changes (adding new fields, etc.) are not allowed. Structural changes
should be made on {Client.configure}.
See {::Google::Cloud::Dialogflow::V2::EntityTypes::Rest::Client::Configuration}
for a description of the configuration fields.
@yield [config] Configure the Client client.
@yieldparam config [Client::Configuration]
@return [Client::Configuration] | configure | ruby | googleapis/google-cloud-ruby | google-cloud-dialogflow-v2/lib/google/cloud/dialogflow/v2/entity_types/rest/client.rb | https://github.com/googleapis/google-cloud-ruby/blob/master/google-cloud-dialogflow-v2/lib/google/cloud/dialogflow/v2/entity_types/rest/client.rb | Apache-2.0 |
def initialize
# Create the configuration object
@config = Configuration.new Client.configure
# Yield the configuration if needed
yield @config if block_given?
# Create credentials
credentials = @config.credentials
# Use self-signed JWT if the endpoint is unchanged from default,
# but only if the default endpoint does not have a region prefix.
enable_self_signed_jwt = @config.endpoint.nil? ||
(@config.endpoint == Configuration::DEFAULT_ENDPOINT &&
[email protected](".").first.include?("-"))
credentials ||= Credentials.default scope: @config.scope,
enable_self_signed_jwt: enable_self_signed_jwt
if credentials.is_a?(::String) || credentials.is_a?(::Hash)
credentials = Credentials.new credentials, scope: @config.scope
end | Create a new EntityTypes REST client object.
@example
# Create a client using the default configuration
client = ::Google::Cloud::Dialogflow::V2::EntityTypes::Rest::Client.new
# Create a client using a custom configuration
client = ::Google::Cloud::Dialogflow::V2::EntityTypes::Rest::Client.new do |config|
config.timeout = 10.0
end
@yield [config] Configure the EntityTypes client.
@yieldparam config [Client::Configuration] | initialize | ruby | googleapis/google-cloud-ruby | google-cloud-dialogflow-v2/lib/google/cloud/dialogflow/v2/entity_types/rest/client.rb | https://github.com/googleapis/google-cloud-ruby/blob/master/google-cloud-dialogflow-v2/lib/google/cloud/dialogflow/v2/entity_types/rest/client.rb | Apache-2.0 |
def list_entity_types request, options = nil
raise ::ArgumentError, "request must be provided" if request.nil?
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dialogflow::V2::ListEntityTypesRequest
# Converts hash and nil to an options object
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
# Customize the options with defaults
call_metadata = @config.rpcs.list_entity_types.metadata.to_h
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
lib_name: @config.lib_name, lib_version: @config.lib_version,
gapic_version: ::Google::Cloud::Dialogflow::V2::VERSION,
transports_version_send: [:rest]
call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
options.apply_defaults timeout: @config.rpcs.list_entity_types.timeout,
metadata: call_metadata,
retry_policy: @config.rpcs.list_entity_types.retry_policy
options.apply_defaults timeout: @config.timeout,
metadata: @config.metadata,
retry_policy: @config.retry_policy
@entity_types_stub.list_entity_types request, options do |result, operation|
result = ::Gapic::Rest::PagedEnumerable.new @entity_types_stub, :list_entity_types, "entity_types", request, result, options
yield result, operation if block_given?
throw :response, result
end | Service calls
Returns the list of all entity types in the specified agent.
@overload list_entity_types(request, options = nil)
Pass arguments to `list_entity_types` via a request object, either of type
{::Google::Cloud::Dialogflow::V2::ListEntityTypesRequest} or an equivalent Hash.
@param request [::Google::Cloud::Dialogflow::V2::ListEntityTypesRequest, ::Hash]
A request object representing the call parameters. Required. To specify no
parameters, or to keep all the default parameter values, pass an empty Hash.
@param options [::Gapic::CallOptions, ::Hash]
Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
@overload list_entity_types(parent: nil, language_code: nil, page_size: nil, page_token: nil)
Pass arguments to `list_entity_types` via keyword arguments. Note that at
least one keyword argument is required. To specify no parameters, or to keep all
the default parameter values, pass an empty Hash as a request object (see above).
@param parent [::String]
Required. The agent to list all entity types from.
Format: `projects/<Project ID>/agent`.
@param language_code [::String]
Optional. The language used to access language-specific data.
If not specified, the agent's default language is used.
For more information, see
[Multilingual intent and entity
data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity).
@param page_size [::Integer]
Optional. The maximum number of items to return in a single page. By
default 100 and at most 1000.
@param page_token [::String]
Optional. The next_page_token value returned from a previous list request.
@yield [result, operation] Access the result along with the TransportOperation object
@yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Dialogflow::V2::EntityType>]
@yieldparam operation [::Gapic::Rest::TransportOperation]
@return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Dialogflow::V2::EntityType>]
@raise [::Google::Cloud::Error] if the REST call is aborted.
@example Basic example
require "google/cloud/dialogflow/v2"
# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Dialogflow::V2::EntityTypes::Rest::Client.new
# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Dialogflow::V2::ListEntityTypesRequest.new
# Call the list_entity_types method.
result = client.list_entity_types request
# The returned object is of type Gapic::PagedEnumerable. You can iterate
# over elements, and API calls will be issued to fetch pages as needed.
result.each do |item|
# Each element is of type ::Google::Cloud::Dialogflow::V2::EntityType.
p item
end | list_entity_types | ruby | googleapis/google-cloud-ruby | google-cloud-dialogflow-v2/lib/google/cloud/dialogflow/v2/entity_types/rest/client.rb | https://github.com/googleapis/google-cloud-ruby/blob/master/google-cloud-dialogflow-v2/lib/google/cloud/dialogflow/v2/entity_types/rest/client.rb | Apache-2.0 |
def get_entity_type request, options = nil
raise ::ArgumentError, "request must be provided" if request.nil?
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dialogflow::V2::GetEntityTypeRequest
# Converts hash and nil to an options object
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
# Customize the options with defaults
call_metadata = @config.rpcs.get_entity_type.metadata.to_h
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
lib_name: @config.lib_name, lib_version: @config.lib_version,
gapic_version: ::Google::Cloud::Dialogflow::V2::VERSION,
transports_version_send: [:rest]
call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
options.apply_defaults timeout: @config.rpcs.get_entity_type.timeout,
metadata: call_metadata,
retry_policy: @config.rpcs.get_entity_type.retry_policy
options.apply_defaults timeout: @config.timeout,
metadata: @config.metadata,
retry_policy: @config.retry_policy
@entity_types_stub.get_entity_type request, options do |result, operation|
yield result, operation if block_given?
end | Retrieves the specified entity type.
@overload get_entity_type(request, options = nil)
Pass arguments to `get_entity_type` via a request object, either of type
{::Google::Cloud::Dialogflow::V2::GetEntityTypeRequest} or an equivalent Hash.
@param request [::Google::Cloud::Dialogflow::V2::GetEntityTypeRequest, ::Hash]
A request object representing the call parameters. Required. To specify no
parameters, or to keep all the default parameter values, pass an empty Hash.
@param options [::Gapic::CallOptions, ::Hash]
Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
@overload get_entity_type(name: nil, language_code: nil)
Pass arguments to `get_entity_type` via keyword arguments. Note that at
least one keyword argument is required. To specify no parameters, or to keep all
the default parameter values, pass an empty Hash as a request object (see above).
@param name [::String]
Required. The name of the entity type.
Format: `projects/<Project ID>/agent/entityTypes/<EntityType ID>`.
@param language_code [::String]
Optional. The language used to access language-specific data.
If not specified, the agent's default language is used.
For more information, see
[Multilingual intent and entity
data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity).
@yield [result, operation] Access the result along with the TransportOperation object
@yieldparam result [::Google::Cloud::Dialogflow::V2::EntityType]
@yieldparam operation [::Gapic::Rest::TransportOperation]
@return [::Google::Cloud::Dialogflow::V2::EntityType]
@raise [::Google::Cloud::Error] if the REST call is aborted.
@example Basic example
require "google/cloud/dialogflow/v2"
# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Dialogflow::V2::EntityTypes::Rest::Client.new
# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Dialogflow::V2::GetEntityTypeRequest.new
# Call the get_entity_type method.
result = client.get_entity_type request
# The returned object is of type Google::Cloud::Dialogflow::V2::EntityType.
p result | get_entity_type | ruby | googleapis/google-cloud-ruby | google-cloud-dialogflow-v2/lib/google/cloud/dialogflow/v2/entity_types/rest/client.rb | https://github.com/googleapis/google-cloud-ruby/blob/master/google-cloud-dialogflow-v2/lib/google/cloud/dialogflow/v2/entity_types/rest/client.rb | Apache-2.0 |
def create_entity_type request, options = nil
raise ::ArgumentError, "request must be provided" if request.nil?
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dialogflow::V2::CreateEntityTypeRequest
# Converts hash and nil to an options object
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
# Customize the options with defaults
call_metadata = @config.rpcs.create_entity_type.metadata.to_h
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
lib_name: @config.lib_name, lib_version: @config.lib_version,
gapic_version: ::Google::Cloud::Dialogflow::V2::VERSION,
transports_version_send: [:rest]
call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
options.apply_defaults timeout: @config.rpcs.create_entity_type.timeout,
metadata: call_metadata,
retry_policy: @config.rpcs.create_entity_type.retry_policy
options.apply_defaults timeout: @config.timeout,
metadata: @config.metadata,
retry_policy: @config.retry_policy
@entity_types_stub.create_entity_type request, options do |result, operation|
yield result, operation if block_given?
end | Creates an entity type in the specified agent.
Note: You should always train an agent prior to sending it queries. See the
[training
documentation](https://cloud.google.com/dialogflow/es/docs/training).
@overload create_entity_type(request, options = nil)
Pass arguments to `create_entity_type` via a request object, either of type
{::Google::Cloud::Dialogflow::V2::CreateEntityTypeRequest} or an equivalent Hash.
@param request [::Google::Cloud::Dialogflow::V2::CreateEntityTypeRequest, ::Hash]
A request object representing the call parameters. Required. To specify no
parameters, or to keep all the default parameter values, pass an empty Hash.
@param options [::Gapic::CallOptions, ::Hash]
Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
@overload create_entity_type(parent: nil, entity_type: nil, language_code: nil)
Pass arguments to `create_entity_type` via keyword arguments. Note that at
least one keyword argument is required. To specify no parameters, or to keep all
the default parameter values, pass an empty Hash as a request object (see above).
@param parent [::String]
Required. The agent to create a entity type for.
Format: `projects/<Project ID>/agent`.
@param entity_type [::Google::Cloud::Dialogflow::V2::EntityType, ::Hash]
Required. The entity type to create.
@param language_code [::String]
Optional. The language used to access language-specific data.
If not specified, the agent's default language is used.
For more information, see
[Multilingual intent and entity
data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity).
@yield [result, operation] Access the result along with the TransportOperation object
@yieldparam result [::Google::Cloud::Dialogflow::V2::EntityType]
@yieldparam operation [::Gapic::Rest::TransportOperation]
@return [::Google::Cloud::Dialogflow::V2::EntityType]
@raise [::Google::Cloud::Error] if the REST call is aborted.
@example Basic example
require "google/cloud/dialogflow/v2"
# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Dialogflow::V2::EntityTypes::Rest::Client.new
# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Dialogflow::V2::CreateEntityTypeRequest.new
# Call the create_entity_type method.
result = client.create_entity_type request
# The returned object is of type Google::Cloud::Dialogflow::V2::EntityType.
p result | create_entity_type | ruby | googleapis/google-cloud-ruby | google-cloud-dialogflow-v2/lib/google/cloud/dialogflow/v2/entity_types/rest/client.rb | https://github.com/googleapis/google-cloud-ruby/blob/master/google-cloud-dialogflow-v2/lib/google/cloud/dialogflow/v2/entity_types/rest/client.rb | Apache-2.0 |
Ruby CodeSearchNet–Filtered
Filtered to remove files from repositories appearing in the CodeSearchNet test split, deduplicated on identical docstring or code.
📘 Dataset Description
This dataset contains Ruby functions and their documentation comments (docstring
) extracted from public GitHub repositories. Each function is paired with metadata such as the repository name, file path, original license, and GitHub URL.
Only code licensed under the following OSI-approved permissive licenses was included:
- MIT
- Apache License 2.0
- BSD 2-Clause
- BSD 3-Clause
- ISC
These licenses permit reuse and redistribution (including commercial use) provided that proper attribution and license terms are preserved.
📄 Licensing and Legal Notice
All code snippets in this dataset were collected from public GitHub repositories that explicitly declare their licenses as one of the following: MIT, Apache-2.0, BSD-2-Clause, BSD-3-Clause, or ISC.
To comply with license terms:
- Each sample retains its license type in the
license
field. - Repository names and GitHub URLs are included to allow proper attribution.
- License texts are available in the
LICENSES/
directory. - No code from repositories lacking a license or using GPL-style licenses was included.
⚠️ Disclaimer: While care has been taken to ensure license compliance, users are responsible for verifying license terms and ensuring proper attribution when using this dataset in downstream applications.
Splits
- train: 159,650 examples
- validation: 1,519 examples
- test: 2,749 examples
Total: 163,918 examples
- Downloads last month
- 81