Class: ReactorSDK::Endpoints::Secrets

Inherits:
BaseEndpoint show all
Defined in:
lib/reactor_sdk/endpoints/secrets.rb

Instance Method Summary collapse

Methods inherited from BaseEndpoint

#initialize

Constructor Details

This class inherits a constructor from ReactorSDK::Endpoints::BaseEndpoint

Instance Method Details

#create(property_id:, environment_id:, attributes:) ⇒ Object



18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/reactor_sdk/endpoints/secrets.rb', line 18

def create(property_id:, environment_id:, attributes:)
  create_resource(
    "/properties/#{property_id}/secrets",
    'secrets',
    Resources::Secret,
    attributes: attributes,
    relationships: {
      environment: {
        data: { id: environment_id, type: 'environments' }
      }
    }
  )
end

#create_note(secret_id, text) ⇒ Object



71
72
73
# File 'lib/reactor_sdk/endpoints/secrets.rb', line 71

def create_note(secret_id, text)
  create_note_for_path("/secrets/#{secret_id}/notes", text)
end

#data_elements(secret_id) ⇒ Object



55
56
57
# File 'lib/reactor_sdk/endpoints/secrets.rb', line 55

def data_elements(secret_id)
  list_resources("/secrets/#{secret_id}/data_elements", Resources::DataElement)
end

#delete(secret_id) ⇒ Object



51
52
53
# File 'lib/reactor_sdk/endpoints/secrets.rb', line 51

def delete(secret_id)
  delete_resource("/secrets/#{secret_id}")
end

#environment(secret_id) ⇒ Object



59
60
61
# File 'lib/reactor_sdk/endpoints/secrets.rb', line 59

def environment(secret_id)
  fetch_resource("/secrets/#{secret_id}/environment", Resources::Environment)
end

#find(secret_id) ⇒ Object



14
15
16
# File 'lib/reactor_sdk/endpoints/secrets.rb', line 14

def find(secret_id)
  fetch_resource("/secrets/#{secret_id}", Resources::Secret)
end

#list_for_environment(environment_id) ⇒ Object



10
11
12
# File 'lib/reactor_sdk/endpoints/secrets.rb', line 10

def list_for_environment(environment_id)
  list_resources("/environments/#{environment_id}/secrets", Resources::Secret)
end

#list_for_property(property_id) ⇒ Object



6
7
8
# File 'lib/reactor_sdk/endpoints/secrets.rb', line 6

def list_for_property(property_id)
  list_resources("/properties/#{property_id}/secrets", Resources::Secret)
end

#list_notes(secret_id) ⇒ Object



67
68
69
# File 'lib/reactor_sdk/endpoints/secrets.rb', line 67

def list_notes(secret_id)
  list_notes_for_path("/secrets/#{secret_id}/notes")
end

#property(secret_id) ⇒ Object



63
64
65
# File 'lib/reactor_sdk/endpoints/secrets.rb', line 63

def property(secret_id)
  fetch_resource("/secrets/#{secret_id}/property", Resources::Property)
end

#retry(secret_id, type_of:) ⇒ Object



47
48
49
# File 'lib/reactor_sdk/endpoints/secrets.rb', line 47

def retry(secret_id, type_of:)
  test_or_retry(secret_id, type_of: type_of, action: 'retry')
end

#test(secret_id, type_of:) ⇒ Object



43
44
45
# File 'lib/reactor_sdk/endpoints/secrets.rb', line 43

def test(secret_id, type_of:)
  test_or_retry(secret_id, type_of: type_of, action: 'test')
end

#test_or_retry(secret_id, type_of:, action:) ⇒ Object



32
33
34
35
36
37
38
39
40
41
# File 'lib/reactor_sdk/endpoints/secrets.rb', line 32

def test_or_retry(secret_id, type_of:, action:)
  update_resource(
    "/secrets/#{secret_id}",
    secret_id,
    'secrets',
    Resources::Secret,
    attributes: { type_of: type_of },
    meta: { action: action }
  )
end