Class: Aliyun::STS::Policy

Inherits:
Common::Struct::Base show all
Defined in:
lib/aliyun/sts/struct.rb

Overview

Constant Summary collapse

VERSION =
'1'

Instance Method Summary collapse

Methods inherited from Common::Struct::Base

#initialize, #to_s

Methods included from Common::Struct::Base::AttrHelper

#attrs

Constructor Details

This class inherits a constructor from Aliyun::Common::Struct::Base

Instance Method Details

#allow(actions, resources) ⇒ Object

Add an ‘Allow’ rule

Parameters:

  • actions (Array<String>)

    actions of the rule. e.g.: oss:GetObject, oss:Get*, oss:*

  • resources (Array<String>)

    resources of the rule. e.g.: acs:oss:::my-bucket, acs:oss:::my-bucket/*, acs:oss:::*



21
22
23
# File 'lib/aliyun/sts/struct.rb', line 21

def allow(actions, resources)
  add_rule(true, actions, resources)
end

#deny(actions, resources) ⇒ Object

Add an ‘Deny’ rule

Parameters:

  • actions (Array<String>)

    actions of the rule. e.g.: oss:GetObject, oss:Get*, oss:*

  • resources (Array<String>)

    resources of the rule. e.g.: acs:oss:::my-bucket, acs:oss:::my-bucket/*, acs:oss:::*



30
31
32
# File 'lib/aliyun/sts/struct.rb', line 30

def deny(actions, resources)
  add_rule(false, actions, resources)
end

#serializeObject

Serialize to rule to string



35
36
37
# File 'lib/aliyun/sts/struct.rb', line 35

def serialize
  {'Version' => VERSION, 'Statement' => @rules}.to_json
end