Class: Google::Cloud::ServiceManagement::V1::ServiceManager::Rest::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/google/cloud/service_management/v1/service_manager/rest/client.rb

Overview

REST client for the ServiceManager service.

Google Service Management API

Defined Under Namespace

Classes: Configuration

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

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

Create a new ServiceManager REST client object.

Examples:


# Create a client using the default configuration
client = ::Google::Cloud::ServiceManagement::V1::ServiceManager::Rest::Client.new

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

Yields:

  • (config)

    Configure the ServiceManager client.

Yield Parameters:



128
129
130
131
132
133
134
135
136
137
138
139
140
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
# File 'lib/google/cloud/service_management/v1/service_manager/rest/client.rb', line 128

def initialize
  # Create the configuration object
  @config = Configuration.new Client.configure

  # Yield the configuration if needed
  yield @config if block_given?

  # Create credentials
  credentials = @config.credentials
  # Use self-signed JWT if the endpoint is unchanged from default,
  # but only if the default endpoint does not have a region prefix.
  enable_self_signed_jwt = @config.endpoint.nil? ||
                           (@config.endpoint == Configuration::DEFAULT_ENDPOINT &&
                           !@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

  @operations_client = ::Google::Cloud::ServiceManagement::V1::ServiceManager::Rest::Operations.new do |config|
    config.credentials = credentials
    config.quota_project = @quota_project_id
    config.endpoint = @config.endpoint
    config.universe_domain = @config.universe_domain
  end

  @service_manager_stub = ::Google::Cloud::ServiceManagement::V1::ServiceManager::Rest::ServiceStub.new(
    endpoint: @config.endpoint,
    endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
    universe_domain: @config.universe_domain,
    credentials: credentials
  )

  @iam_policy_client = Google::Iam::V1::IAMPolicy::Rest::Client.new do |config|
    config.credentials = credentials
    config.quota_project = @quota_project_id
    config.endpoint = @service_manager_stub.endpoint
    config.universe_domain = @service_manager_stub.universe_domain
    config.bindings_override = @config.bindings_override
  end
end

Instance Attribute Details

#iam_policy_clientGoogle::Iam::V1::IAMPolicy::Rest::Client (readonly)

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

Returns:

  • (Google::Iam::V1::IAMPolicy::Rest::Client)


186
187
188
# File 'lib/google/cloud/service_management/v1/service_manager/rest/client.rb', line 186

def iam_policy_client
  @iam_policy_client
end

#operations_client::Google::Cloud::ServiceManagement::V1::ServiceManager::Rest::Operations (readonly)

Get the associated client for long-running operations.



179
180
181
# File 'lib/google/cloud/service_management/v1/service_manager/rest/client.rb', line 179

def operations_client
  @operations_client
end

Class Method Details

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

Configure the ServiceManager Client class.

See Configuration for a description of the configuration fields.

Examples:


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

Yields:

  • (config)

    Configure the Client client.

Yield Parameters:

Returns:



64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
# File 'lib/google/cloud/service_management/v1/service_manager/rest/client.rb', line 64

def self.configure
  @configure ||= begin
    namespace = ["Google", "Cloud", "ServiceManagement", "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 = 10.0

    default_config
  end
  yield @configure if block_given?
  @configure
end

Instance Method Details

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

Configure the ServiceManager 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:



98
99
100
101
# File 'lib/google/cloud/service_management/v1/service_manager/rest/client.rb', line 98

def configure
  yield @config if block_given?
  @config
end

#create_service(request, options = nil) ⇒ ::Gapic::Operation #create_service(service: nil) ⇒ ::Gapic::Operation

Creates a new managed service.

A managed service is immutable, and is subject to mandatory 30-day data retention. You cannot move a service or recreate it within 30 days after deletion.

One producer project can own no more than 500 services. For security and reliability purposes, a production service should be hosted in a dedicated producer project.

Operation

Examples:

Basic example

require "google/cloud/service_management/v1"

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

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

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

# The returned object is of type Gapic::Operation. You can use it to
# check the status of an operation, cancel it, or wait for results.
# Here is how to wait for a response.
result.wait_until_done! timeout: 60
if result.response?
  p result.response
else
  puts "No response received."
end

Overloads:

  • #create_service(request, options = nil) ⇒ ::Gapic::Operation

    Pass arguments to create_service via a request object, either of type CreateServiceRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::ServiceManagement::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(service: nil) ⇒ ::Gapic::Operation

    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:

Yields:

  • (result, operation)

    Access the result along with the TransportOperation object

Yield Parameters:

  • result (::Gapic::Operation)
  • operation (::Gapic::Rest::TransportOperation)

Returns:

  • (::Gapic::Operation)

Raises:

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

    if the REST call is aborted.



431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
# File 'lib/google/cloud/service_management/v1/service_manager/rest/client.rb', line 431

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

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::ServiceManagement::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, x-goog-user-project and x-goog-api-version 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::ServiceManagement::V1::VERSION,
    transports_version_send: [:rest]

  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  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

  @service_manager_stub.create_service request, options do |result, operation|
    result = ::Gapic::Operation.new result, @operations_client, options: options
    yield result, operation if block_given?
    return result
  end
rescue ::Gapic::Rest::Error => e
  raise ::Google::Cloud::Error.from_error(e)
end

#create_service_config(request, options = nil) ⇒ ::Google::Api::Service #create_service_config(service_name: nil, service_config: nil) ⇒ ::Google::Api::Service

Creates a new service configuration (version) for a managed service. This method only stores the service configuration. To roll out the service configuration to backend systems please call CreateServiceRollout.

Only the 100 most recent service configurations and ones referenced by existing rollouts are kept for each service. The rest will be deleted eventually.

Examples:

Basic example

require "google/cloud/service_management/v1"

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

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

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

# The returned object is of type Google::Api::Service.
p result

Overloads:

  • #create_service_config(request, options = nil) ⇒ ::Google::Api::Service

    Pass arguments to create_service_config via a request object, either of type CreateServiceConfigRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::ServiceManagement::V1::CreateServiceConfigRequest, ::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_config(service_name: nil, service_config: nil) ⇒ ::Google::Api::Service

    Pass arguments to create_service_config 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:

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

      Required. The name of the service. See the overview for naming requirements. For example: example.googleapis.com.

    • service_config (::Google::Api::Service, ::Hash) (defaults to: nil)

      Required. The service configuration resource.

Yields:

  • (result, operation)

    Access the result along with the TransportOperation object

Yield Parameters:

Returns:

Raises:

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

    if the REST call is aborted.



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
919
920
921
922
923
924
925
926
927
# File 'lib/google/cloud/service_management/v1/service_manager/rest/client.rb', line 893

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

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::ServiceManagement::V1::CreateServiceConfigRequest

  # 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_config..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version 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::ServiceManagement::V1::VERSION,
    transports_version_send: [:rest]

  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

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

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

  @service_manager_stub.create_service_config request, options do |result, operation|
    yield result, operation if block_given?
    return result
  end
rescue ::Gapic::Rest::Error => e
  raise ::Google::Cloud::Error.from_error(e)
end

#create_service_rollout(request, options = nil) ⇒ ::Gapic::Operation #create_service_rollout(service_name: nil, rollout: nil) ⇒ ::Gapic::Operation

Creates a new service configuration rollout. Based on rollout, the Google Service Management will roll out the service configurations to different backend services. For example, the logging configuration will be pushed to Google Cloud Logging.

Please note that any previous pending and running Rollouts and associated Operations will be automatically cancelled so that the latest Rollout will not be blocked by previous Rollouts.

Only the 100 most recent (in any state) and the last 10 successful (if not already part of the set of 100 most recent) rollouts are kept for each service. The rest will be deleted eventually.

Operation

Examples:

Basic example

require "google/cloud/service_management/v1"

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

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

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

# The returned object is of type Gapic::Operation. You can use it to
# check the status of an operation, cancel it, or wait for results.
# Here is how to wait for a response.
result.wait_until_done! timeout: 60
if result.response?
  p result.response
else
  puts "No response received."
end

Overloads:

  • #create_service_rollout(request, options = nil) ⇒ ::Gapic::Operation

    Pass arguments to create_service_rollout via a request object, either of type CreateServiceRolloutRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::ServiceManagement::V1::CreateServiceRolloutRequest, ::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_rollout(service_name: nil, rollout: nil) ⇒ ::Gapic::Operation

    Pass arguments to create_service_rollout 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:

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

      Required. The name of the service. See the overview for naming requirements. For example: example.googleapis.com.

    • rollout (::Google::Cloud::ServiceManagement::V1::Rollout, ::Hash) (defaults to: nil)

      Required. The rollout resource. The service_name field is output only.

Yields:

  • (result, operation)

    Access the result along with the TransportOperation object

Yield Parameters:

  • result (::Gapic::Operation)
  • operation (::Gapic::Rest::TransportOperation)

Returns:

  • (::Gapic::Operation)

Raises:

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

    if the REST call is aborted.



1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
# File 'lib/google/cloud/service_management/v1/service_manager/rest/client.rb', line 1291

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

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::ServiceManagement::V1::CreateServiceRolloutRequest

  # 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_rollout..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version 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::ServiceManagement::V1::VERSION,
    transports_version_send: [:rest]

  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

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

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

  @service_manager_stub.create_service_rollout request, options do |result, operation|
    result = ::Gapic::Operation.new result, @operations_client, options: options
    yield result, operation if block_given?
    return result
  end
rescue ::Gapic::Rest::Error => e
  raise ::Google::Cloud::Error.from_error(e)
end

#delete_service(request, options = nil) ⇒ ::Gapic::Operation #delete_service(service_name: nil) ⇒ ::Gapic::Operation

Deletes a managed service. This method will change the service to the Soft-Delete state for 30 days. Within this period, service producers may call UndeleteService to restore the service. After 30 days, the service will be permanently deleted.

Operation

Examples:

Basic example

require "google/cloud/service_management/v1"

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

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

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

# The returned object is of type Gapic::Operation. You can use it to
# check the status of an operation, cancel it, or wait for results.
# Here is how to wait for a response.
result.wait_until_done! timeout: 60
if result.response?
  p result.response
else
  puts "No response received."
end

Overloads:

  • #delete_service(request, options = nil) ⇒ ::Gapic::Operation

    Pass arguments to delete_service via a request object, either of type DeleteServiceRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::ServiceManagement::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(service_name: nil) ⇒ ::Gapic::Operation

    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:

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

      Required. The name of the service. See the overview for naming requirements. For example: example.googleapis.com.

Yields:

  • (result, operation)

    Access the result along with the TransportOperation object

Yield Parameters:

  • result (::Gapic::Operation)
  • operation (::Gapic::Rest::TransportOperation)

Returns:

  • (::Gapic::Operation)

Raises:

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

    if the REST call is aborted.



527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
# File 'lib/google/cloud/service_management/v1/service_manager/rest/client.rb', line 527

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

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::ServiceManagement::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, x-goog-user-project and x-goog-api-version 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::ServiceManagement::V1::VERSION,
    transports_version_send: [:rest]

  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  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

  @service_manager_stub.delete_service request, options do |result, operation|
    result = ::Gapic::Operation.new result, @operations_client, options: options
    yield result, operation if block_given?
    return result
  end
rescue ::Gapic::Rest::Error => e
  raise ::Google::Cloud::Error.from_error(e)
end

#generate_config_report(request, options = nil) ⇒ ::Google::Cloud::ServiceManagement::V1::GenerateConfigReportResponse #generate_config_report(new_config: nil, old_config: nil) ⇒ ::Google::Cloud::ServiceManagement::V1::GenerateConfigReportResponse

Generates and returns a report (errors, warnings and changes from existing configurations) associated with GenerateConfigReportRequest.new_value

If GenerateConfigReportRequest.old_value is specified, GenerateConfigReportRequest will contain a single ChangeReport based on the comparison between GenerateConfigReportRequest.new_value and GenerateConfigReportRequest.old_value. If GenerateConfigReportRequest.old_value is not specified, this method will compare GenerateConfigReportRequest.new_value with the last pushed service configuration.

Examples:

Basic example

require "google/cloud/service_management/v1"

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

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

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

# The returned object is of type Google::Cloud::ServiceManagement::V1::GenerateConfigReportResponse.
p result

Overloads:

Yields:

  • (result, operation)

    Access the result along with the TransportOperation object

Yield Parameters:

Returns:

Raises:

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

    if the REST call is aborted.



1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
# File 'lib/google/cloud/service_management/v1/service_manager/rest/client.rb', line 1391

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

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::ServiceManagement::V1::GenerateConfigReportRequest

  # 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.generate_config_report..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version 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::ServiceManagement::V1::VERSION,
    transports_version_send: [:rest]

  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

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

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

  @service_manager_stub.generate_config_report request, options do |result, operation|
    yield result, operation if block_given?
    return result
  end
rescue ::Gapic::Rest::Error => e
  raise ::Google::Cloud::Error.from_error(e)
end

#get_service(request, options = nil) ⇒ ::Google::Cloud::ServiceManagement::V1::ManagedService #get_service(service_name: nil) ⇒ ::Google::Cloud::ServiceManagement::V1::ManagedService

Gets a managed service. Authentication is required unless the service is public.

Examples:

Basic example

require "google/cloud/service_management/v1"

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

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

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

# The returned object is of type Google::Cloud::ServiceManagement::V1::ManagedService.
p result

Overloads:

  • #get_service(request, options = nil) ⇒ ::Google::Cloud::ServiceManagement::V1::ManagedService

    Pass arguments to get_service via a request object, either of type GetServiceRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::ServiceManagement::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(service_name: nil) ⇒ ::Google::Cloud::ServiceManagement::V1::ManagedService

    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:

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

      Required. The name of the service. See the ServiceManager overview for naming requirements. For example: example.googleapis.com.

Yields:

  • (result, operation)

    Access the result along with the TransportOperation object

Yield Parameters:

Returns:

Raises:

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

    if the REST call is aborted.



335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
# File 'lib/google/cloud/service_management/v1/service_manager/rest/client.rb', line 335

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

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::ServiceManagement::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, x-goog-user-project and x-goog-api-version 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::ServiceManagement::V1::VERSION,
    transports_version_send: [:rest]

  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  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

  @service_manager_stub.get_service request, options do |result, operation|
    yield result, operation if block_given?
    return result
  end
rescue ::Gapic::Rest::Error => e
  raise ::Google::Cloud::Error.from_error(e)
end

#get_service_config(request, options = nil) ⇒ ::Google::Api::Service #get_service_config(service_name: nil, config_id: nil, view: nil) ⇒ ::Google::Api::Service

Gets a service configuration (version) for a managed service.

Examples:

Basic example

require "google/cloud/service_management/v1"

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

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

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

# The returned object is of type Google::Api::Service.
p result

Overloads:

  • #get_service_config(request, options = nil) ⇒ ::Google::Api::Service

    Pass arguments to get_service_config via a request object, either of type GetServiceConfigRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::ServiceManagement::V1::GetServiceConfigRequest, ::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_config(service_name: nil, config_id: nil, view: nil) ⇒ ::Google::Api::Service

    Pass arguments to get_service_config 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:

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

      Required. The name of the service. See the overview for naming requirements. For example: example.googleapis.com.

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

      Required. The id of the service configuration resource.

      This field must be specified for the server to return all fields, including SourceInfo.

    • view (::Google::Cloud::ServiceManagement::V1::GetServiceConfigRequest::ConfigView) (defaults to: nil)

      Specifies which parts of the Service Config should be returned in the response.

Yields:

  • (result, operation)

    Access the result along with the TransportOperation object

Yield Parameters:

Returns:

Raises:

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

    if the REST call is aborted.



803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
# File 'lib/google/cloud/service_management/v1/service_manager/rest/client.rb', line 803

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

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::ServiceManagement::V1::GetServiceConfigRequest

  # 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_config..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version 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::ServiceManagement::V1::VERSION,
    transports_version_send: [:rest]

  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

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

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

  @service_manager_stub.get_service_config request, options do |result, operation|
    yield result, operation if block_given?
    return result
  end
rescue ::Gapic::Rest::Error => e
  raise ::Google::Cloud::Error.from_error(e)
end

#get_service_rollout(request, options = nil) ⇒ ::Google::Cloud::ServiceManagement::V1::Rollout #get_service_rollout(service_name: nil, rollout_id: nil) ⇒ ::Google::Cloud::ServiceManagement::V1::Rollout

Gets a service configuration rollout.

Examples:

Basic example

require "google/cloud/service_management/v1"

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

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

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

# The returned object is of type Google::Cloud::ServiceManagement::V1::Rollout.
p result

Overloads:

  • #get_service_rollout(request, options = nil) ⇒ ::Google::Cloud::ServiceManagement::V1::Rollout

    Pass arguments to get_service_rollout via a request object, either of type GetServiceRolloutRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::ServiceManagement::V1::GetServiceRolloutRequest, ::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_rollout(service_name: nil, rollout_id: nil) ⇒ ::Google::Cloud::ServiceManagement::V1::Rollout

    Pass arguments to get_service_rollout 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:

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

      Required. The name of the service. See the overview for naming requirements. For example: example.googleapis.com.

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

      Required. The id of the rollout resource.

Yields:

  • (result, operation)

    Access the result along with the TransportOperation object

Yield Parameters:

Returns:

Raises:

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

    if the REST call is aborted.



1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
# File 'lib/google/cloud/service_management/v1/service_manager/rest/client.rb', line 1188

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

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::ServiceManagement::V1::GetServiceRolloutRequest

  # 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_rollout..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version 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::ServiceManagement::V1::VERSION,
    transports_version_send: [:rest]

  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

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

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

  @service_manager_stub.get_service_rollout request, options do |result, operation|
    yield result, operation if block_given?
    return result
  end
rescue ::Gapic::Rest::Error => e
  raise ::Google::Cloud::Error.from_error(e)
end

#list_service_configs(request, options = nil) ⇒ ::Gapic::Rest::PagedEnumerable<::Google::Api::Service> #list_service_configs(service_name: nil, page_token: nil, page_size: nil) ⇒ ::Gapic::Rest::PagedEnumerable<::Google::Api::Service>

Lists the history of the service configuration for a managed service, from the newest to the oldest.

Examples:

Basic example

require "google/cloud/service_management/v1"

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

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

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

Overloads:

  • #list_service_configs(request, options = nil) ⇒ ::Gapic::Rest::PagedEnumerable<::Google::Api::Service>

    Pass arguments to list_service_configs via a request object, either of type ListServiceConfigsRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::ServiceManagement::V1::ListServiceConfigsRequest, ::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_service_configs(service_name: nil, page_token: nil, page_size: nil) ⇒ ::Gapic::Rest::PagedEnumerable<::Google::Api::Service>

    Pass arguments to list_service_configs 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:

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

      Required. The name of the service. See the overview for naming requirements. For example: example.googleapis.com.

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

      The token of the page to retrieve.

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

      The max number of items to include in the response list. Page size is 50 if not specified. Maximum value is 100.

Yields:

  • (result, operation)

    Access the result along with the TransportOperation object

Yield Parameters:

  • result (::Gapic::Rest::PagedEnumerable<::Google::Api::Service>)
  • operation (::Gapic::Rest::TransportOperation)

Returns:

Raises:

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

    if the REST call is aborted.



713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
# File 'lib/google/cloud/service_management/v1/service_manager/rest/client.rb', line 713

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

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::ServiceManagement::V1::ListServiceConfigsRequest

  # 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_service_configs..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version 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::ServiceManagement::V1::VERSION,
    transports_version_send: [:rest]

  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

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

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

  @service_manager_stub.list_service_configs request, options do |result, operation|
    result = ::Gapic::Rest::PagedEnumerable.new @service_manager_stub, :list_service_configs, "service_configs", request, result, options
    yield result, operation if block_given?
    return result
  end
rescue ::Gapic::Rest::Error => e
  raise ::Google::Cloud::Error.from_error(e)
end

#list_service_rollouts(request, options = nil) ⇒ ::Gapic::Rest::PagedEnumerable<::Google::Cloud::ServiceManagement::V1::Rollout> #list_service_rollouts(service_name: nil, page_token: nil, page_size: nil, filter: nil) ⇒ ::Gapic::Rest::PagedEnumerable<::Google::Cloud::ServiceManagement::V1::Rollout>

Lists the history of the service configuration rollouts for a managed service, from the newest to the oldest.

Examples:

Basic example

require "google/cloud/service_management/v1"

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

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

# Call the list_service_rollouts method.
result = client.list_service_rollouts 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::ServiceManagement::V1::Rollout.
  p item
end

Overloads:

  • #list_service_rollouts(request, options = nil) ⇒ ::Gapic::Rest::PagedEnumerable<::Google::Cloud::ServiceManagement::V1::Rollout>

    Pass arguments to list_service_rollouts via a request object, either of type ListServiceRolloutsRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::ServiceManagement::V1::ListServiceRolloutsRequest, ::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_service_rollouts(service_name: nil, page_token: nil, page_size: nil, filter: nil) ⇒ ::Gapic::Rest::PagedEnumerable<::Google::Cloud::ServiceManagement::V1::Rollout>

    Pass arguments to list_service_rollouts 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:

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

      Required. The name of the service. See the overview for naming requirements. For example: example.googleapis.com.

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

      The token of the page to retrieve.

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

      The max number of items to include in the response list. Page size is 50 if not specified. Maximum value is 100.

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

      Required. Use filter to return subset of rollouts. The following filters are supported:

      -- By [status] [google.api.servicemanagement.v1.Rollout.RolloutStatus]. For example, filter='status=SUCCESS'

      -- By [strategy] [google.api.servicemanagement.v1.Rollout.strategy]. For example, filter='strategy=TrafficPercentStrategy'

Yields:

  • (result, operation)

    Access the result along with the TransportOperation object

Yield Parameters:

Returns:

Raises:

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

    if the REST call is aborted.



1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
# File 'lib/google/cloud/service_management/v1/service_manager/rest/client.rb', line 1103

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

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::ServiceManagement::V1::ListServiceRolloutsRequest

  # 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_service_rollouts..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version 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::ServiceManagement::V1::VERSION,
    transports_version_send: [:rest]

  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

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

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

  @service_manager_stub.list_service_rollouts request, options do |result, operation|
    result = ::Gapic::Rest::PagedEnumerable.new @service_manager_stub, :list_service_rollouts, "rollouts", request, result, options
    yield result, operation if block_given?
    return result
  end
rescue ::Gapic::Rest::Error => e
  raise ::Google::Cloud::Error.from_error(e)
end

#list_services(request, options = nil) ⇒ ::Gapic::Rest::PagedEnumerable<::Google::Cloud::ServiceManagement::V1::ManagedService> #list_services(producer_project_id: nil, page_size: nil, page_token: nil, consumer_id: nil) ⇒ ::Gapic::Rest::PagedEnumerable<::Google::Cloud::ServiceManagement::V1::ManagedService>

Lists managed services.

Returns all public services. For authenticated users, also returns all services the calling user has "servicemanagement.services.get" permission for.

Examples:

Basic example

require "google/cloud/service_management/v1"

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

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::ServiceManagement::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::ServiceManagement::V1::ManagedService.
  p item
end

Overloads:

  • #list_services(request, options = nil) ⇒ ::Gapic::Rest::PagedEnumerable<::Google::Cloud::ServiceManagement::V1::ManagedService>

    Pass arguments to list_services via a request object, either of type ListServicesRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::ServiceManagement::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(producer_project_id: nil, page_size: nil, page_token: nil, consumer_id: nil) ⇒ ::Gapic::Rest::PagedEnumerable<::Google::Cloud::ServiceManagement::V1::ManagedService>

    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:

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

      Include services produced by the specified project.

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

      The max number of items to include in the response list. Page size is 50 if not specified. Maximum value is 500.

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

      Token identifying which result to start with; returned by a previous list call.

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

      Include services consumed by the specified consumer.

      The Google Service Management implementation accepts the following forms:

      • project:

Yields:

  • (result, operation)

    Access the result along with the TransportOperation object

Yield Parameters:

Returns:

Raises:

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

    if the REST call is aborted.



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
# File 'lib/google/cloud/service_management/v1/service_manager/rest/client.rb', line 253

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

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::ServiceManagement::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, x-goog-user-project and x-goog-api-version 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::ServiceManagement::V1::VERSION,
    transports_version_send: [:rest]

  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  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

  @service_manager_stub.list_services request, options do |result, operation|
    result = ::Gapic::Rest::PagedEnumerable.new @service_manager_stub, :list_services, "services", request, result, options
    yield result, operation if block_given?
    return result
  end
rescue ::Gapic::Rest::Error => e
  raise ::Google::Cloud::Error.from_error(e)
end

#submit_config_source(request, options = nil) ⇒ ::Gapic::Operation #submit_config_source(service_name: nil, config_source: nil, validate_only: nil) ⇒ ::Gapic::Operation

Creates a new service configuration (version) for a managed service based on user-supplied configuration source files (for example: OpenAPI Specification). This method stores the source configurations as well as the generated service configuration. To rollout the service configuration to other services, please call CreateServiceRollout.

Only the 100 most recent configuration sources and ones referenced by existing service configurtions are kept for each service. The rest will be deleted eventually.

Operation

Examples:

Basic example

require "google/cloud/service_management/v1"

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

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

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

# The returned object is of type Gapic::Operation. You can use it to
# check the status of an operation, cancel it, or wait for results.
# Here is how to wait for a response.
result.wait_until_done! timeout: 60
if result.response?
  p result.response
else
  puts "No response received."
end

Overloads:

  • #submit_config_source(request, options = nil) ⇒ ::Gapic::Operation

    Pass arguments to submit_config_source via a request object, either of type Google::Cloud::ServiceManagement::V1::SubmitConfigSourceRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::ServiceManagement::V1::SubmitConfigSourceRequest, ::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.

  • #submit_config_source(service_name: nil, config_source: nil, validate_only: nil) ⇒ ::Gapic::Operation

    Pass arguments to submit_config_source 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:

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

      Required. The name of the service. See the overview for naming requirements. For example: example.googleapis.com.

    • config_source (::Google::Cloud::ServiceManagement::V1::ConfigSource, ::Hash) (defaults to: nil)

      Required. The source configuration for the service.

    • validate_only (::Boolean) (defaults to: nil)

      Optional. If set, this will result in the generation of a google.api.Service configuration based on the ConfigSource provided, but the generated config and the sources will NOT be persisted.

Yields:

  • (result, operation)

    Access the result along with the TransportOperation object

Yield Parameters:

  • result (::Gapic::Operation)
  • operation (::Gapic::Rest::TransportOperation)

Returns:

  • (::Gapic::Operation)

Raises:

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

    if the REST call is aborted.



1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
# File 'lib/google/cloud/service_management/v1/service_manager/rest/client.rb', line 1000

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

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::ServiceManagement::V1::SubmitConfigSourceRequest

  # 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.submit_config_source..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version 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::ServiceManagement::V1::VERSION,
    transports_version_send: [:rest]

  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

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

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

  @service_manager_stub.submit_config_source request, options do |result, operation|
    result = ::Gapic::Operation.new result, @operations_client, options: options
    yield result, operation if block_given?
    return result
  end
rescue ::Gapic::Rest::Error => e
  raise ::Google::Cloud::Error.from_error(e)
end

#undelete_service(request, options = nil) ⇒ ::Gapic::Operation #undelete_service(service_name: nil) ⇒ ::Gapic::Operation

Revives a previously deleted managed service. The method restores the service using the configuration at the time the service was deleted. The target service must exist and must have been deleted within the last 30 days.

Operation

Examples:

Basic example

require "google/cloud/service_management/v1"

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

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

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

# The returned object is of type Gapic::Operation. You can use it to
# check the status of an operation, cancel it, or wait for results.
# Here is how to wait for a response.
result.wait_until_done! timeout: 60
if result.response?
  p result.response
else
  puts "No response received."
end

Overloads:

  • #undelete_service(request, options = nil) ⇒ ::Gapic::Operation

    Pass arguments to undelete_service via a request object, either of type UndeleteServiceRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::ServiceManagement::V1::UndeleteServiceRequest, ::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.

  • #undelete_service(service_name: nil) ⇒ ::Gapic::Operation

    Pass arguments to undelete_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:

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

      Required. The name of the service. See the overview for naming requirements. For example: example.googleapis.com.

Yields:

  • (result, operation)

    Access the result along with the TransportOperation object

Yield Parameters:

  • result (::Gapic::Operation)
  • operation (::Gapic::Rest::TransportOperation)

Returns:

  • (::Gapic::Operation)

Raises:

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

    if the REST call is aborted.



621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
# File 'lib/google/cloud/service_management/v1/service_manager/rest/client.rb', line 621

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

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::ServiceManagement::V1::UndeleteServiceRequest

  # 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.undelete_service..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version 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::ServiceManagement::V1::VERSION,
    transports_version_send: [:rest]

  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

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

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

  @service_manager_stub.undelete_service request, options do |result, operation|
    result = ::Gapic::Operation.new result, @operations_client, options: options
    yield result, operation if block_given?
    return result
  end
rescue ::Gapic::Rest::Error => e
  raise ::Google::Cloud::Error.from_error(e)
end

#universe_domainString

The effective universe domain

Returns:

  • (String)


108
109
110
# File 'lib/google/cloud/service_management/v1/service_manager/rest/client.rb', line 108

def universe_domain
  @service_manager_stub.universe_domain
end