1.62.2 (latest) 1.62.1 1.61.0 1.60.0 1.59.0 1.58.0 1.57.1 1.56.0 1.55.0 1.54.0 1.53.0 1.52.0 1.51.0 1.50.0 1.49.0 1.48.1 1.47.0 1.46.0 1.45.0 1.44.0 1.43.0 1.42.0 1.41.0 1.40.0 1.39.0 1.38.0 1.37.0 1.36.2 1.35.0 Reference documentation and code samples for the Cloud Storage API class Google::Cloud::Storage::Policy::Condition.

## Condition

Value object accepting an attribute-based logic expression based on a
subset of the Common Expression Language (CEL).

## Inherits

- Object

## Examples

```ruby
require "google/cloud/storage"

storage = Google::Cloud::Storage.new
bucket = storage.bucket "my-bucket"

policy = bucket.policy requested_policy_version: 3
policy.bindings.each do |binding|
  puts binding.condition.title if binding.condition
end
```

Updating a Policy from version 1 to version 3 by adding a condition:

```ruby
require "google/cloud/storage"

storage = Google::Cloud::Storage.new
bucket = storage.bucket "my-bucket"

bucket.uniform_bucket_level_access = true

bucket.policy requested_policy_version: 3 do |p|
  p.version # the value is 1
  p.version = 3 # Must be explicitly set to opt-in to support for conditions.

  expr = "resource.name.startsWith(\"projects/_/buckets/bucket-name/objects/prefix-a-\")"
  p.bindings.insert({
                      role: "roles/storage.admin",
                      members: ["user:owner@example.com"],
                      condition: {
                        title: "my-condition",
                        description: "description of condition",
                        expression: expr
                      }
                    })
end
```

## Methods

### #description

```ruby
def description() -> String
```
Used to document the condition. Optional.
**Returns**

- (String) --- the current value of description

### #description=

```ruby
def description=(new_description)
```
The description to document the condition. Optional.

### #expression

```ruby
def expression() -> String
```
Defines an attribute-based logic
expression using a subset of the Common Expression Language (CEL).
The condition expression can contain multiple statements, each uses
one attributes, and statements are combined using logic operators,
following CEL language specification. Required.
**Returns**

- (String) --- the current value of expression

### #expression=

```ruby
def expression=(new_expression)
```
An attribute-based logic expression using a subset of the Common
Expression Language (CEL). The condition expression can contain
multiple statements, each uses one attributes, and statements are
combined using logic operators, following CEL language
specification. Required.

### #initialize

```ruby
def initialize(title:, expression:, description: nil) -> Condition
```
Creates a Condition object.
**Parameters**

- **title** (String) --- Used to identify the condition. Required.
- **description** (String) *(defaults to: nil)* --- Used to document the condition. Optional.
- **expression** (String) --- Defines an attribute-based logic expression using a subset of the Common Expression Language (CEL). The condition expression can contain multiple statements, each uses one attributes, and statements are combined using logic operators, following CEL language specification. Required.
**Returns**

- ([Condition](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-storage/latest/Google-Cloud-Storage-Policy-Condition.md.txt)) --- a new instance of Condition

### #title

```ruby
def title() -> String
```
Used to identify the condition. Required.
**Returns**

- (String) --- the current value of title

### #title=

```ruby
def title=(new_title)
```
The title used to identify the condition. Required.

### #to_gapi

```ruby
def to_gapi()
```