Reference documentation and code samples for the Cloud Monitoring V3 API class Google::Cloud::Monitoring::V3::SnoozeService::Client.
Client for the SnoozeService service.
The SnoozeService API is used to temporarily prevent an alert policy from generating alerts. A Snooze is a description of the criteria under which one or more alert policies should not fire alerts for the specified duration.
Inherits
- Object
Methods
.configure
def self.configure() { |config| ... } -> Client::Configuration
Configure the SnoozeService Client class.
See Configuration for a description of the configuration fields.
- (config) — Configure the Client client.
- config (Client::Configuration)
# Modify the configuration for all SnoozeService clients ::Google::Cloud::Monitoring::V3::SnoozeService::Client.configure do |config| config.timeout = 10.0 end
#configure
def configure() { |config| ... } -> Client::Configuration
Configure the SnoozeService Client instance.
The configuration is set to the derived mode, meaning that values can be changed, but structural changes (adding new fields, etc.) are not allowed. Structural changes should be made on Client.configure.
See Configuration for a description of the configuration fields.
- (config) — Configure the Client client.
- config (Client::Configuration)
#create_snooze
def create_snooze(request, options = nil) -> ::Google::Cloud::Monitoring::V3::Snooze
def create_snooze(parent: nil, snooze: nil) -> ::Google::Cloud::Monitoring::V3::Snooze
Creates a Snooze
that will prevent alerts, which match the provided
criteria, from being opened. The Snooze
applies for a specific time
interval.
def create_snooze(request, options = nil) -> ::Google::Cloud::Monitoring::V3::Snooze
create_snooze
via a request object, either of type
CreateSnoozeRequest or an equivalent Hash.
- request (::Google::Cloud::Monitoring::V3::CreateSnoozeRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
- options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def create_snooze(parent: nil, snooze: nil) -> ::Google::Cloud::Monitoring::V3::Snooze
create_snooze
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).
-
parent (::String) —
Required. The project in which a
Snooze
should be created. The format is:projects/[PROJECT_ID_OR_NUMBER]
-
snooze (::Google::Cloud::Monitoring::V3::Snooze, ::Hash) — Required. The
Snooze
to create. Omit thename
field, as it will be filled in by the API.
- (response, operation) — Access the result along with the RPC operation
- response (::Google::Cloud::Monitoring::V3::Snooze)
- operation (::GRPC::ActiveCall::Operation)
- (::Google::Cloud::Error) — if the RPC is aborted.
Basic example
require "google/cloud/monitoring/v3" # Create a client object. The client can be reused for multiple calls. client = Google::Cloud::Monitoring::V3::SnoozeService::Client.new # Create a request. To set request fields, pass in keyword arguments. request = Google::Cloud::Monitoring::V3::CreateSnoozeRequest.new # Call the create_snooze method. result = client.create_snooze request # The returned object is of type Google::Cloud::Monitoring::V3::Snooze. p result
#get_snooze
def get_snooze(request, options = nil) -> ::Google::Cloud::Monitoring::V3::Snooze
def get_snooze(name: nil) -> ::Google::Cloud::Monitoring::V3::Snooze
Retrieves a Snooze
by name
.
def get_snooze(request, options = nil) -> ::Google::Cloud::Monitoring::V3::Snooze
get_snooze
via a request object, either of type
GetSnoozeRequest or an equivalent Hash.
- request (::Google::Cloud::Monitoring::V3::GetSnoozeRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
- options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def get_snooze(name: nil) -> ::Google::Cloud::Monitoring::V3::Snooze
get_snooze
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).
-
name (::String) —
Required. The ID of the
Snooze
to retrieve. The format is:projects/[PROJECT_ID_OR_NUMBER]/snoozes/[SNOOZE_ID]
- (response, operation) — Access the result along with the RPC operation
- response (::Google::Cloud::Monitoring::V3::Snooze)
- operation (::GRPC::ActiveCall::Operation)
- (::Google::Cloud::Error) — if the RPC is aborted.
Basic example
require "google/cloud/monitoring/v3" # Create a client object. The client can be reused for multiple calls. client = Google::Cloud::Monitoring::V3::SnoozeService::Client.new # Create a request. To set request fields, pass in keyword arguments. request = Google::Cloud::Monitoring::V3::GetSnoozeRequest.new # Call the get_snooze method. result = client.get_snooze request # The returned object is of type Google::Cloud::Monitoring::V3::Snooze. p result
#initialize
def initialize() { |config| ... } -> Client
Create a new SnoozeService client object.
- (config) — Configure the SnoozeService client.
- config (Client::Configuration)
- (Client) — a new instance of Client
# Create a client using the default configuration client = ::Google::Cloud::Monitoring::V3::SnoozeService::Client.new # Create a client using a custom configuration client = ::Google::Cloud::Monitoring::V3::SnoozeService::Client.new do |config| config.timeout = 10.0 end
#list_snoozes
def list_snoozes(request, options = nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::Monitoring::V3::Snooze>
def list_snoozes(parent: nil, filter: nil, page_size: nil, page_token: nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::Monitoring::V3::Snooze>
Lists the Snooze
s associated with a project. Can optionally pass in
filter
, which specifies predicates to match Snooze
s.
def list_snoozes(request, options = nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::Monitoring::V3::Snooze>
list_snoozes
via a request object, either of type
ListSnoozesRequest or an equivalent Hash.
- request (::Google::Cloud::Monitoring::V3::ListSnoozesRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
- options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def list_snoozes(parent: nil, filter: nil, page_size: nil, page_token: nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::Monitoring::V3::Snooze>
list_snoozes
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).
-
parent (::String) —
Required. The project whose
Snooze
s should be listed. The format is:projects/[PROJECT_ID_OR_NUMBER]
-
filter (::String) —
Optional. Optional filter to restrict results to the given criteria. The following fields are supported.
interval.start_time
interval.end_time
For example:
``` interval.start_time > "2022-03-11T00:00:00-08:00" AND interval.end_time < "2022-03-12T00:00:00-08:00" ```
- page_size (::Integer) — Optional. The maximum number of results to return for a single query. The server may further constrain the maximum number of results returned in a single page. The value should be in the range [1, 1000]. If the value given is outside this range, the server will decide the number of results to be returned.
-
page_token (::String) — Optional. The
next_page_token
from a previous call toListSnoozesRequest
to get the next page of results.
- (response, operation) — Access the result along with the RPC operation
- response (::Gapic::PagedEnumerable<::Google::Cloud::Monitoring::V3::Snooze>)
- operation (::GRPC::ActiveCall::Operation)
- (::Gapic::PagedEnumerable<::Google::Cloud::Monitoring::V3::Snooze>)
- (::Google::Cloud::Error) — if the RPC is aborted.
Basic example
require "google/cloud/monitoring/v3" # Create a client object. The client can be reused for multiple calls. client = Google::Cloud::Monitoring::V3::SnoozeService::Client.new # Create a request. To set request fields, pass in keyword arguments. request = Google::Cloud::Monitoring::V3::ListSnoozesRequest.new # Call the list_snoozes method. result = client.list_snoozes 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::Monitoring::V3::Snooze. p response end
#update_snooze
def update_snooze(request, options = nil) -> ::Google::Cloud::Monitoring::V3::Snooze
def update_snooze(snooze: nil, update_mask: nil) -> ::Google::Cloud::Monitoring::V3::Snooze
Updates a Snooze
, identified by its name
, with the parameters in the
given Snooze
object.
def update_snooze(request, options = nil) -> ::Google::Cloud::Monitoring::V3::Snooze
update_snooze
via a request object, either of type
UpdateSnoozeRequest or an equivalent Hash.
- request (::Google::Cloud::Monitoring::V3::UpdateSnoozeRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
- options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def update_snooze(snooze: nil, update_mask: nil) -> ::Google::Cloud::Monitoring::V3::Snooze
update_snooze
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).
-
snooze (::Google::Cloud::Monitoring::V3::Snooze, ::Hash) — Required. The
Snooze
to update. Must have the name field present. -
update_mask (::Google::Protobuf::FieldMask, ::Hash) — Required. The fields to update.
For each field listed in
update_mask
:- If the
Snooze
object supplied in theUpdateSnoozeRequest
has a value for that field, the value of the field in the existingSnooze
will be set to the value of the field in the suppliedSnooze
. - If the field does not have a value in the supplied
Snooze
, the field in the existingSnooze
is set to its default value.
Fields not listed retain their existing value.
The following are the field names that are accepted in
update_mask
:display_name
interval.start_time
interval.end_time
That said, the start time and end time of the
Snooze
determines which fields can legally be updated. Before attempting an update, users should consult the documentation forUpdateSnoozeRequest
, which talks about which fields can be updated. - If the
- (response, operation) — Access the result along with the RPC operation
- response (::Google::Cloud::Monitoring::V3::Snooze)
- operation (::GRPC::ActiveCall::Operation)
- (::Google::Cloud::Error) — if the RPC is aborted.
Basic example
require "google/cloud/monitoring/v3" # Create a client object. The client can be reused for multiple calls. client = Google::Cloud::Monitoring::V3::SnoozeService::Client.new # Create a request. To set request fields, pass in keyword arguments. request = Google::Cloud::Monitoring::V3::UpdateSnoozeRequest.new # Call the update_snooze method. result = client.update_snooze request # The returned object is of type Google::Cloud::Monitoring::V3::Snooze. p result