class AliyunSDK::STS::Policy

STS Policy. Referer to help.aliyun.com/document_detail/ram/ram-user-guide/policy_reference/struct_def.html for details.

Constants

VERSION

Public Instance Methods

allow(actions, resources) click to toggle source

Add an ‘Allow’ rule @param actions [Array<String>] actions of the rule. e.g.:

oss:GetObject, oss:Get*, oss:*

@param resources [Array<String>] resources of the rule. e.g.:

acs:oss:*:*:my-bucket, acs:oss:*:*:my-bucket/*, acs:oss:*:*:*
# File lib/aliyun_sdk/sts/struct.rb, line 20
def allow(actions, resources)
  add_rule(true, actions, resources)
end
deny(actions, resources) click to toggle source

Add an ‘Deny’ rule @param actions [Array<String>] actions of the rule. e.g.:

oss:GetObject, oss:Get*, oss:*

@param resources [Array<String>] resources of the rule. e.g.:

acs:oss:*:*:my-bucket, acs:oss:*:*:my-bucket/*, acs:oss:*:*:*
# File lib/aliyun_sdk/sts/struct.rb, line 29
def deny(actions, resources)
  add_rule(false, actions, resources)
end
serialize() click to toggle source

Serialize to rule to string

# File lib/aliyun_sdk/sts/struct.rb, line 34
def serialize
  {'Version' => VERSION, 'Statement' => @rules}.to_json
end

Private Instance Methods

add_rule(allow, actions, resources) click to toggle source
# File lib/aliyun_sdk/sts/struct.rb, line 39
def add_rule(allow, actions, resources)
  @rules ||= []
  @rules << {
    'Effect' => allow ? 'Allow' : 'Deny',
    'Action' => actions,
    'Resource' => resources
  }
end