Class: IbmCloudIam::ServiceId

Inherits:
ApiModelBase show all
Defined in:
lib/ibm_cloud_iam/models/service_id.rb

Overview

Response body format for service ID V1 REST requests.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from ApiModelBase

_deserialize, #_to_hash, #to_body, #to_s

Constructor Details

#initialize(attributes = {}) ⇒ ServiceId

Initializes the object

Parameters:

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

    Model attributes in the form of hash



126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
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
# File 'lib/ibm_cloud_iam/models/service_id.rb', line 126

def initialize(attributes = {})
  if (!attributes.is_a?(Hash))
    fail ArgumentError, "The input argument (attributes) must be a hash in `IbmCloudIam::ServiceId` 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::ServiceId`. 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?(:'iam_id')
    self.iam_id = attributes[:'iam_id']
  else
    self.iam_id = nil
  end

  if attributes.key?(:'entity_tag')
    self.entity_tag = attributes[:'entity_tag']
  else
    self.entity_tag = nil
  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?(:'created_at')
    self.created_at = attributes[:'created_at']
  else
    self.created_at = nil
  end

  if attributes.key?(:'modified_at')
    self.modified_at = attributes[:'modified_at']
  else
    self.modified_at = nil
  end

  if attributes.key?(:'account_id')
    self. = attributes[:'account_id']
  else
    self. = nil
  end

  if attributes.key?(:'group_id')
    self.group_id = attributes[:'group_id']
  end

  if attributes.key?(:'name')
    self.name = attributes[:'name']
  else
    self.name = nil
  end

  if attributes.key?(:'description')
    self.description = attributes[:'description']
  end

  if attributes.key?(:'unique_instance_crns')
    if (value = attributes[:'unique_instance_crns']).is_a?(Array)
      self.unique_instance_crns = value
    end
  end

  if attributes.key?(:'history')
    if (value = attributes[:'history']).is_a?(Array)
      self.history = value
    end
  end

  if attributes.key?(:'apikey')
    self.apikey = attributes[:'apikey']
  end

  if attributes.key?(:'activity')
    self.activity = attributes[:'activity']
  end
end

Instance Attribute Details

#account_idObject

ID of the account the service ID belongs to.



43
44
45
# File 'lib/ibm_cloud_iam/models/service_id.rb', line 43

def 
  @account_id
end

#activityObject

Returns the value of attribute activity.



62
63
64
# File 'lib/ibm_cloud_iam/models/service_id.rb', line 62

def activity
  @activity
end

#apikeyObject

Returns the value of attribute apikey.



60
61
62
# File 'lib/ibm_cloud_iam/models/service_id.rb', line 60

def apikey
  @apikey
end

#contextObject

Returns the value of attribute context.



19
20
21
# File 'lib/ibm_cloud_iam/models/service_id.rb', line 19

def context
  @context
end

#created_atObject

If set contains a date time string of the creation date in ISO format.



37
38
39
# File 'lib/ibm_cloud_iam/models/service_id.rb', line 37

def created_at
  @created_at
end

#crnObject

Cloud Resource Name of the item. Example Cloud Resource Name: 'crn:v1:bluemix:public:iam-identity:us-south:a/myaccount::serviceid:1234-5678-9012'



31
32
33
# File 'lib/ibm_cloud_iam/models/service_id.rb', line 31

def crn
  @crn
end

#descriptionObject

The optional description of the Service Id. The 'description' property is only available if a description was provided during a create of a Service Id.



52
53
54
# File 'lib/ibm_cloud_iam/models/service_id.rb', line 52

def description
  @description
end

#entity_tagObject

Version of the service ID details object. You need to specify this value when updating the service ID to avoid stale updates.



28
29
30
# File 'lib/ibm_cloud_iam/models/service_id.rb', line 28

def entity_tag
  @entity_tag
end

#group_idObject

ID of the group to which the service ID belongs to. Only set if requested via parameter show_group_id.



46
47
48
# File 'lib/ibm_cloud_iam/models/service_id.rb', line 46

def group_id
  @group_id
end

#historyObject

History of the Service ID.



58
59
60
# File 'lib/ibm_cloud_iam/models/service_id.rb', line 58

def history
  @history
end

#iam_idObject

Cloud wide identifier for identities of this service ID.



25
26
27
# File 'lib/ibm_cloud_iam/models/service_id.rb', line 25

def iam_id
  @iam_id
end

#idObject

Unique identifier of this Service Id.



22
23
24
# File 'lib/ibm_cloud_iam/models/service_id.rb', line 22

def id
  @id
end

#lockedObject

The service ID cannot be changed if set to true.



34
35
36
# File 'lib/ibm_cloud_iam/models/service_id.rb', line 34

def locked
  @locked
end

#modified_atObject

If set contains a date time string of the last modification date in ISO format.



40
41
42
# File 'lib/ibm_cloud_iam/models/service_id.rb', line 40

def modified_at
  @modified_at
end

#nameObject

Name of the Service Id. The name is not checked for uniqueness. Therefore multiple names with the same value can exist. Access is done via the UUID of the Service Id.



49
50
51
# File 'lib/ibm_cloud_iam/models/service_id.rb', line 49

def name
  @name
end

#unique_instance_crnsObject

Optional list of CRNs (string array) which point to the services connected to the service ID.



55
56
57
# File 'lib/ibm_cloud_iam/models/service_id.rb', line 55

def unique_instance_crns
  @unique_instance_crns
end

Class Method Details

.acceptable_attribute_mapObject

Returns attribute mapping this model knows about



87
88
89
# File 'lib/ibm_cloud_iam/models/service_id.rb', line 87

def self.acceptable_attribute_map
  attribute_map
end

.acceptable_attributesObject

Returns all the JSON keys this model knows about



92
93
94
# File 'lib/ibm_cloud_iam/models/service_id.rb', line 92

def self.acceptable_attributes
  acceptable_attribute_map.values
end

.attribute_mapObject

Attribute mapping from ruby-style variable name to JSON key.



65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
# File 'lib/ibm_cloud_iam/models/service_id.rb', line 65

def self.attribute_map
  {
    :'context' => :'context',
    :'id' => :'id',
    :'iam_id' => :'iam_id',
    :'entity_tag' => :'entity_tag',
    :'crn' => :'crn',
    :'locked' => :'locked',
    :'created_at' => :'created_at',
    :'modified_at' => :'modified_at',
    :'account_id' => :'account_id',
    :'group_id' => :'group_id',
    :'name' => :'name',
    :'description' => :'description',
    :'unique_instance_crns' => :'unique_instance_crns',
    :'history' => :'history',
    :'apikey' => :'apikey',
    :'activity' => :'activity'
  }
end

.build_from_hash(attributes) ⇒ Object

Builds the object from hash

Parameters:

  • attributes (Hash)

    Model attributes in the form of hash

Returns:

  • (Object)

    Returns the model itself



415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
# File 'lib/ibm_cloud_iam/models/service_id.rb', line 415

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_nullableObject

List of attributes with nullable: true



119
120
121
122
# File 'lib/ibm_cloud_iam/models/service_id.rb', line 119

def self.openapi_nullable
  Set.new([
  ])
end

.openapi_typesObject

Attribute type mapping.



97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
# File 'lib/ibm_cloud_iam/models/service_id.rb', line 97

def self.openapi_types
  {
    :'context' => :'ResponseContext',
    :'id' => :'String',
    :'iam_id' => :'String',
    :'entity_tag' => :'String',
    :'crn' => :'String',
    :'locked' => :'Boolean',
    :'created_at' => :'Time',
    :'modified_at' => :'Time',
    :'account_id' => :'String',
    :'group_id' => :'String',
    :'name' => :'String',
    :'description' => :'String',
    :'unique_instance_crns' => :'Array<String>',
    :'history' => :'Array<EnityHistoryRecord>',
    :'apikey' => :'ApiKey',
    :'activity' => :'Activity'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
# File 'lib/ibm_cloud_iam/models/service_id.rb', line 379

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      context == o.context &&
      id == o.id &&
      iam_id == o.iam_id &&
      entity_tag == o.entity_tag &&
      crn == o.crn &&
      locked == o.locked &&
      created_at == o.created_at &&
      modified_at == o.modified_at &&
       == o. &&
      group_id == o.group_id &&
      name == o.name &&
      description == o.description &&
      unique_instance_crns == o.unique_instance_crns &&
      history == o.history &&
      apikey == o.apikey &&
      activity == o.activity
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


402
403
404
# File 'lib/ibm_cloud_iam/models/service_id.rb', line 402

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



408
409
410
# File 'lib/ibm_cloud_iam/models/service_id.rb', line 408

def hash
  [context, id, iam_id, entity_tag, crn, locked, created_at, modified_at, , group_id, name, description, unique_instance_crns, history, apikey, activity].hash
end

#list_invalid_propertiesObject

Show invalid properties with the reasons. Usually used together with valid?

Returns:

  • Array for valid properties with the reasons



229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
# File 'lib/ibm_cloud_iam/models/service_id.rb', line 229

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 @iam_id.nil?
    invalid_properties.push('invalid value for "iam_id", iam_id cannot be nil.')
  end

  if @entity_tag.nil?
    invalid_properties.push('invalid value for "entity_tag", entity_tag 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_at.nil?
    invalid_properties.push('invalid value for "created_at", created_at cannot be nil.')
  end

  if @modified_at.nil?
    invalid_properties.push('invalid value for "modified_at", modified_at cannot be nil.')
  end

  if @account_id.nil?
    invalid_properties.push('invalid value for "account_id", account_id cannot be nil.')
  end

  if @name.nil?
    invalid_properties.push('invalid value for "name", name cannot be nil.')
  end

  invalid_properties
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



437
438
439
440
441
442
443
444
445
446
447
448
449
# File 'lib/ibm_cloud_iam/models/service_id.rb', line 437

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

Returns:

  • (Boolean)

    true if the model is valid



273
274
275
276
277
278
279
280
281
282
283
284
285
# File 'lib/ibm_cloud_iam/models/service_id.rb', line 273

def valid?
  warn '[DEPRECATED] the `valid?` method is obsolete'
  return false if @id.nil?
  return false if @iam_id.nil?
  return false if @entity_tag.nil?
  return false if @crn.nil?
  return false if @locked.nil?
  return false if @created_at.nil?
  return false if @modified_at.nil?
  return false if @account_id.nil?
  return false if @name.nil?
  true
end