Module: Legion::Extensions::Nautobot::Runners::Cloud

Includes:
Helpers::Lex, Helpers::Client
Included in:
Client
Defined in:
lib/legion/extensions/nautobot/runners/cloud.rb

Instance Method Summary collapse

Methods included from Helpers::Client

#connection

Instance Method Details

#create_cloud_account(url: nil, token: nil, read_only: false, **attrs) ⇒ Object

Raises:



23
24
25
26
27
28
# File 'lib/legion/extensions/nautobot/runners/cloud.rb', line 23

def (url: nil, token: nil, read_only: false, **attrs)
  raise ReadOnlyError, 'Write operations disabled (read_only mode)' if read_only

  resp = connection(url: url, token: token).post('/api/cloud/cloud-accounts/', attrs)
  resp.body
end

#create_cloud_network(url: nil, token: nil, read_only: false, **attrs) ⇒ Object

Raises:



54
55
56
57
58
59
# File 'lib/legion/extensions/nautobot/runners/cloud.rb', line 54

def create_cloud_network(url: nil, token: nil, read_only: false, **attrs)
  raise ReadOnlyError, 'Write operations disabled (read_only mode)' if read_only

  resp = connection(url: url, token: token).post('/api/cloud/cloud-networks/', attrs)
  resp.body
end

#create_cloud_service(url: nil, token: nil, read_only: false, **attrs) ⇒ Object

Raises:



85
86
87
88
89
90
# File 'lib/legion/extensions/nautobot/runners/cloud.rb', line 85

def create_cloud_service(url: nil, token: nil, read_only: false, **attrs)
  raise ReadOnlyError, 'Write operations disabled (read_only mode)' if read_only

  resp = connection(url: url, token: token).post('/api/cloud/cloud-services/', attrs)
  resp.body
end

#delete_cloud_account(id:, url: nil, token: nil, read_only: false) ⇒ Object

Raises:



37
38
39
40
41
# File 'lib/legion/extensions/nautobot/runners/cloud.rb', line 37

def (id:, url: nil, token: nil, read_only: false, **)
  raise ReadOnlyError, 'Write operations disabled (read_only mode)' if read_only

  connection(url: url, token: token).delete("/api/cloud/cloud-accounts/#{id}/")
end

#delete_cloud_network(id:, url: nil, token: nil, read_only: false) ⇒ Object

Raises:



68
69
70
71
72
# File 'lib/legion/extensions/nautobot/runners/cloud.rb', line 68

def delete_cloud_network(id:, url: nil, token: nil, read_only: false, **)
  raise ReadOnlyError, 'Write operations disabled (read_only mode)' if read_only

  connection(url: url, token: token).delete("/api/cloud/cloud-networks/#{id}/")
end

#get_cloud_account(id:, url: nil, token: nil) ⇒ Object



18
19
20
21
# File 'lib/legion/extensions/nautobot/runners/cloud.rb', line 18

def (id:, url: nil, token: nil, **)
  resp = connection(url: url, token: token).get("/api/cloud/cloud-accounts/#{id}/")
  resp.body
end

#get_cloud_network(id:, url: nil, token: nil) ⇒ Object



49
50
51
52
# File 'lib/legion/extensions/nautobot/runners/cloud.rb', line 49

def get_cloud_network(id:, url: nil, token: nil, **)
  resp = connection(url: url, token: token).get("/api/cloud/cloud-networks/#{id}/")
  resp.body
end

#get_cloud_resource_type(id:, url: nil, token: nil) ⇒ Object



98
99
100
101
# File 'lib/legion/extensions/nautobot/runners/cloud.rb', line 98

def get_cloud_resource_type(id:, url: nil, token: nil, **)
  resp = connection(url: url, token: token).get("/api/cloud/cloud-resource-types/#{id}/")
  resp.body
end

#get_cloud_service(id:, url: nil, token: nil) ⇒ Object



80
81
82
83
# File 'lib/legion/extensions/nautobot/runners/cloud.rb', line 80

def get_cloud_service(id:, url: nil, token: nil, **)
  resp = connection(url: url, token: token).get("/api/cloud/cloud-services/#{id}/")
  resp.body
end

#list_cloud_accounts(url: nil, token: nil, **params) ⇒ Object

Cloud Accounts



13
14
15
16
# File 'lib/legion/extensions/nautobot/runners/cloud.rb', line 13

def list_cloud_accounts(url: nil, token: nil, **params)
  resp = connection(url: url, token: token).get('/api/cloud/cloud-accounts/', params)
  resp.body
end

#list_cloud_networks(url: nil, token: nil, **params) ⇒ Object

Cloud Networks



44
45
46
47
# File 'lib/legion/extensions/nautobot/runners/cloud.rb', line 44

def list_cloud_networks(url: nil, token: nil, **params)
  resp = connection(url: url, token: token).get('/api/cloud/cloud-networks/', params)
  resp.body
end

#list_cloud_resource_types(url: nil, token: nil, **params) ⇒ Object

Cloud Resource Types



93
94
95
96
# File 'lib/legion/extensions/nautobot/runners/cloud.rb', line 93

def list_cloud_resource_types(url: nil, token: nil, **params)
  resp = connection(url: url, token: token).get('/api/cloud/cloud-resource-types/', params)
  resp.body
end

#list_cloud_services(url: nil, token: nil, **params) ⇒ Object

Cloud Services



75
76
77
78
# File 'lib/legion/extensions/nautobot/runners/cloud.rb', line 75

def list_cloud_services(url: nil, token: nil, **params)
  resp = connection(url: url, token: token).get('/api/cloud/cloud-services/', params)
  resp.body
end

#update_cloud_account(id:, url: nil, token: nil, read_only: false, **attrs) ⇒ Object

Raises:



30
31
32
33
34
35
# File 'lib/legion/extensions/nautobot/runners/cloud.rb', line 30

def (id:, url: nil, token: nil, read_only: false, **attrs)
  raise ReadOnlyError, 'Write operations disabled (read_only mode)' if read_only

  resp = connection(url: url, token: token).patch("/api/cloud/cloud-accounts/#{id}/", attrs)
  resp.body
end

#update_cloud_network(id:, url: nil, token: nil, read_only: false, **attrs) ⇒ Object

Raises:



61
62
63
64
65
66
# File 'lib/legion/extensions/nautobot/runners/cloud.rb', line 61

def update_cloud_network(id:, url: nil, token: nil, read_only: false, **attrs)
  raise ReadOnlyError, 'Write operations disabled (read_only mode)' if read_only

  resp = connection(url: url, token: token).patch("/api/cloud/cloud-networks/#{id}/", attrs)
  resp.body
end