Class: SDM::Service

Inherits:
Object
  • Object
show all
Defined in:
lib/models/porcelain.rb

Overview

A Service is a service account that can connect to resources they are granted directly, or granted via roles. Services are typically automated jobs.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id: nil, name: nil, suspended: nil, tags: nil) ⇒ Service

Returns a new instance of Service.



9243
9244
9245
9246
9247
9248
9249
9250
9251
9252
9253
# File 'lib/models/porcelain.rb', line 9243

def initialize(
  id: nil,
  name: nil,
  suspended: nil,
  tags: nil
)
  @id = id == nil ? "" : id
  @name = name == nil ? "" : name
  @suspended = suspended == nil ? false : suspended
  @tags = tags == nil ? SDM::_porcelain_zero_value_tags() : tags
end

Instance Attribute Details

#idObject

Unique identifier of the Service.



9235
9236
9237
# File 'lib/models/porcelain.rb', line 9235

def id
  @id
end

#nameObject

Unique human-readable name of the Service.



9237
9238
9239
# File 'lib/models/porcelain.rb', line 9237

def name
  @name
end

#suspendedObject

The Service's suspended state.



9239
9240
9241
# File 'lib/models/porcelain.rb', line 9239

def suspended
  @suspended
end

#tagsObject

Tags is a map of key, value pairs.



9241
9242
9243
# File 'lib/models/porcelain.rb', line 9241

def tags
  @tags
end

Instance Method Details

#to_json(options = {}) ⇒ Object



9255
9256
9257
9258
9259
9260
9261
# File 'lib/models/porcelain.rb', line 9255

def to_json(options = {})
  hash = {}
  self.instance_variables.each do |var|
    hash[var.id2name.delete_prefix("@")] = self.instance_variable_get var
  end
  hash.to_json
end