Class: LaunchDarklyApi::CustomRole

Inherits:
ApiModelBase show all
Defined in:
lib/launchdarkly_api/models/custom_role.rb

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 = {}) ⇒ CustomRole

Initializes the object

Parameters:

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

    Model attributes in the form of hash



104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
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
# File 'lib/launchdarkly_api/models/custom_role.rb', line 104

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

  if attributes.key?(:'_links')
    if (value = attributes[:'_links']).is_a?(Hash)
      self._links = value
    end
  else
    self._links = nil
  end

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

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

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

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

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

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

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

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

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

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

Instance Attribute Details

#_accessObject

Returns the value of attribute _access.



24
25
26
# File 'lib/launchdarkly_api/models/custom_role.rb', line 24

def _access
  @_access
end

#_idObject

The ID of the custom role



19
20
21
# File 'lib/launchdarkly_api/models/custom_role.rb', line 19

def _id
  @_id
end

The location and content type of related resources



22
23
24
# File 'lib/launchdarkly_api/models/custom_role.rb', line 22

def _links
  @_links
end

#_preset_bundle_versionObject

If created from a preset, the preset bundle version



45
46
47
# File 'lib/launchdarkly_api/models/custom_role.rb', line 45

def _preset_bundle_version
  @_preset_bundle_version
end

#_preset_statementsObject

If created from a preset, the read-only statements copied from the preset



48
49
50
# File 'lib/launchdarkly_api/models/custom_role.rb', line 48

def _preset_statements
  @_preset_statements
end

#assigned_toObject

Returns the value of attribute assigned_to.



42
43
44
# File 'lib/launchdarkly_api/models/custom_role.rb', line 42

def assigned_to
  @assigned_to
end

#base_permissionsObject

Returns the value of attribute base_permissions.



38
39
40
# File 'lib/launchdarkly_api/models/custom_role.rb', line 38

def base_permissions
  @base_permissions
end

#descriptionObject

The description of the custom role



27
28
29
# File 'lib/launchdarkly_api/models/custom_role.rb', line 27

def description
  @description
end

#keyObject

The key of the custom role



30
31
32
# File 'lib/launchdarkly_api/models/custom_role.rb', line 30

def key
  @key
end

#nameObject

The name of the custom role



33
34
35
# File 'lib/launchdarkly_api/models/custom_role.rb', line 33

def name
  @name
end

#policyObject

An array of the policies that comprise this custom role



36
37
38
# File 'lib/launchdarkly_api/models/custom_role.rb', line 36

def policy
  @policy
end

#resource_categoryObject

Returns the value of attribute resource_category.



40
41
42
# File 'lib/launchdarkly_api/models/custom_role.rb', line 40

def resource_category
  @resource_category
end

Class Method Details

.acceptable_attribute_mapObject

Returns attribute mapping this model knows about



69
70
71
# File 'lib/launchdarkly_api/models/custom_role.rb', line 69

def self.acceptable_attribute_map
  attribute_map
end

.acceptable_attributesObject

Returns all the JSON keys this model knows about



74
75
76
# File 'lib/launchdarkly_api/models/custom_role.rb', line 74

def self.acceptable_attributes
  acceptable_attribute_map.values
end

.attribute_mapObject

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



51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# File 'lib/launchdarkly_api/models/custom_role.rb', line 51

def self.attribute_map
  {
    :'_id' => :'_id',
    :'_links' => :'_links',
    :'_access' => :'_access',
    :'description' => :'description',
    :'key' => :'key',
    :'name' => :'name',
    :'policy' => :'policy',
    :'base_permissions' => :'basePermissions',
    :'resource_category' => :'resourceCategory',
    :'assigned_to' => :'assignedTo',
    :'_preset_bundle_version' => :'_presetBundleVersion',
    :'_preset_statements' => :'_presetStatements'
  }
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



307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
# File 'lib/launchdarkly_api/models/custom_role.rb', line 307

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



97
98
99
100
# File 'lib/launchdarkly_api/models/custom_role.rb', line 97

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

.openapi_typesObject

Attribute type mapping.



79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
# File 'lib/launchdarkly_api/models/custom_role.rb', line 79

def self.openapi_types
  {
    :'_id' => :'String',
    :'_links' => :'Hash<String, Link>',
    :'_access' => :'Access',
    :'description' => :'String',
    :'key' => :'String',
    :'name' => :'String',
    :'policy' => :'Array<Statement>',
    :'base_permissions' => :'String',
    :'resource_category' => :'String',
    :'assigned_to' => :'AssignedToRep',
    :'_preset_bundle_version' => :'Integer',
    :'_preset_statements' => :'Array<Statement>'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
# File 'lib/launchdarkly_api/models/custom_role.rb', line 275

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      _id == o._id &&
      _links == o._links &&
      _access == o._access &&
      description == o.description &&
      key == o.key &&
      name == o.name &&
      policy == o.policy &&
      base_permissions == o.base_permissions &&
      resource_category == o.resource_category &&
      assigned_to == o.assigned_to &&
      _preset_bundle_version == o._preset_bundle_version &&
      _preset_statements == o._preset_statements
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


294
295
296
# File 'lib/launchdarkly_api/models/custom_role.rb', line 294

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



300
301
302
# File 'lib/launchdarkly_api/models/custom_role.rb', line 300

def hash
  [_id, _links, _access, description, key, name, policy, base_permissions, resource_category, assigned_to, _preset_bundle_version, _preset_statements].hash
end

#list_invalid_propertiesObject

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

Returns:

  • Array for valid properties with the reasons



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
# File 'lib/launchdarkly_api/models/custom_role.rb', line 185

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

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

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

  if @policy.nil?
    invalid_properties.push('invalid value for "policy", policy 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



329
330
331
332
333
334
335
336
337
338
339
340
341
# File 'lib/launchdarkly_api/models/custom_role.rb', line 329

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



213
214
215
216
217
218
219
220
221
# File 'lib/launchdarkly_api/models/custom_role.rb', line 213

def valid?
  warn '[DEPRECATED] the `valid?` method is obsolete'
  return false if @_id.nil?
  return false if @_links.nil?
  return false if @key.nil?
  return false if @name.nil?
  return false if @policy.nil?
  true
end