solarwinds-itsm-api-definitions 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/lib/definitions/common/components.json +34 -0
- data/lib/definitions/common/sites_and_departments.json +6 -0
- data/lib/definitions/openapi.json +20 -0
- data/lib/definitions/paths/content/incidents.json +58 -0
- data/lib/definitions/paths/paths.json +5 -0
- data/lib/resolved_schema/resolved_schema.json +1 -0
- data/lib/solarwinds/itsm/api/definitions.rb +57 -0
- metadata +50 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: a7ea66292b7c9f3019dedc2b63e45fba1a1517501c3d20213b075440091b2ef1
|
4
|
+
data.tar.gz: 88c5a8e92f0f4539d98b78aa306798401fdbd9f6f1684a0a60b5efa9b30fa5ba
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 2c1bd3454a5d487a990e01608c448ae5b60fa22d138a9c3716809c97bc2c22878427cd504a20edd9a8f4d5dc808b23d472cf51accf5d7c61c3acc744679ed47e
|
7
|
+
data.tar.gz: 68d1aa1a5a8a3fad5f53c16e39cba6c2c44065306c04f67d3aaf001e72cbfb117d77b8252ad8a0c2a4d0dedce77a3c1e0d82a5527437e9737b35de3b00729701
|
@@ -0,0 +1,34 @@
|
|
1
|
+
{
|
2
|
+
"components": {
|
3
|
+
"parameters": {
|
4
|
+
"token_param": {
|
5
|
+
"name": "X-Samanage-Authorization",
|
6
|
+
"in": "header",
|
7
|
+
"schema": { "type": "string" },
|
8
|
+
"example": "Bearer TOKEN"
|
9
|
+
},
|
10
|
+
"id_param": {
|
11
|
+
"name": "id",
|
12
|
+
"in": "path",
|
13
|
+
"schema": { "oneOf": [{ "type": "string" }, { "type": "integer" }] },
|
14
|
+
"required": true,
|
15
|
+
"description": "Numeric ID of the incident to update"
|
16
|
+
}
|
17
|
+
},
|
18
|
+
"schemas": {
|
19
|
+
"association_by_name": {
|
20
|
+
"type": "object",
|
21
|
+
"oneOf": [{
|
22
|
+
"type": "object",
|
23
|
+
"properties": {
|
24
|
+
"name": { "type": "string", "required": true }
|
25
|
+
}
|
26
|
+
},
|
27
|
+
{ "enum": ["nil", "", null] }]
|
28
|
+
},
|
29
|
+
"association_by_id": {
|
30
|
+
"oneOf": [{ "type": "string" }, { "type": "integer" }]
|
31
|
+
}
|
32
|
+
}
|
33
|
+
}
|
34
|
+
}
|
@@ -0,0 +1,6 @@
|
|
1
|
+
{
|
2
|
+
"site": { "$ref": "components.json#/components/schemas/association_by_name" },
|
3
|
+
"site_id": { "$ref": "components.json#/components/schemas/association_by_id" },
|
4
|
+
"department": { "$ref": "components.json#/components/schemas/association_by_name" },
|
5
|
+
"department_id": { "$ref": "components.json#/components/schemas/association_by_id" }
|
6
|
+
}
|
@@ -0,0 +1,20 @@
|
|
1
|
+
{
|
2
|
+
"openapi": "3.0.1",
|
3
|
+
"info": {
|
4
|
+
"title": "SolarWinds ITSM API",
|
5
|
+
"description": "All SolarWinds ITSM API definitions",
|
6
|
+
"version": "0.0.1",
|
7
|
+
"contact": {
|
8
|
+
"name": "API Support",
|
9
|
+
"url": "samanage.com/support",
|
10
|
+
"email": "support@samanage.com"
|
11
|
+
}
|
12
|
+
},
|
13
|
+
"servers": [
|
14
|
+
{ "url": "https://api.samanage.com" },
|
15
|
+
{ "url": "https://apieu.samanage.com" }
|
16
|
+
],
|
17
|
+
"paths": {
|
18
|
+
"$ref": "paths/paths.json"
|
19
|
+
}
|
20
|
+
}
|
@@ -0,0 +1,58 @@
|
|
1
|
+
{
|
2
|
+
"/incidents/{id}": {
|
3
|
+
"put": {
|
4
|
+
"operationId": "updateIncidentById",
|
5
|
+
"description": "The update API for incidents in JSON",
|
6
|
+
"parameters": [
|
7
|
+
{ "$ref": "../../common/components.json#/components/parameters/token_param" },
|
8
|
+
{ "$ref": "../../common/components.json#/components/parameters/id_param" }
|
9
|
+
],
|
10
|
+
"requestBody": {
|
11
|
+
"content": {
|
12
|
+
"application/json": {
|
13
|
+
"schema": {
|
14
|
+
"type": "object",
|
15
|
+
"properties": {
|
16
|
+
"incident": {
|
17
|
+
"type": "object",
|
18
|
+
"properties": {
|
19
|
+
"$ref": [
|
20
|
+
"../../common/sites_and_departments.json"
|
21
|
+
],
|
22
|
+
"description": { "type": "string" },
|
23
|
+
"state": { "$ref": "../../common/components.json#/components/schemas/association_by_id" },
|
24
|
+
"assignee": {
|
25
|
+
"type": "object",
|
26
|
+
"oneOf": [{
|
27
|
+
"type": "object",
|
28
|
+
"properties": {
|
29
|
+
"email": {
|
30
|
+
"type": "string",
|
31
|
+
"required": true
|
32
|
+
}
|
33
|
+
}
|
34
|
+
},
|
35
|
+
{
|
36
|
+
"enum": ["nil", "", null]
|
37
|
+
}]
|
38
|
+
},
|
39
|
+
"assignee_id": { "$ref": "../../common/components.json#/components/schemas/association_by_id" }
|
40
|
+
}
|
41
|
+
}
|
42
|
+
}
|
43
|
+
},
|
44
|
+
"examples": {
|
45
|
+
"0": {
|
46
|
+
"value": "{\"incident\":{\"site\":{\"name\":\"SITE-NAME\"},\"department\":{\"name\":\"DEPARTMENT-NAME\"},\"site_id\":SITE-ID,\"department_id\":DEPARTMENT-ID,\"description\":\"SOMEDESCRIPTION\",\"state\":\"SITE-NAME\",\"assignee\":{\"email\":\"EMAIL\"}}}"
|
47
|
+
}
|
48
|
+
}
|
49
|
+
}
|
50
|
+
}
|
51
|
+
},
|
52
|
+
"responses": {
|
53
|
+
"200": { "description": "Object was updated correctly" },
|
54
|
+
"404": { "description": "Not found" }
|
55
|
+
}
|
56
|
+
}
|
57
|
+
}
|
58
|
+
}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"openapi":"3.0.1","info":{"title":"SolarWinds ITSM API","description":"All SolarWinds ITSM API definitions","version":"0.0.1","contact":{"name":"API Support","url":"samanage.com/support","email":"support@samanage.com"}},"servers":[{"url":"https://api.samanage.com"},{"url":"https://apieu.samanage.com"}],"paths":{"/incidents/{id}":{"put":{"operationId":"updateIncidentById","description":"The update API for incidents in JSON","parameters":[{"name":"X-Samanage-Authorization","in":"header","schema":{"type":"string"},"example":"Bearer TOKEN"},{"name":"id","in":"path","schema":{"oneOf":[{"type":"string"},{"type":"integer"}]},"required":true,"description":"Numeric ID of the incident to update"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"incident":{"type":"object","properties":{"site":{"type":"object","oneOf":[{"type":"object","properties":{"name":{"type":"string","required":true}}},{"enum":["nil","",null]}]},"site_id":{"oneOf":[{"type":"string"},{"type":"integer"}]},"department":{"type":"object","oneOf":[{"type":"object","properties":{"name":{"type":"string","required":true}}},{"enum":["nil","",null]}]},"department_id":{"oneOf":[{"type":"string"},{"type":"integer"}]},"description":{"type":"string"},"state":{"oneOf":[{"type":"string"},{"type":"integer"}]},"assignee":{"type":"object","oneOf":[{"type":"object","properties":{"email":{"type":"string","required":true}}},{"enum":["nil","",null]}]},"assignee_id":{"oneOf":[{"type":"string"},{"type":"integer"}]}}}}},"examples":{"0":{"value":"{\"incident\":{\"site\":{\"name\":\"SITE-NAME\"},\"department\":{\"name\":\"DEPARTMENT-NAME\"},\"site_id\":SITE-ID,\"department_id\":DEPARTMENT-ID,\"description\":\"SOMEDESCRIPTION\",\"state\":\"SITE-NAME\",\"assignee\":{\"email\":\"EMAIL\"}}}"}}}}},"responses":{"200":{"description":"Object was updated correctly"},"404":{"description":"Not found"}}}}}}
|
@@ -0,0 +1,57 @@
|
|
1
|
+
require 'json'
|
2
|
+
|
3
|
+
module Solarwinds
|
4
|
+
module Itsm
|
5
|
+
module Api
|
6
|
+
module Definitions
|
7
|
+
RESOLVED_DIR = 'lib/resolved_schema'
|
8
|
+
|
9
|
+
def self.base_schema
|
10
|
+
path = 'lib/definitions/openapi.json'
|
11
|
+
JSON.parse(File.open(path).read)
|
12
|
+
end
|
13
|
+
|
14
|
+
def self.resolved_schema
|
15
|
+
recursive_resolve(base_schema, 'lib/definitions')
|
16
|
+
end
|
17
|
+
|
18
|
+
def self.resolved_schema_path
|
19
|
+
File.join(RESOLVED_DIR, 'resolved_schema.json')
|
20
|
+
end
|
21
|
+
|
22
|
+
def self.write_resolved_schema(path = RESOLVED_DIR, name = 'resolved_schema.json')
|
23
|
+
File.write(File.join(path, name), resolved_schema.to_json)
|
24
|
+
end
|
25
|
+
|
26
|
+
private
|
27
|
+
|
28
|
+
def self.recursive_resolve(schema, base_uri)
|
29
|
+
return schema unless schema.is_a?(Array) || schema.is_a?(Hash)
|
30
|
+
|
31
|
+
schema.each_with_object({}) do |(key, value), resolved_schema|
|
32
|
+
if key == '$ref'
|
33
|
+
reference = [*value].each_with_object({}) do |referred_path, result|
|
34
|
+
split_path = referred_path.split('#/')
|
35
|
+
path_to_file = split_path.first
|
36
|
+
path_to_nested_object = split_path.size > 1 ? split_path.last.split('/') : nil
|
37
|
+
|
38
|
+
path_and_file_name = path_to_file.split(/\/(?!.*\/.*)/)
|
39
|
+
new_base_uri = (path_and_file_name.size > 1) ? Pathname.new("#{base_uri}/#{path_and_file_name.first}").cleanpath.to_s : base_uri
|
40
|
+
json = JSON.parse(File.open(File.join(new_base_uri, path_and_file_name.last)).read)
|
41
|
+
internal_object = path_to_nested_object&.inject(json) { |obj, arg| obj[arg] } || json
|
42
|
+
result.merge!(recursive_resolve(internal_object, new_base_uri))
|
43
|
+
end
|
44
|
+
resolved_schema.merge!(reference)
|
45
|
+
elsif value.is_a?(Array)
|
46
|
+
resolved_schema[key] = value.map { |v| recursive_resolve(v, base_uri) }
|
47
|
+
elsif value.is_a?(Hash)
|
48
|
+
resolved_schema[key] = recursive_resolve(value, base_uri)
|
49
|
+
else
|
50
|
+
resolved_schema[key] = value
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
metadata
ADDED
@@ -0,0 +1,50 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: solarwinds-itsm-api-definitions
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.2
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Jonathan Goldstein
|
8
|
+
- Darth Vader
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2020-05-26 00:00:00.000000000 Z
|
13
|
+
dependencies: []
|
14
|
+
description: SolarWinds ITSM OpenAPI definitions gem
|
15
|
+
email: jonsgold@gmail.com
|
16
|
+
executables: []
|
17
|
+
extensions: []
|
18
|
+
extra_rdoc_files: []
|
19
|
+
files:
|
20
|
+
- lib/definitions/common/components.json
|
21
|
+
- lib/definitions/common/sites_and_departments.json
|
22
|
+
- lib/definitions/openapi.json
|
23
|
+
- lib/definitions/paths/content/incidents.json
|
24
|
+
- lib/definitions/paths/paths.json
|
25
|
+
- lib/resolved_schema/resolved_schema.json
|
26
|
+
- lib/solarwinds/itsm/api/definitions.rb
|
27
|
+
homepage: https://rubygems.org/gems/solarwinds-itsm-api-definitions
|
28
|
+
licenses:
|
29
|
+
- MIT
|
30
|
+
metadata: {}
|
31
|
+
post_install_message:
|
32
|
+
rdoc_options: []
|
33
|
+
require_paths:
|
34
|
+
- lib
|
35
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
36
|
+
requirements:
|
37
|
+
- - ">="
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: '0'
|
40
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
41
|
+
requirements:
|
42
|
+
- - ">="
|
43
|
+
- !ruby/object:Gem::Version
|
44
|
+
version: '0'
|
45
|
+
requirements: []
|
46
|
+
rubygems_version: 3.0.6
|
47
|
+
signing_key:
|
48
|
+
specification_version: 4
|
49
|
+
summary: OpenAPI definitions
|
50
|
+
test_files: []
|