Class: Mutations::Metrics::Dashboard::Annotations::Create::AnnotationSource

Inherits:
Struct
  • Object
show all
Defined in:
app/graphql/mutations/metrics/dashboard/annotations/create.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#objectObject

Returns the value of attribute object

Returns:

  • (Object)

    the current value of object



48
49
50
# File 'app/graphql/mutations/metrics/dashboard/annotations/create.rb', line 48

def object
  @object
end

Instance Method Details

#klassObject



53
54
55
# File 'app/graphql/mutations/metrics/dashboard/annotations/create.rb', line 53

def klass
  object.class.name
end

#typeObject



57
58
59
60
61
# File 'app/graphql/mutations/metrics/dashboard/annotations/create.rb', line 57

def type
  raise Gitlab::Graphql::Errors::ArgumentError, INVALID_ANNOTATION_SOURCE_ERROR unless type_keys[klass]

  type_keys[klass]
end

#type_keysObject



49
50
51
# File 'app/graphql/mutations/metrics/dashboard/annotations/create.rb', line 49

def type_keys
  { 'Clusters::Cluster' => :cluster, 'Environment' => :environment }
end