# Cloud Monitoring V3 API - Class Google::Cloud::Monitoring::V3::SnoozeService::Client (v1.10.0)

1.10.0 (latest) 1.9.0 1.8.0 1.7.1 1.6.1 1.5.1 1.4.0 1.3.0 1.2.0 1.1.0 1.0.1 0.18.0 0.17.0 0.16.0 0.15.2 0.14.0 0.13.0 0.12.1 0.11.0 0.10.0 0.9.0 0.8.0 0.7.1 Reference documentation and code samples for the Cloud Monitoring V3 API class Google::Cloud::Monitoring::V3::SnoozeService::Client.

Client for the SnoozeService service.


<br />

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

## Includes

- [Google::Cloud::Monitoring::V3::SnoozeService::Paths](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-monitoring-v3/latest/Google-Cloud-Monitoring-V3-SnoozeService-Paths)

## Methods

### .configure

    def self.configure() { |config| ... } -> Client::Configuration

Configure the SnoozeService Client class.


<br />

See [Configuration](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-monitoring-v3/latest/Google-Cloud-Monitoring-V3-SnoozeService-Client-Configuration "Google::Cloud::Monitoring::V3::SnoozeService::Client::Configuration (class)")
for a description of the configuration fields.
**Yields**

- (config) --- Configure the Client client.
**Yield Parameter**

- **config** ([Client::Configuration](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-monitoring-v3/latest/Google-Cloud-Monitoring-V3-SnoozeService-Client-Configuration))
**Returns**

- ([Client::Configuration](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-monitoring-v3/latest/Google-Cloud-Monitoring-V3-SnoozeService-Client-Configuration))
**Example**

```ruby
# 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](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-monitoring-v3/latest/Google-Cloud-Monitoring-V3-SnoozeService-Client#Google__Cloud__Monitoring__V3__SnoozeService__Client_configure_class_ "Google::Cloud::Monitoring::V3::SnoozeService::Client.configure (method)").

<br />

See [Configuration](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-monitoring-v3/latest/Google-Cloud-Monitoring-V3-SnoozeService-Client-Configuration "Google::Cloud::Monitoring::V3::SnoozeService::Client::Configuration (class)")
for a description of the configuration fields.
**Yields**

- (config) --- Configure the Client client.
**Yield Parameter**

- **config** ([Client::Configuration](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-monitoring-v3/latest/Google-Cloud-Monitoring-V3-SnoozeService-Client-Configuration))
**Returns**

- ([Client::Configuration](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-monitoring-v3/latest/Google-Cloud-Monitoring-V3-SnoozeService-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.
**Overloads**

    def create_snooze(request, options = nil) -> ::Google::Cloud::Monitoring::V3::Snooze

Pass arguments to `create_snooze` via a request object, either of type [CreateSnoozeRequest](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-monitoring-v3/latest/Google-Cloud-Monitoring-V3-CreateSnoozeRequest "Google::Cloud::Monitoring::V3::CreateSnoozeRequest (class)") or an equivalent Hash. **Parameters**

- **request** ([::Google::Cloud::Monitoring::V3::CreateSnoozeRequest](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-monitoring-v3/latest/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

Pass arguments to `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). **Parameters**

- **parent** (::String) ---

  Required. The
  [project](https://cloud.google.com/monitoring/api/v3#project_name) in which
  a `Snooze` should be created. The format is:

      projects/[PROJECT_ID_OR_NUMBER]

- **snooze** ([::Google::Cloud::Monitoring::V3::Snooze](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-monitoring-v3/latest/Google-Cloud-Monitoring-V3-Snooze), ::Hash) --- Required. The `Snooze` to create. Omit the `name` field, as it will be filled in by the API.
**Yields**

- (response, operation) --- Access the result along with the RPC operation
**Yield Parameters**

- **response** ([::Google::Cloud::Monitoring::V3::Snooze](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-monitoring-v3/latest/Google-Cloud-Monitoring-V3-Snooze))
- **operation** (::GRPC::ActiveCall::Operation)
**Returns**

- ([::Google::Cloud::Monitoring::V3::Snooze](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-monitoring-v3/latest/Google-Cloud-Monitoring-V3-Snooze))
**Raises**

- (::Google::Cloud::Error) --- if the RPC is aborted.
**Example**

Basic example

```ruby
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`.
**Overloads**

    def get_snooze(request, options = nil) -> ::Google::Cloud::Monitoring::V3::Snooze

Pass arguments to `get_snooze` via a request object, either of type [GetSnoozeRequest](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-monitoring-v3/latest/Google-Cloud-Monitoring-V3-GetSnoozeRequest "Google::Cloud::Monitoring::V3::GetSnoozeRequest (class)") or an equivalent Hash. **Parameters**

- **request** ([::Google::Cloud::Monitoring::V3::GetSnoozeRequest](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-monitoring-v3/latest/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

Pass arguments to `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). **Parameter**

- **name** (::String) ---

  Required. The ID of the `Snooze` to retrieve. The format is:

      projects/[PROJECT_ID_OR_NUMBER]/snoozes/[SNOOZE_ID]

**Yields**

- (response, operation) --- Access the result along with the RPC operation
**Yield Parameters**

- **response** ([::Google::Cloud::Monitoring::V3::Snooze](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-monitoring-v3/latest/Google-Cloud-Monitoring-V3-Snooze))
- **operation** (::GRPC::ActiveCall::Operation)
**Returns**

- ([::Google::Cloud::Monitoring::V3::Snooze](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-monitoring-v3/latest/Google-Cloud-Monitoring-V3-Snooze))
**Raises**

- (::Google::Cloud::Error) --- if the RPC is aborted.
**Example**

Basic example

```ruby
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.
**Yields**

- (config) --- Configure the SnoozeService client.
**Yield Parameter**

- **config** ([Client::Configuration](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-monitoring-v3/latest/Google-Cloud-Monitoring-V3-SnoozeService-Client-Configuration))
**Returns**

- ([Client](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-monitoring-v3/latest/Google-Cloud-Monitoring-V3-SnoozeService-Client)) --- a new instance of Client
**Example**

```ruby
# 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.
**Overloads**

    def list_snoozes(request, options = nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::Monitoring::V3::Snooze>

Pass arguments to `list_snoozes` via a request object, either of type [ListSnoozesRequest](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-monitoring-v3/latest/Google-Cloud-Monitoring-V3-ListSnoozesRequest "Google::Cloud::Monitoring::V3::ListSnoozesRequest (class)") or an equivalent Hash. **Parameters**

- **request** ([::Google::Cloud::Monitoring::V3::ListSnoozesRequest](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-monitoring-v3/latest/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>

Pass arguments to `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). **Parameters**

- **parent** (::String) ---

  Required. The
  [project](https://cloud.google.com/monitoring/api/v3#project_name) 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 to `ListSnoozesRequest` to get the next page of results.
**Yields**

- (response, operation) --- Access the result along with the RPC operation
**Yield Parameters**

- **response** (::Gapic::PagedEnumerable\<[::Google::Cloud::Monitoring::V3::Snooze](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-monitoring-v3/latest/Google-Cloud-Monitoring-V3-Snooze)\>)
- **operation** (::GRPC::ActiveCall::Operation)
**Returns**

- (::Gapic::PagedEnumerable\<[::Google::Cloud::Monitoring::V3::Snooze](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-monitoring-v3/latest/Google-Cloud-Monitoring-V3-Snooze)\>)
**Raises**

- (::Google::Cloud::Error) --- if the RPC is aborted.
**Example**

Basic example

```ruby
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 elements, and API calls will be issued to fetch pages as needed.
result.each do |item|
  # Each element is of type ::Google::Cloud::Monitoring::V3::Snooze.
  p item
end
```

### #logger

    def logger() -> Logger

The logger used for request/response debug logging.
**Returns**

- (Logger)

### #universe_domain

    def universe_domain() -> String

The effective universe domain
**Returns**

- (String)

### #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.
**Overloads**

    def update_snooze(request, options = nil) -> ::Google::Cloud::Monitoring::V3::Snooze

Pass arguments to `update_snooze` via a request object, either of type [UpdateSnoozeRequest](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-monitoring-v3/latest/Google-Cloud-Monitoring-V3-UpdateSnoozeRequest "Google::Cloud::Monitoring::V3::UpdateSnoozeRequest (class)") or an equivalent Hash. **Parameters**

- **request** ([::Google::Cloud::Monitoring::V3::UpdateSnoozeRequest](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-monitoring-v3/latest/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

Pass arguments to `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). **Parameters**

- **snooze** ([::Google::Cloud::Monitoring::V3::Snooze](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-monitoring-v3/latest/Google-Cloud-Monitoring-V3-Snooze), ::Hash) --- Required. The `Snooze` to update. Must have the name field present.
- **update_mask** ([::Google::Protobuf::FieldMask](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-monitoring-v3/latest/Google-Protobuf-FieldMask), ::Hash) --- Required. The fields to update.


  For each field listed in `update_mask`:
  - If the `Snooze` object supplied in the `UpdateSnoozeRequest` has a value for that field, the value of the field in the existing `Snooze` will be set to the value of the field in the supplied `Snooze`.
  - If the field does not have a value in the supplied `Snooze`, the field in the existing `Snooze` 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 for `UpdateSnoozeRequest`, which talks about
  which fields can be updated.
**Yields**

- (response, operation) --- Access the result along with the RPC operation
**Yield Parameters**

- **response** ([::Google::Cloud::Monitoring::V3::Snooze](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-monitoring-v3/latest/Google-Cloud-Monitoring-V3-Snooze))
- **operation** (::GRPC::ActiveCall::Operation)
**Returns**

- ([::Google::Cloud::Monitoring::V3::Snooze](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-monitoring-v3/latest/Google-Cloud-Monitoring-V3-Snooze))
**Raises**

- (::Google::Cloud::Error) --- if the RPC is aborted.
**Example**

Basic example

```ruby
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
```