Class: IbmCloudIam::ApiKey
- Inherits:
-
ApiModelBase
- Object
- ApiModelBase
- IbmCloudIam::ApiKey
- Defined in:
- lib/ibm_cloud_iam/models/api_key.rb
Overview
Response body format for API key V1 REST requests.
Instance Attribute Summary collapse
-
#account_id ⇒ Object
ID of the account that this API key authenticates for.
-
#action_when_leaked ⇒ Object
Defines the action to take when API key is leaked, valid values are 'none', 'disable' and 'delete'.
-
#activity ⇒ Object
Returns the value of attribute activity.
-
#apikey ⇒ Object
The API key value.
-
#context ⇒ Object
Returns the value of attribute context.
-
#created_at ⇒ Object
If set contains a date time string of the creation date in ISO format.
-
#created_by ⇒ Object
IAM ID of the user or service which created the API key.
-
#crn ⇒ Object
Cloud Resource Name of the item.
-
#description ⇒ Object
The optional description of the API key.
-
#disabled ⇒ Object
Defines if API key is disabled, API key cannot be used if 'disabled' is set to true.
-
#entity_tag ⇒ Object
Version of the API Key details object.
-
#expires_at ⇒ Object
Date and time when the API key becomes invalid, ISO 8601 datetime in the format 'yyyy-MM-ddTHH:mm+0000'.
-
#history ⇒ Object
History of the API key.
-
#iam_id ⇒ Object
The iam_id that this API key authenticates.
-
#id ⇒ Object
Unique identifier of this API Key.
-
#locked ⇒ Object
The API key cannot be changed if set to true.
-
#modified_at ⇒ Object
If set contains a date time string of the last modification date in ISO format.
-
#name ⇒ Object
Name of the API key.
-
#support_sessions ⇒ Object
Defines whether you can manage CLI login sessions for the API key.
Class Method Summary collapse
-
.acceptable_attribute_map ⇒ Object
Returns attribute mapping this model knows about.
-
.acceptable_attributes ⇒ Object
Returns all the JSON keys this model knows about.
-
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
-
.build_from_hash(attributes) ⇒ Object
Builds the object from hash.
-
.openapi_nullable ⇒ Object
List of attributes with nullable: true.
-
.openapi_types ⇒ Object
Attribute type mapping.
Instance Method Summary collapse
-
#==(o) ⇒ Object
Checks equality by comparing each attribute.
- #eql?(o) ⇒ Boolean
-
#hash ⇒ Integer
Calculates hash code according to all attributes.
-
#initialize(attributes = {}) ⇒ ApiKey
constructor
Initializes the object.
-
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons.
-
#to_hash ⇒ Hash
Returns the object in the form of hash.
-
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid.
Methods inherited from ApiModelBase
_deserialize, #_to_hash, #to_body, #to_s
Constructor Details
#initialize(attributes = {}) ⇒ ApiKey
Initializes the object
142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 |
# File 'lib/ibm_cloud_iam/models/api_key.rb', line 142 def initialize(attributes = {}) if (!attributes.is_a?(Hash)) fail ArgumentError, "The input argument (attributes) must be a hash in `IbmCloudIam::ApiKey` initialize method" end # check to see if the attribute exists and convert string to symbol for hash key acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| if (!acceptable_attribute_map.key?(k.to_sym)) fail ArgumentError, "`#{k}` is not a valid attribute in `IbmCloudIam::ApiKey`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } if attributes.key?(:'context') self.context = attributes[:'context'] end if attributes.key?(:'id') self.id = attributes[:'id'] else self.id = nil end if attributes.key?(:'entity_tag') self.entity_tag = attributes[:'entity_tag'] end if attributes.key?(:'crn') self.crn = attributes[:'crn'] else self.crn = nil end if attributes.key?(:'locked') self.locked = attributes[:'locked'] else self.locked = nil end if attributes.key?(:'disabled') self.disabled = attributes[:'disabled'] end if attributes.key?(:'created_at') self.created_at = attributes[:'created_at'] end if attributes.key?(:'created_by') self.created_by = attributes[:'created_by'] else self.created_by = nil end if attributes.key?(:'modified_at') self.modified_at = attributes[:'modified_at'] end if attributes.key?(:'name') self.name = attributes[:'name'] else self.name = nil end if attributes.key?(:'support_sessions') self.support_sessions = attributes[:'support_sessions'] end if attributes.key?(:'action_when_leaked') self.action_when_leaked = attributes[:'action_when_leaked'] end if attributes.key?(:'expires_at') self.expires_at = attributes[:'expires_at'] end if attributes.key?(:'description') self.description = attributes[:'description'] end if attributes.key?(:'iam_id') self.iam_id = attributes[:'iam_id'] else self.iam_id = nil end if attributes.key?(:'account_id') self.account_id = attributes[:'account_id'] else self.account_id = nil end if attributes.key?(:'apikey') self.apikey = attributes[:'apikey'] else self.apikey = nil end if attributes.key?(:'history') if (value = attributes[:'history']).is_a?(Array) self.history = value end end if attributes.key?(:'activity') self.activity = attributes[:'activity'] end end |
Instance Attribute Details
#account_id ⇒ Object
ID of the account that this API key authenticates for.
64 65 66 |
# File 'lib/ibm_cloud_iam/models/api_key.rb', line 64 def account_id @account_id end |
#action_when_leaked ⇒ Object
Defines the action to take when API key is leaked, valid values are 'none', 'disable' and 'delete'.
52 53 54 |
# File 'lib/ibm_cloud_iam/models/api_key.rb', line 52 def action_when_leaked @action_when_leaked end |
#activity ⇒ Object
Returns the value of attribute activity.
72 73 74 |
# File 'lib/ibm_cloud_iam/models/api_key.rb', line 72 def activity @activity end |
#apikey ⇒ Object
The API key value. This property only contains the API key value for the following cases: create an API key, update a service ID API key that stores the API key value as retrievable, or get a service ID API key that stores the API key value as retrievable. All other operations don't return the API key value, for example all user API key related operations, except for create, don't contain the API key value.
67 68 69 |
# File 'lib/ibm_cloud_iam/models/api_key.rb', line 67 def apikey @apikey end |
#context ⇒ Object
Returns the value of attribute context.
19 20 21 |
# File 'lib/ibm_cloud_iam/models/api_key.rb', line 19 def context @context end |
#created_at ⇒ Object
If set contains a date time string of the creation date in ISO format.
37 38 39 |
# File 'lib/ibm_cloud_iam/models/api_key.rb', line 37 def created_at @created_at end |
#created_by ⇒ Object
IAM ID of the user or service which created the API key.
40 41 42 |
# File 'lib/ibm_cloud_iam/models/api_key.rb', line 40 def created_by @created_by end |
#crn ⇒ Object
Cloud Resource Name of the item. Example Cloud Resource Name: 'crn:v1:bluemix:public:iam-identity:us-south:a/myaccount::apikey:1234-9012-5678'
28 29 30 |
# File 'lib/ibm_cloud_iam/models/api_key.rb', line 28 def crn @crn end |
#description ⇒ Object
The optional description of the API key. The 'description' property is only available if a description was provided during a create of an API key.
58 59 60 |
# File 'lib/ibm_cloud_iam/models/api_key.rb', line 58 def description @description end |
#disabled ⇒ Object
Defines if API key is disabled, API key cannot be used if 'disabled' is set to true.
34 35 36 |
# File 'lib/ibm_cloud_iam/models/api_key.rb', line 34 def disabled @disabled end |
#entity_tag ⇒ Object
Version of the API Key details object. You need to specify this value when updating the API key to avoid stale updates.
25 26 27 |
# File 'lib/ibm_cloud_iam/models/api_key.rb', line 25 def entity_tag @entity_tag end |
#expires_at ⇒ Object
Date and time when the API key becomes invalid, ISO 8601 datetime in the format 'yyyy-MM-ddTHH:mm+0000'. WARNING An API key will be permanently and irrevocably deleted when both the expires_at and modified_at timestamps are more than ninety (90) days in the past, regardless of the key’s locked status or any other state.
55 56 57 |
# File 'lib/ibm_cloud_iam/models/api_key.rb', line 55 def expires_at @expires_at end |
#history ⇒ Object
History of the API key.
70 71 72 |
# File 'lib/ibm_cloud_iam/models/api_key.rb', line 70 def history @history end |
#iam_id ⇒ Object
The iam_id that this API key authenticates.
61 62 63 |
# File 'lib/ibm_cloud_iam/models/api_key.rb', line 61 def iam_id @iam_id end |
#id ⇒ Object
Unique identifier of this API Key.
22 23 24 |
# File 'lib/ibm_cloud_iam/models/api_key.rb', line 22 def id @id end |
#locked ⇒ Object
The API key cannot be changed if set to true.
31 32 33 |
# File 'lib/ibm_cloud_iam/models/api_key.rb', line 31 def locked @locked end |
#modified_at ⇒ Object
If set contains a date time string of the last modification date in ISO format.
43 44 45 |
# File 'lib/ibm_cloud_iam/models/api_key.rb', line 43 def modified_at @modified_at end |
#name ⇒ Object
Name of the API key. The name is not checked for uniqueness. Therefore multiple names with the same value can exist. Access is done via the UUID of the API key.
46 47 48 |
# File 'lib/ibm_cloud_iam/models/api_key.rb', line 46 def name @name end |
#support_sessions ⇒ Object
Defines whether you can manage CLI login sessions for the API key. When true, sessions are created and can be reviewed or revoked. When false, no sessions are tracked. To block access, delete or rotate the API key. Available only for user API keys.
49 50 51 |
# File 'lib/ibm_cloud_iam/models/api_key.rb', line 49 def support_sessions @support_sessions end |
Class Method Details
.acceptable_attribute_map ⇒ Object
Returns attribute mapping this model knows about
100 101 102 |
# File 'lib/ibm_cloud_iam/models/api_key.rb', line 100 def self.acceptable_attribute_map attribute_map end |
.acceptable_attributes ⇒ Object
Returns all the JSON keys this model knows about
105 106 107 |
# File 'lib/ibm_cloud_iam/models/api_key.rb', line 105 def self.acceptable_attributes acceptable_attribute_map.values end |
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 |
# File 'lib/ibm_cloud_iam/models/api_key.rb', line 75 def self.attribute_map { :'context' => :'context', :'id' => :'id', :'entity_tag' => :'entity_tag', :'crn' => :'crn', :'locked' => :'locked', :'disabled' => :'disabled', :'created_at' => :'created_at', :'created_by' => :'created_by', :'modified_at' => :'modified_at', :'name' => :'name', :'support_sessions' => :'support_sessions', :'action_when_leaked' => :'action_when_leaked', :'expires_at' => :'expires_at', :'description' => :'description', :'iam_id' => :'iam_id', :'account_id' => :'account_id', :'apikey' => :'apikey', :'history' => :'history', :'activity' => :'activity' } end |
.build_from_hash(attributes) ⇒ Object
Builds the object from hash
427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 |
# File 'lib/ibm_cloud_iam/models/api_key.rb', line 427 def self.build_from_hash(attributes) return nil unless attributes.is_a?(Hash) attributes = attributes.transform_keys(&:to_sym) transformed_hash = {} openapi_types.each_pair do |key, type| if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? transformed_hash["#{key}"] = nil elsif type =~ /\AArray<(.*)>/i # check to ensure the input is an array given that the attribute # is documented as an array but the input is not if attributes[attribute_map[key]].is_a?(Array) transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } end elsif !attributes[attribute_map[key]].nil? transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) end end new(transformed_hash) end |
.openapi_nullable ⇒ Object
List of attributes with nullable: true
135 136 137 138 |
# File 'lib/ibm_cloud_iam/models/api_key.rb', line 135 def self.openapi_nullable Set.new([ ]) end |
.openapi_types ⇒ Object
Attribute type mapping.
110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 |
# File 'lib/ibm_cloud_iam/models/api_key.rb', line 110 def self.openapi_types { :'context' => :'ResponseContext', :'id' => :'String', :'entity_tag' => :'String', :'crn' => :'String', :'locked' => :'Boolean', :'disabled' => :'Boolean', :'created_at' => :'Time', :'created_by' => :'String', :'modified_at' => :'Time', :'name' => :'String', :'support_sessions' => :'Boolean', :'action_when_leaked' => :'String', :'expires_at' => :'String', :'description' => :'String', :'iam_id' => :'String', :'account_id' => :'String', :'apikey' => :'String', :'history' => :'Array<EnityHistoryRecord>', :'activity' => :'Activity' } end |
Instance Method Details
#==(o) ⇒ Object
Checks equality by comparing each attribute.
388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 |
# File 'lib/ibm_cloud_iam/models/api_key.rb', line 388 def ==(o) return true if self.equal?(o) self.class == o.class && context == o.context && id == o.id && entity_tag == o.entity_tag && crn == o.crn && locked == o.locked && disabled == o.disabled && created_at == o.created_at && created_by == o.created_by && modified_at == o.modified_at && name == o.name && support_sessions == o.support_sessions && action_when_leaked == o.action_when_leaked && expires_at == o.expires_at && description == o.description && iam_id == o.iam_id && account_id == o.account_id && apikey == o.apikey && history == o.history && activity == o.activity end |
#eql?(o) ⇒ Boolean
414 415 416 |
# File 'lib/ibm_cloud_iam/models/api_key.rb', line 414 def eql?(o) self == o end |
#hash ⇒ Integer
Calculates hash code according to all attributes.
420 421 422 |
# File 'lib/ibm_cloud_iam/models/api_key.rb', line 420 def hash [context, id, entity_tag, crn, locked, disabled, created_at, created_by, modified_at, name, support_sessions, action_when_leaked, expires_at, description, iam_id, account_id, apikey, history, activity].hash end |
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons. Usually used together with valid?
253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 |
# File 'lib/ibm_cloud_iam/models/api_key.rb', line 253 def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new if @id.nil? invalid_properties.push('invalid value for "id", id cannot be nil.') end if @crn.nil? invalid_properties.push('invalid value for "crn", crn cannot be nil.') end if @locked.nil? invalid_properties.push('invalid value for "locked", locked cannot be nil.') end if @created_by.nil? invalid_properties.push('invalid value for "created_by", created_by cannot be nil.') end if @name.nil? invalid_properties.push('invalid value for "name", name cannot be nil.') end if @iam_id.nil? invalid_properties.push('invalid value for "iam_id", iam_id cannot be nil.') end if @account_id.nil? invalid_properties.push('invalid value for "account_id", account_id cannot be nil.') end if @apikey.nil? invalid_properties.push('invalid value for "apikey", apikey cannot be nil.') end invalid_properties end |
#to_hash ⇒ Hash
Returns the object in the form of hash
449 450 451 452 453 454 455 456 457 458 459 460 461 |
# File 'lib/ibm_cloud_iam/models/api_key.rb', line 449 def to_hash hash = {} self.class.attribute_map.each_pair do |attr, param| value = self.send(attr) if value.nil? is_nullable = self.class.openapi_nullable.include?(attr) next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) end hash[param] = _to_hash(value) end hash end |
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid
293 294 295 296 297 298 299 300 301 302 303 304 |
# File 'lib/ibm_cloud_iam/models/api_key.rb', line 293 def valid? warn '[DEPRECATED] the `valid?` method is obsolete' return false if @id.nil? return false if @crn.nil? return false if @locked.nil? return false if @created_by.nil? return false if @name.nil? return false if @iam_id.nil? return false if @account_id.nil? return false if @apikey.nil? true end |