Module: Legion::Extensions::Nautobot::Runners::Extras
- Includes:
- Helpers::Lex, Helpers::Client
- Included in:
- Client
- Defined in:
- lib/legion/extensions/nautobot/runners/extras.rb
Instance Method Summary collapse
- #create_config_context(url: nil, token: nil, read_only: false, **attrs) ⇒ Object
- #create_contact(url: nil, token: nil, read_only: false, **attrs) ⇒ Object
- #create_custom_field(url: nil, token: nil, read_only: false, **attrs) ⇒ Object
- #create_role(url: nil, token: nil, read_only: false, **attrs) ⇒ Object
- #create_status(url: nil, token: nil, read_only: false, **attrs) ⇒ Object
- #create_tag(url: nil, token: nil, read_only: false, **attrs) ⇒ Object
- #create_webhook(url: nil, token: nil, read_only: false, **attrs) ⇒ Object
- #delete_config_context(id:, url: nil, token: nil, read_only: false) ⇒ Object
- #get_config_context(id:, url: nil, token: nil) ⇒ Object
- #get_contact(id:, url: nil, token: nil) ⇒ Object
- #get_custom_field(id:, url: nil, token: nil) ⇒ Object
- #get_dynamic_group(id:, url: nil, token: nil) ⇒ Object
- #get_external_integration(id:, url: nil, token: nil) ⇒ Object
- #get_git_repository(id:, url: nil, token: nil) ⇒ Object
- #get_job(id:, url: nil, token: nil) ⇒ Object
- #get_job_result(id:, url: nil, token: nil) ⇒ Object
- #get_object_change(id:, url: nil, token: nil) ⇒ Object
- #get_relationship(id:, url: nil, token: nil) ⇒ Object
- #get_role(id:, url: nil, token: nil) ⇒ Object
- #get_secret(id:, url: nil, token: nil) ⇒ Object
- #get_status(id:, url: nil, token: nil) ⇒ Object
- #get_tag(id:, url: nil, token: nil) ⇒ Object
- #get_team(id:, url: nil, token: nil) ⇒ Object
- #get_webhook(id:, url: nil, token: nil) ⇒ Object
-
#graphql_query(query:, variables: nil, url: nil, token: nil) ⇒ Object
GraphQL.
-
#list_computed_fields(url: nil, token: nil, **params) ⇒ Object
Computed Fields.
-
#list_config_context_schemas(url: nil, token: nil, **params) ⇒ Object
Config Context Schemas.
-
#list_config_contexts(url: nil, token: nil, **params) ⇒ Object
Config Contexts.
-
#list_contacts(url: nil, token: nil, **params) ⇒ Object
Contacts.
-
#list_custom_fields(url: nil, token: nil, **params) ⇒ Object
Custom Fields.
-
#list_custom_links(url: nil, token: nil, **params) ⇒ Object
Custom Links.
-
#list_dynamic_groups(url: nil, token: nil, **params) ⇒ Object
Dynamic Groups.
-
#list_external_integrations(url: nil, token: nil, **params) ⇒ Object
External Integrations.
-
#list_git_repositories(url: nil, token: nil, **params) ⇒ Object
Git Repositories.
- #list_job_results(url: nil, token: nil, **params) ⇒ Object
-
#list_jobs(url: nil, token: nil, **params) ⇒ Object
Jobs.
-
#list_notes(url: nil, token: nil, **params) ⇒ Object
Notes.
-
#list_object_changes(url: nil, token: nil, **params) ⇒ Object
Object Changes (changelog).
-
#list_relationships(url: nil, token: nil, **params) ⇒ Object
Relationships.
-
#list_roles(url: nil, token: nil, **params) ⇒ Object
Roles.
- #list_scheduled_jobs(url: nil, token: nil, **params) ⇒ Object
-
#list_secrets(url: nil, token: nil, **params) ⇒ Object
Secrets.
- #list_secrets_groups(url: nil, token: nil, **params) ⇒ Object
-
#list_statuses(url: nil, token: nil, **params) ⇒ Object
Statuses.
-
#list_tags(url: nil, token: nil, **params) ⇒ Object
Tags.
-
#list_teams(url: nil, token: nil, **params) ⇒ Object
Teams.
-
#list_webhooks(url: nil, token: nil, **params) ⇒ Object
Webhooks.
- #run_job(id:, url: nil, token: nil, read_only: false, **attrs) ⇒ Object
- #sync_git_repository(id:, url: nil, token: nil, read_only: false) ⇒ Object
- #update_config_context(id:, url: nil, token: nil, read_only: false, **attrs) ⇒ Object
Methods included from Helpers::Client
Instance Method Details
#create_config_context(url: nil, token: nil, read_only: false, **attrs) ⇒ Object
107 108 109 110 111 112 |
# File 'lib/legion/extensions/nautobot/runners/extras.rb', line 107 def create_config_context(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/extras/config-contexts/', attrs) resp.body end |
#create_contact(url: nil, token: nil, read_only: false, **attrs) ⇒ Object
276 277 278 279 280 281 |
# File 'lib/legion/extensions/nautobot/runners/extras.rb', line 276 def create_contact(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/extras/contacts/', attrs) resp.body end |
#create_custom_field(url: nil, token: nil, read_only: false, **attrs) ⇒ Object
77 78 79 80 81 82 |
# File 'lib/legion/extensions/nautobot/runners/extras.rb', line 77 def create_custom_field(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/extras/custom-fields/', attrs) resp.body end |
#create_role(url: nil, token: nil, read_only: false, **attrs) ⇒ Object
59 60 61 62 63 64 |
# File 'lib/legion/extensions/nautobot/runners/extras.rb', line 59 def create_role(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/extras/roles/', attrs) resp.body end |
#create_status(url: nil, token: nil, read_only: false, **attrs) ⇒ Object
41 42 43 44 45 46 |
# File 'lib/legion/extensions/nautobot/runners/extras.rb', line 41 def create_status(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/extras/statuses/', attrs) resp.body end |
#create_tag(url: nil, token: nil, read_only: false, **attrs) ⇒ Object
23 24 25 26 27 28 |
# File 'lib/legion/extensions/nautobot/runners/extras.rb', line 23 def create_tag(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/extras/tags/', attrs) resp.body end |
#create_webhook(url: nil, token: nil, read_only: false, **attrs) ⇒ Object
233 234 235 236 237 238 |
# File 'lib/legion/extensions/nautobot/runners/extras.rb', line 233 def create_webhook(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/extras/webhooks/', attrs) resp.body end |
#delete_config_context(id:, url: nil, token: nil, read_only: false) ⇒ Object
121 122 123 124 125 |
# File 'lib/legion/extensions/nautobot/runners/extras.rb', line 121 def delete_config_context(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/extras/config-contexts/#{id}/") end |
#get_config_context(id:, url: nil, token: nil) ⇒ Object
102 103 104 105 |
# File 'lib/legion/extensions/nautobot/runners/extras.rb', line 102 def get_config_context(id:, url: nil, token: nil, **) resp = connection(url: url, token: token).get("/api/extras/config-contexts/#{id}/") resp.body end |
#get_contact(id:, url: nil, token: nil) ⇒ Object
271 272 273 274 |
# File 'lib/legion/extensions/nautobot/runners/extras.rb', line 271 def get_contact(id:, url: nil, token: nil, **) resp = connection(url: url, token: token).get("/api/extras/contacts/#{id}/") resp.body end |
#get_custom_field(id:, url: nil, token: nil) ⇒ Object
72 73 74 75 |
# File 'lib/legion/extensions/nautobot/runners/extras.rb', line 72 def get_custom_field(id:, url: nil, token: nil, **) resp = connection(url: url, token: token).get("/api/extras/custom-fields/#{id}/") resp.body end |
#get_dynamic_group(id:, url: nil, token: nil) ⇒ Object
139 140 141 142 |
# File 'lib/legion/extensions/nautobot/runners/extras.rb', line 139 def get_dynamic_group(id:, url: nil, token: nil, **) resp = connection(url: url, token: token).get("/api/extras/dynamic-groups/#{id}/") resp.body end |
#get_external_integration(id:, url: nil, token: nil) ⇒ Object
300 301 302 303 |
# File 'lib/legion/extensions/nautobot/runners/extras.rb', line 300 def get_external_integration(id:, url: nil, token: nil, **) resp = connection(url: url, token: token).get("/api/extras/external-integrations/#{id}/") resp.body end |
#get_git_repository(id:, url: nil, token: nil) ⇒ Object
150 151 152 153 |
# File 'lib/legion/extensions/nautobot/runners/extras.rb', line 150 def get_git_repository(id:, url: nil, token: nil, **) resp = connection(url: url, token: token).get("/api/extras/git-repositories/#{id}/") resp.body end |
#get_job(id:, url: nil, token: nil) ⇒ Object
168 169 170 171 |
# File 'lib/legion/extensions/nautobot/runners/extras.rb', line 168 def get_job(id:, url: nil, token: nil, **) resp = connection(url: url, token: token).get("/api/extras/jobs/#{id}/") resp.body end |
#get_job_result(id:, url: nil, token: nil) ⇒ Object
185 186 187 188 |
# File 'lib/legion/extensions/nautobot/runners/extras.rb', line 185 def get_job_result(id:, url: nil, token: nil, **) resp = connection(url: url, token: token).get("/api/extras/job-results/#{id}/") resp.body end |
#get_object_change(id:, url: nil, token: nil) ⇒ Object
260 261 262 263 |
# File 'lib/legion/extensions/nautobot/runners/extras.rb', line 260 def get_object_change(id:, url: nil, token: nil, **) resp = connection(url: url, token: token).get("/api/extras/object-changes/#{id}/") resp.body end |
#get_relationship(id:, url: nil, token: nil) ⇒ Object
217 218 219 220 |
# File 'lib/legion/extensions/nautobot/runners/extras.rb', line 217 def get_relationship(id:, url: nil, token: nil, **) resp = connection(url: url, token: token).get("/api/extras/relationships/#{id}/") resp.body end |
#get_role(id:, url: nil, token: nil) ⇒ Object
54 55 56 57 |
# File 'lib/legion/extensions/nautobot/runners/extras.rb', line 54 def get_role(id:, url: nil, token: nil, **) resp = connection(url: url, token: token).get("/api/extras/roles/#{id}/") resp.body end |
#get_secret(id:, url: nil, token: nil) ⇒ Object
201 202 203 204 |
# File 'lib/legion/extensions/nautobot/runners/extras.rb', line 201 def get_secret(id:, url: nil, token: nil, **) resp = connection(url: url, token: token).get("/api/extras/secrets/#{id}/") resp.body end |
#get_status(id:, url: nil, token: nil) ⇒ Object
36 37 38 39 |
# File 'lib/legion/extensions/nautobot/runners/extras.rb', line 36 def get_status(id:, url: nil, token: nil, **) resp = connection(url: url, token: token).get("/api/extras/statuses/#{id}/") resp.body end |
#get_tag(id:, url: nil, token: nil) ⇒ Object
18 19 20 21 |
# File 'lib/legion/extensions/nautobot/runners/extras.rb', line 18 def get_tag(id:, url: nil, token: nil, **) resp = connection(url: url, token: token).get("/api/extras/tags/#{id}/") resp.body end |
#get_team(id:, url: nil, token: nil) ⇒ Object
289 290 291 292 |
# File 'lib/legion/extensions/nautobot/runners/extras.rb', line 289 def get_team(id:, url: nil, token: nil, **) resp = connection(url: url, token: token).get("/api/extras/teams/#{id}/") resp.body end |
#get_webhook(id:, url: nil, token: nil) ⇒ Object
228 229 230 231 |
# File 'lib/legion/extensions/nautobot/runners/extras.rb', line 228 def get_webhook(id:, url: nil, token: nil, **) resp = connection(url: url, token: token).get("/api/extras/webhooks/#{id}/") resp.body end |
#graphql_query(query:, variables: nil, url: nil, token: nil) ⇒ Object
GraphQL
241 242 243 244 245 246 |
# File 'lib/legion/extensions/nautobot/runners/extras.rb', line 241 def graphql_query(query:, variables: nil, url: nil, token: nil, **) payload = { query: query } payload[:variables] = variables if variables resp = connection(url: url, token: token).post('/api/graphql/', payload) resp.body end |
#list_computed_fields(url: nil, token: nil, **params) ⇒ Object
Computed Fields
91 92 93 94 |
# File 'lib/legion/extensions/nautobot/runners/extras.rb', line 91 def list_computed_fields(url: nil, token: nil, **params) resp = connection(url: url, token: token).get('/api/extras/computed-fields/', params) resp.body end |
#list_config_context_schemas(url: nil, token: nil, **params) ⇒ Object
Config Context Schemas
128 129 130 131 |
# File 'lib/legion/extensions/nautobot/runners/extras.rb', line 128 def list_config_context_schemas(url: nil, token: nil, **params) resp = connection(url: url, token: token).get('/api/extras/config-context-schemas/', params) resp.body end |
#list_config_contexts(url: nil, token: nil, **params) ⇒ Object
Config Contexts
97 98 99 100 |
# File 'lib/legion/extensions/nautobot/runners/extras.rb', line 97 def list_config_contexts(url: nil, token: nil, **params) resp = connection(url: url, token: token).get('/api/extras/config-contexts/', params) resp.body end |
#list_contacts(url: nil, token: nil, **params) ⇒ Object
Contacts
266 267 268 269 |
# File 'lib/legion/extensions/nautobot/runners/extras.rb', line 266 def list_contacts(url: nil, token: nil, **params) resp = connection(url: url, token: token).get('/api/extras/contacts/', params) resp.body end |
#list_custom_fields(url: nil, token: nil, **params) ⇒ Object
Custom Fields
67 68 69 70 |
# File 'lib/legion/extensions/nautobot/runners/extras.rb', line 67 def list_custom_fields(url: nil, token: nil, **params) resp = connection(url: url, token: token).get('/api/extras/custom-fields/', params) resp.body end |
#list_custom_links(url: nil, token: nil, **params) ⇒ Object
Custom Links
85 86 87 88 |
# File 'lib/legion/extensions/nautobot/runners/extras.rb', line 85 def list_custom_links(url: nil, token: nil, **params) resp = connection(url: url, token: token).get('/api/extras/custom-links/', params) resp.body end |
#list_dynamic_groups(url: nil, token: nil, **params) ⇒ Object
Dynamic Groups
134 135 136 137 |
# File 'lib/legion/extensions/nautobot/runners/extras.rb', line 134 def list_dynamic_groups(url: nil, token: nil, **params) resp = connection(url: url, token: token).get('/api/extras/dynamic-groups/', params) resp.body end |
#list_external_integrations(url: nil, token: nil, **params) ⇒ Object
External Integrations
295 296 297 298 |
# File 'lib/legion/extensions/nautobot/runners/extras.rb', line 295 def list_external_integrations(url: nil, token: nil, **params) resp = connection(url: url, token: token).get('/api/extras/external-integrations/', params) resp.body end |
#list_git_repositories(url: nil, token: nil, **params) ⇒ Object
Git Repositories
145 146 147 148 |
# File 'lib/legion/extensions/nautobot/runners/extras.rb', line 145 def list_git_repositories(url: nil, token: nil, **params) resp = connection(url: url, token: token).get('/api/extras/git-repositories/', params) resp.body end |
#list_job_results(url: nil, token: nil, **params) ⇒ Object
180 181 182 183 |
# File 'lib/legion/extensions/nautobot/runners/extras.rb', line 180 def list_job_results(url: nil, token: nil, **params) resp = connection(url: url, token: token).get('/api/extras/job-results/', params) resp.body end |
#list_jobs(url: nil, token: nil, **params) ⇒ Object
Jobs
163 164 165 166 |
# File 'lib/legion/extensions/nautobot/runners/extras.rb', line 163 def list_jobs(url: nil, token: nil, **params) resp = connection(url: url, token: token).get('/api/extras/jobs/', params) resp.body end |
#list_notes(url: nil, token: nil, **params) ⇒ Object
Notes
249 250 251 252 |
# File 'lib/legion/extensions/nautobot/runners/extras.rb', line 249 def list_notes(url: nil, token: nil, **params) resp = connection(url: url, token: token).get('/api/extras/notes/', params) resp.body end |
#list_object_changes(url: nil, token: nil, **params) ⇒ Object
Object Changes (changelog)
255 256 257 258 |
# File 'lib/legion/extensions/nautobot/runners/extras.rb', line 255 def list_object_changes(url: nil, token: nil, **params) resp = connection(url: url, token: token).get('/api/extras/object-changes/', params) resp.body end |
#list_relationships(url: nil, token: nil, **params) ⇒ Object
Relationships
212 213 214 215 |
# File 'lib/legion/extensions/nautobot/runners/extras.rb', line 212 def list_relationships(url: nil, token: nil, **params) resp = connection(url: url, token: token).get('/api/extras/relationships/', params) resp.body end |
#list_roles(url: nil, token: nil, **params) ⇒ Object
Roles
49 50 51 52 |
# File 'lib/legion/extensions/nautobot/runners/extras.rb', line 49 def list_roles(url: nil, token: nil, **params) resp = connection(url: url, token: token).get('/api/extras/roles/', params) resp.body end |
#list_scheduled_jobs(url: nil, token: nil, **params) ⇒ Object
190 191 192 193 |
# File 'lib/legion/extensions/nautobot/runners/extras.rb', line 190 def list_scheduled_jobs(url: nil, token: nil, **params) resp = connection(url: url, token: token).get('/api/extras/scheduled-jobs/', params) resp.body end |
#list_secrets(url: nil, token: nil, **params) ⇒ Object
Secrets
196 197 198 199 |
# File 'lib/legion/extensions/nautobot/runners/extras.rb', line 196 def list_secrets(url: nil, token: nil, **params) resp = connection(url: url, token: token).get('/api/extras/secrets/', params) resp.body end |
#list_secrets_groups(url: nil, token: nil, **params) ⇒ Object
206 207 208 209 |
# File 'lib/legion/extensions/nautobot/runners/extras.rb', line 206 def list_secrets_groups(url: nil, token: nil, **params) resp = connection(url: url, token: token).get('/api/extras/secrets-groups/', params) resp.body end |
#list_statuses(url: nil, token: nil, **params) ⇒ Object
Statuses
31 32 33 34 |
# File 'lib/legion/extensions/nautobot/runners/extras.rb', line 31 def list_statuses(url: nil, token: nil, **params) resp = connection(url: url, token: token).get('/api/extras/statuses/', params) resp.body end |
#list_tags(url: nil, token: nil, **params) ⇒ Object
Tags
13 14 15 16 |
# File 'lib/legion/extensions/nautobot/runners/extras.rb', line 13 def (url: nil, token: nil, **params) resp = connection(url: url, token: token).get('/api/extras/tags/', params) resp.body end |
#list_teams(url: nil, token: nil, **params) ⇒ Object
Teams
284 285 286 287 |
# File 'lib/legion/extensions/nautobot/runners/extras.rb', line 284 def list_teams(url: nil, token: nil, **params) resp = connection(url: url, token: token).get('/api/extras/teams/', params) resp.body end |
#list_webhooks(url: nil, token: nil, **params) ⇒ Object
Webhooks
223 224 225 226 |
# File 'lib/legion/extensions/nautobot/runners/extras.rb', line 223 def list_webhooks(url: nil, token: nil, **params) resp = connection(url: url, token: token).get('/api/extras/webhooks/', params) resp.body end |
#run_job(id:, url: nil, token: nil, read_only: false, **attrs) ⇒ Object
173 174 175 176 177 178 |
# File 'lib/legion/extensions/nautobot/runners/extras.rb', line 173 def run_job(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).post("/api/extras/jobs/#{id}/run/", attrs) resp.body end |
#sync_git_repository(id:, url: nil, token: nil, read_only: false) ⇒ Object
155 156 157 158 159 160 |
# File 'lib/legion/extensions/nautobot/runners/extras.rb', line 155 def sync_git_repository(id:, url: nil, token: nil, read_only: false, **) raise ReadOnlyError, 'Write operations disabled (read_only mode)' if read_only resp = connection(url: url, token: token).post("/api/extras/git-repositories/#{id}/sync/") resp.body end |
#update_config_context(id:, url: nil, token: nil, read_only: false, **attrs) ⇒ Object
114 115 116 117 118 119 |
# File 'lib/legion/extensions/nautobot/runners/extras.rb', line 114 def update_config_context(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/extras/config-contexts/#{id}/", attrs) resp.body end |