Class: Awscli::Iam::Group
- Inherits:
-
Object
- Object
- Awscli::Iam::Group
- Defined in:
- lib/awscli/iam.rb
Instance Method Summary collapse
- #create(groupname, path) ⇒ Object
- #delete(groupname) ⇒ Object
-
#initialize(connection) ⇒ Group
constructor
A new instance of Group.
- #list(path) ⇒ Object
Constructor Details
#initialize(connection) ⇒ Group
Returns a new instance of Group.
233 234 235 |
# File 'lib/awscli/iam.rb', line 233 def initialize(connection) @conn = connection end |
Instance Method Details
#create(groupname, path) ⇒ Object
244 245 246 247 248 249 250 251 |
# File 'lib/awscli/iam.rb', line 244 def create(groupname, path) @conn.create_group(groupname, path ||= '/') puts "Created group: #{groupname}" rescue Fog::AWS::IAM::ValidationError puts "ValidationError: #{$!}" rescue Fog::AWS::IAM::EntityAlreadyExists puts "[Error] Group Exists: #{$!}" end |
#delete(groupname) ⇒ Object
253 254 255 256 257 258 |
# File 'lib/awscli/iam.rb', line 253 def delete(groupname) @conn.delete_group(groupname) puts "Create group: #{groupname}" rescue Fog::AWS::IAM::NotFound puts "[Error]: #{$!}" end |
#list(path) ⇒ Object
237 238 239 240 241 242 |
# File 'lib/awscli/iam.rb', line 237 def list(path) groups = @conn.list_groups('PathPrefix' => path).body['Groups'] Formatador.display_table(groups) rescue Fog::AWS::IAM::ValidationError puts "ValidationError: #{$!}" end |