# Assured Workloads for Government V1 API - Class Google::Cloud::AssuredWorkloads::V1::AssuredWorkloadsService::Client (v1.8.0)

1.8.0 (latest) 1.7.0 1.6.0 1.5.1 1.4.0 1.3.0 1.2.1 1.1.0 1.0.1 0.10.0 0.9.2 0.8.0 0.7.0 0.6.0 0.5.0 0.4.0 0.3.0 0.2.1 Reference documentation and code samples for the Assured Workloads for Government V1 API class Google::Cloud::AssuredWorkloads::V1::AssuredWorkloadsService::Client.

Client for the AssuredWorkloadsService service.


<br />

Service to manage AssuredWorkloads.

## Inherits

- Object

## Includes

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

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

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

### #acknowledge_violation

    def acknowledge_violation(request, options = nil) -> ::Google::Cloud::AssuredWorkloads::V1::AcknowledgeViolationResponse
    def acknowledge_violation(name: nil, comment: nil, non_compliant_org_policy: nil) -> ::Google::Cloud::AssuredWorkloads::V1::AcknowledgeViolationResponse

Acknowledges an existing violation. By acknowledging a violation, users
acknowledge the existence of a compliance violation in their workload and
decide to ignore it due to a valid business justification. Acknowledgement
is a permanent operation and it cannot be reverted.
**Overloads**

    def acknowledge_violation(request, options = nil) -> ::Google::Cloud::AssuredWorkloads::V1::AcknowledgeViolationResponse

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

- **request** ([::Google::Cloud::AssuredWorkloads::V1::AcknowledgeViolationRequest](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-assured_workloads-v1/latest/Google-Cloud-AssuredWorkloads-V1-AcknowledgeViolationRequest), ::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 acknowledge_violation(name: nil, comment: nil, non_compliant_org_policy: nil) -> ::Google::Cloud::AssuredWorkloads::V1::AcknowledgeViolationResponse

Pass arguments to `acknowledge_violation` 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 Violation to acknowledge. Format: organizations/{organization}/locations/{location}/workloads/{workload}/violations/{violation}
- **comment** (::String) --- Required. Business justification explaining the need for violation acknowledgement
- **non_compliant_org_policy** (::String) --- Optional. This field is deprecated and will be removed in future version of the API. Name of the OrgPolicy which was modified with non-compliant change and resulted in this violation. Format: projects/{project_number}/policies/{constraint_name} folders/{folder_id}/policies/{constraint_name} organizations/{organization_id}/policies/{constraint_name}
**Yields**

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

- **response** ([::Google::Cloud::AssuredWorkloads::V1::AcknowledgeViolationResponse](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-assured_workloads-v1/latest/Google-Cloud-AssuredWorkloads-V1-AcknowledgeViolationResponse))
- **operation** (::GRPC::ActiveCall::Operation)
**Returns**

- ([::Google::Cloud::AssuredWorkloads::V1::AcknowledgeViolationResponse](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-assured_workloads-v1/latest/Google-Cloud-AssuredWorkloads-V1-AcknowledgeViolationResponse))
**Raises**

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

Basic example

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

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

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

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

# The returned object is of type Google::Cloud::AssuredWorkloads::V1::AcknowledgeViolationResponse.
p result
```

### #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-v1/latest/Google-Cloud-AssuredWorkloads-V1-AssuredWorkloadsService-Client#Google__Cloud__AssuredWorkloads__V1__AssuredWorkloadsService__Client_configure_class_ "Google::Cloud::AssuredWorkloads::V1::AssuredWorkloadsService::Client.configure (method)").

<br />

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

- ([Client::Configuration](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-assured_workloads-v1/latest/Google-Cloud-AssuredWorkloads-V1-AssuredWorkloadsService-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-v1/latest/Google-Cloud-AssuredWorkloads-V1-CreateWorkloadRequest "Google::Cloud::AssuredWorkloads::V1::CreateWorkloadRequest (class)") or an equivalent Hash. **Parameters**

- **request** ([::Google::Cloud::AssuredWorkloads::V1::CreateWorkloadRequest](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-assured_workloads-v1/latest/Google-Cloud-AssuredWorkloads-V1-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::V1::Workload](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-assured_workloads-v1/latest/Google-Cloud-AssuredWorkloads-V1-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**

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

- **response** (::Gapic::Operation)
- **operation** (::GRPC::ActiveCall::Operation)
**Returns**

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

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

Basic example

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

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

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::AssuredWorkloads::V1::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.
**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-v1/latest/Google-Cloud-AssuredWorkloads-V1-DeleteWorkloadRequest "Google::Cloud::AssuredWorkloads::V1::DeleteWorkloadRequest (class)") or an equivalent Hash. **Parameters**

- **request** ([::Google::Cloud::AssuredWorkloads::V1::DeleteWorkloadRequest](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-assured_workloads-v1/latest/Google-Cloud-AssuredWorkloads-V1-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**

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

- **response** ([::Google::Protobuf::Empty](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-assured_workloads-v1/latest/Google-Protobuf-Empty))
- **operation** (::GRPC::ActiveCall::Operation)
**Returns**

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

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

Basic example

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

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

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

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

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

### #get_violation

    def get_violation(request, options = nil) -> ::Google::Cloud::AssuredWorkloads::V1::Violation
    def get_violation(name: nil) -> ::Google::Cloud::AssuredWorkloads::V1::Violation

Retrieves Assured Workload Violation based on ID.
**Overloads**

    def get_violation(request, options = nil) -> ::Google::Cloud::AssuredWorkloads::V1::Violation

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

- **request** ([::Google::Cloud::AssuredWorkloads::V1::GetViolationRequest](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-assured_workloads-v1/latest/Google-Cloud-AssuredWorkloads-V1-GetViolationRequest), ::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_violation(name: nil) -> ::Google::Cloud::AssuredWorkloads::V1::Violation

Pass arguments to `get_violation` 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 resource name of the Violation to fetch (ie. Violation.name). Format: organizations/{organization}/locations/{location}/workloads/{workload}/violations/{violation}
**Yields**

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

- **response** ([::Google::Cloud::AssuredWorkloads::V1::Violation](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-assured_workloads-v1/latest/Google-Cloud-AssuredWorkloads-V1-Violation))
- **operation** (::GRPC::ActiveCall::Operation)
**Returns**

- ([::Google::Cloud::AssuredWorkloads::V1::Violation](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-assured_workloads-v1/latest/Google-Cloud-AssuredWorkloads-V1-Violation))
**Raises**

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

Basic example

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

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

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

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

# The returned object is of type Google::Cloud::AssuredWorkloads::V1::Violation.
p result
```

### #get_workload

    def get_workload(request, options = nil) -> ::Google::Cloud::AssuredWorkloads::V1::Workload
    def get_workload(name: nil) -> ::Google::Cloud::AssuredWorkloads::V1::Workload

Gets Assured Workload associated with a CRM Node
**Overloads**

    def get_workload(request, options = nil) -> ::Google::Cloud::AssuredWorkloads::V1::Workload

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

- **request** ([::Google::Cloud::AssuredWorkloads::V1::GetWorkloadRequest](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-assured_workloads-v1/latest/Google-Cloud-AssuredWorkloads-V1-GetWorkloadRequest), ::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_workload(name: nil) -> ::Google::Cloud::AssuredWorkloads::V1::Workload

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

- **name** (::String) --- Required. The resource name of the Workload to fetch. This is the workload'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".
**Yields**

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

- **response** ([::Google::Cloud::AssuredWorkloads::V1::Workload](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-assured_workloads-v1/latest/Google-Cloud-AssuredWorkloads-V1-Workload))
- **operation** (::GRPC::ActiveCall::Operation)
**Returns**

- ([::Google::Cloud::AssuredWorkloads::V1::Workload](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-assured_workloads-v1/latest/Google-Cloud-AssuredWorkloads-V1-Workload))
**Raises**

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

Basic example

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

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

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

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

# The returned object is of type Google::Cloud::AssuredWorkloads::V1::Workload.
p result
```

### #initialize

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

Create a new AssuredWorkloadsService 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-v1/latest/Google-Cloud-AssuredWorkloads-V1-AssuredWorkloadsService-Client-Configuration))
**Returns**

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

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

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

### #list_violations

    def list_violations(request, options = nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::AssuredWorkloads::V1::Violation>
    def list_violations(parent: nil, interval: nil, page_size: nil, page_token: nil, filter: nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::AssuredWorkloads::V1::Violation>

Lists the Violations in the AssuredWorkload Environment.
Callers may also choose to read across multiple Workloads as per
[AIP-159](https://google.aip.dev/159) by using '-' (the hyphen or dash
character) as a wildcard character instead of workload-id in the parent.
Format `organizations/{org_id}/locations/{location}/workloads/-`
**Overloads**

    def list_violations(request, options = nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::AssuredWorkloads::V1::Violation>

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

- **request** ([::Google::Cloud::AssuredWorkloads::V1::ListViolationsRequest](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-assured_workloads-v1/latest/Google-Cloud-AssuredWorkloads-V1-ListViolationsRequest), ::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_violations(parent: nil, interval: nil, page_size: nil, page_token: nil, filter: nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::AssuredWorkloads::V1::Violation>

Pass arguments to `list_violations` 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 Workload name. Format `organizations/{org_id}/locations/{location}/workloads/{workload}`.
- **interval** ([::Google::Cloud::AssuredWorkloads::V1::TimeWindow](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-assured_workloads-v1/latest/Google-Cloud-AssuredWorkloads-V1-TimeWindow), ::Hash) --- Optional. Specifies the time window for retrieving active Violations. When specified, retrieves Violations that were active between start_time and end_time.
- **page_size** (::Integer) --- Optional. Page size.
- **page_token** (::String) --- Optional. Page token returned from previous request.
- **filter** (::String) --- Optional. A custom filter for filtering by the Violations properties.
**Yields**

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

- **response** (::Gapic::PagedEnumerable\<[::Google::Cloud::AssuredWorkloads::V1::Violation](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-assured_workloads-v1/latest/Google-Cloud-AssuredWorkloads-V1-Violation)\>)
- **operation** (::GRPC::ActiveCall::Operation)
**Returns**

- (::Gapic::PagedEnumerable\<[::Google::Cloud::AssuredWorkloads::V1::Violation](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-assured_workloads-v1/latest/Google-Cloud-AssuredWorkloads-V1-Violation)\>)
**Raises**

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

Basic example

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

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

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

# Call the list_violations method.
result = client.list_violations 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::AssuredWorkloads::V1::Violation.
  p item
end
```

### #list_workloads

    def list_workloads(request, options = nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::AssuredWorkloads::V1::Workload>
    def list_workloads(parent: nil, page_size: nil, page_token: nil, filter: nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::AssuredWorkloads::V1::Workload>

Lists Assured Workloads under a CRM Node.
**Overloads**

    def list_workloads(request, options = nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::AssuredWorkloads::V1::Workload>

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

- **request** ([::Google::Cloud::AssuredWorkloads::V1::ListWorkloadsRequest](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-assured_workloads-v1/latest/Google-Cloud-AssuredWorkloads-V1-ListWorkloadsRequest), ::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_workloads(parent: nil, page_size: nil, page_token: nil, filter: nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::AssuredWorkloads::V1::Workload>

Pass arguments to `list_workloads` 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. Parent Resource to list workloads from. Must be of the form `organizations/{org_id}/locations/{location}`.
- **page_size** (::Integer) --- Page size.
- **page_token** (::String) --- Page token returned from previous request. Page token contains context from previous request. Page token needs to be passed in the second and following requests.
- **filter** (::String) --- A custom filter for filtering by properties of a workload. At this time, only filtering by labels is supported.
**Yields**

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

- **response** (::Gapic::PagedEnumerable\<[::Google::Cloud::AssuredWorkloads::V1::Workload](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-assured_workloads-v1/latest/Google-Cloud-AssuredWorkloads-V1-Workload)\>)
- **operation** (::GRPC::ActiveCall::Operation)
**Returns**

- (::Gapic::PagedEnumerable\<[::Google::Cloud::AssuredWorkloads::V1::Workload](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-assured_workloads-v1/latest/Google-Cloud-AssuredWorkloads-V1-Workload)\>)
**Raises**

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

Basic example

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

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

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

# Call the list_workloads method.
result = client.list_workloads 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::AssuredWorkloads::V1::Workload.
  p item
end
```

### #logger

    def logger() -> Logger

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

- (Logger)

### #operations_client

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

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

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

### #restrict_allowed_resources

    def restrict_allowed_resources(request, options = nil) -> ::Google::Cloud::AssuredWorkloads::V1::RestrictAllowedResourcesResponse
    def restrict_allowed_resources(name: nil, restriction_type: nil) -> ::Google::Cloud::AssuredWorkloads::V1::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::V1::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-v1/latest/Google-Cloud-AssuredWorkloads-V1-RestrictAllowedResourcesRequest "Google::Cloud::AssuredWorkloads::V1::RestrictAllowedResourcesRequest (class)") or an equivalent Hash. **Parameters**

- **request** ([::Google::Cloud::AssuredWorkloads::V1::RestrictAllowedResourcesRequest](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-assured_workloads-v1/latest/Google-Cloud-AssuredWorkloads-V1-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::V1::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::V1::RestrictAllowedResourcesRequest::RestrictionType](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-assured_workloads-v1/latest/Google-Cloud-AssuredWorkloads-V1-RestrictAllowedResourcesRequest-RestrictionType)) --- Required. The type of restriction for using gcp products in the Workload environment.
**Yields**

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

- **response** ([::Google::Cloud::AssuredWorkloads::V1::RestrictAllowedResourcesResponse](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-assured_workloads-v1/latest/Google-Cloud-AssuredWorkloads-V1-RestrictAllowedResourcesResponse))
- **operation** (::GRPC::ActiveCall::Operation)
**Returns**

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

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

Basic example

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

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

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

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

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

### #universe_domain

    def universe_domain() -> String

The effective universe domain
**Returns**

- (String)

### #update_workload

    def update_workload(request, options = nil) -> ::Google::Cloud::AssuredWorkloads::V1::Workload
    def update_workload(workload: nil, update_mask: nil) -> ::Google::Cloud::AssuredWorkloads::V1::Workload

Updates an existing workload.
Currently allows updating of workload display_name and labels.
For force updates don't set etag field in the Workload.
Only one update operation per workload can be in progress.
**Overloads**

    def update_workload(request, options = nil) -> ::Google::Cloud::AssuredWorkloads::V1::Workload

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

- **request** ([::Google::Cloud::AssuredWorkloads::V1::UpdateWorkloadRequest](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-assured_workloads-v1/latest/Google-Cloud-AssuredWorkloads-V1-UpdateWorkloadRequest), ::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_workload(workload: nil, update_mask: nil) -> ::Google::Cloud::AssuredWorkloads::V1::Workload

Pass arguments to `update_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**

- **workload** ([::Google::Cloud::AssuredWorkloads::V1::Workload](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-assured_workloads-v1/latest/Google-Cloud-AssuredWorkloads-V1-Workload), ::Hash) --- Required. The workload to update. The workload's `name` field is used to identify the workload to be updated. Format: organizations/{org_id}/locations/{location_id}/workloads/{workload_id}
- **update_mask** ([::Google::Protobuf::FieldMask](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-assured_workloads-v1/latest/Google-Protobuf-FieldMask), ::Hash) --- Required. The list of fields to be updated.
**Yields**

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

- **response** ([::Google::Cloud::AssuredWorkloads::V1::Workload](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-assured_workloads-v1/latest/Google-Cloud-AssuredWorkloads-V1-Workload))
- **operation** (::GRPC::ActiveCall::Operation)
**Returns**

- ([::Google::Cloud::AssuredWorkloads::V1::Workload](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-assured_workloads-v1/latest/Google-Cloud-AssuredWorkloads-V1-Workload))
**Raises**

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

Basic example

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

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

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

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

# The returned object is of type Google::Cloud::AssuredWorkloads::V1::Workload.
p result
```