class Google::Cloud::Storage::Policy

# Policy

An abstract Cloud IAM Policy for the Cloud Storage service. See concrete subclasses {Google::Cloud::Storage::PolicyV1} and {Google::Cloud::Storage::PolicyV3}.

A common pattern for updating a resource's metadata, such as its Policy, is to read the current data from the service, update the data locally, and then send the modified data for writing. This pattern may result in a conflict if two or more processes attempt the sequence simultaneously. IAM solves this problem with the {Google::Cloud::Storage::Policy#etag} property, which is used to verify whether the policy has changed since the last request. When you make a request to with an `etag` value, Cloud IAM compares the `etag` value in the request with the existing `etag` value associated with the policy. It writes the policy only if the `etag` values match.

When you update a policy, first read the policy (and its current `etag`) from the service, then modify the policy locally, and then write the modified policy to the service. See {Google::Cloud::Storage::Bucket#policy} and {Google::Cloud::Storage::Bucket#policy=}.

@see cloud.google.com/iam/docs/managing-policies Managing

policies

@see cloud.google.com/storage/docs/json_api/v1/buckets/setIamPolicy

Buckets: setIamPolicy

@attr [String] etag Used to verify whether the policy has changed since

the last request. The policy will be written only if the `etag` values
match.

@attr [Integer] version The syntax schema version of the policy. Each version

of the policy contains a specific syntax schema that can be used by bindings.
The newer version may contain role bindings with the newer syntax schema
that is unsupported by earlier versions. This field is not intended to
be used for any purposes other than policy syntax schema control.

The following policy versions are valid:

* 1 -  The first version of Cloud IAM policy schema. Supports binding one
  role to one or more members. Does not support conditional bindings.
* 3 - Introduces the condition field in the role binding, which further
  constrains the role binding via context-based and attribute-based rules.
  See [Understanding policies](https://cloud.google.com/iam/docs/policies)
  and [Overview of Cloud IAM Conditions](https://cloud.google.com/iam/docs/conditions-overview)
  for more information.

Attributes

etag[R]
version[R]

Public Class Methods

new(etag, version) click to toggle source

@private Creates a Policy object.

# File lib/google/cloud/storage/policy.rb, line 77
def initialize etag, version
  @etag = etag
  @version = version
end