Class: Google::Cloud::ServiceDirectory::V1::RegistrationService::Client

Inherits:
Object
  • Object
show all
Includes:
Paths
Defined in:
lib/google/cloud/service_directory/v1/registration_service/client.rb

Overview

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/*.

Defined Under Namespace

Classes: Configuration

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Paths

#endpoint_path, #location_path, #namespace_path, #network_path, #service_path

Constructor Details

#initialize {|config| ... } ⇒ Client

Create a new RegistrationService client object.

Examples:


# Create a client using the default configuration
client = ::Google::Cloud::ServiceDirectory::V1::RegistrationService::Client.new

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

Yields:

  • (config)

    Configure the RegistrationService client.

Yield Parameters:



141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
# File 'lib/google/cloud/service_directory/v1/registration_service/client.rb', line 141

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/cloud/servicedirectory/v1/registration_service_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 &&
                           !@config.endpoint.split(".").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
  @quota_project_id = @config.quota_project
  @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id

  @registration_service_stub = ::Gapic::ServiceStub.new(
    ::Google::Cloud::ServiceDirectory::V1::RegistrationService::Stub,
    credentials: credentials,
    endpoint: @config.endpoint,
    endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
    universe_domain: @config.universe_domain,
    channel_args: @config.channel_args,
    interceptors: @config.interceptors,
    channel_pool_config: @config.channel_pool
  )

  @location_client = Google::Cloud::Location::Locations::Client.new do |config|
    config.credentials = credentials
    config.quota_project = @quota_project_id
    config.endpoint = @registration_service_stub.endpoint
    config.universe_domain = @registration_service_stub.universe_domain
  end
end

Instance Attribute Details

#location_clientGoogle::Cloud::Location::Locations::Client (readonly)

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

Returns:

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


193
194
195
# File 'lib/google/cloud/service_directory/v1/registration_service/client.rb', line 193

def location_client
  @location_client
end

Class Method Details

.configure {|config| ... } ⇒ Client::Configuration

Configure the RegistrationService Client class.

See Configuration for a description of the configuration fields.

Examples:


# Modify the configuration for all RegistrationService clients
::Google::Cloud::ServiceDirectory::V1::RegistrationService::Client.configure do |config|
  config.timeout = 10.0
end

Yields:

  • (config)

    Configure the Client client.

Yield Parameters:

Returns:



74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
# File 'lib/google/cloud/service_directory/v1/registration_service/client.rb', line 74

def self.configure
  @configure ||= begin
    namespace = ["Google", "Cloud", "ServiceDirectory", "V1"]
    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
    default_config = Client::Configuration.new parent_config

    default_config.timeout = 15.0
    default_config.retry_policy = {
      initial_delay: 1.0, max_delay: 60.0, multiplier: 1.3, retry_codes: [14, 2]
    }

    default_config
  end
  yield @configure if block_given?
  @configure
end

Instance Method Details

#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 configure.

See Configuration for a description of the configuration fields.

Yields:

  • (config)

    Configure the Client client.

Yield Parameters:

Returns:



111
112
113
114
# File 'lib/google/cloud/service_directory/v1/registration_service/client.rb', line 111

def configure
  yield @config if block_given?
  @config
end

#create_endpoint(request, options = nil) ⇒ ::Google::Cloud::ServiceDirectory::V1::Endpoint #create_endpoint(parent: nil, endpoint_id: nil, endpoint: nil) ⇒ ::Google::Cloud::ServiceDirectory::V1::Endpoint

Creates an endpoint, and returns the new endpoint.

Examples:

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::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

Overloads:

  • #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) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #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) (defaults to: nil)

      Required. The resource name of the service that this endpoint provides.

    • endpoint_id (::String) (defaults to: nil)

      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) (defaults to: nil)

      Required. A endpoint with initial fields set.

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
# File 'lib/google/cloud/service_directory/v1/registration_service/client.rb', line 1232

def create_endpoint request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::ServiceDirectory::V1::CreateEndpointRequest

  # 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
   = @config.rpcs.create_endpoint..to_h

  # Set x-goog-api-client and x-goog-user-project headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::ServiceDirectory::V1::VERSION
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.parent
    header_params["parent"] = request.parent
  end

  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
  [:"x-goog-request-params"] ||= request_params_header

  options.apply_defaults timeout:      @config.rpcs.create_endpoint.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.create_endpoint.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @registration_service_stub.call_rpc :create_endpoint, request, options: options do |response, operation|
    yield response, operation if block_given?
    return response
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end

#create_namespace(request, options = nil) ⇒ ::Google::Cloud::ServiceDirectory::V1::Namespace #create_namespace(parent: nil, namespace_id: nil, namespace: nil) ⇒ ::Google::Cloud::ServiceDirectory::V1::Namespace

Creates a namespace, and returns the new namespace.

Examples:

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::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

Overloads:

  • #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) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #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) (defaults to: nil)

      Required. The resource name of the project and location the namespace will be created in.

    • namespace_id (::String) (defaults to: nil)

      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) (defaults to: nil)

      Required. A namespace with initial fields set.

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
# File 'lib/google/cloud/service_directory/v1/registration_service/client.rb', line 252

def create_namespace request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::ServiceDirectory::V1::CreateNamespaceRequest

  # 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
   = @config.rpcs.create_namespace..to_h

  # Set x-goog-api-client and x-goog-user-project headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::ServiceDirectory::V1::VERSION
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.parent
    header_params["parent"] = request.parent
  end

  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
  [:"x-goog-request-params"] ||= request_params_header

  options.apply_defaults timeout:      @config.rpcs.create_namespace.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.create_namespace.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @registration_service_stub.call_rpc :create_namespace, request, options: options do |response, operation|
    yield response, operation if block_given?
    return response
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end

#create_service(request, options = nil) ⇒ ::Google::Cloud::ServiceDirectory::V1::Service #create_service(parent: nil, service_id: nil, service: nil) ⇒ ::Google::Cloud::ServiceDirectory::V1::Service

Creates a service, and returns the new service.

Examples:

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::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

Overloads:

  • #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) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #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) (defaults to: nil)

      Required. The resource name of the namespace this service will belong to.

    • service_id (::String) (defaults to: nil)

      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) (defaults to: nil)

      Required. A service with initial fields set.

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
# File 'lib/google/cloud/service_directory/v1/registration_service/client.rb', line 741

def create_service request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::ServiceDirectory::V1::CreateServiceRequest

  # 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
   = @config.rpcs.create_service..to_h

  # Set x-goog-api-client and x-goog-user-project headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::ServiceDirectory::V1::VERSION
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.parent
    header_params["parent"] = request.parent
  end

  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
  [:"x-goog-request-params"] ||= request_params_header

  options.apply_defaults timeout:      @config.rpcs.create_service.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.create_service.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @registration_service_stub.call_rpc :create_service, request, options: options do |response, operation|
    yield response, operation if block_given?
    return response
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end

#delete_endpoint(request, options = nil) ⇒ ::Google::Protobuf::Empty #delete_endpoint(name: nil) ⇒ ::Google::Protobuf::Empty

Deletes an endpoint.

Examples:

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::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

Overloads:

  • #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) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #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).

    Parameters:

    • name (::String) (defaults to: nil)

      Required. The name of the endpoint to delete.

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
# File 'lib/google/cloud/service_directory/v1/registration_service/client.rb', line 1630

def delete_endpoint request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::ServiceDirectory::V1::DeleteEndpointRequest

  # 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
   = @config.rpcs.delete_endpoint..to_h

  # Set x-goog-api-client and x-goog-user-project headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::ServiceDirectory::V1::VERSION
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.name
    header_params["name"] = request.name
  end

  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
  [:"x-goog-request-params"] ||= request_params_header

  options.apply_defaults timeout:      @config.rpcs.delete_endpoint.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.delete_endpoint.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @registration_service_stub.call_rpc :delete_endpoint, request, options: options do |response, operation|
    yield response, operation if block_given?
    return response
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end

#delete_namespace(request, options = nil) ⇒ ::Google::Protobuf::Empty #delete_namespace(name: nil) ⇒ ::Google::Protobuf::Empty

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

Examples:

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::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

Overloads:

  • #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) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #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).

    Parameters:

    • name (::String) (defaults to: nil)

      Required. The name of the namespace to delete.

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
# File 'lib/google/cloud/service_directory/v1/registration_service/client.rb', line 646

def delete_namespace request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::ServiceDirectory::V1::DeleteNamespaceRequest

  # 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
   = @config.rpcs.delete_namespace..to_h

  # Set x-goog-api-client and x-goog-user-project headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::ServiceDirectory::V1::VERSION
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.name
    header_params["name"] = request.name
  end

  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
  [:"x-goog-request-params"] ||= request_params_header

  options.apply_defaults timeout:      @config.rpcs.delete_namespace.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.delete_namespace.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @registration_service_stub.call_rpc :delete_namespace, request, options: options do |response, operation|
    yield response, operation if block_given?
    return response
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end

#delete_service(request, options = nil) ⇒ ::Google::Protobuf::Empty #delete_service(name: nil) ⇒ ::Google::Protobuf::Empty

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

Examples:

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::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

Overloads:

  • #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) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #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).

    Parameters:

    • name (::String) (defaults to: nil)

      Required. The name of the service to delete.

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
# File 'lib/google/cloud/service_directory/v1/registration_service/client.rb', line 1137

def delete_service request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::ServiceDirectory::V1::DeleteServiceRequest

  # 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
   = @config.rpcs.delete_service..to_h

  # Set x-goog-api-client and x-goog-user-project headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::ServiceDirectory::V1::VERSION
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.name
    header_params["name"] = request.name
  end

  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
  [:"x-goog-request-params"] ||= request_params_header

  options.apply_defaults timeout:      @config.rpcs.delete_service.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.delete_service.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @registration_service_stub.call_rpc :delete_service, request, options: options do |response, operation|
    yield response, operation if block_given?
    return response
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end

#get_endpoint(request, options = nil) ⇒ ::Google::Cloud::ServiceDirectory::V1::Endpoint #get_endpoint(name: nil) ⇒ ::Google::Cloud::ServiceDirectory::V1::Endpoint

Gets an endpoint.

Examples:

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::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

Overloads:

  • #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) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #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).

    Parameters:

    • name (::String) (defaults to: nil)

      Required. The name of the endpoint to get.

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
# File 'lib/google/cloud/service_directory/v1/registration_service/client.rb', line 1458

def get_endpoint request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::ServiceDirectory::V1::GetEndpointRequest

  # 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
   = @config.rpcs.get_endpoint..to_h

  # Set x-goog-api-client and x-goog-user-project headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::ServiceDirectory::V1::VERSION
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.name
    header_params["name"] = request.name
  end

  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
  [:"x-goog-request-params"] ||= request_params_header

  options.apply_defaults timeout:      @config.rpcs.get_endpoint.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.get_endpoint.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @registration_service_stub.call_rpc :get_endpoint, request, options: options do |response, operation|
    yield response, operation if block_given?
    return response
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end

#get_iam_policy(request, options = nil) ⇒ ::Google::Iam::V1::Policy #get_iam_policy(resource: nil, options: nil) ⇒ ::Google::Iam::V1::Policy

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

Examples:

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::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

Overloads:

  • #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) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #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) (defaults to: nil)

      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) (defaults to: nil)

      OPTIONAL: A GetPolicyOptions object for specifying options to GetIamPolicy.

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
# File 'lib/google/cloud/service_directory/v1/registration_service/client.rb', line 1719

def get_iam_policy request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Iam::V1::GetIamPolicyRequest

  # 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
   = @config.rpcs.get_iam_policy..to_h

  # Set x-goog-api-client and x-goog-user-project headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::ServiceDirectory::V1::VERSION
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.resource
    header_params["resource"] = request.resource
  end

  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
  [:"x-goog-request-params"] ||= request_params_header

  options.apply_defaults timeout:      @config.rpcs.get_iam_policy.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.get_iam_policy.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @registration_service_stub.call_rpc :get_iam_policy, request, options: options do |response, operation|
    yield response, operation if block_given?
    return response
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end

#get_namespace(request, options = nil) ⇒ ::Google::Cloud::ServiceDirectory::V1::Namespace #get_namespace(name: nil) ⇒ ::Google::Cloud::ServiceDirectory::V1::Namespace

Gets a namespace.

Examples:

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::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

Overloads:

  • #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) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #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).

    Parameters:

    • name (::String) (defaults to: nil)

      Required. The name of the namespace to retrieve.

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
# File 'lib/google/cloud/service_directory/v1/registration_service/client.rb', line 473

def get_namespace request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::ServiceDirectory::V1::GetNamespaceRequest

  # 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
   = @config.rpcs.get_namespace..to_h

  # Set x-goog-api-client and x-goog-user-project headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::ServiceDirectory::V1::VERSION
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.name
    header_params["name"] = request.name
  end

  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
  [:"x-goog-request-params"] ||= request_params_header

  options.apply_defaults timeout:      @config.rpcs.get_namespace.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.get_namespace.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @registration_service_stub.call_rpc :get_namespace, request, options: options do |response, operation|
    yield response, operation if block_given?
    return response
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end

#get_service(request, options = nil) ⇒ ::Google::Cloud::ServiceDirectory::V1::Service #get_service(name: nil) ⇒ ::Google::Cloud::ServiceDirectory::V1::Service

Gets a service.

Examples:

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::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

Overloads:

  • #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) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #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).

    Parameters:

    • name (::String) (defaults to: nil)

      Required. The name of the service to get.

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
# File 'lib/google/cloud/service_directory/v1/registration_service/client.rb', line 964

def get_service request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::ServiceDirectory::V1::GetServiceRequest

  # 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
   = @config.rpcs.get_service..to_h

  # Set x-goog-api-client and x-goog-user-project headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::ServiceDirectory::V1::VERSION
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.name
    header_params["name"] = request.name
  end

  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
  [:"x-goog-request-params"] ||= request_params_header

  options.apply_defaults timeout:      @config.rpcs.get_service.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.get_service.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @registration_service_stub.call_rpc :get_service, request, options: options do |response, operation|
    yield response, operation if block_given?
    return response
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end

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

Lists all endpoints.

Examples:

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::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

Overloads:

  • #list_endpoints(request, options = nil) ⇒ ::Gapic::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) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #list_endpoints(parent: nil, page_size: nil, page_token: nil, filter: nil, order_by: nil) ⇒ ::Gapic::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) (defaults to: nil)

      Required. The resource name of the service whose endpoints you'd like to list.

    • page_size (::Integer) (defaults to: nil)

      Optional. The maximum number of items to return.

    • page_token (::String) (defaults to: nil)

      Optional. The next_page_token value returned from a previous List request, if any.

    • filter (::String) (defaults to: nil)

      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) (defaults to: nil)

      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:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
# File 'lib/google/cloud/service_directory/v1/registration_service/client.rb', line 1372

def list_endpoints request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::ServiceDirectory::V1::ListEndpointsRequest

  # 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
   = @config.rpcs.list_endpoints..to_h

  # Set x-goog-api-client and x-goog-user-project headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::ServiceDirectory::V1::VERSION
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.parent
    header_params["parent"] = request.parent
  end

  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
  [:"x-goog-request-params"] ||= request_params_header

  options.apply_defaults timeout:      @config.rpcs.list_endpoints.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.list_endpoints.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @registration_service_stub.call_rpc :list_endpoints, request, options: options do |response, operation|
    response = ::Gapic::PagedEnumerable.new @registration_service_stub, :list_endpoints, request, response, operation, options
    yield response, operation if block_given?
    return response
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end

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

Lists all namespaces.

Examples:

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::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

Overloads:

  • #list_namespaces(request, options = nil) ⇒ ::Gapic::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) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #list_namespaces(parent: nil, page_size: nil, page_token: nil, filter: nil, order_by: nil) ⇒ ::Gapic::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) (defaults to: nil)

      Required. The resource name of the project and location whose namespaces you'd like to list.

    • page_size (::Integer) (defaults to: nil)

      Optional. The maximum number of items to return.

    • page_token (::String) (defaults to: nil)

      Optional. The next_page_token value returned from a previous List request, if any.

    • filter (::String) (defaults to: nil)

      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) (defaults to: nil)

      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:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
# File 'lib/google/cloud/service_directory/v1/registration_service/client.rb', line 387

def list_namespaces request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::ServiceDirectory::V1::ListNamespacesRequest

  # 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
   = @config.rpcs.list_namespaces..to_h

  # Set x-goog-api-client and x-goog-user-project headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::ServiceDirectory::V1::VERSION
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.parent
    header_params["parent"] = request.parent
  end

  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
  [:"x-goog-request-params"] ||= request_params_header

  options.apply_defaults timeout:      @config.rpcs.list_namespaces.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.list_namespaces.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @registration_service_stub.call_rpc :list_namespaces, request, options: options do |response, operation|
    response = ::Gapic::PagedEnumerable.new @registration_service_stub, :list_namespaces, request, response, operation, options
    yield response, operation if block_given?
    return response
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end

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

Lists all services belonging to a namespace.

Examples:

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::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

Overloads:

  • #list_services(request, options = nil) ⇒ ::Gapic::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) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #list_services(parent: nil, page_size: nil, page_token: nil, filter: nil, order_by: nil) ⇒ ::Gapic::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) (defaults to: nil)

      Required. The resource name of the namespace whose services you'd like to list.

    • page_size (::Integer) (defaults to: nil)

      Optional. The maximum number of items to return.

    • page_token (::String) (defaults to: nil)

      Optional. The next_page_token value returned from a previous List request, if any.

    • filter (::String) (defaults to: nil)

      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) (defaults to: nil)

      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:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
# File 'lib/google/cloud/service_directory/v1/registration_service/client.rb', line 878

def list_services request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::ServiceDirectory::V1::ListServicesRequest

  # 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
   = @config.rpcs.list_services..to_h

  # Set x-goog-api-client and x-goog-user-project headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::ServiceDirectory::V1::VERSION
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.parent
    header_params["parent"] = request.parent
  end

  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
  [:"x-goog-request-params"] ||= request_params_header

  options.apply_defaults timeout:      @config.rpcs.list_services.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.list_services.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @registration_service_stub.call_rpc :list_services, request, options: options do |response, operation|
    response = ::Gapic::PagedEnumerable.new @registration_service_stub, :list_services, request, response, operation, options
    yield response, operation if block_given?
    return response
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end

#set_iam_policy(request, options = nil) ⇒ ::Google::Iam::V1::Policy #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).

Examples:

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::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

Overloads:

  • #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) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #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) (defaults to: nil)

      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) (defaults to: nil)

      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) (defaults to: nil)

      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:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
# File 'lib/google/cloud/service_directory/v1/registration_service/client.rb', line 1816

def set_iam_policy request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Iam::V1::SetIamPolicyRequest

  # 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
   = @config.rpcs.set_iam_policy..to_h

  # Set x-goog-api-client and x-goog-user-project headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::ServiceDirectory::V1::VERSION
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.resource
    header_params["resource"] = request.resource
  end

  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
  [:"x-goog-request-params"] ||= request_params_header

  options.apply_defaults timeout:      @config.rpcs.set_iam_policy.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.set_iam_policy.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @registration_service_stub.call_rpc :set_iam_policy, request, options: options do |response, operation|
    yield response, operation if block_given?
    return response
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end

#test_iam_permissions(request, options = nil) ⇒ ::Google::Iam::V1::TestIamPermissionsResponse #test_iam_permissions(resource: nil, permissions: nil) ⇒ ::Google::Iam::V1::TestIamPermissionsResponse

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

Examples:

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::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

Overloads:

  • #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) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #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) (defaults to: nil)

      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>) (defaults to: nil)

      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:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
# File 'lib/google/cloud/service_directory/v1/registration_service/client.rb', line 1907

def test_iam_permissions request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Iam::V1::TestIamPermissionsRequest

  # 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
   = @config.rpcs.test_iam_permissions..to_h

  # Set x-goog-api-client and x-goog-user-project headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::ServiceDirectory::V1::VERSION
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.resource
    header_params["resource"] = request.resource
  end

  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
  [:"x-goog-request-params"] ||= request_params_header

  options.apply_defaults timeout:      @config.rpcs.test_iam_permissions.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.test_iam_permissions.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @registration_service_stub.call_rpc :test_iam_permissions, request, options: options do |response, operation|
    yield response, operation if block_given?
    return response
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end

#universe_domainString

The effective universe domain

Returns:

  • (String)


121
122
123
# File 'lib/google/cloud/service_directory/v1/registration_service/client.rb', line 121

def universe_domain
  @registration_service_stub.universe_domain
end

#update_endpoint(request, options = nil) ⇒ ::Google::Cloud::ServiceDirectory::V1::Endpoint #update_endpoint(endpoint: nil, update_mask: nil) ⇒ ::Google::Cloud::ServiceDirectory::V1::Endpoint

Updates an endpoint.

Examples:

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::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

Overloads:

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
# File 'lib/google/cloud/service_directory/v1/registration_service/client.rb', line 1545

def update_endpoint request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::ServiceDirectory::V1::UpdateEndpointRequest

  # 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
   = @config.rpcs.update_endpoint..to_h

  # Set x-goog-api-client and x-goog-user-project headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::ServiceDirectory::V1::VERSION
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.endpoint&.name
    header_params["endpoint.name"] = request.endpoint.name
  end

  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
  [:"x-goog-request-params"] ||= request_params_header

  options.apply_defaults timeout:      @config.rpcs.update_endpoint.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.update_endpoint.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @registration_service_stub.call_rpc :update_endpoint, request, options: options do |response, operation|
    yield response, operation if block_given?
    return response
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end

#update_namespace(request, options = nil) ⇒ ::Google::Cloud::ServiceDirectory::V1::Namespace #update_namespace(namespace: nil, update_mask: nil) ⇒ ::Google::Cloud::ServiceDirectory::V1::Namespace

Updates a namespace.

Examples:

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::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

Overloads:

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
# File 'lib/google/cloud/service_directory/v1/registration_service/client.rb', line 560

def update_namespace request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::ServiceDirectory::V1::UpdateNamespaceRequest

  # 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
   = @config.rpcs.update_namespace..to_h

  # Set x-goog-api-client and x-goog-user-project headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::ServiceDirectory::V1::VERSION
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.namespace&.name
    header_params["namespace.name"] = request.namespace.name
  end

  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
  [:"x-goog-request-params"] ||= request_params_header

  options.apply_defaults timeout:      @config.rpcs.update_namespace.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.update_namespace.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @registration_service_stub.call_rpc :update_namespace, request, options: options do |response, operation|
    yield response, operation if block_given?
    return response
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end

#update_service(request, options = nil) ⇒ ::Google::Cloud::ServiceDirectory::V1::Service #update_service(service: nil, update_mask: nil) ⇒ ::Google::Cloud::ServiceDirectory::V1::Service

Updates a service.

Examples:

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::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

Overloads:

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
# File 'lib/google/cloud/service_directory/v1/registration_service/client.rb', line 1051

def update_service request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::ServiceDirectory::V1::UpdateServiceRequest

  # 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
   = @config.rpcs.update_service..to_h

  # Set x-goog-api-client and x-goog-user-project headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::ServiceDirectory::V1::VERSION
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.service&.name
    header_params["service.name"] = request.service.name
  end

  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
  [:"x-goog-request-params"] ||= request_params_header

  options.apply_defaults timeout:      @config.rpcs.update_service.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.update_service.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @registration_service_stub.call_rpc :update_service, request, options: options do |response, operation|
    yield response, operation if block_given?
    return response
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end