Essential Contacts V1 API - Class Google::Cloud::EssentialContacts::V1::EssentialContactsService::Rest::Client (v1.0.0)

Reference documentation and code samples for the Essential Contacts V1 API class Google::Cloud::EssentialContacts::V1::EssentialContactsService::Rest::Client.

REST client for the EssentialContactsService service.

Manages contacts for important Google Cloud notifications.

Inherits

  • Object

Methods

.configure

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

Configure the EssentialContactsService Client class.

See Configuration for a description of the configuration fields.

Yields
  • (config) — Configure the Client client.
Yield Parameter
Example
# Modify the configuration for all EssentialContactsService clients
::Google::Cloud::EssentialContacts::V1::EssentialContactsService::Rest::Client.configure do |config|
  config.timeout = 10.0
end

#compute_contacts

def compute_contacts(request, options = nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Cloud::EssentialContacts::V1::Contact>
def compute_contacts(parent: nil, notification_categories: nil, page_size: nil, page_token: nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Cloud::EssentialContacts::V1::Contact>

Lists all contacts for the resource that are subscribed to the specified notification categories, including contacts inherited from any parent resources.

Overloads
def compute_contacts(request, options = nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Cloud::EssentialContacts::V1::Contact>
Pass arguments to compute_contacts via a request object, either of type ComputeContactsRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::EssentialContacts::V1::ComputeContactsRequest, ::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 compute_contacts(parent: nil, notification_categories: nil, page_size: nil, page_token: nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Cloud::EssentialContacts::V1::Contact>
Pass arguments to compute_contacts 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 name of the resource to compute contacts for. Format: organizations/{organization_id}, folders/{folder_id} or projects/{project_id}
  • notification_categories (::Array<::Google::Cloud::EssentialContacts::V1::NotificationCategory>) — The categories of notifications to compute contacts for. If ALL is included in this list, contacts subscribed to any notification category will be returned.
  • page_size (::Integer) — Optional. The maximum number of results to return from this request. Non-positive values are ignored. The presence of next_page_token in the response indicates that more results might be available. If not specified, the default page_size is 100.
  • page_token (::String) — Optional. If present, retrieves the next batch of results from the preceding call to this method. page_token must be the value of next_page_token from the previous response. The values of other method parameters should be identical to those in the previous call.
Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
Returns
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.
Example

Basic example

require "google/cloud/essential_contacts/v1"

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

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

# Call the compute_contacts method.
result = client.compute_contacts 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::EssentialContacts::V1::Contact.
  p item
end

#configure

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

Configure the EssentialContactsService 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.

Yields
  • (config) — Configure the Client client.
Yield Parameter

#create_contact

def create_contact(request, options = nil) -> ::Google::Cloud::EssentialContacts::V1::Contact
def create_contact(parent: nil, contact: nil) -> ::Google::Cloud::EssentialContacts::V1::Contact

Adds a new contact for a resource.

Overloads
def create_contact(request, options = nil) -> ::Google::Cloud::EssentialContacts::V1::Contact
Pass arguments to create_contact via a request object, either of type CreateContactRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::EssentialContacts::V1::CreateContactRequest, ::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_contact(parent: nil, contact: nil) -> ::Google::Cloud::EssentialContacts::V1::Contact
Pass arguments to create_contact 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 resource to save this contact for. Format: organizations/{organization_id}, folders/{folder_id} or projects/{project_id}
  • contact (::Google::Cloud::EssentialContacts::V1::Contact, ::Hash) — Required. The contact to create. Must specify an email address and language tag.
Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.
Example

Basic example

require "google/cloud/essential_contacts/v1"

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

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

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

# The returned object is of type Google::Cloud::EssentialContacts::V1::Contact.
p result

#delete_contact

def delete_contact(request, options = nil) -> ::Google::Protobuf::Empty
def delete_contact(name: nil) -> ::Google::Protobuf::Empty

Deletes a contact.

Overloads
def delete_contact(request, options = nil) -> ::Google::Protobuf::Empty
Pass arguments to delete_contact via a request object, either of type DeleteContactRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::EssentialContacts::V1::DeleteContactRequest, ::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 delete_contact(name: nil) -> ::Google::Protobuf::Empty
Pass arguments to delete_contact 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 name of the contact to delete. Format: organizations/{organization_id}/contacts/{contact_id}, folders/{folder_id}/contacts/{contact_id} or projects/{project_id}/contacts/{contact_id}
Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.
Example

Basic example

require "google/cloud/essential_contacts/v1"

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

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

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

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

#get_contact

def get_contact(request, options = nil) -> ::Google::Cloud::EssentialContacts::V1::Contact
def get_contact(name: nil) -> ::Google::Cloud::EssentialContacts::V1::Contact

Gets a single contact.

Overloads
def get_contact(request, options = nil) -> ::Google::Cloud::EssentialContacts::V1::Contact
Pass arguments to get_contact via a request object, either of type GetContactRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::EssentialContacts::V1::GetContactRequest, ::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_contact(name: nil) -> ::Google::Cloud::EssentialContacts::V1::Contact
Pass arguments to get_contact 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 name of the contact to retrieve. Format: organizations/{organization_id}/contacts/{contact_id}, folders/{folder_id}/contacts/{contact_id} or projects/{project_id}/contacts/{contact_id}
Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.
Example

Basic example

require "google/cloud/essential_contacts/v1"

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

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

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

# The returned object is of type Google::Cloud::EssentialContacts::V1::Contact.
p result

#initialize

def initialize() { |config| ... } -> Client

Create a new EssentialContactsService REST client object.

Yields
  • (config) — Configure the EssentialContactsService client.
Yield Parameter
Returns
  • (Client) — a new instance of Client
Example
# Create a client using the default configuration
client = ::Google::Cloud::EssentialContacts::V1::EssentialContactsService::Rest::Client.new

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

#list_contacts

def list_contacts(request, options = nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Cloud::EssentialContacts::V1::Contact>
def list_contacts(parent: nil, page_size: nil, page_token: nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Cloud::EssentialContacts::V1::Contact>

Lists the contacts that have been set on a resource.

Overloads
def list_contacts(request, options = nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Cloud::EssentialContacts::V1::Contact>
Pass arguments to list_contacts via a request object, either of type ListContactsRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::EssentialContacts::V1::ListContactsRequest, ::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_contacts(parent: nil, page_size: nil, page_token: nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Cloud::EssentialContacts::V1::Contact>
Pass arguments to list_contacts 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 parent resource name. Format: organizations/{organization_id}, folders/{folder_id} or projects/{project_id}
  • page_size (::Integer) — Optional. The maximum number of results to return from this request. Non-positive values are ignored. The presence of next_page_token in the response indicates that more results might be available. If not specified, the default page_size is 100.
  • page_token (::String) — Optional. If present, retrieves the next batch of results from the preceding call to this method. page_token must be the value of next_page_token from the previous response. The values of other method parameters should be identical to those in the previous call.
Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
Returns
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.
Example

Basic example

require "google/cloud/essential_contacts/v1"

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

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

# Call the list_contacts method.
result = client.list_contacts 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::EssentialContacts::V1::Contact.
  p item
end

#send_test_message

def send_test_message(request, options = nil) -> ::Google::Protobuf::Empty
def send_test_message(contacts: nil, resource: nil, notification_category: nil) -> ::Google::Protobuf::Empty

Allows a contact admin to send a test message to contact to verify that it has been configured correctly.

Overloads
def send_test_message(request, options = nil) -> ::Google::Protobuf::Empty
Pass arguments to send_test_message via a request object, either of type SendTestMessageRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::EssentialContacts::V1::SendTestMessageRequest, ::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 send_test_message(contacts: nil, resource: nil, notification_category: nil) -> ::Google::Protobuf::Empty
Pass arguments to send_test_message 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
  • contacts (::Array<::String>) — Required. The list of names of the contacts to send a test message to. Format: organizations/{organization_id}/contacts/{contact_id}, folders/{folder_id}/contacts/{contact_id} or projects/{project_id}/contacts/{contact_id}
  • resource (::String) — Required. The name of the resource to send the test message for. All contacts must either be set directly on this resource or inherited from another resource that is an ancestor of this one. Format: organizations/{organization_id}, folders/{folder_id} or projects/{project_id}
  • notification_category (::Google::Cloud::EssentialContacts::V1::NotificationCategory) — Required. The notification category to send the test message for. All contacts must be subscribed to this category.
Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.
Example

Basic example

require "google/cloud/essential_contacts/v1"

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

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

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

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

#universe_domain

def universe_domain() -> String

The effective universe domain

Returns
  • (String)

#update_contact

def update_contact(request, options = nil) -> ::Google::Cloud::EssentialContacts::V1::Contact
def update_contact(contact: nil, update_mask: nil) -> ::Google::Cloud::EssentialContacts::V1::Contact

Updates a contact. Note: A contact's email address cannot be changed.

Overloads
def update_contact(request, options = nil) -> ::Google::Cloud::EssentialContacts::V1::Contact
Pass arguments to update_contact via a request object, either of type UpdateContactRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::EssentialContacts::V1::UpdateContactRequest, ::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_contact(contact: nil, update_mask: nil) -> ::Google::Cloud::EssentialContacts::V1::Contact
Pass arguments to update_contact 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
  • contact (::Google::Cloud::EssentialContacts::V1::Contact, ::Hash) — Required. The contact resource to replace the existing saved contact. Note: the email address of the contact cannot be modified.
  • update_mask (::Google::Protobuf::FieldMask, ::Hash) — Optional. The update mask applied to the resource. For the FieldMask definition, see https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask
Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.
Example

Basic example

require "google/cloud/essential_contacts/v1"

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

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

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

# The returned object is of type Google::Cloud::EssentialContacts::V1::Contact.
p result