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(created_at: nil, id: nil, name: nil, suspended: nil, tags: nil) ⇒ Service

Returns a new instance of Service.



17137
17138
17139
17140
17141
17142
17143
17144
17145
17146
17147
17148
17149
# File 'lib/models/porcelain.rb', line 17137

def initialize(
  created_at: nil,
  id: nil,
  name: nil,
  suspended: nil,
  tags: nil
)
  @created_at = created_at == nil ? nil : created_at
  @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

#created_atObject

CreatedAt is the timestamp when the service was created



17127
17128
17129
# File 'lib/models/porcelain.rb', line 17127

def created_at
  @created_at
end

#idObject

Unique identifier of the Service.



17129
17130
17131
# File 'lib/models/porcelain.rb', line 17129

def id
  @id
end

#nameObject

Unique human-readable name of the Service.



17131
17132
17133
# File 'lib/models/porcelain.rb', line 17131

def name
  @name
end

#suspendedObject

The Service's suspended state.



17133
17134
17135
# File 'lib/models/porcelain.rb', line 17133

def suspended
  @suspended
end

#tagsObject

Tags is a map of key, value pairs.



17135
17136
17137
# File 'lib/models/porcelain.rb', line 17135

def tags
  @tags
end

Instance Method Details

#to_json(options = {}) ⇒ Object



17151
17152
17153
17154
17155
17156
17157
# File 'lib/models/porcelain.rb', line 17151

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