sophos_central_api 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +3 -0
- data/README.md +21 -1
- data/lib/sophos/client.rb +15 -2
- data/lib/sophos/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4001f1778a4cbba03903acb2007aeca8c0840b351baf9654e2e238efb5b1650a
|
4
|
+
data.tar.gz: fd8467571f6574c9647faab25aa1fc3016a6e1321a179ba5a94de32911cb4fc2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: df69465b988d9cdc9460ea1e3220eb5e8516386b1c1b6b54d44885c23724c6eac20084053eb7002bc0b1d7bca600e181000879bac27192f0fc2aa4fea14311d1
|
7
|
+
data.tar.gz: 5766c1061673b8fc638573094111ca4c0023c25d02c58480cc824874187c981e39dce26aeaf93c6ccbacde44b0c862589f973db52789de5d3bb26023dff3ac98
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -70,6 +70,27 @@ roles = client.roles
|
|
70
70
|
|.billing_usage(year, month) |/partner/v1/billing-usage/{year}/{month}|
|
71
71
|
|
72
72
|
|
73
|
+
### Common
|
74
|
+
This is the OAS 3.0 specification for the Common API in Sophos Central.
|
75
|
+
|
76
|
+
```
|
77
|
+
@client = Sophos.client()
|
78
|
+
@client.login
|
79
|
+
:
|
80
|
+
tenant = @client.tenant(id)
|
81
|
+
# create client for tenant
|
82
|
+
@client.client(tenant).endpoints
|
83
|
+
|
84
|
+
```
|
85
|
+
|
86
|
+
|Resource|API endpoint|
|
87
|
+
|:--|:--|
|
88
|
+
|.alerts, .alert(id) |.../alerts/|
|
89
|
+
|.directory_user_groups, .directory_user_groups(id) |.../directory/user-groups|
|
90
|
+
|.directory_user_group_users(id) |.../directory/user-groups/{id}/users|
|
91
|
+
|.directory_users, .directory_user(id) |.../directory/users|
|
92
|
+
|.directory_user_groups(id) |.../directory/users/{id}/groups|
|
93
|
+
|
73
94
|
### Endpoints
|
74
95
|
Returns endpoint for a provided tenant
|
75
96
|
```
|
@@ -83,7 +104,6 @@ tenant = @client.tenant(id)
|
|
83
104
|
|
84
105
|
|Resource|API endpoint|
|
85
106
|
|:--|:--|
|
86
|
-
|
87
107
|
|.downloads |.../downloads/|
|
88
108
|
|.endpoint_groups, .endpoint_group(id) |.../endpoint-groupss/|
|
89
109
|
|.migrations, .migration(id) |.../migrations|
|
data/lib/sophos/client.rb
CHANGED
@@ -9,12 +9,25 @@ module Sophos
|
|
9
9
|
class Client < API
|
10
10
|
require File.expand_path('client/partner', __dir__)
|
11
11
|
|
12
|
+
# get client to access api host for given tenant
|
13
|
+
# @return [TenantClient]
|
14
|
+
def client(tenant)
|
15
|
+
tenant_client(tenant.apiHost, tenant.id) if tenant
|
16
|
+
end
|
17
|
+
|
18
|
+
# get teannt client to access api host for given tenant id
|
19
|
+
# @return [TenantClient]
|
12
20
|
def tenant_client( api_host, tenant_id )
|
13
|
-
|
21
|
+
# create client and copy access_token and set default headers
|
22
|
+
TenantClient.new(self.config.merge({
|
23
|
+
access_token: access_token,
|
24
|
+
endpoint: api_host,
|
25
|
+
tenant_id: tenant_id,
|
26
|
+
connection_options: { headers: { 'X-Tenant-ID': tenant_id } }
|
27
|
+
}))
|
14
28
|
end
|
15
29
|
|
16
30
|
include Sophos::Client::Partner
|
17
|
-
|
18
31
|
end
|
19
32
|
|
20
33
|
# Wrapper for the Sophos Central REST API for tenant related calls
|
data/lib/sophos/version.rb
CHANGED