class Google::Cloud::Monitoring::V3::NotificationChannelService::Client
Client
for the NotificationChannelService
service.
The Notification Channel API provides access to configuration that controls how messages related to incidents are sent.
Attributes
@private
Public Class Methods
Configure the NotificationChannelService
Client
class.
See {::Google::Cloud::Monitoring::V3::NotificationChannelService::Client::Configuration} for a description of the configuration fields.
@example
# Modify the configuration for all NotificationChannelService clients ::Google::Cloud::Monitoring::V3::NotificationChannelService::Client.configure do |config| config.timeout = 10.0 end
@yield [config] Configure the Client
client. @yieldparam config [Client::Configuration]
@return [Client::Configuration]
# File lib/google/cloud/monitoring/v3/notification_channel_service/client.rb, line 57 def self.configure @configure ||= begin namespace = ["Google", "Cloud", "Monitoring", "V3"] 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_notification_channel_descriptors.timeout = 30.0 default_config.rpcs.list_notification_channel_descriptors.retry_policy = { initial_delay: 0.1, max_delay: 30.0, multiplier: 1.3, retry_codes: [14] } default_config.rpcs.get_notification_channel_descriptor.timeout = 30.0 default_config.rpcs.get_notification_channel_descriptor.retry_policy = { initial_delay: 0.1, max_delay: 30.0, multiplier: 1.3, retry_codes: [14] } default_config.rpcs.list_notification_channels.timeout = 30.0 default_config.rpcs.list_notification_channels.retry_policy = { initial_delay: 0.1, max_delay: 30.0, multiplier: 1.3, retry_codes: [14] } default_config.rpcs.get_notification_channel.timeout = 30.0 default_config.rpcs.get_notification_channel.retry_policy = { initial_delay: 0.1, max_delay: 30.0, multiplier: 1.3, retry_codes: [14] } default_config.rpcs.create_notification_channel.timeout = 30.0 default_config.rpcs.update_notification_channel.timeout = 30.0 default_config.rpcs.delete_notification_channel.timeout = 30.0 default_config.rpcs.delete_notification_channel.retry_policy = { initial_delay: 0.1, max_delay: 30.0, multiplier: 1.3, retry_codes: [14] } default_config.rpcs.send_notification_channel_verification_code.timeout = 30.0 default_config.rpcs.get_notification_channel_verification_code.timeout = 30.0 default_config.rpcs.get_notification_channel_verification_code.retry_policy = { initial_delay: 0.1, max_delay: 30.0, multiplier: 1.3, retry_codes: [14] } default_config.rpcs.verify_notification_channel.timeout = 30.0 default_config.rpcs.verify_notification_channel.retry_policy = { initial_delay: 0.1, max_delay: 30.0, multiplier: 1.3, retry_codes: [14] } default_config end yield @configure if block_given? @configure end
Create a new NotificationChannelService
client object.
@example
# Create a client using the default configuration client = ::Google::Cloud::Monitoring::V3::NotificationChannelService::Client.new # Create a client using a custom configuration client = ::Google::Cloud::Monitoring::V3::NotificationChannelService::Client.new do |config| config.timeout = 10.0 end
@yield [config] Configure the NotificationChannelService
client. @yieldparam config [Client::Configuration]
# File lib/google/cloud/monitoring/v3/notification_channel_service/client.rb, line 151 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/monitoring/v3/notification_service_services_pb" # Create the configuration object @config = Configuration.new Client.configure # Yield the configuration if needed yield @config if block_given? # Create credentials credentials = @config.credentials # Use self-signed JWT if the endpoint is unchanged from default, # but only if the default endpoint does not have a region prefix. enable_self_signed_jwt = @config.endpoint == 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 @notification_channel_service_stub = ::Gapic::ServiceStub.new( ::Google::Cloud::Monitoring::V3::NotificationChannelService::Stub, credentials: credentials, endpoint: @config.endpoint, channel_args: @config.channel_args, interceptors: @config.interceptors ) end
Public Instance Methods
Configure the NotificationChannelService
Client
instance.
The configuration is set to the derived mode, meaning that values can be changed, but structural changes (adding new fields, etc.) are not allowed. Structural changes should be made on {Client.configure}.
See {::Google::Cloud::Monitoring::V3::NotificationChannelService::Client::Configuration} for a description of the configuration fields.
@yield [config] Configure the Client
client. @yieldparam config [Client::Configuration]
@return [Client::Configuration]
# File lib/google/cloud/monitoring/v3/notification_channel_service/client.rb, line 130 def configure yield @config if block_given? @config end
Creates a new notification channel, representing a single notification endpoint such as an email address, SMS number, or PagerDuty service.
@overload create_notification_channel
(request, options = nil)
Pass arguments to `create_notification_channel` via a request object, either of type {::Google::Cloud::Monitoring::V3::CreateNotificationChannelRequest} or an equivalent Hash. @param request [::Google::Cloud::Monitoring::V3::CreateNotificationChannelRequest, ::Hash] A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash. @param options [::Gapic::CallOptions, ::Hash] Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
@overload create_notification_channel
(name: nil, notification_channel: nil)
Pass arguments to `create_notification_channel` via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above). @param name [::String] Required. The [project](https://cloud.google.com/monitoring/api/v3#project_name) on which to execute the request. The format is: projects/[PROJECT_ID_OR_NUMBER] This names the container into which the channel will be written, this does not name the newly created channel. The resulting channel's name will have a normalized version of this field as a prefix, but will add `/notificationChannels/[CHANNEL_ID]` to identify the channel. @param notification_channel [::Google::Cloud::Monitoring::V3::NotificationChannel, ::Hash] Required. The definition of the `NotificationChannel` to create.
@yield [response, operation] Access the result along with the RPC operation @yieldparam response [::Google::Cloud::Monitoring::V3::NotificationChannel] @yieldparam operation [::GRPC::ActiveCall::Operation]
@return [::Google::Cloud::Monitoring::V3::NotificationChannel]
@raise [::Google::Cloud::Error] if the RPC is aborted.
# File lib/google/cloud/monitoring/v3/notification_channel_service/client.rb, line 562 def create_notification_channel request, options = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Monitoring::V3::CreateNotificationChannelRequest # Converts hash and nil to an options object options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h # Customize the options with defaults metadata = @config.rpcs.create_notification_channel.metadata.to_h # Set x-goog-api-client and x-goog-user-project headers metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::Monitoring::V3::VERSION metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id header_params = { "name" => request.name } request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") metadata[:"x-goog-request-params"] ||= request_params_header options.apply_defaults timeout: @config.rpcs.create_notification_channel.timeout, metadata: metadata, retry_policy: @config.rpcs.create_notification_channel.retry_policy options.apply_defaults timeout: @config.timeout, metadata: @config.metadata, retry_policy: @config.retry_policy @notification_channel_service_stub.call_rpc :create_notification_channel, 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
Deletes a notification channel.
@overload delete_notification_channel
(request, options = nil)
Pass arguments to `delete_notification_channel` via a request object, either of type {::Google::Cloud::Monitoring::V3::DeleteNotificationChannelRequest} or an equivalent Hash. @param request [::Google::Cloud::Monitoring::V3::DeleteNotificationChannelRequest, ::Hash] A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash. @param options [::Gapic::CallOptions, ::Hash] Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
@overload delete_notification_channel
(name: nil, force: nil)
Pass arguments to `delete_notification_channel` via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above). @param name [::String] Required. The channel for which to execute the request. The format is: projects/[PROJECT_ID_OR_NUMBER]/notificationChannels/[CHANNEL_ID] @param force [::Boolean] If true, the notification channel will be deleted regardless of its use in alert policies (the policies will be updated to remove the channel). If false, channels that are still referenced by an existing alerting policy will fail to be deleted in a delete operation.
@yield [response, operation] Access the result along with the RPC operation @yieldparam response [::Google::Protobuf::Empty] @yieldparam operation [::GRPC::ActiveCall::Operation]
@return [::Google::Protobuf::Empty]
@raise [::Google::Cloud::Error] if the RPC is aborted.
# File lib/google/cloud/monitoring/v3/notification_channel_service/client.rb, line 711 def delete_notification_channel request, options = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Monitoring::V3::DeleteNotificationChannelRequest # Converts hash and nil to an options object options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h # Customize the options with defaults metadata = @config.rpcs.delete_notification_channel.metadata.to_h # Set x-goog-api-client and x-goog-user-project headers metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::Monitoring::V3::VERSION metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id header_params = { "name" => request.name } request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") metadata[:"x-goog-request-params"] ||= request_params_header options.apply_defaults timeout: @config.rpcs.delete_notification_channel.timeout, metadata: metadata, retry_policy: @config.rpcs.delete_notification_channel.retry_policy options.apply_defaults timeout: @config.timeout, metadata: @config.metadata, retry_policy: @config.retry_policy @notification_channel_service_stub.call_rpc :delete_notification_channel, 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
Gets a single notification channel. The channel includes the relevant configuration details with which the channel was created. However, the response may truncate or omit passwords, API keys, or other private key matter and thus the response may not be 100% identical to the information that was supplied in the call to the create method.
@overload get_notification_channel
(request, options = nil)
Pass arguments to `get_notification_channel` via a request object, either of type {::Google::Cloud::Monitoring::V3::GetNotificationChannelRequest} or an equivalent Hash. @param request [::Google::Cloud::Monitoring::V3::GetNotificationChannelRequest, ::Hash] A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash. @param options [::Gapic::CallOptions, ::Hash] Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
@overload get_notification_channel
(name: nil)
Pass arguments to `get_notification_channel` via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above). @param name [::String] Required. The channel for which to execute the request. The format is: projects/[PROJECT_ID_OR_NUMBER]/notificationChannels/[CHANNEL_ID]
@yield [response, operation] Access the result along with the RPC operation @yieldparam response [::Google::Cloud::Monitoring::V3::NotificationChannel] @yieldparam operation [::GRPC::ActiveCall::Operation]
@return [::Google::Cloud::Monitoring::V3::NotificationChannel]
@raise [::Google::Cloud::Error] if the RPC is aborted.
# File lib/google/cloud/monitoring/v3/notification_channel_service/client.rb, line 483 def get_notification_channel request, options = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Monitoring::V3::GetNotificationChannelRequest # Converts hash and nil to an options object options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h # Customize the options with defaults metadata = @config.rpcs.get_notification_channel.metadata.to_h # Set x-goog-api-client and x-goog-user-project headers metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::Monitoring::V3::VERSION metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id header_params = { "name" => request.name } request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") metadata[:"x-goog-request-params"] ||= request_params_header options.apply_defaults timeout: @config.rpcs.get_notification_channel.timeout, metadata: metadata, retry_policy: @config.rpcs.get_notification_channel.retry_policy options.apply_defaults timeout: @config.timeout, metadata: @config.metadata, retry_policy: @config.retry_policy @notification_channel_service_stub.call_rpc :get_notification_channel, 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
Gets a single channel descriptor. The descriptor indicates which fields are expected / permitted for a notification channel of the given type.
@overload get_notification_channel_descriptor
(request, options = nil)
Pass arguments to `get_notification_channel_descriptor` via a request object, either of type {::Google::Cloud::Monitoring::V3::GetNotificationChannelDescriptorRequest} or an equivalent Hash. @param request [::Google::Cloud::Monitoring::V3::GetNotificationChannelDescriptorRequest, ::Hash] A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash. @param options [::Gapic::CallOptions, ::Hash] Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
@overload get_notification_channel_descriptor
(name: nil)
Pass arguments to `get_notification_channel_descriptor` via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above). @param name [::String] Required. The channel type for which to execute the request. The format is: projects/[PROJECT_ID_OR_NUMBER]/notificationChannelDescriptors/[CHANNEL_TYPE]
@yield [response, operation] Access the result along with the RPC operation @yieldparam response [::Google::Cloud::Monitoring::V3::NotificationChannelDescriptor] @yieldparam operation [::GRPC::ActiveCall::Operation]
@return [::Google::Cloud::Monitoring::V3::NotificationChannelDescriptor]
@raise [::Google::Cloud::Error] if the RPC is aborted.
# File lib/google/cloud/monitoring/v3/notification_channel_service/client.rb, line 309 def get_notification_channel_descriptor request, options = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Monitoring::V3::GetNotificationChannelDescriptorRequest # Converts hash and nil to an options object options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h # Customize the options with defaults metadata = @config.rpcs.get_notification_channel_descriptor.metadata.to_h # Set x-goog-api-client and x-goog-user-project headers metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::Monitoring::V3::VERSION metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id header_params = { "name" => request.name } request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") metadata[:"x-goog-request-params"] ||= request_params_header options.apply_defaults timeout: @config.rpcs.get_notification_channel_descriptor.timeout, metadata: metadata, retry_policy: @config.rpcs.get_notification_channel_descriptor.retry_policy options.apply_defaults timeout: @config.timeout, metadata: @config.metadata, retry_policy: @config.retry_policy @notification_channel_service_stub.call_rpc :get_notification_channel_descriptor, 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
Requests a verification code for an already verified channel that can then be used in a call to VerifyNotificationChannel() on a different channel with an equivalent identity in the same or in a different project. This makes it possible to copy a channel between projects without requiring manual reverification of the channel. If the channel is not in the verified state, this method will fail (in other words, this may only be used if the SendNotificationChannelVerificationCode and VerifyNotificationChannel paths have already been used to put the given channel into the verified state).
There is no guarantee that the verification codes returned by this method will be of a similar structure or form as the ones that are delivered to the channel via SendNotificationChannelVerificationCode; while VerifyNotificationChannel() will recognize both the codes delivered via SendNotificationChannelVerificationCode() and returned from GetNotificationChannelVerificationCode(), it is typically the case that the verification codes delivered via SendNotificationChannelVerificationCode() will be shorter and also have a shorter expiration (e.g. codes such as “G-123456”) whereas GetVerificationCode() will typically return a much longer, websafe base 64 encoded string that has a longer expiration time.
@overload get_notification_channel_verification_code
(request, options = nil)
Pass arguments to `get_notification_channel_verification_code` via a request object, either of type {::Google::Cloud::Monitoring::V3::GetNotificationChannelVerificationCodeRequest} or an equivalent Hash. @param request [::Google::Cloud::Monitoring::V3::GetNotificationChannelVerificationCodeRequest, ::Hash] A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash. @param options [::Gapic::CallOptions, ::Hash] Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
@overload get_notification_channel_verification_code
(name: nil, expire_time: nil)
Pass arguments to `get_notification_channel_verification_code` via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above). @param name [::String] Required. The notification channel for which a verification code is to be generated and retrieved. This must name a channel that is already verified; if the specified channel is not verified, the request will fail. @param expire_time [::Google::Protobuf::Timestamp, ::Hash] The desired expiration time. If specified, the API will guarantee that the returned code will not be valid after the specified timestamp; however, the API cannot guarantee that the returned code will be valid for at least as long as the requested time (the API puts an upper bound on the amount of time for which a code may be valid). If omitted, a default expiration will be used, which may be less than the max permissible expiration (so specifying an expiration may extend the code's lifetime over omitting an expiration, even though the API does impose an upper limit on the maximum expiration that is permitted).
@yield [response, operation] Access the result along with the RPC operation @yieldparam response [::Google::Cloud::Monitoring::V3::GetNotificationChannelVerificationCodeResponse] @yieldparam operation [::GRPC::ActiveCall::Operation]
@return [::Google::Cloud::Monitoring::V3::GetNotificationChannelVerificationCodeResponse]
@raise [::Google::Cloud::Error] if the RPC is aborted.
# File lib/google/cloud/monitoring/v3/notification_channel_service/client.rb, line 880 def get_notification_channel_verification_code request, options = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Monitoring::V3::GetNotificationChannelVerificationCodeRequest # Converts hash and nil to an options object options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h # Customize the options with defaults metadata = @config.rpcs.get_notification_channel_verification_code.metadata.to_h # Set x-goog-api-client and x-goog-user-project headers metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::Monitoring::V3::VERSION metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id header_params = { "name" => request.name } request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") metadata[:"x-goog-request-params"] ||= request_params_header options.apply_defaults timeout: @config.rpcs.get_notification_channel_verification_code.timeout, metadata: metadata, retry_policy: @config.rpcs.get_notification_channel_verification_code.retry_policy options.apply_defaults timeout: @config.timeout, metadata: @config.metadata, retry_policy: @config.retry_policy @notification_channel_service_stub.call_rpc :get_notification_channel_verification_code, 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
Lists the descriptors for supported channel types. The use of descriptors makes it possible for new channel types to be dynamically added.
@overload list_notification_channel_descriptors
(request, options = nil)
Pass arguments to `list_notification_channel_descriptors` via a request object, either of type {::Google::Cloud::Monitoring::V3::ListNotificationChannelDescriptorsRequest} or an equivalent Hash. @param request [::Google::Cloud::Monitoring::V3::ListNotificationChannelDescriptorsRequest, ::Hash] A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash. @param options [::Gapic::CallOptions, ::Hash] Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
@overload list_notification_channel_descriptors
(name: nil, page_size: nil, page_token: nil)
Pass arguments to `list_notification_channel_descriptors` via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above). @param name [::String] Required. The REST resource name of the parent from which to retrieve the notification channel descriptors. The expected syntax is: projects/[PROJECT_ID_OR_NUMBER] Note that this [names](https://cloud.google.com/monitoring/api/v3#project_name) the parent container in which to look for the descriptors; to retrieve a single descriptor by name, use the {::Google::Cloud::Monitoring::V3::NotificationChannelService::Client#get_notification_channel_descriptor GetNotificationChannelDescriptor} operation, instead. @param page_size [::Integer] The maximum number of results to return in a single response. If not set to a positive number, a reasonable value will be chosen by the service. @param page_token [::String] If non-empty, `page_token` must contain a value returned as the `next_page_token` in a previous response to request the next set of results.
@yield [response, operation] Access the result along with the RPC operation @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::Monitoring::V3::NotificationChannelDescriptor>] @yieldparam operation [::GRPC::ActiveCall::Operation]
@return [::Gapic::PagedEnumerable<::Google::Cloud::Monitoring::V3::NotificationChannelDescriptor>]
@raise [::Google::Cloud::Error] if the RPC is aborted.
# File lib/google/cloud/monitoring/v3/notification_channel_service/client.rb, line 237 def list_notification_channel_descriptors request, options = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Monitoring::V3::ListNotificationChannelDescriptorsRequest # Converts hash and nil to an options object options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h # Customize the options with defaults metadata = @config.rpcs.list_notification_channel_descriptors.metadata.to_h # Set x-goog-api-client and x-goog-user-project headers metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::Monitoring::V3::VERSION metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id header_params = { "name" => request.name } request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") metadata[:"x-goog-request-params"] ||= request_params_header options.apply_defaults timeout: @config.rpcs.list_notification_channel_descriptors.timeout, metadata: metadata, retry_policy: @config.rpcs.list_notification_channel_descriptors.retry_policy options.apply_defaults timeout: @config.timeout, metadata: @config.metadata, retry_policy: @config.retry_policy @notification_channel_service_stub.call_rpc :list_notification_channel_descriptors, request, options: options do |response, operation| response = ::Gapic::PagedEnumerable.new @notification_channel_service_stub, :list_notification_channel_descriptors, 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
Lists the notification channels that have been created for the project.
@overload list_notification_channels
(request, options = nil)
Pass arguments to `list_notification_channels` via a request object, either of type {::Google::Cloud::Monitoring::V3::ListNotificationChannelsRequest} or an equivalent Hash. @param request [::Google::Cloud::Monitoring::V3::ListNotificationChannelsRequest, ::Hash] A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash. @param options [::Gapic::CallOptions, ::Hash] Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
@overload list_notification_channels
(name: nil, filter: nil, order_by: nil, page_size: nil, page_token: nil)
Pass arguments to `list_notification_channels` via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above). @param name [::String] Required. The [project](https://cloud.google.com/monitoring/api/v3#project_name) on which to execute the request. The format is: projects/[PROJECT_ID_OR_NUMBER] This names the container in which to look for the notification channels; it does not name a specific channel. To query a specific channel by REST resource name, use the {::Google::Cloud::Monitoring::V3::NotificationChannelService::Client#get_notification_channel `GetNotificationChannel`} operation. @param filter [::String] If provided, this field specifies the criteria that must be met by notification channels to be included in the response. For more details, see [sorting and filtering](https://cloud.google.com/monitoring/api/v3/sorting-and-filtering). @param order_by [::String] A comma-separated list of fields by which to sort the result. Supports the same set of fields as in `filter`. Entries can be prefixed with a minus sign to sort in descending rather than ascending order. For more details, see [sorting and filtering](https://cloud.google.com/monitoring/api/v3/sorting-and-filtering). @param page_size [::Integer] The maximum number of results to return in a single response. If not set to a positive number, a reasonable value will be chosen by the service. @param page_token [::String] If non-empty, `page_token` must contain a value returned as the `next_page_token` in a previous response to request the next set of results.
@yield [response, operation] Access the result along with the RPC operation @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::Monitoring::V3::NotificationChannel>] @yieldparam operation [::GRPC::ActiveCall::Operation]
@return [::Gapic::PagedEnumerable<::Google::Cloud::Monitoring::V3::NotificationChannel>]
@raise [::Google::Cloud::Error] if the RPC is aborted.
# File lib/google/cloud/monitoring/v3/notification_channel_service/client.rb, line 408 def list_notification_channels request, options = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Monitoring::V3::ListNotificationChannelsRequest # Converts hash and nil to an options object options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h # Customize the options with defaults metadata = @config.rpcs.list_notification_channels.metadata.to_h # Set x-goog-api-client and x-goog-user-project headers metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::Monitoring::V3::VERSION metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id header_params = { "name" => request.name } request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") metadata[:"x-goog-request-params"] ||= request_params_header options.apply_defaults timeout: @config.rpcs.list_notification_channels.timeout, metadata: metadata, retry_policy: @config.rpcs.list_notification_channels.retry_policy options.apply_defaults timeout: @config.timeout, metadata: @config.metadata, retry_policy: @config.retry_policy @notification_channel_service_stub.call_rpc :list_notification_channels, request, options: options do |response, operation| response = ::Gapic::PagedEnumerable.new @notification_channel_service_stub, :list_notification_channels, 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
Causes a verification code to be delivered to the channel. The code can then be supplied in `VerifyNotificationChannel` to verify the channel.
@overload send_notification_channel_verification_code
(request, options = nil)
Pass arguments to `send_notification_channel_verification_code` via a request object, either of type {::Google::Cloud::Monitoring::V3::SendNotificationChannelVerificationCodeRequest} or an equivalent Hash. @param request [::Google::Cloud::Monitoring::V3::SendNotificationChannelVerificationCodeRequest, ::Hash] A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash. @param options [::Gapic::CallOptions, ::Hash] Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
@overload send_notification_channel_verification_code
(name: nil)
Pass arguments to `send_notification_channel_verification_code` via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above). @param name [::String] Required. The notification channel to which to send a verification code.
@yield [response, operation] Access the result along with the RPC operation @yieldparam response [::Google::Protobuf::Empty] @yieldparam operation [::GRPC::ActiveCall::Operation]
@return [::Google::Protobuf::Empty]
@raise [::Google::Cloud::Error] if the RPC is aborted.
# File lib/google/cloud/monitoring/v3/notification_channel_service/client.rb, line 780 def send_notification_channel_verification_code request, options = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Monitoring::V3::SendNotificationChannelVerificationCodeRequest # Converts hash and nil to an options object options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h # Customize the options with defaults metadata = @config.rpcs.send_notification_channel_verification_code.metadata.to_h # Set x-goog-api-client and x-goog-user-project headers metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::Monitoring::V3::VERSION metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id header_params = { "name" => request.name } request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") metadata[:"x-goog-request-params"] ||= request_params_header options.apply_defaults timeout: @config.rpcs.send_notification_channel_verification_code.timeout, metadata: metadata, retry_policy: @config.rpcs.send_notification_channel_verification_code.retry_policy options.apply_defaults timeout: @config.timeout, metadata: @config.metadata, retry_policy: @config.retry_policy @notification_channel_service_stub.call_rpc :send_notification_channel_verification_code, 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
Updates a notification channel. Fields not specified in the field mask remain unchanged.
@overload update_notification_channel
(request, options = nil)
Pass arguments to `update_notification_channel` via a request object, either of type {::Google::Cloud::Monitoring::V3::UpdateNotificationChannelRequest} or an equivalent Hash. @param request [::Google::Cloud::Monitoring::V3::UpdateNotificationChannelRequest, ::Hash] A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash. @param options [::Gapic::CallOptions, ::Hash] Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
@overload update_notification_channel
(update_mask: nil, notification_channel: nil)
Pass arguments to `update_notification_channel` via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above). @param update_mask [::Google::Protobuf::FieldMask, ::Hash] The fields to update. @param notification_channel [::Google::Cloud::Monitoring::V3::NotificationChannel, ::Hash] Required. A description of the changes to be applied to the specified notification channel. The description must provide a definition for fields to be updated; the names of these fields should also be included in the `update_mask`.
@yield [response, operation] Access the result along with the RPC operation @yieldparam response [::Google::Cloud::Monitoring::V3::NotificationChannel] @yieldparam operation [::GRPC::ActiveCall::Operation]
@return [::Google::Cloud::Monitoring::V3::NotificationChannel]
@raise [::Google::Cloud::Error] if the RPC is aborted.
# File lib/google/cloud/monitoring/v3/notification_channel_service/client.rb, line 636 def update_notification_channel request, options = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Monitoring::V3::UpdateNotificationChannelRequest # Converts hash and nil to an options object options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h # Customize the options with defaults metadata = @config.rpcs.update_notification_channel.metadata.to_h # Set x-goog-api-client and x-goog-user-project headers metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::Monitoring::V3::VERSION metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id header_params = { "notification_channel.name" => request.notification_channel.name } request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") metadata[:"x-goog-request-params"] ||= request_params_header options.apply_defaults timeout: @config.rpcs.update_notification_channel.timeout, metadata: metadata, retry_policy: @config.rpcs.update_notification_channel.retry_policy options.apply_defaults timeout: @config.timeout, metadata: @config.metadata, retry_policy: @config.retry_policy @notification_channel_service_stub.call_rpc :update_notification_channel, 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
Verifies a `NotificationChannel` by proving receipt of the code delivered to the channel as a result of calling `SendNotificationChannelVerificationCode`.
@overload verify_notification_channel
(request, options = nil)
Pass arguments to `verify_notification_channel` via a request object, either of type {::Google::Cloud::Monitoring::V3::VerifyNotificationChannelRequest} or an equivalent Hash. @param request [::Google::Cloud::Monitoring::V3::VerifyNotificationChannelRequest, ::Hash] A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash. @param options [::Gapic::CallOptions, ::Hash] Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
@overload verify_notification_channel
(name: nil, code: nil)
Pass arguments to `verify_notification_channel` via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above). @param name [::String] Required. The notification channel to verify. @param code [::String] Required. The verification code that was delivered to the channel as a result of invoking the `SendNotificationChannelVerificationCode` API method or that was retrieved from a verified channel via `GetNotificationChannelVerificationCode`. For example, one might have "G-123456" or "TKNZGhhd2EyN3I1MnRnMjRv" (in general, one is only guaranteed that the code is valid UTF-8; one should not make any assumptions regarding the structure or format of the code).
@yield [response, operation] Access the result along with the RPC operation @yieldparam response [::Google::Cloud::Monitoring::V3::NotificationChannel] @yieldparam operation [::GRPC::ActiveCall::Operation]
@return [::Google::Cloud::Monitoring::V3::NotificationChannel]
@raise [::Google::Cloud::Error] if the RPC is aborted.
# File lib/google/cloud/monitoring/v3/notification_channel_service/client.rb, line 958 def verify_notification_channel request, options = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Monitoring::V3::VerifyNotificationChannelRequest # Converts hash and nil to an options object options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h # Customize the options with defaults metadata = @config.rpcs.verify_notification_channel.metadata.to_h # Set x-goog-api-client and x-goog-user-project headers metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::Monitoring::V3::VERSION metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id header_params = { "name" => request.name } request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") metadata[:"x-goog-request-params"] ||= request_params_header options.apply_defaults timeout: @config.rpcs.verify_notification_channel.timeout, metadata: metadata, retry_policy: @config.rpcs.verify_notification_channel.retry_policy options.apply_defaults timeout: @config.timeout, metadata: @config.metadata, retry_policy: @config.retry_policy @notification_channel_service_stub.call_rpc :verify_notification_channel, 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