# Container Analysis V1 API - Class Google::Cloud::ContainerAnalysis::V1::ContainerAnalysis::Client (v1.7.0)

1.7.0 (latest) 1.6.0 1.5.1 1.4.0 1.3.1 1.2.0 1.1.0 1.0.1 0.10.0 0.9.2 0.8.0 0.7.1 0.6.0 0.5.0 0.4.7 Reference documentation and code samples for the Container Analysis V1 API class Google::Cloud::ContainerAnalysis::V1::ContainerAnalysis::Client.

rubocop:disable Style/Documentation

## Inherits

- Object

## Includes

- [Google::Cloud::ContainerAnalysis::V1::ContainerAnalysis::Paths](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-container_analysis-v1/latest/Google-Cloud-ContainerAnalysis-V1-ContainerAnalysis-Paths)

## Methods

### .configure

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

Configure the ContainerAnalysis Client class.


<br />

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

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

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

### #configure

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

Configure the ContainerAnalysis 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-container_analysis-v1/latest/Google-Cloud-ContainerAnalysis-V1-ContainerAnalysis-Client#Google__Cloud__ContainerAnalysis__V1__ContainerAnalysis__Client_configure_class_ "Google::Cloud::ContainerAnalysis::V1::ContainerAnalysis::Client.configure (method)").

<br />

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

- ([Client::Configuration](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-container_analysis-v1/latest/Google-Cloud-ContainerAnalysis-V1-ContainerAnalysis-Client-Configuration))

### #export_sbom

    def export_sbom(request, options = nil) -> ::Google::Cloud::ContainerAnalysis::V1::ExportSBOMResponse
    def export_sbom(name: nil, cloud_storage_location: nil) -> ::Google::Cloud::ContainerAnalysis::V1::ExportSBOMResponse

Generates an SBOM for the given resource.
**Overloads**

    def export_sbom(request, options = nil) -> ::Google::Cloud::ContainerAnalysis::V1::ExportSBOMResponse

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

- **request** ([::Google::Cloud::ContainerAnalysis::V1::ExportSBOMRequest](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-container_analysis-v1/latest/Google-Cloud-ContainerAnalysis-V1-ExportSBOMRequest), ::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 export_sbom(name: nil, cloud_storage_location: nil) -> ::Google::Cloud::ContainerAnalysis::V1::ExportSBOMResponse

Pass arguments to `export_sbom` 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 of the resource in the form of `projects/[PROJECT_ID]/resources/[RESOURCE_URL]`.
- **cloud_storage_location** ([::Google::Cloud::ContainerAnalysis::V1::ExportSBOMRequest::CloudStorageLocation](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-container_analysis-v1/latest/Google-Cloud-ContainerAnalysis-V1-ExportSBOMRequest-CloudStorageLocation), ::Hash) --- Optional. Empty placeholder to denote that this is a Google Cloud Storage export request.
**Yields**

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

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

- ([::Google::Cloud::ContainerAnalysis::V1::ExportSBOMResponse](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-container_analysis-v1/latest/Google-Cloud-ContainerAnalysis-V1-ExportSBOMResponse))
**Raises**

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

Basic example

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

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

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

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

# The returned object is of type Google::Cloud::ContainerAnalysis::V1::ExportSBOMResponse.
p result
```

### #get_iam_policy

    def get_iam_policy(request, options = nil) -> ::Google::Iam::V1::Policy
    def get_iam_policy(resource: nil, options: nil) -> ::Google::Iam::V1::Policy

Gets the access control policy for a note or an occurrence resource.
Requires `containeranalysis.notes.setIamPolicy` or
`containeranalysis.occurrences.setIamPolicy` permission if the resource is
a note or occurrence, respectively.


<br />

The resource takes the format `projects/[PROJECT_ID]/notes/[NOTE_ID]` for
notes and `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]` for
occurrences.
**Overloads**

    def get_iam_policy(request, options = nil) -> ::Google::Iam::V1::Policy

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

- **request** ([::Google::Iam::V1::GetIamPolicyRequest](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-container_analysis-v1/latest/Google-Iam-V1-GetIamPolicyRequest), ::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_iam_policy(resource: nil, options: nil) -> ::Google::Iam::V1::Policy

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

- **resource** (::String) --- REQUIRED: The resource for which the policy is being requested. See the operation documentation for the appropriate value for this field.
- **options** ([::Google::Iam::V1::GetPolicyOptions](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-container_analysis-v1/latest/Google-Iam-V1-GetPolicyOptions), ::Hash) --- OPTIONAL: A `GetPolicyOptions` object for specifying options to `GetIamPolicy`.
**Yields**

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

- **response** ([::Google::Iam::V1::Policy](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-container_analysis-v1/latest/Google-Iam-V1-Policy))
- **operation** (::GRPC::ActiveCall::Operation)
**Returns**

- ([::Google::Iam::V1::Policy](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-container_analysis-v1/latest/Google-Iam-V1-Policy))
**Raises**

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

Basic example

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

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

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Iam::V1::GetIamPolicyRequest.new

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

# The returned object is of type Google::Iam::V1::Policy.
p result
```

### #get_vulnerability_occurrences_summary

    def get_vulnerability_occurrences_summary(request, options = nil) -> ::Google::Cloud::ContainerAnalysis::V1::VulnerabilityOccurrencesSummary
    def get_vulnerability_occurrences_summary(parent: nil, filter: nil) -> ::Google::Cloud::ContainerAnalysis::V1::VulnerabilityOccurrencesSummary

Gets a summary of the number and severity of occurrences.
**Overloads**

    def get_vulnerability_occurrences_summary(request, options = nil) -> ::Google::Cloud::ContainerAnalysis::V1::VulnerabilityOccurrencesSummary

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

- **request** ([::Google::Cloud::ContainerAnalysis::V1::GetVulnerabilityOccurrencesSummaryRequest](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-container_analysis-v1/latest/Google-Cloud-ContainerAnalysis-V1-GetVulnerabilityOccurrencesSummaryRequest), ::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_vulnerability_occurrences_summary(parent: nil, filter: nil) -> ::Google::Cloud::ContainerAnalysis::V1::VulnerabilityOccurrencesSummary

Pass arguments to `get_vulnerability_occurrences_summary` 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 project to get a vulnerability summary for in the form of `projects/[PROJECT_ID]`.
- **filter** (::String) --- The filter expression.
**Yields**

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

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

- ([::Google::Cloud::ContainerAnalysis::V1::VulnerabilityOccurrencesSummary](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-container_analysis-v1/latest/Google-Cloud-ContainerAnalysis-V1-VulnerabilityOccurrencesSummary))
**Raises**

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

Basic example

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

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

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

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

# The returned object is of type Google::Cloud::ContainerAnalysis::V1::VulnerabilityOccurrencesSummary.
p result
```

### #grafeas_client

    def grafeas_client() { |config| ... } -> Grafeas::V1::Grafeas::Client

Return a Grafeas client for Container Analysis.

By default, the client uses the same connection and settings as
the underlying ContainerAnalysis client. You can optionally
customize the settings by passing a configuration block.

#### Examples

To create a new Grafeas client with the same configuration as the
ContainerAnalysis client:

    grafeas_client = container_analysis_client.grafeas_client

To create a new Grafeas client with a custom configuration:

    grafeas_client = container_analysis_client.grafeas_client do |config|
      config.timeout = 10.0
    end

**Yields**

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

- **config** ([Client::Configuration](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-container_analysis-v1/latest/Google-Cloud-ContainerAnalysis-V1-ContainerAnalysis-Client-Configuration))
**Returns**

- (Grafeas::V1::Grafeas::Client)

### #initialize

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

Create a new ContainerAnalysis client object.
**Yields**

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

- **config** ([Client::Configuration](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-container_analysis-v1/latest/Google-Cloud-ContainerAnalysis-V1-ContainerAnalysis-Client-Configuration))
**Returns**

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

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

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

### #logger

    def logger() -> Logger

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

- (Logger)

### #set_iam_policy

    def set_iam_policy(request, options = nil) -> ::Google::Iam::V1::Policy
    def set_iam_policy(resource: nil, policy: nil, update_mask: nil) -> ::Google::Iam::V1::Policy

Sets the access control policy on the specified note or occurrence.
Requires `containeranalysis.notes.setIamPolicy` or
`containeranalysis.occurrences.setIamPolicy` permission if the resource is
a note or an occurrence, respectively.


<br />

The resource takes the format `projects/[PROJECT_ID]/notes/[NOTE_ID]` for
notes and `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]` for
occurrences.
**Overloads**

    def set_iam_policy(request, options = nil) -> ::Google::Iam::V1::Policy

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

- **request** ([::Google::Iam::V1::SetIamPolicyRequest](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-container_analysis-v1/latest/Google-Iam-V1-SetIamPolicyRequest), ::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 set_iam_policy(resource: nil, policy: nil, update_mask: nil) -> ::Google::Iam::V1::Policy

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

- **resource** (::String) --- REQUIRED: The resource for which the policy is being specified. See the operation documentation for the appropriate value for this field.
- **policy** ([::Google::Iam::V1::Policy](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-container_analysis-v1/latest/Google-Iam-V1-Policy), ::Hash) --- REQUIRED: The complete policy to be applied to the `resource`. The size of the policy is limited to a few 10s of KB. An empty policy is a valid policy but certain Cloud Platform services (such as Projects) might reject them.
- **update_mask** ([::Google::Protobuf::FieldMask](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-container_analysis-v1/latest/Google-Protobuf-FieldMask), ::Hash) --- OPTIONAL: A FieldMask specifying which fields of the policy to modify. Only the fields in the mask will be modified. If no mask is provided, the following default mask is used:


  `paths: "bindings, etag"`
**Yields**

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

- **response** ([::Google::Iam::V1::Policy](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-container_analysis-v1/latest/Google-Iam-V1-Policy))
- **operation** (::GRPC::ActiveCall::Operation)
**Returns**

- ([::Google::Iam::V1::Policy](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-container_analysis-v1/latest/Google-Iam-V1-Policy))
**Raises**

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

Basic example

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

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

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Iam::V1::SetIamPolicyRequest.new

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

# The returned object is of type Google::Iam::V1::Policy.
p result
```

### #test_iam_permissions

    def test_iam_permissions(request, options = nil) -> ::Google::Iam::V1::TestIamPermissionsResponse
    def test_iam_permissions(resource: nil, permissions: nil) -> ::Google::Iam::V1::TestIamPermissionsResponse

Returns the permissions that a caller has on the specified note or
occurrence. Requires list permission on the project (for example,
`containeranalysis.notes.list`).


<br />

The resource takes the format `projects/[PROJECT_ID]/notes/[NOTE_ID]` for
notes and `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]` for
occurrences.
**Overloads**

    def test_iam_permissions(request, options = nil) -> ::Google::Iam::V1::TestIamPermissionsResponse

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

- **request** ([::Google::Iam::V1::TestIamPermissionsRequest](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-container_analysis-v1/latest/Google-Iam-V1-TestIamPermissionsRequest), ::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 test_iam_permissions(resource: nil, permissions: nil) -> ::Google::Iam::V1::TestIamPermissionsResponse

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

- **resource** (::String) --- REQUIRED: The resource for which the policy detail is being requested. See the operation documentation for the appropriate value for this field.
- **permissions** (::Array\<::String\>) --- The set of permissions to check for the `resource`. Permissions with wildcards (such as '*' or 'storage.* ') are not allowed. For more information see [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions).
**Yields**

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

- **response** ([::Google::Iam::V1::TestIamPermissionsResponse](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-container_analysis-v1/latest/Google-Iam-V1-TestIamPermissionsResponse))
- **operation** (::GRPC::ActiveCall::Operation)
**Returns**

- ([::Google::Iam::V1::TestIamPermissionsResponse](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-container_analysis-v1/latest/Google-Iam-V1-TestIamPermissionsResponse))
**Raises**

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

Basic example

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

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

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Iam::V1::TestIamPermissionsRequest.new

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

# The returned object is of type Google::Iam::V1::TestIamPermissionsResponse.
p result
```

### #universe_domain

    def universe_domain() -> String

The effective universe domain
**Returns**

- (String)