example_fdhbiopcnmeocbr_gem_misc 1.2.3

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 759b11a66c70c924e8404912141f404546655b9c6bfc9fca33ed7efb80bfc7d6
4
+ data.tar.gz: 07206e1a7e0cbee5b05436aa3351eb40d6cb7017720c766fc5299e3f34559ab3
5
+ SHA512:
6
+ metadata.gz: ce3f951b4c3f53600fe77fe607b208527282cce3de01066104f0330338eee5b71d965b4e72a362f334e442ce4ce4d32b8306471c48b8630594e98b3e645fde38
7
+ data.tar.gz: a1c0a6ee94f34ee2058c810dd7efb0b77fb6229e6ba4c4292a49bfc6d3572a1207702bdcdfdea3f2059ae275e050f46422d9e7d8e6af045f46a7bc5ea8f5d43d
data/Gemfile ADDED
@@ -0,0 +1,9 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
4
+
5
+ group :development, :test do
6
+ gem 'rake', '~> 13.0.1'
7
+ gem 'pry-byebug'
8
+ gem 'rubocop', '~> 0.66.0'
9
+ end
data/README.md ADDED
@@ -0,0 +1,155 @@
1
+ # pnap_audit_api
2
+
3
+ AuditApi - the Ruby gem for the Audit Log API
4
+
5
+ The Audit Logs API lets you read audit log entries and track API calls or activities in the Bare Metal Cloud Portal.<br>
6
+ <br>
7
+ <span class='pnap-api-knowledge-base-link'>
8
+ Knowledge base articles to help you can be found
9
+ <a href='https://phoenixnap.com/kb/bmc-server-management-via-api#audit-log-api' target='_blank'>here</a>
10
+ </span><br>
11
+ <br>
12
+ <b>All URLs are relative to (https://api.phoenixnap.com/audit/v1/)</b>
13
+
14
+
15
+ This SDK is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project:
16
+
17
+ - API version: 1.0
18
+ For more information, please visit [https://phoenixnap.com/](https://phoenixnap.com/)
19
+
20
+ ## Installation
21
+
22
+ ### Build a gem
23
+
24
+ To build the Ruby code into a gem:
25
+
26
+ ```shell
27
+ gem build pnap_audit_api.gemspec
28
+ ```
29
+
30
+ Then either install the gem locally, replacing `<VERSION>` with the actual version:
31
+
32
+ ```shell
33
+ gem install ./pnap_audit_api-<VERSION>.gem
34
+ ```
35
+
36
+ (for development, run `gem install --dev ./pnap_audit_api-<VERSION>.gem` to install the development dependencies)
37
+
38
+ or publish the gem to a gem hosting service, e.g. [RubyGems](https://rubygems.org/).
39
+
40
+ Finally add this to the Gemfile:
41
+
42
+ gem 'pnap_audit_api', '~> <VERSION>'
43
+
44
+ ### Install from Git
45
+
46
+ To install this Gem from this repository, you'll need to get Bundler by doing `gem install bundler`. Add the following line in your Gemfile:
47
+
48
+ gem 'pnap_audit_api', git: 'https://github.com/phoenixnap/ruby-sdk-bmc-poc', glob: 'AuditApi/*.gemspec'
49
+
50
+ If you'd like the development version:
51
+
52
+ gem 'pnap_audit_api', git: 'https://github.com/phoenixnap/ruby-sdk-bmc-poc', glob: 'AuditApi/*.gemspec', branch: 'develop'
53
+
54
+ Then run `bundle install`.
55
+
56
+ ### Include the Ruby code directly
57
+
58
+ Include the Ruby code directly using `-I` as follows:
59
+
60
+ ```shell
61
+ ruby -Ilib script.rb
62
+ ```
63
+
64
+ ## Getting Started
65
+
66
+ Please follow the [installation](#installation) procedure and then run the following code:
67
+
68
+ ```ruby
69
+ # Load the gem
70
+ require 'pnap_audit_api'
71
+
72
+ # Setup authorization
73
+ AuditApi.configure do |config|
74
+ # Configure OAuth2 access token for authorization: OAuth2
75
+ config.access_token = 'YOUR ACCESS TOKEN'
76
+ end
77
+
78
+ api_instance = AuditApi::EventsApi.new
79
+ opts = {
80
+ from: Time.parse('2021-04-27T16:24:57.123Z'), # Time | From the date and time (inclusive) to filter event log records by.
81
+ to: Time.parse('2021-04-29T16:24:57.123Z'), # Time | To the date and time (inclusive) to filter event log records by.
82
+ limit: 10, # Integer | Limit the number of records returned.
83
+ order: 'ASC', # String | Ordering of the event's time. SortBy can be introduced later on.
84
+ username: 'johnd@phoenixnap.com', # String | The username that did the actions.
85
+ verb: 'POST', # String | The HTTP verb corresponding to the action.
86
+ uri: '/ams/v1/clients/12345' # String | The request uri.
87
+ }
88
+
89
+ begin
90
+ #List event logs.
91
+ result = api_instance.events_get(opts)
92
+ p result
93
+ rescue AuditApi::ApiError => e
94
+ puts "Exception when calling EventsApi->events_get: #{e}"
95
+ end
96
+
97
+ ```
98
+
99
+ Authorization can also be setup by using the [`oauth`](https://github.com/oauth-xx/oauth2) library:
100
+
101
+ ```ruby
102
+ # Load the gem
103
+ require 'pnap_audit_api'
104
+ require 'oauth2'
105
+
106
+ # Setup variables for getting a token.
107
+ client_id = 'YOUR_CLIENT_ID'
108
+ client_secret = 'YOUR_CLIENT_SECRET'
109
+ auth_url = 'https://auth.phoenixnap.com/auth/realms/BMC/protocol/openid-connect/token'
110
+
111
+
112
+ # Setup authorization
113
+ AuditApi.configure do |config|
114
+ # Retrieve the token using OAuth2.
115
+ client = OAuth2::Client.new(client_id, client_secret, token_url: auth_url)
116
+ token = client.client_credentials.get_token
117
+
118
+ # Configure OAuth2 access token for authorization: OAuth2
119
+ config.access_token = token.token
120
+ end
121
+
122
+ ```
123
+
124
+ ## Documentation for API Endpoints
125
+
126
+ All URIs are relative to *https://api.phoenixnap.com/audit/v1*
127
+
128
+ Class | Method | HTTP request | Description
129
+ ------------ | ------------- | ------------- | -------------
130
+ *AuditApi::EventsApi* | [**events_get**](docs/EventsApi.md#events_get) | **GET** /events | List event logs.
131
+
132
+
133
+ ## Documentation for Models
134
+
135
+ - [AuditApi::ApiAction](docs/ApiAction.md)
136
+ - [AuditApi::ApiActionAllOf](docs/ApiActionAllOf.md)
137
+ - [AuditApi::Event](docs/Event.md)
138
+ - [AuditApi::Headers](docs/Headers.md)
139
+ - [AuditApi::Request](docs/Request.md)
140
+ - [AuditApi::Response](docs/Response.md)
141
+ - [AuditApi::UserInfo](docs/UserInfo.md)
142
+
143
+
144
+ ## Documentation for Authorization
145
+
146
+
147
+ ### OAuth2
148
+
149
+
150
+ - **Type**: OAuth
151
+ - **Flow**: application
152
+ - **Authorization URL**:
153
+ - **Scopes**:
154
+ - audit.read: Grants read only access to audit-log-api.
155
+
data/Rakefile ADDED
@@ -0,0 +1,10 @@
1
+ require "bundler/gem_tasks"
2
+
3
+ begin
4
+ require 'rspec/core/rake_task'
5
+
6
+ RSpec::Core::RakeTask.new(:spec)
7
+ task default: :spec
8
+ rescue LoadError
9
+ # no rspec available
10
+ end
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 1.2.3
data/docs/ApiAction.md ADDED
@@ -0,0 +1,26 @@
1
+ # AuditApi::ApiAction
2
+
3
+ ## Properties
4
+
5
+ | Name | Type | Description | Notes |
6
+ | ---- | ---- | ----------- | ----- |
7
+ | **name** | **String** | The name of the event. | [optional] |
8
+ | **timestamp** | **Time** | The UTC time the event initiated. | |
9
+ | **user_info** | [**UserInfo**](UserInfo.md) | | |
10
+ | **response** | [**Response**](Response.md) | | |
11
+ | **request** | [**Request**](Request.md) | | |
12
+
13
+ ## Example
14
+
15
+ ```ruby
16
+ require 'pnap_audit_api'
17
+
18
+ instance = AuditApi::ApiAction.new(
19
+ name: API.CreateServer,
20
+ timestamp: null,
21
+ user_info: null,
22
+ response: null,
23
+ request: null
24
+ )
25
+ ```
26
+
@@ -0,0 +1,20 @@
1
+ # AuditApi::ApiActionAllOf
2
+
3
+ ## Properties
4
+
5
+ | Name | Type | Description | Notes |
6
+ | ---- | ---- | ----------- | ----- |
7
+ | **response** | [**Response**](Response.md) | | |
8
+ | **request** | [**Request**](Request.md) | | |
9
+
10
+ ## Example
11
+
12
+ ```ruby
13
+ require 'pnap_audit_api'
14
+
15
+ instance = AuditApi::ApiActionAllOf.new(
16
+ response: null,
17
+ request: null
18
+ )
19
+ ```
20
+
data/docs/Event.md ADDED
@@ -0,0 +1,22 @@
1
+ # AuditApi::Event
2
+
3
+ ## Properties
4
+
5
+ | Name | Type | Description | Notes |
6
+ | ---- | ---- | ----------- | ----- |
7
+ | **name** | **String** | The name of the event. | [optional] |
8
+ | **timestamp** | **Time** | The UTC time the event initiated. | |
9
+ | **user_info** | [**UserInfo**](UserInfo.md) | | |
10
+
11
+ ## Example
12
+
13
+ ```ruby
14
+ require 'pnap_audit_api'
15
+
16
+ instance = AuditApi::Event.new(
17
+ name: API.CreateServer,
18
+ timestamp: null,
19
+ user_info: null
20
+ )
21
+ ```
22
+
data/docs/EventsApi.md ADDED
@@ -0,0 +1,91 @@
1
+ # AuditApi::EventsApi
2
+
3
+ All URIs are relative to *https://api.phoenixnap.com/audit/v1*
4
+
5
+ | Method | HTTP request | Description |
6
+ | ------ | ------------ | ----------- |
7
+ | [**events_get**](EventsApi.md#events_get) | **GET** /events | List event logs. |
8
+
9
+
10
+ ## events_get
11
+
12
+ > <Array<Event>> events_get(opts)
13
+
14
+ List event logs.
15
+
16
+ Retrieves the event logs for given time period. All date & times are in UTC.
17
+
18
+ ### Examples
19
+
20
+ ```ruby
21
+ require 'time'
22
+ require 'pnap_audit_api'
23
+ # setup authorization
24
+ AuditApi.configure do |config|
25
+ # Configure OAuth2 access token for authorization: OAuth2
26
+ config.access_token = 'YOUR ACCESS TOKEN'
27
+ end
28
+
29
+ api_instance = AuditApi::EventsApi.new
30
+ opts = {
31
+ from: Time.parse('2021-04-27T16:24:57.123Z'), # Time | From the date and time (inclusive) to filter event log records by.
32
+ to: Time.parse('2021-04-29T16:24:57.123Z'), # Time | To the date and time (inclusive) to filter event log records by.
33
+ limit: 10, # Integer | Limit the number of records returned.
34
+ order: 'ASC', # String | Ordering of the event's time. SortBy can be introduced later on.
35
+ username: 'johnd@phoenixnap.com', # String | The username that did the actions.
36
+ verb: 'POST', # String | The HTTP verb corresponding to the action.
37
+ uri: '/ams/v1/clients/12345' # String | The request uri.
38
+ }
39
+
40
+ begin
41
+ # List event logs.
42
+ result = api_instance.events_get(opts)
43
+ p result
44
+ rescue AuditApi::ApiError => e
45
+ puts "Error when calling EventsApi->events_get: #{e}"
46
+ end
47
+ ```
48
+
49
+ #### Using the events_get_with_http_info variant
50
+
51
+ This returns an Array which contains the response data, status code and headers.
52
+
53
+ > <Array(<Array<Event>>, Integer, Hash)> events_get_with_http_info(opts)
54
+
55
+ ```ruby
56
+ begin
57
+ # List event logs.
58
+ data, status_code, headers = api_instance.events_get_with_http_info(opts)
59
+ p status_code # => 2xx
60
+ p headers # => { ... }
61
+ p data # => <Array<Event>>
62
+ rescue AuditApi::ApiError => e
63
+ puts "Error when calling EventsApi->events_get_with_http_info: #{e}"
64
+ end
65
+ ```
66
+
67
+ ### Parameters
68
+
69
+ | Name | Type | Description | Notes |
70
+ | ---- | ---- | ----------- | ----- |
71
+ | **from** | **Time** | From the date and time (inclusive) to filter event log records by. | [optional] |
72
+ | **to** | **Time** | To the date and time (inclusive) to filter event log records by. | [optional] |
73
+ | **limit** | **Integer** | Limit the number of records returned. | [optional] |
74
+ | **order** | **String** | Ordering of the event&#39;s time. SortBy can be introduced later on. | [optional][default to &#39;ASC&#39;] |
75
+ | **username** | **String** | The username that did the actions. | [optional] |
76
+ | **verb** | **String** | The HTTP verb corresponding to the action. | [optional] |
77
+ | **uri** | **String** | The request uri. | [optional] |
78
+
79
+ ### Return type
80
+
81
+ [**Array&lt;Event&gt;**](Event.md)
82
+
83
+ ### Authorization
84
+
85
+ [OAuth2](../README.md#OAuth2)
86
+
87
+ ### HTTP request headers
88
+
89
+ - **Content-Type**: Not defined
90
+ - **Accept**: application/json
91
+
data/docs/Headers.md ADDED
@@ -0,0 +1,18 @@
1
+ # AuditApi::Headers
2
+
3
+ ## Properties
4
+
5
+ | Name | Type | Description | Notes |
6
+ | ---- | ---- | ----------- | ----- |
7
+ | **user_agent** | **String** | The UA String | |
8
+
9
+ ## Example
10
+
11
+ ```ruby
12
+ require 'pnap_audit_api'
13
+
14
+ instance = AuditApi::Headers.new(
15
+ user_agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.93 Safari/537.36
16
+ )
17
+ ```
18
+
data/docs/Request.md ADDED
@@ -0,0 +1,22 @@
1
+ # AuditApi::Request
2
+
3
+ ## Properties
4
+
5
+ | Name | Type | Description | Notes |
6
+ | ---- | ---- | ----------- | ----- |
7
+ | **headers** | [**Headers**](Headers.md) | | |
8
+ | **uri** | **String** | The request URI. | |
9
+ | **verb** | **String** | The HTTP request verb. | |
10
+
11
+ ## Example
12
+
13
+ ```ruby
14
+ require 'pnap_audit_api'
15
+
16
+ instance = AuditApi::Request.new(
17
+ headers: null,
18
+ uri: /v1/servers/jghf757HGhjghg,
19
+ verb: PATCH
20
+ )
21
+ ```
22
+
data/docs/Response.md ADDED
@@ -0,0 +1,20 @@
1
+ # AuditApi::Response
2
+
3
+ ## Properties
4
+
5
+ | Name | Type | Description | Notes |
6
+ | ---- | ---- | ----------- | ----- |
7
+ | **status_code** | **Integer** | The status code returned in the response sent to the API. | |
8
+ | **resource_id** | **String** | The ID of the resource that was created. | [optional] |
9
+
10
+ ## Example
11
+
12
+ ```ruby
13
+ require 'pnap_audit_api'
14
+
15
+ instance = AuditApi::Response.new(
16
+ status_code: 200,
17
+ resource_id: 5edf1c9b4215748ac543d721
18
+ )
19
+ ```
20
+
data/docs/UserInfo.md ADDED
@@ -0,0 +1,22 @@
1
+ # AuditApi::UserInfo
2
+
3
+ ## Properties
4
+
5
+ | Name | Type | Description | Notes |
6
+ | ---- | ---- | ----------- | ----- |
7
+ | **account_id** | **String** | The BMC account ID | |
8
+ | **client_id** | **String** | The client ID of the application | [optional] |
9
+ | **username** | **String** | The logged in user or owner of the client application | |
10
+
11
+ ## Example
12
+
13
+ ```ruby
14
+ require 'pnap_audit_api'
15
+
16
+ instance = AuditApi::UserInfo.new(
17
+ account_id: 1234dfgdsf,
18
+ client_id: e9d335b1-3aa4-4760-9bad-2595c0449035,
19
+ username: johnd@phoenixnap.com
20
+ )
21
+ ```
22
+
@@ -0,0 +1,108 @@
1
+ =begin
2
+ #Audit Log API
3
+
4
+ #The Audit Logs API lets you read audit log entries and track API calls or activities in the Bare Metal Cloud Portal.<br> <br> <span class='pnap-api-knowledge-base-link'> Knowledge base articles to help you can be found <a href='https://phoenixnap.com/kb/bmc-server-management-via-api#audit-log-api' target='_blank'>here</a> </span><br> <br> <b>All URLs are relative to (https://api.phoenixnap.com/audit/v1/)</b>
5
+
6
+ The version of the OpenAPI document: 1.0
7
+ Contact: support@phoenixnap.com
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 5.4.0
10
+
11
+ =end
12
+
13
+ require 'cgi'
14
+
15
+ module AuditApi
16
+ class EventsApi
17
+ attr_accessor :api_client
18
+
19
+ def initialize(api_client = ApiClient.default)
20
+ @api_client = api_client
21
+ end
22
+ # List event logs.
23
+ # Retrieves the event logs for given time period. All date & times are in UTC.
24
+ # @param [Hash] opts the optional parameters
25
+ # @option opts [Time] :from From the date and time (inclusive) to filter event log records by.
26
+ # @option opts [Time] :to To the date and time (inclusive) to filter event log records by.
27
+ # @option opts [Integer] :limit Limit the number of records returned.
28
+ # @option opts [String] :order Ordering of the event&#39;s time. SortBy can be introduced later on. (default to 'ASC')
29
+ # @option opts [String] :username The username that did the actions.
30
+ # @option opts [String] :verb The HTTP verb corresponding to the action.
31
+ # @option opts [String] :uri The request uri.
32
+ # @return [Array<Event>]
33
+ def events_get(opts = {})
34
+ data, _status_code, _headers = events_get_with_http_info(opts)
35
+ data
36
+ end
37
+
38
+ # List event logs.
39
+ # Retrieves the event logs for given time period. All date &amp; times are in UTC.
40
+ # @param [Hash] opts the optional parameters
41
+ # @option opts [Time] :from From the date and time (inclusive) to filter event log records by.
42
+ # @option opts [Time] :to To the date and time (inclusive) to filter event log records by.
43
+ # @option opts [Integer] :limit Limit the number of records returned.
44
+ # @option opts [String] :order Ordering of the event&#39;s time. SortBy can be introduced later on.
45
+ # @option opts [String] :username The username that did the actions.
46
+ # @option opts [String] :verb The HTTP verb corresponding to the action.
47
+ # @option opts [String] :uri The request uri.
48
+ # @return [Array<(Array<Event>, Integer, Hash)>] Array<Event> data, response status code and response headers
49
+ def events_get_with_http_info(opts = {})
50
+ if @api_client.config.debugging
51
+ @api_client.config.logger.debug 'Calling API: EventsApi.events_get ...'
52
+ end
53
+ allowable_values = ["ASC", "DESC"]
54
+ if @api_client.config.client_side_validation && opts[:'order'] && !allowable_values.include?(opts[:'order'])
55
+ fail ArgumentError, "invalid value for \"order\", must be one of #{allowable_values}"
56
+ end
57
+ allowable_values = ["POST", "PUT", "PATCH", "DELETE"]
58
+ if @api_client.config.client_side_validation && opts[:'verb'] && !allowable_values.include?(opts[:'verb'])
59
+ fail ArgumentError, "invalid value for \"verb\", must be one of #{allowable_values}"
60
+ end
61
+ # resource path
62
+ local_var_path = '/events'
63
+
64
+ # query parameters
65
+ query_params = opts[:query_params] || {}
66
+ query_params[:'from'] = opts[:'from'] if !opts[:'from'].nil?
67
+ query_params[:'to'] = opts[:'to'] if !opts[:'to'].nil?
68
+ query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
69
+ query_params[:'order'] = opts[:'order'] if !opts[:'order'].nil?
70
+ query_params[:'username'] = opts[:'username'] if !opts[:'username'].nil?
71
+ query_params[:'verb'] = opts[:'verb'] if !opts[:'verb'].nil?
72
+ query_params[:'uri'] = opts[:'uri'] if !opts[:'uri'].nil?
73
+
74
+ # header parameters
75
+ header_params = opts[:header_params] || {}
76
+ # HTTP header 'Accept' (if needed)
77
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
78
+
79
+ # form parameters
80
+ form_params = opts[:form_params] || {}
81
+
82
+ # http body (model)
83
+ post_body = opts[:debug_body]
84
+
85
+ # return_type
86
+ return_type = opts[:debug_return_type] || 'Array<Event>'
87
+
88
+ # auth_names
89
+ auth_names = opts[:debug_auth_names] || ['OAuth2']
90
+
91
+ new_options = opts.merge(
92
+ :operation => :"EventsApi.events_get",
93
+ :header_params => header_params,
94
+ :query_params => query_params,
95
+ :form_params => form_params,
96
+ :body => post_body,
97
+ :auth_names => auth_names,
98
+ :return_type => return_type
99
+ )
100
+
101
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
102
+ if @api_client.config.debugging
103
+ @api_client.config.logger.debug "API called: EventsApi#events_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
104
+ end
105
+ return data, status_code, headers
106
+ end
107
+ end
108
+ end