Service Directory V1 API - Class Google::Cloud::ServiceDirectory::V1::RegistrationService::Rest::Client (v0.9.0)

Reference documentation and code samples for the Service Directory V1 API class Google::Cloud::ServiceDirectory::V1::RegistrationService::Rest::Client.

REST client for the RegistrationService service.

Service Directory API for registering services. It defines the following resource model:

  • The API has a collection of Namespace resources, named projects//locations//namespaces/.

  • Each Namespace has a collection of Service resources, named projects//locations//namespaces//services/.

  • Each Service has a collection of Endpoint resources, named projects//locations//namespaces//services//endpoints/.

Inherits

  • Object

Methods

.configure

def self.configure() { |config| ... } -> Client::Configuration

Configure the RegistrationService Client class.

See Configuration for a description of the configuration fields.

Yields
  • (config) — Configure the Client client.
Yield Parameter
Example
# Modify the configuration for all RegistrationService clients
::Google::Cloud::ServiceDirectory::V1::RegistrationService::Rest::Client.configure do |config|
  config.timeout = 10.0
end

#configure

def configure() { |config| ... } -> Client::Configuration

Configure the RegistrationService 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 Configuration for a description of the configuration fields.

Yields
  • (config) — Configure the Client client.
Yield Parameter

#create_endpoint

def create_endpoint(request, options = nil) -> ::Google::Cloud::ServiceDirectory::V1::Endpoint
def create_endpoint(parent: nil, endpoint_id: nil, endpoint: nil) -> ::Google::Cloud::ServiceDirectory::V1::Endpoint

Creates an endpoint, and returns the new endpoint.

Overloads
def create_endpoint(request, options = nil) -> ::Google::Cloud::ServiceDirectory::V1::Endpoint
Pass arguments to create_endpoint via a request object, either of type CreateEndpointRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::ServiceDirectory::V1::CreateEndpointRequest, ::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.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
def create_endpoint(parent: nil, endpoint_id: nil, endpoint: nil) -> ::Google::Cloud::ServiceDirectory::V1::Endpoint
Pass arguments to create_endpoint 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).
Parameters
  • parent (::String) — Required. The resource name of the service that this endpoint provides.
  • endpoint_id (::String) — Required. The Resource ID must be 1-63 characters long, and comply with RFC1035. Specifically, the name must be 1-63 characters long and match the regular expression [a-z](?:[-a-z0-9]{0,61}[a-z0-9])? which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash.
  • endpoint (::Google::Cloud::ServiceDirectory::V1::Endpoint, ::Hash) — Required. A endpoint with initial fields set.
Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.
Example

Basic example

require "google/cloud/service_directory/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::ServiceDirectory::V1::RegistrationService::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::ServiceDirectory::V1::CreateEndpointRequest.new

# Call the create_endpoint method.
result = client.create_endpoint request

# The returned object is of type Google::Cloud::ServiceDirectory::V1::Endpoint.
p result

#create_namespace

def create_namespace(request, options = nil) -> ::Google::Cloud::ServiceDirectory::V1::Namespace
def create_namespace(parent: nil, namespace_id: nil, namespace: nil) -> ::Google::Cloud::ServiceDirectory::V1::Namespace

Creates a namespace, and returns the new namespace.

Overloads
def create_namespace(request, options = nil) -> ::Google::Cloud::ServiceDirectory::V1::Namespace
Pass arguments to create_namespace via a request object, either of type CreateNamespaceRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::ServiceDirectory::V1::CreateNamespaceRequest, ::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.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
def create_namespace(parent: nil, namespace_id: nil, namespace: nil) -> ::Google::Cloud::ServiceDirectory::V1::Namespace
Pass arguments to create_namespace 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).
Parameters
  • parent (::String) — Required. The resource name of the project and location the namespace will be created in.
  • namespace_id (::String) — Required. The Resource ID must be 1-63 characters long, and comply with RFC1035. Specifically, the name must be 1-63 characters long and match the regular expression [a-z](?:[-a-z0-9]{0,61}[a-z0-9])? which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash.
  • namespace (::Google::Cloud::ServiceDirectory::V1::Namespace, ::Hash) — Required. A namespace with initial fields set.
Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.
Example

Basic example

require "google/cloud/service_directory/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::ServiceDirectory::V1::RegistrationService::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::ServiceDirectory::V1::CreateNamespaceRequest.new

# Call the create_namespace method.
result = client.create_namespace request

# The returned object is of type Google::Cloud::ServiceDirectory::V1::Namespace.
p result

#create_service

def create_service(request, options = nil) -> ::Google::Cloud::ServiceDirectory::V1::Service
def create_service(parent: nil, service_id: nil, service: nil) -> ::Google::Cloud::ServiceDirectory::V1::Service

Creates a service, and returns the new service.

Overloads
def create_service(request, options = nil) -> ::Google::Cloud::ServiceDirectory::V1::Service
Pass arguments to create_service via a request object, either of type CreateServiceRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::ServiceDirectory::V1::CreateServiceRequest, ::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.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
def create_service(parent: nil, service_id: nil, service: nil) -> ::Google::Cloud::ServiceDirectory::V1::Service
Pass arguments to create_service 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).
Parameters
  • parent (::String) — Required. The resource name of the namespace this service will belong to.
  • service_id (::String) — Required. The Resource ID must be 1-63 characters long, and comply with RFC1035. Specifically, the name must be 1-63 characters long and match the regular expression [a-z](?:[-a-z0-9]{0,61}[a-z0-9])? which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash.
  • service (::Google::Cloud::ServiceDirectory::V1::Service, ::Hash) — Required. A service with initial fields set.
Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.
Example

Basic example

require "google/cloud/service_directory/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::ServiceDirectory::V1::RegistrationService::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::ServiceDirectory::V1::CreateServiceRequest.new

# Call the create_service method.
result = client.create_service request

# The returned object is of type Google::Cloud::ServiceDirectory::V1::Service.
p result

#delete_endpoint

def delete_endpoint(request, options = nil) -> ::Google::Protobuf::Empty
def delete_endpoint(name: nil) -> ::Google::Protobuf::Empty

Deletes an endpoint.

Overloads
def delete_endpoint(request, options = nil) -> ::Google::Protobuf::Empty
Pass arguments to delete_endpoint via a request object, either of type DeleteEndpointRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::ServiceDirectory::V1::DeleteEndpointRequest, ::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.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
def delete_endpoint(name: nil) -> ::Google::Protobuf::Empty
Pass arguments to delete_endpoint 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).
Parameter
  • name (::String) — Required. The name of the endpoint to delete.
Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.
Example

Basic example

require "google/cloud/service_directory/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::ServiceDirectory::V1::RegistrationService::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::ServiceDirectory::V1::DeleteEndpointRequest.new

# Call the delete_endpoint method.
result = client.delete_endpoint request

# The returned object is of type Google::Protobuf::Empty.
p result

#delete_namespace

def delete_namespace(request, options = nil) -> ::Google::Protobuf::Empty
def delete_namespace(name: nil) -> ::Google::Protobuf::Empty

Deletes a namespace. This also deletes all services and endpoints in the namespace.

Overloads
def delete_namespace(request, options = nil) -> ::Google::Protobuf::Empty
Pass arguments to delete_namespace via a request object, either of type DeleteNamespaceRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::ServiceDirectory::V1::DeleteNamespaceRequest, ::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.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
def delete_namespace(name: nil) -> ::Google::Protobuf::Empty
Pass arguments to delete_namespace 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).
Parameter
  • name (::String) — Required. The name of the namespace to delete.
Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.
Example

Basic example

require "google/cloud/service_directory/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::ServiceDirectory::V1::RegistrationService::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::ServiceDirectory::V1::DeleteNamespaceRequest.new

# Call the delete_namespace method.
result = client.delete_namespace request

# The returned object is of type Google::Protobuf::Empty.
p result

#delete_service

def delete_service(request, options = nil) -> ::Google::Protobuf::Empty
def delete_service(name: nil) -> ::Google::Protobuf::Empty

Deletes a service. This also deletes all endpoints associated with the service.

Overloads
def delete_service(request, options = nil) -> ::Google::Protobuf::Empty
Pass arguments to delete_service via a request object, either of type DeleteServiceRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::ServiceDirectory::V1::DeleteServiceRequest, ::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.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
def delete_service(name: nil) -> ::Google::Protobuf::Empty
Pass arguments to delete_service 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).
Parameter
  • name (::String) — Required. The name of the service to delete.
Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.
Example

Basic example

require "google/cloud/service_directory/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::ServiceDirectory::V1::RegistrationService::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::ServiceDirectory::V1::DeleteServiceRequest.new

# Call the delete_service method.
result = client.delete_service request

# The returned object is of type Google::Protobuf::Empty.
p result

#get_endpoint

def get_endpoint(request, options = nil) -> ::Google::Cloud::ServiceDirectory::V1::Endpoint
def get_endpoint(name: nil) -> ::Google::Cloud::ServiceDirectory::V1::Endpoint

Gets an endpoint.

Overloads
def get_endpoint(request, options = nil) -> ::Google::Cloud::ServiceDirectory::V1::Endpoint
Pass arguments to get_endpoint via a request object, either of type GetEndpointRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::ServiceDirectory::V1::GetEndpointRequest, ::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.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
def get_endpoint(name: nil) -> ::Google::Cloud::ServiceDirectory::V1::Endpoint
Pass arguments to get_endpoint 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).
Parameter
  • name (::String) — Required. The name of the endpoint to get.
Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.
Example

Basic example

require "google/cloud/service_directory/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::ServiceDirectory::V1::RegistrationService::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::ServiceDirectory::V1::GetEndpointRequest.new

# Call the get_endpoint method.
result = client.get_endpoint request

# The returned object is of type Google::Cloud::ServiceDirectory::V1::Endpoint.
p result

#get_iam_policy

def get_iam_policy(request, options = nil) -> ::Google::Iam::V1::Policy
def get_iam_policy(resource: nil, options: nil) -> ::Google::Iam::V1::Policy

Gets the IAM Policy for a resource (namespace or service only).

Overloads
def get_iam_policy(request, options = nil) -> ::Google::Iam::V1::Policy
Pass arguments to get_iam_policy via a request object, either of type Iam::V1::GetIamPolicyRequest or an equivalent Hash.
Parameters
  • request (::Google::Iam::V1::GetIamPolicyRequest, ::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.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
def get_iam_policy(resource: nil, options: nil) -> ::Google::Iam::V1::Policy
Pass arguments to get_iam_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).
Parameters
  • resource (::String) — REQUIRED: The resource for which the policy is being requested. See the operation documentation for the appropriate value for this field.
  • options (::Google::Iam::V1::GetPolicyOptions, ::Hash) — OPTIONAL: A GetPolicyOptions object for specifying options to GetIamPolicy.
Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.
Example

Basic example

require "google/cloud/service_directory/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::ServiceDirectory::V1::RegistrationService::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Iam::V1::GetIamPolicyRequest.new

# Call the get_iam_policy method.
result = client.get_iam_policy request

# The returned object is of type Google::Iam::V1::Policy.
p result

#get_namespace

def get_namespace(request, options = nil) -> ::Google::Cloud::ServiceDirectory::V1::Namespace
def get_namespace(name: nil) -> ::Google::Cloud::ServiceDirectory::V1::Namespace

Gets a namespace.

Overloads
def get_namespace(request, options = nil) -> ::Google::Cloud::ServiceDirectory::V1::Namespace
Pass arguments to get_namespace via a request object, either of type GetNamespaceRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::ServiceDirectory::V1::GetNamespaceRequest, ::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.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
def get_namespace(name: nil) -> ::Google::Cloud::ServiceDirectory::V1::Namespace
Pass arguments to get_namespace 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).
Parameter
  • name (::String) — Required. The name of the namespace to retrieve.
Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.
Example

Basic example

require "google/cloud/service_directory/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::ServiceDirectory::V1::RegistrationService::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::ServiceDirectory::V1::GetNamespaceRequest.new

# Call the get_namespace method.
result = client.get_namespace request

# The returned object is of type Google::Cloud::ServiceDirectory::V1::Namespace.
p result

#get_service

def get_service(request, options = nil) -> ::Google::Cloud::ServiceDirectory::V1::Service
def get_service(name: nil) -> ::Google::Cloud::ServiceDirectory::V1::Service

Gets a service.

Overloads
def get_service(request, options = nil) -> ::Google::Cloud::ServiceDirectory::V1::Service
Pass arguments to get_service via a request object, either of type GetServiceRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::ServiceDirectory::V1::GetServiceRequest, ::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.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
def get_service(name: nil) -> ::Google::Cloud::ServiceDirectory::V1::Service
Pass arguments to get_service 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).
Parameter
  • name (::String) — Required. The name of the service to get.
Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.
Example

Basic example

require "google/cloud/service_directory/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::ServiceDirectory::V1::RegistrationService::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::ServiceDirectory::V1::GetServiceRequest.new

# Call the get_service method.
result = client.get_service request

# The returned object is of type Google::Cloud::ServiceDirectory::V1::Service.
p result

#initialize

def initialize() { |config| ... } -> Client

Create a new RegistrationService REST client object.

Yields
  • (config) — Configure the RegistrationService client.
Yield Parameter
Returns
  • (Client) — a new instance of Client
Example
# Create a client using the default configuration
client = ::Google::Cloud::ServiceDirectory::V1::RegistrationService::Rest::Client.new

# Create a client using a custom configuration
client = ::Google::Cloud::ServiceDirectory::V1::RegistrationService::Rest::Client.new do |config|
  config.timeout = 10.0
end

#list_endpoints

def list_endpoints(request, options = nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Cloud::ServiceDirectory::V1::Endpoint>
def list_endpoints(parent: nil, page_size: nil, page_token: nil, filter: nil, order_by: nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Cloud::ServiceDirectory::V1::Endpoint>

Lists all endpoints.

Overloads
def list_endpoints(request, options = nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Cloud::ServiceDirectory::V1::Endpoint>
Pass arguments to list_endpoints via a request object, either of type ListEndpointsRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::ServiceDirectory::V1::ListEndpointsRequest, ::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.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
def list_endpoints(parent: nil, page_size: nil, page_token: nil, filter: nil, order_by: nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Cloud::ServiceDirectory::V1::Endpoint>
Pass arguments to list_endpoints 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).
Parameters
  • parent (::String) — Required. The resource name of the service whose endpoints you'd like to list.
  • page_size (::Integer) — Optional. The maximum number of items to return.
  • page_token (::String) — Optional. The next_page_token value returned from a previous List request, if any.
  • filter (::String) — Optional. The filter to list results by.

    General filter string syntax: <field> <operator> <value> (<logical connector>)

    • <field> can be name, address, port, or annotations.<key> for map field
    • <operator> can be <, >, <=, >=, !=, =, :. Of which : means HAS, and is roughly the same as =
    • <value> must be the same data type as field
    • <logical connector> can be AND, OR, NOT

    Examples of valid filters:

    • annotations.owner returns endpoints that have a annotation with the key owner, this is the same as annotations:owner
    • annotations.protocol=gRPC returns endpoints that have key/value protocol=gRPC
    • address=192.108.1.105 returns endpoints that have this address
    • port>8080 returns endpoints that have port number larger than 8080 * name>projects/my-project/locations/us-east1/namespaces/my-namespace/services/my-service/endpoints/endpoint-c returns endpoints that have name that is alphabetically later than the string, so "endpoint-e" is returned but "endpoint-a" is not
    • annotations.owner!=sd AND annotations.foo=bar returns endpoints that have owner in annotation key but value is not sd AND have key/value foo=bar
    • doesnotexist.foo=bar returns an empty list. Note that endpoint doesn't have a field called "doesnotexist". Since the filter does not match any endpoints, it returns no results

    For more information about filtering, see API Filtering.

  • order_by (::String) — Optional. The order to list results by.

    General order_by string syntax: <field> (<asc|desc>) (,)

    • <field> allows values: name, address, port
    • <asc|desc> ascending or descending order by <field>. If this is left blank, asc is used

    Note that an empty order_by string results in default order, which is order by name in ascending order.

Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
Returns
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.
Example

Basic example

require "google/cloud/service_directory/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::ServiceDirectory::V1::RegistrationService::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::ServiceDirectory::V1::ListEndpointsRequest.new

# Call the list_endpoints method.
result = client.list_endpoints 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::ServiceDirectory::V1::Endpoint.
  p item
end

#list_namespaces

def list_namespaces(request, options = nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Cloud::ServiceDirectory::V1::Namespace>
def list_namespaces(parent: nil, page_size: nil, page_token: nil, filter: nil, order_by: nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Cloud::ServiceDirectory::V1::Namespace>

Lists all namespaces.

Overloads
def list_namespaces(request, options = nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Cloud::ServiceDirectory::V1::Namespace>
Pass arguments to list_namespaces via a request object, either of type ListNamespacesRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::ServiceDirectory::V1::ListNamespacesRequest, ::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.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
def list_namespaces(parent: nil, page_size: nil, page_token: nil, filter: nil, order_by: nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Cloud::ServiceDirectory::V1::Namespace>
Pass arguments to list_namespaces 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).
Parameters
  • parent (::String) — Required. The resource name of the project and location whose namespaces you'd like to list.
  • page_size (::Integer) — Optional. The maximum number of items to return.
  • page_token (::String) — Optional. The next_page_token value returned from a previous List request, if any.
  • filter (::String) — Optional. The filter to list results by.

    General filter string syntax: <field> <operator> <value> (<logical connector>)

    • <field> can be name or labels.<key> for map field
    • <operator> can be <, >, <=, >=, !=, =, :. Of which : means HAS, and is roughly the same as =
    • <value> must be the same data type as field
    • <logical connector> can be AND, OR, NOT

    Examples of valid filters:

    • labels.owner returns namespaces that have a label with the key owner, this is the same as labels:owner
    • labels.owner=sd returns namespaces that have key/value owner=sd
    • name>projects/my-project/locations/us-east1/namespaces/namespace-c returns namespaces that have name that is alphabetically later than the string, so "namespace-e" is returned but "namespace-a" is not
    • labels.owner!=sd AND labels.foo=bar returns namespaces that have owner in label key but value is not sd AND have key/value foo=bar
    • doesnotexist.foo=bar returns an empty list. Note that namespace doesn't have a field called "doesnotexist". Since the filter does not match any namespaces, it returns no results

    For more information about filtering, see API Filtering.

  • order_by (::String) — Optional. The order to list results by.

    General order_by string syntax: <field> (<asc|desc>) (,)

    • <field> allows value: name
    • <asc|desc> ascending or descending order by <field>. If this is left blank, asc is used

    Note that an empty order_by string results in default order, which is order by name in ascending order.

Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
Returns
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.
Example

Basic example

require "google/cloud/service_directory/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::ServiceDirectory::V1::RegistrationService::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::ServiceDirectory::V1::ListNamespacesRequest.new

# Call the list_namespaces method.
result = client.list_namespaces 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::ServiceDirectory::V1::Namespace.
  p item
end

#list_services

def list_services(request, options = nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Cloud::ServiceDirectory::V1::Service>
def list_services(parent: nil, page_size: nil, page_token: nil, filter: nil, order_by: nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Cloud::ServiceDirectory::V1::Service>

Lists all services belonging to a namespace.

Overloads
def list_services(request, options = nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Cloud::ServiceDirectory::V1::Service>
Pass arguments to list_services via a request object, either of type ListServicesRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::ServiceDirectory::V1::ListServicesRequest, ::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.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
def list_services(parent: nil, page_size: nil, page_token: nil, filter: nil, order_by: nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Cloud::ServiceDirectory::V1::Service>
Pass arguments to list_services 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).
Parameters
  • parent (::String) — Required. The resource name of the namespace whose services you'd like to list.
  • page_size (::Integer) — Optional. The maximum number of items to return.
  • page_token (::String) — Optional. The next_page_token value returned from a previous List request, if any.
  • filter (::String) — Optional. The filter to list results by.

    General filter string syntax: <field> <operator> <value> (<logical connector>)

    • <field> can be name or annotations.<key> for map field
    • <operator> can be <, >, <=, >=, !=, =, :. Of which : means HAS, and is roughly the same as =
    • <value> must be the same data type as field
    • <logical connector> can be AND, OR, NOT

    Examples of valid filters:

    • annotations.owner returns services that have a annotation with the key owner, this is the same as annotations:owner
    • annotations.protocol=gRPC returns services that have key/value protocol=gRPC * name>projects/my-project/locations/us-east1/namespaces/my-namespace/services/service-c returns services that have name that is alphabetically later than the string, so "service-e" is returned but "service-a" is not
    • annotations.owner!=sd AND annotations.foo=bar returns services that have owner in annotation key but value is not sd AND have key/value foo=bar
    • doesnotexist.foo=bar returns an empty list. Note that service doesn't have a field called "doesnotexist". Since the filter does not match any services, it returns no results

    For more information about filtering, see API Filtering.

  • order_by (::String) — Optional. The order to list results by.

    General order_by string syntax: <field> (<asc|desc>) (,)

    • <field> allows value: name
    • <asc|desc> ascending or descending order by <field>. If this is left blank, asc is used

    Note that an empty order_by string results in default order, which is order by name in ascending order.

Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
Returns
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.
Example

Basic example

require "google/cloud/service_directory/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::ServiceDirectory::V1::RegistrationService::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::ServiceDirectory::V1::ListServicesRequest.new

# Call the list_services method.
result = client.list_services 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::ServiceDirectory::V1::Service.
  p item
end

#location_client

def location_client() -> Google::Cloud::Location::Locations::Rest::Client

Get the associated client for mix-in of the Locations.

Returns
  • (Google::Cloud::Location::Locations::Rest::Client)

#set_iam_policy

def set_iam_policy(request, options = nil) -> ::Google::Iam::V1::Policy
def set_iam_policy(resource: nil, policy: nil, update_mask: nil) -> ::Google::Iam::V1::Policy

Sets the IAM Policy for a resource (namespace or service only).

Overloads
def set_iam_policy(request, options = nil) -> ::Google::Iam::V1::Policy
Pass arguments to set_iam_policy via a request object, either of type Iam::V1::SetIamPolicyRequest or an equivalent Hash.
Parameters
  • request (::Google::Iam::V1::SetIamPolicyRequest, ::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.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
def set_iam_policy(resource: nil, policy: nil, update_mask: nil) -> ::Google::Iam::V1::Policy
Pass arguments to set_iam_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).
Parameters
  • resource (::String) — REQUIRED: The resource for which the policy is being specified. See the operation documentation for the appropriate value for this field.
  • policy (::Google::Iam::V1::Policy, ::Hash) — REQUIRED: The complete policy to be applied to the resource. The size of the policy is limited to a few 10s of KB. An empty policy is a valid policy but certain Cloud Platform services (such as Projects) might reject them.
  • update_mask (::Google::Protobuf::FieldMask, ::Hash) — OPTIONAL: A FieldMask specifying which fields of the policy to modify. Only the fields in the mask will be modified. If no mask is provided, the following default mask is used:

    paths: "bindings, etag"

Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.
Example

Basic example

require "google/cloud/service_directory/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::ServiceDirectory::V1::RegistrationService::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Iam::V1::SetIamPolicyRequest.new

# Call the set_iam_policy method.
result = client.set_iam_policy request

# The returned object is of type Google::Iam::V1::Policy.
p result

#test_iam_permissions

def test_iam_permissions(request, options = nil) -> ::Google::Iam::V1::TestIamPermissionsResponse
def test_iam_permissions(resource: nil, permissions: nil) -> ::Google::Iam::V1::TestIamPermissionsResponse

Tests IAM permissions for a resource (namespace or service only).

Overloads
def test_iam_permissions(request, options = nil) -> ::Google::Iam::V1::TestIamPermissionsResponse
Pass arguments to test_iam_permissions via a request object, either of type Iam::V1::TestIamPermissionsRequest or an equivalent Hash.
Parameters
  • request (::Google::Iam::V1::TestIamPermissionsRequest, ::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.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
def test_iam_permissions(resource: nil, permissions: nil) -> ::Google::Iam::V1::TestIamPermissionsResponse
Pass arguments to test_iam_permissions 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).
Parameters
  • resource (::String) — REQUIRED: The resource for which the policy detail is being requested. See the operation documentation for the appropriate value for this field.
  • permissions (::Array<::String>) — The set of permissions to check for the resource. Permissions with wildcards (such as '' or 'storage.') are not allowed. For more information see IAM Overview.
Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.
Example

Basic example

require "google/cloud/service_directory/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::ServiceDirectory::V1::RegistrationService::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Iam::V1::TestIamPermissionsRequest.new

# Call the test_iam_permissions method.
result = client.test_iam_permissions request

# The returned object is of type Google::Iam::V1::TestIamPermissionsResponse.
p result

#update_endpoint

def update_endpoint(request, options = nil) -> ::Google::Cloud::ServiceDirectory::V1::Endpoint
def update_endpoint(endpoint: nil, update_mask: nil) -> ::Google::Cloud::ServiceDirectory::V1::Endpoint

Updates an endpoint.

Overloads
def update_endpoint(request, options = nil) -> ::Google::Cloud::ServiceDirectory::V1::Endpoint
Pass arguments to update_endpoint via a request object, either of type UpdateEndpointRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::ServiceDirectory::V1::UpdateEndpointRequest, ::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.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
def update_endpoint(endpoint: nil, update_mask: nil) -> ::Google::Cloud::ServiceDirectory::V1::Endpoint
Pass arguments to update_endpoint 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).
Parameters
Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.
Example

Basic example

require "google/cloud/service_directory/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::ServiceDirectory::V1::RegistrationService::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::ServiceDirectory::V1::UpdateEndpointRequest.new

# Call the update_endpoint method.
result = client.update_endpoint request

# The returned object is of type Google::Cloud::ServiceDirectory::V1::Endpoint.
p result

#update_namespace

def update_namespace(request, options = nil) -> ::Google::Cloud::ServiceDirectory::V1::Namespace
def update_namespace(namespace: nil, update_mask: nil) -> ::Google::Cloud::ServiceDirectory::V1::Namespace

Updates a namespace.

Overloads
def update_namespace(request, options = nil) -> ::Google::Cloud::ServiceDirectory::V1::Namespace
Pass arguments to update_namespace via a request object, either of type UpdateNamespaceRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::ServiceDirectory::V1::UpdateNamespaceRequest, ::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.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
def update_namespace(namespace: nil, update_mask: nil) -> ::Google::Cloud::ServiceDirectory::V1::Namespace
Pass arguments to update_namespace 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).
Parameters
Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.
Example

Basic example

require "google/cloud/service_directory/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::ServiceDirectory::V1::RegistrationService::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::ServiceDirectory::V1::UpdateNamespaceRequest.new

# Call the update_namespace method.
result = client.update_namespace request

# The returned object is of type Google::Cloud::ServiceDirectory::V1::Namespace.
p result

#update_service

def update_service(request, options = nil) -> ::Google::Cloud::ServiceDirectory::V1::Service
def update_service(service: nil, update_mask: nil) -> ::Google::Cloud::ServiceDirectory::V1::Service

Updates a service.

Overloads
def update_service(request, options = nil) -> ::Google::Cloud::ServiceDirectory::V1::Service
Pass arguments to update_service via a request object, either of type UpdateServiceRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::ServiceDirectory::V1::UpdateServiceRequest, ::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.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
def update_service(service: nil, update_mask: nil) -> ::Google::Cloud::ServiceDirectory::V1::Service
Pass arguments to update_service 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).
Parameters
Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.
Example

Basic example

require "google/cloud/service_directory/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::ServiceDirectory::V1::RegistrationService::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::ServiceDirectory::V1::UpdateServiceRequest.new

# Call the update_service method.
result = client.update_service request

# The returned object is of type Google::Cloud::ServiceDirectory::V1::Service.
p result