# Assured Workloads for Government V1beta1 API - Class Google::Cloud::AssuredWorkloads::V1beta1::AssuredWorkloadsService::Rest::Client (v0.26.0)

0.26.0 (latest) 0.25.0 0.24.0 0.23.1 0.22.0 0.21.1 0.20.1 0.19.0 0.18.1 0.17.2 0.16.0 0.15.0 0.14.0 0.13.0 0.12.0 0.11.0 0.10.0 0.9.2 Reference documentation and code samples for the Assured Workloads for Government V1beta1 API class Google::Cloud::AssuredWorkloads::V1beta1::AssuredWorkloadsService::Rest::Client.

REST client for the AssuredWorkloadsService service.


<br />

Service to manage AssuredWorkloads.

## Inherits

- Object

## Includes

- [Google::Cloud::AssuredWorkloads::V1beta1::AssuredWorkloadsService::Paths](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-assured_workloads-v1beta1/latest/Google-Cloud-AssuredWorkloads-V1beta1-AssuredWorkloadsService-Paths)

## Methods

### .configure

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

Configure the AssuredWorkloadsService Client class.


<br />

See [Configuration](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-assured_workloads-v1beta1/latest/Google-Cloud-AssuredWorkloads-V1beta1-AssuredWorkloadsService-Rest-Client-Configuration "Google::Cloud::AssuredWorkloads::V1beta1::AssuredWorkloadsService::Rest::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-assured_workloads-v1beta1/latest/Google-Cloud-AssuredWorkloads-V1beta1-AssuredWorkloadsService-Rest-Client-Configuration))
**Returns**

- ([Client::Configuration](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-assured_workloads-v1beta1/latest/Google-Cloud-AssuredWorkloads-V1beta1-AssuredWorkloadsService-Rest-Client-Configuration))
**Example**

```ruby
# Modify the configuration for all AssuredWorkloadsService clients
::Google::Cloud::AssuredWorkloads::V1beta1::AssuredWorkloadsService::Rest::Client.configure do |config|
  config.timeout = 10.0
end
```

### #configure

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

Configure the AssuredWorkloadsService 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-assured_workloads-v1beta1/latest/Google-Cloud-AssuredWorkloads-V1beta1-AssuredWorkloadsService-Rest-Client#Google__Cloud__AssuredWorkloads__V1beta1__AssuredWorkloadsService__Rest__Client_configure_class_ "Google::Cloud::AssuredWorkloads::V1beta1::AssuredWorkloadsService::Rest::Client.configure (method)").

<br />

See [Configuration](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-assured_workloads-v1beta1/latest/Google-Cloud-AssuredWorkloads-V1beta1-AssuredWorkloadsService-Rest-Client-Configuration "Google::Cloud::AssuredWorkloads::V1beta1::AssuredWorkloadsService::Rest::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-assured_workloads-v1beta1/latest/Google-Cloud-AssuredWorkloads-V1beta1-AssuredWorkloadsService-Rest-Client-Configuration))
**Returns**

- ([Client::Configuration](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-assured_workloads-v1beta1/latest/Google-Cloud-AssuredWorkloads-V1beta1-AssuredWorkloadsService-Rest-Client-Configuration))

### #create_workload

    def create_workload(request, options = nil) -> ::Gapic::Operation
    def create_workload(parent: nil, workload: nil, external_id: nil) -> ::Gapic::Operation

Creates Assured Workload.
**Overloads**

    def create_workload(request, options = nil) -> ::Gapic::Operation

Pass arguments to `create_workload` via a request object, either of type [CreateWorkloadRequest](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-assured_workloads-v1beta1/latest/Google-Cloud-AssuredWorkloads-V1beta1-CreateWorkloadRequest "Google::Cloud::AssuredWorkloads::V1beta1::CreateWorkloadRequest (class)") or an equivalent Hash. **Parameters**

- **request** ([::Google::Cloud::AssuredWorkloads::V1beta1::CreateWorkloadRequest](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-assured_workloads-v1beta1/latest/Google-Cloud-AssuredWorkloads-V1beta1-CreateWorkloadRequest), ::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_workload(parent: nil, workload: nil, external_id: nil) -> ::Gapic::Operation

Pass arguments to `create_workload` 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 name of the new Workload's parent. Must be of the form `organizations/{org_id}/locations/{location_id}`.
- **workload** ([::Google::Cloud::AssuredWorkloads::V1beta1::Workload](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-assured_workloads-v1beta1/latest/Google-Cloud-AssuredWorkloads-V1beta1-Workload), ::Hash) --- Required. Assured Workload to create
- **external_id** (::String) --- Optional. A identifier associated with the workload and underlying projects which allows for the break down of billing costs for a workload. The value provided for the identifier will add a label to the workload and contained projects with the identifier as the value.
**Yields**

- (result, operation) --- Access the result along with the TransportOperation object
**Yield Parameters**

- **result** (::Gapic::Operation)
- **operation** (::Gapic::Rest::TransportOperation)
**Returns**

- (::Gapic::Operation)
**Raises**

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

Basic example

```ruby
require "google/cloud/assured_workloads/v1beta1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::AssuredWorkloads::V1beta1::AssuredWorkloadsService::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::AssuredWorkloads::V1beta1::CreateWorkloadRequest.new

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

# The returned object is of type Gapic::Operation. You can use it to
# check the status of an operation, cancel it, or wait for results.
# Here is how to wait for a response.
result.wait_until_done! timeout: 60
if result.response?
  p result.response
else
  puts "No response received."
end
```

### #delete_workload

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

Deletes the workload. Make sure that workload's direct children are already
in a deleted state, otherwise the request will fail with a
FAILED_PRECONDITION error.
In addition to assuredworkloads.workload.delete permission, the user should
also have orgpolicy.policy.set permission on the deleted folder to remove
Assured Workloads OrgPolicies.
**Overloads**

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

Pass arguments to `delete_workload` via a request object, either of type [DeleteWorkloadRequest](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-assured_workloads-v1beta1/latest/Google-Cloud-AssuredWorkloads-V1beta1-DeleteWorkloadRequest "Google::Cloud::AssuredWorkloads::V1beta1::DeleteWorkloadRequest (class)") or an equivalent Hash. **Parameters**

- **request** ([::Google::Cloud::AssuredWorkloads::V1beta1::DeleteWorkloadRequest](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-assured_workloads-v1beta1/latest/Google-Cloud-AssuredWorkloads-V1beta1-DeleteWorkloadRequest), ::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_workload(name: nil, etag: nil) -> ::Google::Protobuf::Empty

Pass arguments to `delete_workload` via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above). **Parameters**

- **name** (::String) --- Required. The `name` field is used to identify the workload. Format: organizations/{org_id}/locations/{location_id}/workloads/{workload_id}
- **etag** (::String) --- Optional. The etag of the workload. If this is provided, it must match the server's etag.
**Yields**

- (result, operation) --- Access the result along with the TransportOperation object
**Yield Parameters**

- **result** ([::Google::Protobuf::Empty](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-assured_workloads-v1beta1/latest/Google-Protobuf-Empty))
- **operation** (::Gapic::Rest::TransportOperation)
**Returns**

- ([::Google::Protobuf::Empty](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-assured_workloads-v1beta1/latest/Google-Protobuf-Empty))
**Raises**

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

Basic example

```ruby
require "google/cloud/assured_workloads/v1beta1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::AssuredWorkloads::V1beta1::AssuredWorkloadsService::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::AssuredWorkloads::V1beta1::DeleteWorkloadRequest.new

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

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

### #initialize

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

Create a new AssuredWorkloadsService REST client object.
**Yields**

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

- **config** ([Client::Configuration](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-assured_workloads-v1beta1/latest/Google-Cloud-AssuredWorkloads-V1beta1-AssuredWorkloadsService-Rest-Client-Configuration))
**Returns**

- ([Client](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-assured_workloads-v1beta1/latest/Google-Cloud-AssuredWorkloads-V1beta1-AssuredWorkloadsService-Rest-Client)) --- a new instance of Client
**Example**

```ruby
# Create a client using the default configuration
client = ::Google::Cloud::AssuredWorkloads::V1beta1::AssuredWorkloadsService::Rest::Client.new

# Create a client using a custom configuration
client = ::Google::Cloud::AssuredWorkloads::V1beta1::AssuredWorkloadsService::Rest::Client.new do |config|
  config.timeout = 10.0
end
```

### #logger

    def logger() -> Logger

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

- (Logger)

### #operations_client

    def operations_client() -> ::Google::Cloud::AssuredWorkloads::V1beta1::AssuredWorkloadsService::Rest::Operations

Get the associated client for long-running operations.
**Returns**

- ([::Google::Cloud::AssuredWorkloads::V1beta1::AssuredWorkloadsService::Rest::Operations](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-assured_workloads-v1beta1/latest/Google-Cloud-AssuredWorkloads-V1beta1-AssuredWorkloadsService-Rest-Operations))

### #restrict_allowed_resources

    def restrict_allowed_resources(request, options = nil) -> ::Google::Cloud::AssuredWorkloads::V1beta1::RestrictAllowedResourcesResponse
    def restrict_allowed_resources(name: nil, restriction_type: nil) -> ::Google::Cloud::AssuredWorkloads::V1beta1::RestrictAllowedResourcesResponse

Restrict the list of resources allowed in the Workload environment.
The current list of allowed products can be found at
<https://cloud.google.com/assured-workloads/docs/supported-products>
In addition to assuredworkloads.workload.update permission, the user should
also have orgpolicy.policy.set permission on the folder resource
to use this functionality.
**Overloads**

    def restrict_allowed_resources(request, options = nil) -> ::Google::Cloud::AssuredWorkloads::V1beta1::RestrictAllowedResourcesResponse

Pass arguments to `restrict_allowed_resources` via a request object, either of type [RestrictAllowedResourcesRequest](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-assured_workloads-v1beta1/latest/Google-Cloud-AssuredWorkloads-V1beta1-RestrictAllowedResourcesRequest "Google::Cloud::AssuredWorkloads::V1beta1::RestrictAllowedResourcesRequest (class)") or an equivalent Hash. **Parameters**

- **request** ([::Google::Cloud::AssuredWorkloads::V1beta1::RestrictAllowedResourcesRequest](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-assured_workloads-v1beta1/latest/Google-Cloud-AssuredWorkloads-V1beta1-RestrictAllowedResourcesRequest), ::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 restrict_allowed_resources(name: nil, restriction_type: nil) -> ::Google::Cloud::AssuredWorkloads::V1beta1::RestrictAllowedResourcesResponse

Pass arguments to `restrict_allowed_resources` via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above). **Parameters**

- **name** (::String) --- Required. The resource name of the Workload. This is the workloads's relative path in the API, formatted as "organizations/{organization_id}/locations/{location_id}/workloads/{workload_id}". For example, "organizations/123/locations/us-east1/workloads/assured-workload-1".
- **restriction_type** ([::Google::Cloud::AssuredWorkloads::V1beta1::RestrictAllowedResourcesRequest::RestrictionType](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-assured_workloads-v1beta1/latest/Google-Cloud-AssuredWorkloads-V1beta1-RestrictAllowedResourcesRequest-RestrictionType)) --- Required. The type of restriction for using gcp products in the Workload environment.
**Yields**

- (result, operation) --- Access the result along with the TransportOperation object
**Yield Parameters**

- **result** ([::Google::Cloud::AssuredWorkloads::V1beta1::RestrictAllowedResourcesResponse](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-assured_workloads-v1beta1/latest/Google-Cloud-AssuredWorkloads-V1beta1-RestrictAllowedResourcesResponse))
- **operation** (::Gapic::Rest::TransportOperation)
**Returns**

- ([::Google::Cloud::AssuredWorkloads::V1beta1::RestrictAllowedResourcesResponse](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-assured_workloads-v1beta1/latest/Google-Cloud-AssuredWorkloads-V1beta1-RestrictAllowedResourcesResponse))
**Raises**

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

Basic example

```ruby
require "google/cloud/assured_workloads/v1beta1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::AssuredWorkloads::V1beta1::AssuredWorkloadsService::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::AssuredWorkloads::V1beta1::RestrictAllowedResourcesRequest.new

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

# The returned object is of type Google::Cloud::AssuredWorkloads::V1beta1::RestrictAllowedResourcesResponse.
p result
```

### #universe_domain

    def universe_domain() -> String

The effective universe domain
**Returns**

- (String)