# Policy Simulator V1 API - Class Google::Cloud::PolicySimulator::V1::Simulator::Rest::Client (v1.9.0)

1.9.0 (latest) 1.8.1 1.7.0 1.6.1 1.5.0 1.4.0 1.3.0 1.2.1 1.1.0 1.0.1 0.4.0 0.3.2 0.2.0 0.1.1 Reference documentation and code samples for the Policy Simulator V1 API class Google::Cloud::PolicySimulator::V1::Simulator::Rest::Client.

REST client for the Simulator service.


Policy Simulator API service.

Policy Simulator is a collection of endpoints for creating, running, and
viewing a [Replay](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-policy_simulator-v1/latest/Google-Cloud-PolicySimulator-V1-Replay "Google::Cloud::PolicySimulator::V1::Replay (class)"). A
[Replay](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-policy_simulator-v1/latest/Google-Cloud-PolicySimulator-V1-Replay "Google::Cloud::PolicySimulator::V1::Replay (class)") is a type of simulation that
lets you see how your principals' access to resources might change if you
changed your IAM policy.

<br />

During a [Replay](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-policy_simulator-v1/latest/Google-Cloud-PolicySimulator-V1-Replay "Google::Cloud::PolicySimulator::V1::Replay (class)"), Policy Simulator
re-evaluates, or replays, past access attempts under both the current policy
and your proposed policy, and compares those results to determine how your
principals' access might change under the proposed policy.

## Inherits

- Object

## Includes

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

## Methods

### .configure

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

Configure the Simulator Client class.


<br />

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

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

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

### #configure

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

Configure the Simulator 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-policy_simulator-v1/latest/Google-Cloud-PolicySimulator-V1-Simulator-Rest-Client#Google__Cloud__PolicySimulator__V1__Simulator__Rest__Client_configure_class_ "Google::Cloud::PolicySimulator::V1::Simulator::Rest::Client.configure (method)").

<br />

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

- ([Client::Configuration](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-policy_simulator-v1/latest/Google-Cloud-PolicySimulator-V1-Simulator-Rest-Client-Configuration))

### #create_replay

    def create_replay(request, options = nil) -> ::Gapic::Operation
    def create_replay(parent: nil, replay: nil) -> ::Gapic::Operation

Creates and starts a [Replay](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-policy_simulator-v1/latest/Google-Cloud-PolicySimulator-V1-Replay "Google::Cloud::PolicySimulator::V1::Replay (class)") using
the given [ReplayConfig](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-policy_simulator-v1/latest/Google-Cloud-PolicySimulator-V1-ReplayConfig "Google::Cloud::PolicySimulator::V1::ReplayConfig (class)").
**Overloads**

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

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

- **request** ([::Google::Cloud::PolicySimulator::V1::CreateReplayRequest](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-policy_simulator-v1/latest/Google-Cloud-PolicySimulator-V1-CreateReplayRequest), ::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_replay(parent: nil, replay: nil) -> ::Gapic::Operation

Pass arguments to `create_replay` 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 where this [Replay](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-policy_simulator-v1/latest/Google-Cloud-PolicySimulator-V1-Replay "Google::Cloud::PolicySimulator::V1::Replay (class)") will be created. This resource must be a project, folder, or organization with a location.


  Example: `projects/my-example-project/locations/global`
- **replay** ([::Google::Cloud::PolicySimulator::V1::Replay](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-policy_simulator-v1/latest/Google-Cloud-PolicySimulator-V1-Replay), ::Hash) --- Required. The [Replay](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-policy_simulator-v1/latest/Google-Cloud-PolicySimulator-V1-Replay "Google::Cloud::PolicySimulator::V1::Replay (class)") to create. Set `Replay.ReplayConfig` to configure the replay.
**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/policy_simulator/v1"

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

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

# Call the create_replay method.
result = client.create_replay 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
```

### #get_replay

    def get_replay(request, options = nil) -> ::Google::Cloud::PolicySimulator::V1::Replay
    def get_replay(name: nil) -> ::Google::Cloud::PolicySimulator::V1::Replay

Gets the specified [Replay](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-policy_simulator-v1/latest/Google-Cloud-PolicySimulator-V1-Replay "Google::Cloud::PolicySimulator::V1::Replay (class)"). Each
`Replay` is available for at least 7 days.
**Overloads**

    def get_replay(request, options = nil) -> ::Google::Cloud::PolicySimulator::V1::Replay

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

- **request** ([::Google::Cloud::PolicySimulator::V1::GetReplayRequest](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-policy_simulator-v1/latest/Google-Cloud-PolicySimulator-V1-GetReplayRequest), ::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_replay(name: nil) -> ::Google::Cloud::PolicySimulator::V1::Replay

Pass arguments to `get_replay` 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 [Replay](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-policy_simulator-v1/latest/Google-Cloud-PolicySimulator-V1-Replay "Google::Cloud::PolicySimulator::V1::Replay (class)") to retrieve, in the following format:


  `{projects|folders|organizations}/{resource-id}/locations/global/replays/{replay-id}`,
  where `{resource-id}` is the ID of the project, folder, or organization
  that owns the `Replay`.

  Example:
  `projects/my-example-project/locations/global/replays/506a5f7f-38ce-4d7d-8e03-479ce1833c36`
**Yields**

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

- **result** ([::Google::Cloud::PolicySimulator::V1::Replay](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-policy_simulator-v1/latest/Google-Cloud-PolicySimulator-V1-Replay))
- **operation** (::Gapic::Rest::TransportOperation)
**Returns**

- ([::Google::Cloud::PolicySimulator::V1::Replay](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-policy_simulator-v1/latest/Google-Cloud-PolicySimulator-V1-Replay))
**Raises**

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

Basic example

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

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

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

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

# The returned object is of type Google::Cloud::PolicySimulator::V1::Replay.
p result
```

### #initialize

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

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

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

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

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

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

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

### #list_replay_results

    def list_replay_results(request, options = nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Cloud::PolicySimulator::V1::ReplayResult>
    def list_replay_results(parent: nil, page_size: nil, page_token: nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Cloud::PolicySimulator::V1::ReplayResult>

Lists the results of running a
[Replay](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-policy_simulator-v1/latest/Google-Cloud-PolicySimulator-V1-Replay "Google::Cloud::PolicySimulator::V1::Replay (class)").
**Overloads**

    def list_replay_results(request, options = nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Cloud::PolicySimulator::V1::ReplayResult>

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

- **request** ([::Google::Cloud::PolicySimulator::V1::ListReplayResultsRequest](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-policy_simulator-v1/latest/Google-Cloud-PolicySimulator-V1-ListReplayResultsRequest), ::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_replay_results(parent: nil, page_size: nil, page_token: nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Cloud::PolicySimulator::V1::ReplayResult>

Pass arguments to `list_replay_results` 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 [Replay](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-policy_simulator-v1/latest/Google-Cloud-PolicySimulator-V1-Replay "Google::Cloud::PolicySimulator::V1::Replay (class)") whose results are listed, in the following format:


  `{projects|folders|organizations}/{resource-id}/locations/global/replays/{replay-id}`

  Example:
  `projects/my-project/locations/global/replays/506a5f7f-38ce-4d7d-8e03-479ce1833c36`
- **page_size** (::Integer) --- The maximum number of [ReplayResult](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-policy_simulator-v1/latest/Google-Cloud-PolicySimulator-V1-ReplayResult "Google::Cloud::PolicySimulator::V1::ReplayResult (class)") objects to return. Defaults to 5000.


  The maximum value is 5000; values above 5000 are rounded down to 5000.
- **page_token** (::String) --- A page token, received from a previous [Simulator.ListReplayResults](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-policy_simulator-v1/latest/Google-Cloud-PolicySimulator-V1-Simulator-Rest-Client#Google__Cloud__PolicySimulator__V1__Simulator__Rest__Client_list_replay_results_instance_ "Google::Cloud::PolicySimulator::V1::Simulator::Rest::Client#list_replay_results (method)") call. Provide this token to retrieve the next page of results.


  When paginating, all other parameters provided to
  \[Simulator.ListReplayResults\[\] must match the call that provided the page
  token.
**Yields**

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

- **result** (::Gapic::Rest::PagedEnumerable\<[::Google::Cloud::PolicySimulator::V1::ReplayResult](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-policy_simulator-v1/latest/Google-Cloud-PolicySimulator-V1-ReplayResult)\>)
- **operation** (::Gapic::Rest::TransportOperation)
**Returns**

- (::Gapic::Rest::PagedEnumerable\<[::Google::Cloud::PolicySimulator::V1::ReplayResult](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-policy_simulator-v1/latest/Google-Cloud-PolicySimulator-V1-ReplayResult)\>)
**Raises**

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

Basic example

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

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

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

# Call the list_replay_results method.
result = client.list_replay_results 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::PolicySimulator::V1::ReplayResult.
  p item
end
```

### #logger

    def logger() -> Logger

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

- (Logger)

### #operations_client

    def operations_client() -> ::Google::Cloud::PolicySimulator::V1::Simulator::Rest::Operations

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

- ([::Google::Cloud::PolicySimulator::V1::Simulator::Rest::Operations](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-policy_simulator-v1/latest/Google-Cloud-PolicySimulator-V1-Simulator-Rest-Operations))

### #universe_domain

    def universe_domain() -> String

The effective universe domain
**Returns**

- (String)