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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 04451b9de1b30bc8215d2ba53c65dc525e8d26e1ab0c9029aee862226af6f51b
4
- data.tar.gz: 4cf4dbe623d1938faeaf5b53287726276b64dd5cc81b3911dfb0ec033498c31b
3
+ metadata.gz: 4001f1778a4cbba03903acb2007aeca8c0840b351baf9654e2e238efb5b1650a
4
+ data.tar.gz: fd8467571f6574c9647faab25aa1fc3016a6e1321a179ba5a94de32911cb4fc2
5
5
  SHA512:
6
- metadata.gz: 5bd33c2679d91ad9735a9b6e8ed28720da5f630a532ca8437449e4270b8dc9b89ead74f7d328403835d64ca070e37b524665637bb5171150a90e6613d8545116
7
- data.tar.gz: 8cb69af1e71db88d60772dd6b3d3a2112bb2787a8333913e4e86b2e25130c03ad3620b167c17ceedabd58b89db931c895c36e203d16b4d8d32ae0976e2d1ef65
6
+ metadata.gz: df69465b988d9cdc9460ea1e3220eb5e8516386b1c1b6b54d44885c23724c6eac20084053eb7002bc0b1d7bca600e181000879bac27192f0fc2aa4fea14311d1
7
+ data.tar.gz: 5766c1061673b8fc638573094111ca4c0023c25d02c58480cc824874187c981e39dce26aeaf93c6ccbacde44b0c862589f973db52789de5d3bb26023dff3ac98
data/CHANGELOG.md CHANGED
@@ -3,3 +3,6 @@
3
3
  ## [0.1.0] - 2024-02-14
4
4
  - Initial release
5
5
 
6
+ ## [0.1.1] - 2024-02-14
7
+ - Convienience method added to get client for a teannt api host
8
+
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
- TenantClient.new(self.config.merge({ access_token: access_token, endpoint: api_host, tenant_id: tenant_id, connection_options: { headers: { 'X-Tenant-ID': tenant_id } } }))
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Sophos
4
- VERSION = '0.1.0'
4
+ VERSION = '0.1.1'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sophos_central_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Janco Tanis