class Google::Cloud::Storage::Policy::Bindings
end
})
}
expression: expr
description: “description of condition”,
title: “my-condition”,
condition: {
members: [“user:owner@example.com”],
role: “roles/storage.admin”,
p.bindings.insert({
expr = “resource.name.startsWith("projects/_/buckets/bucket-name/objects/prefix-a-")”
p.version = 3 # Must be explicitly set to opt-in to support for conditions.
p.version # the value is 1
bucket.policy requested_policy_version: 3 do |p|
bucket.uniform_bucket_level_access = true
bucket = storage.bucket “my-bucket”
storage = Google::Cloud::Storage.new
require “google/cloud/storage”
@example Updating a Policy from version 1 to version 3:
@see cloud.google.com/iam/docs/overview Cloud IAM Overview
a bucket.
Enumerable object for managing Cloud IAM bindings associated with
# Bindings
#
def coerce_bindings *bindings
def coerce_bindings *bindings bindings.map do |binding| binding = Binding.new(**binding) if binding.is_a? Hash raise ArgumentError, "expected Binding, not #{binding.inspect}" unless binding.is_a? Binding binding end end
def each &block
-
(Enumerator)
-
Other tags:
- Yieldparam: binding - A
Other tags:
- Yield: - A binding in this bindings collection.
def each &block return enum_for :each unless block_given? @bindings.each(&block) end
def initialize
- Private: - Creates a Bindings object.
def initialize @bindings = [] end
def insert *bindings
- Example: Updating a Policy from version 1 to version 3: -
Returns:
-
(Bindings)
- `self` for chaining.
Parameters:
-
bindings
(Google::Cloud::Storage::Policy::Binding, Hash
) -- One
def insert *bindings bindings = coerce_bindings(*bindings) @bindings += bindings self end
def remove *bindings
-
(Bindings)
- `self` for chaining.
Parameters:
-
bindings
(Google::Cloud::Storage::Policy::Binding, Hash
) -- One
def remove *bindings bindings = coerce_bindings(*bindings) @bindings -= bindings self end
def to_gapi
- Private: -
def to_gapi @bindings.map(&:to_gapi) end