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

Reference documentation and code samples for the Container Analysis V1 API class Google::Cloud::ContainerAnalysis::V1::ContainerAnalysis::Client.

rubocop:disable Style/Documentation

Inherits

  • Object

Methods

.configure

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

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

See Configuration for a description of the configuration fields.

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

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

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 or an equivalent Hash.
Parameters
  • request (::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, ::Hash) — OPTIONAL: A GetPolicyOptions object for specifying options to GetIamPolicy.
Yields
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the RPC is aborted.
Example

Basic example

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 or an equivalent Hash.
Parameters
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
Raises
  • (::Google::Cloud::Error) — if the RPC is aborted.
Example

Basic example

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
Returns
  • (Grafeas::V1::Grafeas::Client)

#initialize

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

Create a new ContainerAnalysis client object.

Yields
  • (config) — Configure the ContainerAnalysis client.
Yield Parameter
Returns
  • (Client) — a new instance of Client
Example
# 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.

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 or an equivalent Hash.
Parameters
  • request (::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, ::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, ::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
Raises
  • (::Google::Cloud::Error) — if the RPC is aborted.
Example

Basic example

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).

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 or an equivalent Hash.
Parameters
  • request (::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.
Yields
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the RPC is aborted.
Example

Basic example

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)