Class: Google::Cloud::Logging::V2::ConfigService::Client

Inherits:
Object
  • Object
show all
Includes:
Paths
Defined in:
lib/google/cloud/logging/v2/config_service/client.rb

Overview

Client for the ConfigService service.

Service for configuring sinks used to route log entries.

Defined Under Namespace

Classes: Configuration

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Paths

#billing_account_location_path, #billing_account_path, #cmek_settings_path, #folder_location_path, #folder_path, #location_path, #log_bucket_path, #log_exclusion_path, #log_sink_path, #log_view_path, #organization_location_path, #organization_path, #project_path

Constructor Details

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

Create a new ConfigService client object.

Examples:


# Create a client using the default configuration
client = ::Google::Cloud::Logging::V2::ConfigService::Client.new

# Create a client using a custom configuration
client = ::Google::Cloud::Logging::V2::ConfigService::Client.new do |config|
  config.timeout = 10.0
end

Yields:

  • (config)

    Configure the ConfigService client.

Yield Parameters:



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
# File 'lib/google/cloud/logging/v2/config_service/client.rb', line 150

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/logging/v2/logging_config_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 == Client.configure.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

  @config_service_stub = ::Gapic::ServiceStub.new(
    ::Google::Cloud::Logging::V2::ConfigServiceV2::Stub,
    credentials:  credentials,
    endpoint:     @config.endpoint,
    channel_args: @config.channel_args,
    interceptors: @config.interceptors
  )
end

Class Method Details

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

Configure the ConfigService Client class.

See Configuration for a description of the configuration fields.

Examples:


# Modify the configuration for all ConfigService clients
::Google::Cloud::Logging::V2::ConfigService::Client.configure do |config|
  config.timeout = 10.0
end

Yields:

  • (config)

    Configure the Client client.

Yield Parameters:

Returns:



56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
# File 'lib/google/cloud/logging/v2/config_service/client.rb', line 56

def self.configure
  @configure ||= begin
    namespace = ["Google", "Cloud", "Logging", "V2"]
    parent_config = while namespace.any?
                      parent_name = namespace.join "::"
                      parent_const = const_get parent_name
                      break parent_const.configure if parent_const.respond_to? :configure
                      namespace.pop
                    end
    default_config = Client::Configuration.new parent_config

    default_config.rpcs.list_sinks.timeout = 60.0
    default_config.rpcs.list_sinks.retry_policy = {
      initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 13, 14]
    }

    default_config.rpcs.get_sink.timeout = 60.0
    default_config.rpcs.get_sink.retry_policy = {
      initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 13, 14]
    }

    default_config.rpcs.create_sink.timeout = 120.0

    default_config.rpcs.update_sink.timeout = 60.0
    default_config.rpcs.update_sink.retry_policy = {
      initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 13, 14]
    }

    default_config.rpcs.delete_sink.timeout = 60.0
    default_config.rpcs.delete_sink.retry_policy = {
      initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 13, 14]
    }

    default_config.rpcs.list_exclusions.timeout = 60.0
    default_config.rpcs.list_exclusions.retry_policy = {
      initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 13, 14]
    }

    default_config.rpcs.get_exclusion.timeout = 60.0
    default_config.rpcs.get_exclusion.retry_policy = {
      initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 13, 14]
    }

    default_config.rpcs.create_exclusion.timeout = 120.0

    default_config.rpcs.update_exclusion.timeout = 120.0

    default_config.rpcs.delete_exclusion.timeout = 60.0
    default_config.rpcs.delete_exclusion.retry_policy = {
      initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 13, 14]
    }

    default_config
  end
  yield @configure if block_given?
  @configure
end

Instance Method Details

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

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



129
130
131
132
# File 'lib/google/cloud/logging/v2/config_service/client.rb', line 129

def configure
  yield @config if block_given?
  @config
end

#create_bucket(request, options = nil) ⇒ ::Google::Cloud::Logging::V2::LogBucket #create_bucket(parent: nil, bucket_id: nil, bucket: nil) ⇒ ::Google::Cloud::Logging::V2::LogBucket

Creates a bucket that can be used to store log entries. Once a bucket has been created, the region cannot be changed.

Examples:

Basic example

require "google/cloud/logging/v2"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Logging::V2::ConfigService::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Logging::V2::CreateBucketRequest.new

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

# The returned object is of type Google::Cloud::Logging::V2::LogBucket.
p result

Overloads:

  • #create_bucket(request, options = nil) ⇒ ::Google::Cloud::Logging::V2::LogBucket

    Pass arguments to create_bucket via a request object, either of type Google::Cloud::Logging::V2::CreateBucketRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::Logging::V2::CreateBucketRequest, ::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_bucket(parent: nil, bucket_id: nil, bucket: nil) ⇒ ::Google::Cloud::Logging::V2::LogBucket

    Pass arguments to create_bucket 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 in which to create the bucket:

      "projects/[PROJECT_ID]/locations/[LOCATION_ID]"
      

      Example: "projects/my-logging-project/locations/global"

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

      Required. A client-assigned identifier such as "my-bucket". Identifiers are limited to 100 characters and can include only letters, digits, underscores, hyphens, and periods.

    • bucket (::Google::Cloud::Logging::V2::LogBucket, ::Hash) (defaults to: nil)

      Required. The new bucket. The region specified in the new bucket must be compliant with any Location Restriction Org Policy. The name field in the bucket is ignored.

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

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

    if the RPC is aborted.



448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
# File 'lib/google/cloud/logging/v2/config_service/client.rb', line 448

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

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Logging::V2::CreateBucketRequest

  # 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_bucket..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::Logging::V2::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_bucket.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.create_bucket.retry_policy

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

  @config_service_stub.call_rpc :create_bucket, 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_exclusion(request, options = nil) ⇒ ::Google::Cloud::Logging::V2::LogExclusion #create_exclusion(parent: nil, exclusion: nil) ⇒ ::Google::Cloud::Logging::V2::LogExclusion

Creates a new exclusion in a specified parent resource. Only log entries belonging to that resource can be excluded. You can have up to 10 exclusions in a resource.

Examples:

Basic example

require "google/cloud/logging/v2"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Logging::V2::ConfigService::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Logging::V2::CreateExclusionRequest.new

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

# The returned object is of type Google::Cloud::Logging::V2::LogExclusion.
p result

Overloads:

  • #create_exclusion(request, options = nil) ⇒ ::Google::Cloud::Logging::V2::LogExclusion

    Pass arguments to create_exclusion via a request object, either of type Google::Cloud::Logging::V2::CreateExclusionRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::Logging::V2::CreateExclusionRequest, ::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_exclusion(parent: nil, exclusion: nil) ⇒ ::Google::Cloud::Logging::V2::LogExclusion

    Pass arguments to create_exclusion 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 parent resource in which to create the exclusion:

      "projects/[PROJECT_ID]"
      "organizations/[ORGANIZATION_ID]"
      "billingAccounts/[BILLING_ACCOUNT_ID]"
      "folders/[FOLDER_ID]"
      

      Examples: "projects/my-logging-project", "organizations/123456789".

    • exclusion (::Google::Cloud::Logging::V2::LogExclusion, ::Hash) (defaults to: nil)

      Required. The new exclusion, whose name parameter is an exclusion name that is not already used in the parent resource.

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

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

    if the RPC is aborted.



2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
# File 'lib/google/cloud/logging/v2/config_service/client.rb', line 2057

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

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Logging::V2::CreateExclusionRequest

  # 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_exclusion..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::Logging::V2::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_exclusion.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.create_exclusion.retry_policy

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

  @config_service_stub.call_rpc :create_exclusion, 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_sink(request, options = nil) ⇒ ::Google::Cloud::Logging::V2::LogSink #create_sink(parent: nil, sink: nil, unique_writer_identity: nil) ⇒ ::Google::Cloud::Logging::V2::LogSink

Creates a sink that exports specified log entries to a destination. The export of newly-ingested log entries begins immediately, unless the sink's writer_identity is not permitted to write to the destination. A sink can export log entries only from the resource owning the sink.

Examples:

Basic example

require "google/cloud/logging/v2"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Logging::V2::ConfigService::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Logging::V2::CreateSinkRequest.new

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

# The returned object is of type Google::Cloud::Logging::V2::LogSink.
p result

Overloads:

  • #create_sink(request, options = nil) ⇒ ::Google::Cloud::Logging::V2::LogSink

    Pass arguments to create_sink via a request object, either of type Google::Cloud::Logging::V2::CreateSinkRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::Logging::V2::CreateSinkRequest, ::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_sink(parent: nil, sink: nil, unique_writer_identity: nil) ⇒ ::Google::Cloud::Logging::V2::LogSink

    Pass arguments to create_sink 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 in which to create the sink:

      "projects/[PROJECT_ID]"
      "organizations/[ORGANIZATION_ID]"
      "billingAccounts/[BILLING_ACCOUNT_ID]"
      "folders/[FOLDER_ID]"
      

      Examples: "projects/my-logging-project", "organizations/123456789".

    • sink (::Google::Cloud::Logging::V2::LogSink, ::Hash) (defaults to: nil)

      Required. The new sink, whose name parameter is a sink identifier that is not already in use.

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

      Optional. Determines the kind of IAM identity returned as writer_identity in the new sink. If this value is omitted or set to false, and if the sink's parent is a project, then the value returned as writer_identity is the same group or service account used by Logging before the addition of writer identities to this API. The sink's destination must be in the same project as the sink itself.

      If this field is set to true, or if the sink is owned by a non-project resource such as an organization, then the value of writer_identity will be a unique service account used only for exports from the new sink. For more information, see writer_identity in LogSink.

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

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

    if the RPC is aborted.



1541
1542
1543
1544
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
# File 'lib/google/cloud/logging/v2/config_service/client.rb', line 1541

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

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Logging::V2::CreateSinkRequest

  # 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_sink..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::Logging::V2::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_sink.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.create_sink.retry_policy

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

  @config_service_stub.call_rpc :create_sink, 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_view(request, options = nil) ⇒ ::Google::Cloud::Logging::V2::LogView #create_view(parent: nil, view_id: nil, view: nil) ⇒ ::Google::Cloud::Logging::V2::LogView

Creates a view over logs in a bucket. A bucket may contain a maximum of 50 views.

Examples:

Basic example

require "google/cloud/logging/v2"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Logging::V2::ConfigService::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Logging::V2::CreateViewRequest.new

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

# The returned object is of type Google::Cloud::Logging::V2::LogView.
p result

Overloads:

  • #create_view(request, options = nil) ⇒ ::Google::Cloud::Logging::V2::LogView

    Pass arguments to create_view via a request object, either of type Google::Cloud::Logging::V2::CreateViewRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::Logging::V2::CreateViewRequest, ::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_view(parent: nil, view_id: nil, view: nil) ⇒ ::Google::Cloud::Logging::V2::LogView

    Pass arguments to create_view 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 bucket in which to create the view

      "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]"
      

      Example: "projects/my-logging-project/locations/my-location/buckets/my-bucket"

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

      Required. The id to use for this view.

    • view (::Google::Cloud::Logging::V2::LogView, ::Hash) (defaults to: nil)

      Required. The new view.

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

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

    if the RPC is aborted.



1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
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
# File 'lib/google/cloud/logging/v2/config_service/client.rb', line 1041

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

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Logging::V2::CreateViewRequest

  # 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_view..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::Logging::V2::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_view.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.create_view.retry_policy

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

  @config_service_stub.call_rpc :create_view, 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_bucket(request, options = nil) ⇒ ::Google::Protobuf::Empty #delete_bucket(name: nil) ⇒ ::Google::Protobuf::Empty

Deletes a bucket. Moves the bucket to the DELETE_REQUESTED state. After 7 days, the bucket will be purged and all logs in the bucket will be permanently deleted.

Examples:

Basic example

require "google/cloud/logging/v2"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Logging::V2::ConfigService::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Logging::V2::DeleteBucketRequest.new

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

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

Overloads:

  • #delete_bucket(request, options = nil) ⇒ ::Google::Protobuf::Empty

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

    Parameters:

    • request (::Google::Cloud::Logging::V2::DeleteBucketRequest, ::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_bucket(name: nil) ⇒ ::Google::Protobuf::Empty

    Pass arguments to delete_bucket 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 full resource name of the bucket to delete.

      "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]"
      "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]"
      "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]"
      "folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]"
      

      Example: "projects/my-project-id/locations/my-location/buckets/my-bucket-id".

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

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

    if the RPC is aborted.



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
686
687
688
689
690
691
692
693
694
695
696
697
698
# File 'lib/google/cloud/logging/v2/config_service/client.rb', line 659

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

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Logging::V2::DeleteBucketRequest

  # 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_bucket..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::Logging::V2::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_bucket.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.delete_bucket.retry_policy

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

  @config_service_stub.call_rpc :delete_bucket, 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_exclusion(request, options = nil) ⇒ ::Google::Protobuf::Empty #delete_exclusion(name: nil) ⇒ ::Google::Protobuf::Empty

Deletes an exclusion.

Examples:

Basic example

require "google/cloud/logging/v2"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Logging::V2::ConfigService::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Logging::V2::DeleteExclusionRequest.new

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

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

Overloads:

  • #delete_exclusion(request, options = nil) ⇒ ::Google::Protobuf::Empty

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

    Parameters:

    • request (::Google::Cloud::Logging::V2::DeleteExclusionRequest, ::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_exclusion(name: nil) ⇒ ::Google::Protobuf::Empty

    Pass arguments to delete_exclusion 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 resource name of an existing exclusion to delete:

      "projects/[PROJECT_ID]/exclusions/[EXCLUSION_ID]"
      "organizations/[ORGANIZATION_ID]/exclusions/[EXCLUSION_ID]"
      "billingAccounts/[BILLING_ACCOUNT_ID]/exclusions/[EXCLUSION_ID]"
      "folders/[FOLDER_ID]/exclusions/[EXCLUSION_ID]"
      

      Example: "projects/my-project-id/exclusions/my-exclusion-id".

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

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

    if the RPC is aborted.



2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
# File 'lib/google/cloud/logging/v2/config_service/client.rb', line 2252

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

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Logging::V2::DeleteExclusionRequest

  # 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_exclusion..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::Logging::V2::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_exclusion.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.delete_exclusion.retry_policy

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

  @config_service_stub.call_rpc :delete_exclusion, 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_sink(request, options = nil) ⇒ ::Google::Protobuf::Empty #delete_sink(sink_name: nil) ⇒ ::Google::Protobuf::Empty

Deletes a sink. If the sink has a unique writer_identity, then that service account is also deleted.

Examples:

Basic example

require "google/cloud/logging/v2"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Logging::V2::ConfigService::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Logging::V2::DeleteSinkRequest.new

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

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

Overloads:

  • #delete_sink(request, options = nil) ⇒ ::Google::Protobuf::Empty

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

    Parameters:

    • request (::Google::Cloud::Logging::V2::DeleteSinkRequest, ::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_sink(sink_name: nil) ⇒ ::Google::Protobuf::Empty

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

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

      Required. The full resource name of the sink to delete, including the parent resource and the sink identifier:

      "projects/[PROJECT_ID]/sinks/[SINK_ID]"
      "organizations/[ORGANIZATION_ID]/sinks/[SINK_ID]"
      "billingAccounts/[BILLING_ACCOUNT_ID]/sinks/[SINK_ID]"
      "folders/[FOLDER_ID]/sinks/[SINK_ID]"
      

      Example: "projects/my-project-id/sinks/my-sink-id".

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

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

    if the RPC is aborted.



1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
# File 'lib/google/cloud/logging/v2/config_service/client.rb', line 1762

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

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Logging::V2::DeleteSinkRequest

  # 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_sink..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::Logging::V2::VERSION
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.sink_name
    header_params["sink_name"] = request.sink_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_sink.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.delete_sink.retry_policy

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

  @config_service_stub.call_rpc :delete_sink, 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_view(request, options = nil) ⇒ ::Google::Protobuf::Empty #delete_view(name: nil) ⇒ ::Google::Protobuf::Empty

Deletes a view from a bucket.

Examples:

Basic example

require "google/cloud/logging/v2"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Logging::V2::ConfigService::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Logging::V2::DeleteViewRequest.new

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

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

Overloads:

  • #delete_view(request, options = nil) ⇒ ::Google::Protobuf::Empty

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

    Parameters:

    • request (::Google::Cloud::Logging::V2::DeleteViewRequest, ::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_view(name: nil) ⇒ ::Google::Protobuf::Empty

    Pass arguments to delete_view 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 full resource name of the view to delete:

      "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]"
      

      Example: "projects/my-project-id/locations/my-location/buckets/my-bucket-id/views/my-view-id".

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

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

    if the RPC is aborted.



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
1272
# File 'lib/google/cloud/logging/v2/config_service/client.rb', line 1233

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

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Logging::V2::DeleteViewRequest

  # 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_view..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::Logging::V2::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_view.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.delete_view.retry_policy

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

  @config_service_stub.call_rpc :delete_view, 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_bucket(request, options = nil) ⇒ ::Google::Cloud::Logging::V2::LogBucket #get_bucket(name: nil) ⇒ ::Google::Cloud::Logging::V2::LogBucket

Gets a bucket.

Examples:

Basic example

require "google/cloud/logging/v2"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Logging::V2::ConfigService::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Logging::V2::GetBucketRequest.new

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

# The returned object is of type Google::Cloud::Logging::V2::LogBucket.
p result

Overloads:

  • #get_bucket(request, options = nil) ⇒ ::Google::Cloud::Logging::V2::LogBucket

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

    Parameters:

    • request (::Google::Cloud::Logging::V2::GetBucketRequest, ::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_bucket(name: nil) ⇒ ::Google::Cloud::Logging::V2::LogBucket

    Pass arguments to get_bucket 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 resource name of the bucket:

      "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]"
      "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]"
      "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]"
      "folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]"
      

      Example: "projects/my-project-id/locations/my-location/buckets/my-bucket-id".

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

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

    if the RPC is aborted.



350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
# File 'lib/google/cloud/logging/v2/config_service/client.rb', line 350

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

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Logging::V2::GetBucketRequest

  # 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_bucket..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::Logging::V2::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_bucket.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.get_bucket.retry_policy

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

  @config_service_stub.call_rpc :get_bucket, 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_cmek_settings(request, options = nil) ⇒ ::Google::Cloud::Logging::V2::CmekSettings #get_cmek_settings(name: nil) ⇒ ::Google::Cloud::Logging::V2::CmekSettings

Gets the Logs Router CMEK settings for the given resource.

Note: CMEK for the Logs Router can currently only be configured for GCP organizations. Once configured, it applies to all projects and folders in the GCP organization.

See Enabling CMEK for Logs Router for more information.

Examples:

Basic example

require "google/cloud/logging/v2"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Logging::V2::ConfigService::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Logging::V2::GetCmekSettingsRequest.new

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

# The returned object is of type Google::Cloud::Logging::V2::CmekSettings.
p result

Overloads:

  • #get_cmek_settings(request, options = nil) ⇒ ::Google::Cloud::Logging::V2::CmekSettings

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

    Parameters:

    • request (::Google::Cloud::Logging::V2::GetCmekSettingsRequest, ::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_cmek_settings(name: nil) ⇒ ::Google::Cloud::Logging::V2::CmekSettings

    Pass arguments to get_cmek_settings 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 resource for which to retrieve CMEK settings.

      "projects/[PROJECT_ID]/cmekSettings"
      "organizations/[ORGANIZATION_ID]/cmekSettings"
      "billingAccounts/[BILLING_ACCOUNT_ID]/cmekSettings"
      "folders/[FOLDER_ID]/cmekSettings"
      

      Example: "organizations/12345/cmekSettings".

      Note: CMEK for the Logs Router can currently only be configured for GCP organizations. Once configured, it applies to all projects and folders in the GCP organization.

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

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

    if the RPC is aborted.



2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
# File 'lib/google/cloud/logging/v2/config_service/client.rb', line 2356

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

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Logging::V2::GetCmekSettingsRequest

  # 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_cmek_settings..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::Logging::V2::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_cmek_settings.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.get_cmek_settings.retry_policy

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

  @config_service_stub.call_rpc :get_cmek_settings, 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_exclusion(request, options = nil) ⇒ ::Google::Cloud::Logging::V2::LogExclusion #get_exclusion(name: nil) ⇒ ::Google::Cloud::Logging::V2::LogExclusion

Gets the description of an exclusion.

Examples:

Basic example

require "google/cloud/logging/v2"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Logging::V2::ConfigService::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Logging::V2::GetExclusionRequest.new

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

# The returned object is of type Google::Cloud::Logging::V2::LogExclusion.
p result

Overloads:

  • #get_exclusion(request, options = nil) ⇒ ::Google::Cloud::Logging::V2::LogExclusion

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

    Parameters:

    • request (::Google::Cloud::Logging::V2::GetExclusionRequest, ::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_exclusion(name: nil) ⇒ ::Google::Cloud::Logging::V2::LogExclusion

    Pass arguments to get_exclusion 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 resource name of an existing exclusion:

      "projects/[PROJECT_ID]/exclusions/[EXCLUSION_ID]"
      "organizations/[ORGANIZATION_ID]/exclusions/[EXCLUSION_ID]"
      "billingAccounts/[BILLING_ACCOUNT_ID]/exclusions/[EXCLUSION_ID]"
      "folders/[FOLDER_ID]/exclusions/[EXCLUSION_ID]"
      

      Example: "projects/my-project-id/exclusions/my-exclusion-id".

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

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

    if the RPC is aborted.



1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
# File 'lib/google/cloud/logging/v2/config_service/client.rb', line 1960

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

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Logging::V2::GetExclusionRequest

  # 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_exclusion..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::Logging::V2::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_exclusion.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.get_exclusion.retry_policy

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

  @config_service_stub.call_rpc :get_exclusion, 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_sink(request, options = nil) ⇒ ::Google::Cloud::Logging::V2::LogSink #get_sink(sink_name: nil) ⇒ ::Google::Cloud::Logging::V2::LogSink

Gets a sink.

Examples:

Basic example

require "google/cloud/logging/v2"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Logging::V2::ConfigService::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Logging::V2::GetSinkRequest.new

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

# The returned object is of type Google::Cloud::Logging::V2::LogSink.
p result

Overloads:

  • #get_sink(request, options = nil) ⇒ ::Google::Cloud::Logging::V2::LogSink

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

    Parameters:

    • request (::Google::Cloud::Logging::V2::GetSinkRequest, ::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_sink(sink_name: nil) ⇒ ::Google::Cloud::Logging::V2::LogSink

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

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

      Required. The resource name of the sink:

      "projects/[PROJECT_ID]/sinks/[SINK_ID]"
      "organizations/[ORGANIZATION_ID]/sinks/[SINK_ID]"
      "billingAccounts/[BILLING_ACCOUNT_ID]/sinks/[SINK_ID]"
      "folders/[FOLDER_ID]/sinks/[SINK_ID]"
      

      Example: "projects/my-project-id/sinks/my-sink-id".

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

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

    if the RPC is aborted.



1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
# File 'lib/google/cloud/logging/v2/config_service/client.rb', line 1431

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

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Logging::V2::GetSinkRequest

  # 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_sink..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::Logging::V2::VERSION
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.sink_name
    header_params["sink_name"] = request.sink_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_sink.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.get_sink.retry_policy

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

  @config_service_stub.call_rpc :get_sink, 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_view(request, options = nil) ⇒ ::Google::Cloud::Logging::V2::LogView #get_view(name: nil) ⇒ ::Google::Cloud::Logging::V2::LogView

Gets a view.

Examples:

Basic example

require "google/cloud/logging/v2"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Logging::V2::ConfigService::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Logging::V2::GetViewRequest.new

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

# The returned object is of type Google::Cloud::Logging::V2::LogView.
p result

Overloads:

  • #get_view(request, options = nil) ⇒ ::Google::Cloud::Logging::V2::LogView

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

    Parameters:

    • request (::Google::Cloud::Logging::V2::GetViewRequest, ::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_view(name: nil) ⇒ ::Google::Cloud::Logging::V2::LogView

    Pass arguments to get_view 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 resource name of the policy:

      "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]"
      

      Example: "projects/my-project-id/locations/my-location/buckets/my-bucket-id/views/my-view-id".

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

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

    if the RPC is aborted.



946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
# File 'lib/google/cloud/logging/v2/config_service/client.rb', line 946

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

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Logging::V2::GetViewRequest

  # 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_view..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::Logging::V2::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_view.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.get_view.retry_policy

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

  @config_service_stub.call_rpc :get_view, 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_buckets(request, options = nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::Logging::V2::LogBucket> #list_buckets(parent: nil, page_token: nil, page_size: nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::Logging::V2::LogBucket>

Lists buckets.

Examples:

Basic example

require "google/cloud/logging/v2"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Logging::V2::ConfigService::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Logging::V2::ListBucketsRequest.new

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

# The returned object is of type Gapic::PagedEnumerable. You can
# iterate over all elements by calling #each, and the enumerable
# will lazily make API calls to fetch subsequent pages. Other
# methods are also available for managing paging directly.
result.each do |response|
  # Each element is of type ::Google::Cloud::Logging::V2::LogBucket.
  p response
end

Overloads:

  • #list_buckets(request, options = nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::Logging::V2::LogBucket>

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

    Parameters:

    • request (::Google::Cloud::Logging::V2::ListBucketsRequest, ::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_buckets(parent: nil, page_token: nil, page_size: nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::Logging::V2::LogBucket>

    Pass arguments to list_buckets 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 parent resource whose buckets are to be listed:

      "projects/[PROJECT_ID]/locations/[LOCATION_ID]"
      "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]"
      "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]"
      "folders/[FOLDER_ID]/locations/[LOCATION_ID]"
      

      Note: The locations portion of the resource must be specified, but supplying the character - in place of [LOCATION_ID] will return all buckets.

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

      Optional. If present, then retrieve the next batch of results from the preceding call to this method. pageToken must be the value of nextPageToken from the previous response. The values of other method parameters should be identical to those in the previous call.

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

      Optional. The maximum number of results to return from this request. Non-positive values are ignored. The presence of nextPageToken in the response indicates that more results might be available.

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

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

    if the RPC is aborted.



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
292
293
294
295
296
# File 'lib/google/cloud/logging/v2/config_service/client.rb', line 256

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

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Logging::V2::ListBucketsRequest

  # 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_buckets..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::Logging::V2::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_buckets.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.list_buckets.retry_policy

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

  @config_service_stub.call_rpc :list_buckets, request, options: options do |response, operation|
    response = ::Gapic::PagedEnumerable.new @config_service_stub, :list_buckets, 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_exclusions(request, options = nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::Logging::V2::LogExclusion> #list_exclusions(parent: nil, page_token: nil, page_size: nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::Logging::V2::LogExclusion>

Lists all the exclusions in a parent resource.

Examples:

Basic example

require "google/cloud/logging/v2"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Logging::V2::ConfigService::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Logging::V2::ListExclusionsRequest.new

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

# The returned object is of type Gapic::PagedEnumerable. You can
# iterate over all elements by calling #each, and the enumerable
# will lazily make API calls to fetch subsequent pages. Other
# methods are also available for managing paging directly.
result.each do |response|
  # Each element is of type ::Google::Cloud::Logging::V2::LogExclusion.
  p response
end

Overloads:

  • #list_exclusions(request, options = nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::Logging::V2::LogExclusion>

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

    Parameters:

    • request (::Google::Cloud::Logging::V2::ListExclusionsRequest, ::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_exclusions(parent: nil, page_token: nil, page_size: nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::Logging::V2::LogExclusion>

    Pass arguments to list_exclusions 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 parent resource whose exclusions are to be listed.

      "projects/[PROJECT_ID]"
      "organizations/[ORGANIZATION_ID]"
      "billingAccounts/[BILLING_ACCOUNT_ID]"
      "folders/[FOLDER_ID]"
      
    • page_token (::String) (defaults to: nil)

      Optional. If present, then retrieve the next batch of results from the preceding call to this method. pageToken must be the value of nextPageToken from the previous response. The values of other method parameters should be identical to those in the previous call.

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

      Optional. The maximum number of results to return from this request. Non-positive values are ignored. The presence of nextPageToken in the response indicates that more results might be available.

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

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

    if the RPC is aborted.



1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
# File 'lib/google/cloud/logging/v2/config_service/client.rb', line 1867

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

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Logging::V2::ListExclusionsRequest

  # 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_exclusions..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::Logging::V2::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_exclusions.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.list_exclusions.retry_policy

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

  @config_service_stub.call_rpc :list_exclusions, request, options: options do |response, operation|
    response = ::Gapic::PagedEnumerable.new @config_service_stub, :list_exclusions, 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_sinks(request, options = nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::Logging::V2::LogSink> #list_sinks(parent: nil, page_token: nil, page_size: nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::Logging::V2::LogSink>

Lists sinks.

Examples:

Basic example

require "google/cloud/logging/v2"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Logging::V2::ConfigService::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Logging::V2::ListSinksRequest.new

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

# The returned object is of type Gapic::PagedEnumerable. You can
# iterate over all elements by calling #each, and the enumerable
# will lazily make API calls to fetch subsequent pages. Other
# methods are also available for managing paging directly.
result.each do |response|
  # Each element is of type ::Google::Cloud::Logging::V2::LogSink.
  p response
end

Overloads:

  • #list_sinks(request, options = nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::Logging::V2::LogSink>

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

    Parameters:

    • request (::Google::Cloud::Logging::V2::ListSinksRequest, ::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_sinks(parent: nil, page_token: nil, page_size: nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::Logging::V2::LogSink>

    Pass arguments to list_sinks 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 parent resource whose sinks are to be listed:

      "projects/[PROJECT_ID]"
      "organizations/[ORGANIZATION_ID]"
      "billingAccounts/[BILLING_ACCOUNT_ID]"
      "folders/[FOLDER_ID]"
      
    • page_token (::String) (defaults to: nil)

      Optional. If present, then retrieve the next batch of results from the preceding call to this method. pageToken must be the value of nextPageToken from the previous response. The values of other method parameters should be identical to those in the previous call.

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

      Optional. The maximum number of results to return from this request. Non-positive values are ignored. The presence of nextPageToken in the response indicates that more results might be available.

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

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

    if the RPC is aborted.



1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
# File 'lib/google/cloud/logging/v2/config_service/client.rb', line 1338

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

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Logging::V2::ListSinksRequest

  # 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_sinks..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::Logging::V2::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_sinks.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.list_sinks.retry_policy

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

  @config_service_stub.call_rpc :list_sinks, request, options: options do |response, operation|
    response = ::Gapic::PagedEnumerable.new @config_service_stub, :list_sinks, 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_views(request, options = nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::Logging::V2::LogView> #list_views(parent: nil, page_token: nil, page_size: nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::Logging::V2::LogView>

Lists views on a bucket.

Examples:

Basic example

require "google/cloud/logging/v2"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Logging::V2::ConfigService::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Logging::V2::ListViewsRequest.new

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

# The returned object is of type Gapic::PagedEnumerable. You can
# iterate over all elements by calling #each, and the enumerable
# will lazily make API calls to fetch subsequent pages. Other
# methods are also available for managing paging directly.
result.each do |response|
  # Each element is of type ::Google::Cloud::Logging::V2::LogView.
  p response
end

Overloads:

  • #list_views(request, options = nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::Logging::V2::LogView>

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

    Parameters:

    • request (::Google::Cloud::Logging::V2::ListViewsRequest, ::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_views(parent: nil, page_token: nil, page_size: nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::Logging::V2::LogView>

    Pass arguments to list_views 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 bucket whose views are to be listed:

      "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]"
      
    • page_token (::String) (defaults to: nil)

      Optional. If present, then retrieve the next batch of results from the preceding call to this method. pageToken must be the value of nextPageToken from the previous response. The values of other method parameters should be identical to those in the previous call.

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

      Optional. The maximum number of results to return from this request. Non-positive values are ignored. The presence of nextPageToken in the response indicates that more results might be available.

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

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

    if the RPC is aborted.



855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
# File 'lib/google/cloud/logging/v2/config_service/client.rb', line 855

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

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Logging::V2::ListViewsRequest

  # 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_views..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::Logging::V2::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_views.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.list_views.retry_policy

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

  @config_service_stub.call_rpc :list_views, request, options: options do |response, operation|
    response = ::Gapic::PagedEnumerable.new @config_service_stub, :list_views, 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

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

Undeletes a bucket. A bucket that has been deleted may be undeleted within the grace period of 7 days.

Examples:

Basic example

require "google/cloud/logging/v2"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Logging::V2::ConfigService::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Logging::V2::UndeleteBucketRequest.new

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

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

Overloads:

  • #undelete_bucket(request, options = nil) ⇒ ::Google::Protobuf::Empty

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

    Parameters:

    • request (::Google::Cloud::Logging::V2::UndeleteBucketRequest, ::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_bucket(name: nil) ⇒ ::Google::Protobuf::Empty

    Pass arguments to undelete_bucket 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 full resource name of the bucket to undelete.

      "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]"
      "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]"
      "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]"
      "folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]"
      

      Example: "projects/my-project-id/locations/my-location/buckets/my-bucket-id".

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

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

    if the RPC is aborted.



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
781
782
783
784
785
786
787
788
789
790
791
792
# File 'lib/google/cloud/logging/v2/config_service/client.rb', line 753

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

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Logging::V2::UndeleteBucketRequest

  # 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_bucket..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::Logging::V2::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.undelete_bucket.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.undelete_bucket.retry_policy

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

  @config_service_stub.call_rpc :undelete_bucket, 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_bucket(request, options = nil) ⇒ ::Google::Cloud::Logging::V2::LogBucket #update_bucket(name: nil, bucket: nil, update_mask: nil) ⇒ ::Google::Cloud::Logging::V2::LogBucket

Updates a bucket. This method replaces the following fields in the existing bucket with values from the new bucket: retention_period

If the retention period is decreased and the bucket is locked, FAILED_PRECONDITION will be returned.

If the bucket has a LifecycleState of DELETE_REQUESTED, FAILED_PRECONDITION will be returned.

A buckets region may not be modified after it is created.

Examples:

Basic example

require "google/cloud/logging/v2"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Logging::V2::ConfigService::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Logging::V2::UpdateBucketRequest.new

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

# The returned object is of type Google::Cloud::Logging::V2::LogBucket.
p result

Overloads:

  • #update_bucket(request, options = nil) ⇒ ::Google::Cloud::Logging::V2::LogBucket

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

    Parameters:

    • request (::Google::Cloud::Logging::V2::UpdateBucketRequest, ::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.

  • #update_bucket(name: nil, bucket: nil, update_mask: nil) ⇒ ::Google::Cloud::Logging::V2::LogBucket

    Pass arguments to update_bucket 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 full resource name of the bucket to update.

      "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]"
      "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]"
      "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]"
      "folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]"
      

      Example: "projects/my-project-id/locations/my-location/buckets/my-bucket-id". Also requires permission "resourcemanager.projects.updateLiens" to set the locked property

    • bucket (::Google::Cloud::Logging::V2::LogBucket, ::Hash) (defaults to: nil)

      Required. The updated bucket.

    • update_mask (::Google::Protobuf::FieldMask, ::Hash) (defaults to: nil)

      Required. Field mask that specifies the fields in bucket that need an update. A bucket field will be overwritten if, and only if, it is in the update mask. name and output only fields cannot be updated.

      For a detailed FieldMask definition, see https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#google.protobuf.FieldMask

      Example: updateMask=retention_days.

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

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

    if the RPC is aborted.



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
600
601
602
# File 'lib/google/cloud/logging/v2/config_service/client.rb', line 563

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

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Logging::V2::UpdateBucketRequest

  # 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_bucket..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::Logging::V2::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.update_bucket.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.update_bucket.retry_policy

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

  @config_service_stub.call_rpc :update_bucket, 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_cmek_settings(request, options = nil) ⇒ ::Google::Cloud::Logging::V2::CmekSettings #update_cmek_settings(name: nil, cmek_settings: nil, update_mask: nil) ⇒ ::Google::Cloud::Logging::V2::CmekSettings

Updates the Logs Router CMEK settings for the given resource.

Note: CMEK for the Logs Router can currently only be configured for GCP organizations. Once configured, it applies to all projects and folders in the GCP organization.

UpdateCmekSettings will fail if 1) kms_key_name is invalid, or 2) the associated service account does not have the required roles/cloudkms.cryptoKeyEncrypterDecrypter role assigned for the key, or 3) access to the key is disabled.

See Enabling CMEK for Logs Router for more information.

Examples:

Basic example

require "google/cloud/logging/v2"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Logging::V2::ConfigService::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Logging::V2::UpdateCmekSettingsRequest.new

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

# The returned object is of type Google::Cloud::Logging::V2::CmekSettings.
p result

Overloads:

  • #update_cmek_settings(request, options = nil) ⇒ ::Google::Cloud::Logging::V2::CmekSettings

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

    Parameters:

    • request (::Google::Cloud::Logging::V2::UpdateCmekSettingsRequest, ::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.

  • #update_cmek_settings(name: nil, cmek_settings: nil, update_mask: nil) ⇒ ::Google::Cloud::Logging::V2::CmekSettings

    Pass arguments to update_cmek_settings 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 resource name for the CMEK settings to update.

      "projects/[PROJECT_ID]/cmekSettings"
      "organizations/[ORGANIZATION_ID]/cmekSettings"
      "billingAccounts/[BILLING_ACCOUNT_ID]/cmekSettings"
      "folders/[FOLDER_ID]/cmekSettings"
      

      Example: "organizations/12345/cmekSettings".

      Note: CMEK for the Logs Router can currently only be configured for GCP organizations. Once configured, it applies to all projects and folders in the GCP organization.

    • cmek_settings (::Google::Cloud::Logging::V2::CmekSettings, ::Hash) (defaults to: nil)

      Required. The CMEK settings to update.

      See Enabling CMEK for Logs Router for more information.

    • update_mask (::Google::Protobuf::FieldMask, ::Hash) (defaults to: nil)

      Optional. Field mask identifying which fields from cmek_settings should be updated. A field will be overwritten if and only if it is in the update mask. Output only fields cannot be updated.

      See FieldMask for more information.

      Example: "updateMask=kmsKeyName"

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

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

    if the RPC is aborted.



2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
# File 'lib/google/cloud/logging/v2/config_service/client.rb', line 2480

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

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Logging::V2::UpdateCmekSettingsRequest

  # 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_cmek_settings..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::Logging::V2::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.update_cmek_settings.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.update_cmek_settings.retry_policy

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

  @config_service_stub.call_rpc :update_cmek_settings, 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_exclusion(request, options = nil) ⇒ ::Google::Cloud::Logging::V2::LogExclusion #update_exclusion(name: nil, exclusion: nil, update_mask: nil) ⇒ ::Google::Cloud::Logging::V2::LogExclusion

Changes one or more properties of an existing exclusion.

Examples:

Basic example

require "google/cloud/logging/v2"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Logging::V2::ConfigService::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Logging::V2::UpdateExclusionRequest.new

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

# The returned object is of type Google::Cloud::Logging::V2::LogExclusion.
p result

Overloads:

  • #update_exclusion(request, options = nil) ⇒ ::Google::Cloud::Logging::V2::LogExclusion

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

    Parameters:

    • request (::Google::Cloud::Logging::V2::UpdateExclusionRequest, ::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.

  • #update_exclusion(name: nil, exclusion: nil, update_mask: nil) ⇒ ::Google::Cloud::Logging::V2::LogExclusion

    Pass arguments to update_exclusion 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 resource name of the exclusion to update:

      "projects/[PROJECT_ID]/exclusions/[EXCLUSION_ID]"
      "organizations/[ORGANIZATION_ID]/exclusions/[EXCLUSION_ID]"
      "billingAccounts/[BILLING_ACCOUNT_ID]/exclusions/[EXCLUSION_ID]"
      "folders/[FOLDER_ID]/exclusions/[EXCLUSION_ID]"
      

      Example: "projects/my-project-id/exclusions/my-exclusion-id".

    • exclusion (::Google::Cloud::Logging::V2::LogExclusion, ::Hash) (defaults to: nil)

      Required. New values for the existing exclusion. Only the fields specified in update_mask are relevant.

    • update_mask (::Google::Protobuf::FieldMask, ::Hash) (defaults to: nil)

      Required. A non-empty list of fields to change in the existing exclusion. New values for the fields are taken from the corresponding fields in the LogExclusion included in this request. Fields not mentioned in update_mask are not changed and are ignored in the request.

      For example, to change the filter and description of an exclusion, specify an update_mask of "filter,description".

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

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

    if the RPC is aborted.



2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
# File 'lib/google/cloud/logging/v2/config_service/client.rb', line 2160

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

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Logging::V2::UpdateExclusionRequest

  # 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_exclusion..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::Logging::V2::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.update_exclusion.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.update_exclusion.retry_policy

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

  @config_service_stub.call_rpc :update_exclusion, 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_sink(request, options = nil) ⇒ ::Google::Cloud::Logging::V2::LogSink #update_sink(sink_name: nil, sink: nil, unique_writer_identity: nil, update_mask: nil) ⇒ ::Google::Cloud::Logging::V2::LogSink

Updates a sink. This method replaces the following fields in the existing sink with values from the new sink: destination, and filter.

The updated sink might also have a new writer_identity; see the unique_writer_identity field.

Examples:

Basic example

require "google/cloud/logging/v2"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Logging::V2::ConfigService::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Logging::V2::UpdateSinkRequest.new

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

# The returned object is of type Google::Cloud::Logging::V2::LogSink.
p result

Overloads:

  • #update_sink(request, options = nil) ⇒ ::Google::Cloud::Logging::V2::LogSink

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

    Parameters:

    • request (::Google::Cloud::Logging::V2::UpdateSinkRequest, ::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.

  • #update_sink(sink_name: nil, sink: nil, unique_writer_identity: nil, update_mask: nil) ⇒ ::Google::Cloud::Logging::V2::LogSink

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

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

      Required. The full resource name of the sink to update, including the parent resource and the sink identifier:

      "projects/[PROJECT_ID]/sinks/[SINK_ID]"
      "organizations/[ORGANIZATION_ID]/sinks/[SINK_ID]"
      "billingAccounts/[BILLING_ACCOUNT_ID]/sinks/[SINK_ID]"
      "folders/[FOLDER_ID]/sinks/[SINK_ID]"
      

      Example: "projects/my-project-id/sinks/my-sink-id".

    • sink (::Google::Cloud::Logging::V2::LogSink, ::Hash) (defaults to: nil)

      Required. The updated sink, whose name is the same identifier that appears as part of sink_name.

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

      Optional. See sinks.create for a description of this field. When updating a sink, the effect of this field on the value of writer_identity in the updated sink depends on both the old and new values of this field:

      • If the old and new values of this field are both false or both true, then there is no change to the sink's writer_identity.
      • If the old value is false and the new value is true, then writer_identity is changed to a unique service account.
      • It is an error if the old value is true and the new value is set to false or defaulted to false.
    • update_mask (::Google::Protobuf::FieldMask, ::Hash) (defaults to: nil)

      Optional. Field mask that specifies the fields in sink that need an update. A sink field will be overwritten if, and only if, it is in the update mask. name and output only fields cannot be updated.

      An empty updateMask is temporarily treated as using the following mask for backwards compatibility purposes: destination,filter,includeChildren At some point in the future, behavior will be removed and specifying an empty updateMask will be an error.

      For a detailed FieldMask definition, see https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#google.protobuf.FieldMask

      Example: updateMask=filter.

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

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

    if the RPC is aborted.



1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
# File 'lib/google/cloud/logging/v2/config_service/client.rb', line 1668

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

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Logging::V2::UpdateSinkRequest

  # 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_sink..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::Logging::V2::VERSION
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.sink_name
    header_params["sink_name"] = request.sink_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_sink.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.update_sink.retry_policy

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

  @config_service_stub.call_rpc :update_sink, 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_view(request, options = nil) ⇒ ::Google::Cloud::Logging::V2::LogView #update_view(name: nil, view: nil, update_mask: nil) ⇒ ::Google::Cloud::Logging::V2::LogView

Updates a view. This method replaces the following fields in the existing view with values from the new view: filter.

Examples:

Basic example

require "google/cloud/logging/v2"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Logging::V2::ConfigService::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Logging::V2::UpdateViewRequest.new

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

# The returned object is of type Google::Cloud::Logging::V2::LogView.
p result

Overloads:

  • #update_view(request, options = nil) ⇒ ::Google::Cloud::Logging::V2::LogView

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

    Parameters:

    • request (::Google::Cloud::Logging::V2::UpdateViewRequest, ::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.

  • #update_view(name: nil, view: nil, update_mask: nil) ⇒ ::Google::Cloud::Logging::V2::LogView

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

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

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

    if the RPC is aborted.



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
1177
1178
1179
1180
1181
1182
# File 'lib/google/cloud/logging/v2/config_service/client.rb', line 1143

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

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Logging::V2::UpdateViewRequest

  # 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_view..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::Logging::V2::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.update_view.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.update_view.retry_policy

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

  @config_service_stub.call_rpc :update_view, 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