You are viewing documentation for version 3 of the AWS SDK for Ruby. Version 2 documentation can be found here.

Class: Aws::IAM::AccessKeyPair

Inherits:
Object
  • Object
show all
Defined in:
gems/aws-sdk-iam/lib/aws-sdk-iam/access_key_pair.rb

Defined Under Namespace

Classes: Collection

Actions collapse

Read-Only Attributes collapse

Instance Method Summary collapse

Constructor Details

#initialize(user_name, id, secret, options = {}) ⇒ AccessKeyPair #initialize(options = {}) ⇒ AccessKeyPair

Returns a new instance of AccessKeyPair

Overloads:

  • #initialize(user_name, id, secret, options = {}) ⇒ AccessKeyPair

    Parameters:

    • user_name (String)
    • id (String)
    • secret (String)

    Options Hash (options):

  • #initialize(options = {}) ⇒ AccessKeyPair

    Options Hash (options):

    • :user_name (required, String)
    • :id (required, String)
    • :secret (required, String)
    • :client (Client)


23
24
25
26
27
28
29
30
# File 'gems/aws-sdk-iam/lib/aws-sdk-iam/access_key_pair.rb', line 23

def initialize(*args)
  options = Hash === args.last ? args.pop.dup : {}
  @user_name = extract_user_name(args, options)
  @id = extract_id(args, options)
  @secret = extract_secret(args, options)
  @data = options.delete(:data)
  @client = options.delete(:client) || Client.new(options)
end

Instance Method Details

#activate(options = {}) ⇒ EmptyStructure

Examples:

Request syntax with placeholder values


access_key_pair.activate()

Parameters:

  • options (Hash) (defaults to: {})

    ({})

Returns:

  • (EmptyStructure)


101
102
103
104
105
106
107
108
109
# File 'gems/aws-sdk-iam/lib/aws-sdk-iam/access_key_pair.rb', line 101

def activate(options = {})
  options = options.merge(
    user_name: @user_name,
    access_key_id: @id,
    status: "Active"
  )
  resp = @client.update_access_key(options)
  resp.data
end

#clientClient

Returns:



67
68
69
# File 'gems/aws-sdk-iam/lib/aws-sdk-iam/access_key_pair.rb', line 67

def client
  @client
end

#create_dateTime

The date when the access key was created.

Returns:

  • (Time)


60
61
62
# File 'gems/aws-sdk-iam/lib/aws-sdk-iam/access_key_pair.rb', line 60

def create_date
  data.create_date
end

#dataTypes::AccessKey

Returns the data for this Aws::IAM::AccessKeyPair.

Returns:

Raises:



82
83
84
85
# File 'gems/aws-sdk-iam/lib/aws-sdk-iam/access_key_pair.rb', line 82

def data
  load unless @data
  @data
end

#data_loaded?Boolean

Returns true if this resource is loaded. Accessing attributes or #data on an unloaded resource will trigger a call to #load.

Returns:

  • (Boolean)

    Returns true if this resource is loaded. Accessing attributes or #data on an unloaded resource will trigger a call to #load.



90
91
92
# File 'gems/aws-sdk-iam/lib/aws-sdk-iam/access_key_pair.rb', line 90

def data_loaded?
  !!@data
end

#deactivate(options = {}) ⇒ EmptyStructure

Examples:

Request syntax with placeholder values


access_key_pair.deactivate()

Parameters:

  • options (Hash) (defaults to: {})

    ({})

Returns:

  • (EmptyStructure)


116
117
118
119
120
121
122
123
124
# File 'gems/aws-sdk-iam/lib/aws-sdk-iam/access_key_pair.rb', line 116

def deactivate(options = {})
  options = options.merge(
    user_name: @user_name,
    access_key_id: @id,
    status: "Inactive"
  )
  resp = @client.update_access_key(options)
  resp.data
end

#delete(options = {}) ⇒ EmptyStructure

Examples:

Request syntax with placeholder values


access_key_pair.delete()

Parameters:

  • options (Hash) (defaults to: {})

    ({})

Returns:

  • (EmptyStructure)


131
132
133
134
135
136
137
138
# File 'gems/aws-sdk-iam/lib/aws-sdk-iam/access_key_pair.rb', line 131

def delete(options = {})
  options = options.merge(
    user_name: @user_name,
    access_key_id: @id
  )
  resp = @client.delete_access_key(options)
  resp.data
end

#idString Also known as: access_key_id

Returns:

  • (String)


40
41
42
# File 'gems/aws-sdk-iam/lib/aws-sdk-iam/access_key_pair.rb', line 40

def id
  @id
end

#secretString Also known as: secret_access_key

Returns:

  • (String)


46
47
48
# File 'gems/aws-sdk-iam/lib/aws-sdk-iam/access_key_pair.rb', line 46

def secret
  @secret
end

#statusString

The status of the access key. Active means the key is valid for API calls, while Inactive means it is not.

Returns:

  • (String)


54
55
56
# File 'gems/aws-sdk-iam/lib/aws-sdk-iam/access_key_pair.rb', line 54

def status
  data.status
end

#user_nameString

Returns:

  • (String)


35
36
37
# File 'gems/aws-sdk-iam/lib/aws-sdk-iam/access_key_pair.rb', line 35

def user_name
  @user_name
end