pulp_ansible_client 0.4.3 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +8 -12
- data/docs/AnsibleCollectionVersion.md +0 -2
- data/docs/AnsibleCollectionVersionResponse.md +5 -9
- data/docs/AnsibleCopyApi.md +62 -0
- data/docs/AnsibleRoleResponse.md +4 -4
- data/docs/CollectionResponse.md +5 -5
- data/docs/CollectionVersionResponse.md +0 -2
- data/docs/ContentCollectionVersionsApi.md +0 -4
- data/docs/Copy.md +17 -0
- data/docs/{CertificationEnum.md → PatchedCollection.md} +3 -2
- data/docs/PulpAnsibleGalaxyApiCollectionsApi.md +5 -5
- data/docs/PulpAnsibleGalaxyApiV3VersionsApi.md +0 -4
- data/lib/pulp_ansible_client/api/ansible_copy_api.rb +86 -0
- data/lib/pulp_ansible_client/api/content_collection_versions_api.rb +0 -10
- data/lib/pulp_ansible_client/api/pulp_ansible_galaxy_api_collections_api.rb +10 -10
- data/lib/pulp_ansible_client/api/pulp_ansible_galaxy_api_v3_versions_api.rb +0 -10
- data/lib/pulp_ansible_client/models/ansible_collection_version.rb +1 -16
- data/lib/pulp_ansible_client/models/ansible_collection_version_response.rb +17 -42
- data/lib/pulp_ansible_client/models/ansible_role_response.rb +14 -14
- data/lib/pulp_ansible_client/models/collection_response.rb +22 -32
- data/lib/pulp_ansible_client/models/collection_version_response.rb +1 -10
- data/lib/pulp_ansible_client/models/{collection_metadata.rb → copy.rb} +15 -16
- data/lib/pulp_ansible_client/models/{collection_namespace.rb → patched_collection.rb} +11 -16
- data/lib/pulp_ansible_client/version.rb +1 -1
- data/lib/pulp_ansible_client.rb +3 -7
- data/spec/api/{pulp_ansible_galaxy_api_v3_collections_certified_api_spec.rb → ansible_copy_api_spec.rb} +12 -15
- data/spec/api/content_collection_versions_api_spec.rb +0 -2
- data/spec/api/pulp_ansible_galaxy_api_collections_api_spec.rb +1 -1
- data/spec/api/pulp_ansible_galaxy_api_v3_versions_api_spec.rb +0 -2
- data/spec/models/ansible_collection_version_response_spec.rb +2 -14
- data/spec/models/ansible_collection_version_spec.rb +0 -6
- data/spec/models/ansible_role_response_spec.rb +2 -2
- data/spec/models/collection_response_spec.rb +7 -7
- data/spec/models/collection_version_response_spec.rb +0 -6
- data/spec/models/{collection_metadata_spec.rb → copy_spec.rb} +7 -7
- data/spec/models/{collection_namespace_spec.rb → patched_collection_spec.rb} +7 -7
- metadata +14 -30
- data/docs/Collection.md +0 -21
- data/docs/CollectionMetadata.md +0 -17
- data/docs/CollectionNamespace.md +0 -17
- data/docs/CollectionRef.md +0 -19
- data/docs/CollectionVersion.md +0 -21
- data/docs/PulpAnsibleGalaxyApiV3CollectionsCertifiedApi.md +0 -63
- data/lib/pulp_ansible_client/api/pulp_ansible_galaxy_api_v3_collections_certified_api.rb +0 -108
- data/lib/pulp_ansible_client/models/certification_enum.rb +0 -37
- data/lib/pulp_ansible_client/models/collection.rb +0 -240
- data/lib/pulp_ansible_client/models/collection_ref.rb +0 -226
- data/lib/pulp_ansible_client/models/collection_version.rb +0 -235
- data/spec/models/certification_enum_spec.rb +0 -35
- data/spec/models/collection_ref_spec.rb +0 -47
- data/spec/models/collection_spec.rb +0 -53
- data/spec/models/collection_version_spec.rb +0 -53
data/docs/Collection.md
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
# PulpAnsibleClient::Collection
|
2
|
-
|
3
|
-
## Properties
|
4
|
-
|
5
|
-
Name | Type | Description | Notes
|
6
|
-
------------ | ------------- | ------------- | -------------
|
7
|
-
**created_at** | **DateTime** | |
|
8
|
-
**updated_at** | **DateTime** | |
|
9
|
-
**deprecated** | **Boolean** | |
|
10
|
-
|
11
|
-
## Code Sample
|
12
|
-
|
13
|
-
```ruby
|
14
|
-
require 'PulpAnsibleClient'
|
15
|
-
|
16
|
-
instance = PulpAnsibleClient::Collection.new(created_at: null,
|
17
|
-
updated_at: null,
|
18
|
-
deprecated: null)
|
19
|
-
```
|
20
|
-
|
21
|
-
|
data/docs/CollectionMetadata.md
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
# PulpAnsibleClient::CollectionMetadata
|
2
|
-
|
3
|
-
## Properties
|
4
|
-
|
5
|
-
Name | Type | Description | Notes
|
6
|
-
------------ | ------------- | ------------- | -------------
|
7
|
-
**tags** | **Array<String>** | |
|
8
|
-
|
9
|
-
## Code Sample
|
10
|
-
|
11
|
-
```ruby
|
12
|
-
require 'PulpAnsibleClient'
|
13
|
-
|
14
|
-
instance = PulpAnsibleClient::CollectionMetadata.new(tags: null)
|
15
|
-
```
|
16
|
-
|
17
|
-
|
data/docs/CollectionNamespace.md
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
# PulpAnsibleClient::CollectionNamespace
|
2
|
-
|
3
|
-
## Properties
|
4
|
-
|
5
|
-
Name | Type | Description | Notes
|
6
|
-
------------ | ------------- | ------------- | -------------
|
7
|
-
**name** | **String** | |
|
8
|
-
|
9
|
-
## Code Sample
|
10
|
-
|
11
|
-
```ruby
|
12
|
-
require 'PulpAnsibleClient'
|
13
|
-
|
14
|
-
instance = PulpAnsibleClient::CollectionNamespace.new(name: null)
|
15
|
-
```
|
16
|
-
|
17
|
-
|
data/docs/CollectionRef.md
DELETED
@@ -1,19 +0,0 @@
|
|
1
|
-
# PulpAnsibleClient::CollectionRef
|
2
|
-
|
3
|
-
## Properties
|
4
|
-
|
5
|
-
Name | Type | Description | Notes
|
6
|
-
------------ | ------------- | ------------- | -------------
|
7
|
-
**id** | **String** | |
|
8
|
-
**name** | **String** | |
|
9
|
-
|
10
|
-
## Code Sample
|
11
|
-
|
12
|
-
```ruby
|
13
|
-
require 'PulpAnsibleClient'
|
14
|
-
|
15
|
-
instance = PulpAnsibleClient::CollectionRef.new(id: null,
|
16
|
-
name: null)
|
17
|
-
```
|
18
|
-
|
19
|
-
|
data/docs/CollectionVersion.md
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
# PulpAnsibleClient::CollectionVersion
|
2
|
-
|
3
|
-
## Properties
|
4
|
-
|
5
|
-
Name | Type | Description | Notes
|
6
|
-
------------ | ------------- | ------------- | -------------
|
7
|
-
**certification** | [**CertificationEnum**](CertificationEnum.md) | | [optional]
|
8
|
-
**created_at** | **DateTime** | |
|
9
|
-
**updated_at** | **DateTime** | |
|
10
|
-
|
11
|
-
## Code Sample
|
12
|
-
|
13
|
-
```ruby
|
14
|
-
require 'PulpAnsibleClient'
|
15
|
-
|
16
|
-
instance = PulpAnsibleClient::CollectionVersion.new(certification: null,
|
17
|
-
created_at: null,
|
18
|
-
updated_at: null)
|
19
|
-
```
|
20
|
-
|
21
|
-
|
@@ -1,63 +0,0 @@
|
|
1
|
-
# PulpAnsibleClient::PulpAnsibleGalaxyApiV3CollectionsCertifiedApi
|
2
|
-
|
3
|
-
All URIs are relative to *http://pulp*
|
4
|
-
|
5
|
-
Method | HTTP request | Description
|
6
|
-
------------- | ------------- | -------------
|
7
|
-
[**set_certified**](PulpAnsibleGalaxyApiV3CollectionsCertifiedApi.md#set_certified) | **PUT** /pulp_ansible/galaxy/{path}/api/v3/collections/{namespace}/{name}/versions/{version}/certified/ |
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
## set_certified
|
12
|
-
|
13
|
-
> CollectionVersionResponse set_certified(name, namespace, path, version, collection_version)
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
Set collection version certified status.
|
18
|
-
|
19
|
-
### Example
|
20
|
-
|
21
|
-
```ruby
|
22
|
-
# load the gem
|
23
|
-
require 'pulp_ansible_client'
|
24
|
-
|
25
|
-
api_instance = PulpAnsibleClient::PulpAnsibleGalaxyApiV3CollectionsCertifiedApi.new
|
26
|
-
name = 'name_example' # String |
|
27
|
-
namespace = 'namespace_example' # String |
|
28
|
-
path = 'path_example' # String |
|
29
|
-
version = 'version_example' # String |
|
30
|
-
collection_version = PulpAnsibleClient::CollectionVersion.new # CollectionVersion |
|
31
|
-
|
32
|
-
begin
|
33
|
-
result = api_instance.set_certified(name, namespace, path, version, collection_version)
|
34
|
-
p result
|
35
|
-
rescue PulpAnsibleClient::ApiError => e
|
36
|
-
puts "Exception when calling PulpAnsibleGalaxyApiV3CollectionsCertifiedApi->set_certified: #{e}"
|
37
|
-
end
|
38
|
-
```
|
39
|
-
|
40
|
-
### Parameters
|
41
|
-
|
42
|
-
|
43
|
-
Name | Type | Description | Notes
|
44
|
-
------------- | ------------- | ------------- | -------------
|
45
|
-
**name** | **String**| |
|
46
|
-
**namespace** | **String**| |
|
47
|
-
**path** | **String**| |
|
48
|
-
**version** | **String**| |
|
49
|
-
**collection_version** | [**CollectionVersion**](CollectionVersion.md)| |
|
50
|
-
|
51
|
-
### Return type
|
52
|
-
|
53
|
-
[**CollectionVersionResponse**](CollectionVersionResponse.md)
|
54
|
-
|
55
|
-
### Authorization
|
56
|
-
|
57
|
-
No authorization required
|
58
|
-
|
59
|
-
### HTTP request headers
|
60
|
-
|
61
|
-
- **Content-Type**: application/json, application/x-www-form-urlencoded, multipart/form-data
|
62
|
-
- **Accept**: application/json
|
63
|
-
|
@@ -1,108 +0,0 @@
|
|
1
|
-
=begin
|
2
|
-
#Pulp 3 API
|
3
|
-
|
4
|
-
#Fetch, Upload, Organize, and Distribute Software Packages
|
5
|
-
|
6
|
-
The version of the OpenAPI document: v3
|
7
|
-
Contact: pulp-list@redhat.com
|
8
|
-
Generated by: https://openapi-generator.tech
|
9
|
-
OpenAPI Generator version: 4.2.3
|
10
|
-
|
11
|
-
=end
|
12
|
-
|
13
|
-
require 'cgi'
|
14
|
-
|
15
|
-
module PulpAnsibleClient
|
16
|
-
class PulpAnsibleGalaxyApiV3CollectionsCertifiedApi
|
17
|
-
attr_accessor :api_client
|
18
|
-
|
19
|
-
def initialize(api_client = ApiClient.default)
|
20
|
-
@api_client = api_client
|
21
|
-
end
|
22
|
-
# Set collection version certified status.
|
23
|
-
# @param name [String]
|
24
|
-
# @param namespace [String]
|
25
|
-
# @param path [String]
|
26
|
-
# @param version [String]
|
27
|
-
# @param collection_version [CollectionVersion]
|
28
|
-
# @param [Hash] opts the optional parameters
|
29
|
-
# @return [CollectionVersionResponse]
|
30
|
-
def set_certified(name, namespace, path, version, collection_version, opts = {})
|
31
|
-
data, _status_code, _headers = set_certified_with_http_info(name, namespace, path, version, collection_version, opts)
|
32
|
-
data
|
33
|
-
end
|
34
|
-
|
35
|
-
# Set collection version certified status.
|
36
|
-
# @param name [String]
|
37
|
-
# @param namespace [String]
|
38
|
-
# @param path [String]
|
39
|
-
# @param version [String]
|
40
|
-
# @param collection_version [CollectionVersion]
|
41
|
-
# @param [Hash] opts the optional parameters
|
42
|
-
# @return [Array<(CollectionVersionResponse, Integer, Hash)>] CollectionVersionResponse data, response status code and response headers
|
43
|
-
def set_certified_with_http_info(name, namespace, path, version, collection_version, opts = {})
|
44
|
-
if @api_client.config.debugging
|
45
|
-
@api_client.config.logger.debug 'Calling API: PulpAnsibleGalaxyApiV3CollectionsCertifiedApi.set_certified ...'
|
46
|
-
end
|
47
|
-
# verify the required parameter 'name' is set
|
48
|
-
if @api_client.config.client_side_validation && name.nil?
|
49
|
-
fail ArgumentError, "Missing the required parameter 'name' when calling PulpAnsibleGalaxyApiV3CollectionsCertifiedApi.set_certified"
|
50
|
-
end
|
51
|
-
# verify the required parameter 'namespace' is set
|
52
|
-
if @api_client.config.client_side_validation && namespace.nil?
|
53
|
-
fail ArgumentError, "Missing the required parameter 'namespace' when calling PulpAnsibleGalaxyApiV3CollectionsCertifiedApi.set_certified"
|
54
|
-
end
|
55
|
-
# verify the required parameter 'path' is set
|
56
|
-
if @api_client.config.client_side_validation && path.nil?
|
57
|
-
fail ArgumentError, "Missing the required parameter 'path' when calling PulpAnsibleGalaxyApiV3CollectionsCertifiedApi.set_certified"
|
58
|
-
end
|
59
|
-
# verify the required parameter 'version' is set
|
60
|
-
if @api_client.config.client_side_validation && version.nil?
|
61
|
-
fail ArgumentError, "Missing the required parameter 'version' when calling PulpAnsibleGalaxyApiV3CollectionsCertifiedApi.set_certified"
|
62
|
-
end
|
63
|
-
# verify the required parameter 'collection_version' is set
|
64
|
-
if @api_client.config.client_side_validation && collection_version.nil?
|
65
|
-
fail ArgumentError, "Missing the required parameter 'collection_version' when calling PulpAnsibleGalaxyApiV3CollectionsCertifiedApi.set_certified"
|
66
|
-
end
|
67
|
-
# resource path
|
68
|
-
local_var_path = '/pulp_ansible/galaxy/{path}/api/v3/collections/{namespace}/{name}/versions/{version}/certified/'.sub('{' + 'name' + '}', CGI.escape(name.to_s).gsub('%2F', '/')).sub('{' + 'namespace' + '}', CGI.escape(namespace.to_s).gsub('%2F', '/')).sub('{' + 'path' + '}', CGI.escape(path.to_s).gsub('%2F', '/')).sub('{' + 'version' + '}', CGI.escape(version.to_s).gsub('%2F', '/'))
|
69
|
-
|
70
|
-
# query parameters
|
71
|
-
query_params = opts[:query_params] || {}
|
72
|
-
|
73
|
-
# header parameters
|
74
|
-
header_params = opts[:header_params] || {}
|
75
|
-
# HTTP header 'Accept' (if needed)
|
76
|
-
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
77
|
-
# HTTP header 'Content-Type'
|
78
|
-
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', 'application/x-www-form-urlencoded', 'multipart/form-data'])
|
79
|
-
|
80
|
-
# form parameters
|
81
|
-
form_params = opts[:form_params] || {}
|
82
|
-
|
83
|
-
# http body (model)
|
84
|
-
post_body = opts[:body] || @api_client.object_to_http_body(collection_version)
|
85
|
-
|
86
|
-
# return_type
|
87
|
-
return_type = opts[:return_type] || 'CollectionVersionResponse'
|
88
|
-
|
89
|
-
# auth_names
|
90
|
-
auth_names = opts[:auth_names] || []
|
91
|
-
|
92
|
-
new_options = opts.merge(
|
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(:PUT, local_var_path, new_options)
|
102
|
-
if @api_client.config.debugging
|
103
|
-
@api_client.config.logger.debug "API called: PulpAnsibleGalaxyApiV3CollectionsCertifiedApi#set_certified\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
104
|
-
end
|
105
|
-
return data, status_code, headers
|
106
|
-
end
|
107
|
-
end
|
108
|
-
end
|
@@ -1,37 +0,0 @@
|
|
1
|
-
=begin
|
2
|
-
#Pulp 3 API
|
3
|
-
|
4
|
-
#Fetch, Upload, Organize, and Distribute Software Packages
|
5
|
-
|
6
|
-
The version of the OpenAPI document: v3
|
7
|
-
Contact: pulp-list@redhat.com
|
8
|
-
Generated by: https://openapi-generator.tech
|
9
|
-
OpenAPI Generator version: 4.2.3
|
10
|
-
|
11
|
-
=end
|
12
|
-
|
13
|
-
require 'date'
|
14
|
-
|
15
|
-
module PulpAnsibleClient
|
16
|
-
class CertificationEnum
|
17
|
-
CERTIFIED = "certified".freeze
|
18
|
-
NOT_CERTIFIED = "not_certified".freeze
|
19
|
-
NEEDS_REVIEW = "needs_review".freeze
|
20
|
-
|
21
|
-
# Builds the enum from string
|
22
|
-
# @param [String] The enum value in the form of the string
|
23
|
-
# @return [String] The enum value
|
24
|
-
def self.build_from_hash(value)
|
25
|
-
new.build_from_hash(value)
|
26
|
-
end
|
27
|
-
|
28
|
-
# Builds the enum from string
|
29
|
-
# @param [String] The enum value in the form of the string
|
30
|
-
# @return [String] The enum value
|
31
|
-
def build_from_hash(value)
|
32
|
-
constantValues = CertificationEnum.constants.select { |c| CertificationEnum::const_get(c) == value }
|
33
|
-
raise "Invalid ENUM value #{value} for class #CertificationEnum" if constantValues.empty?
|
34
|
-
value
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|
@@ -1,240 +0,0 @@
|
|
1
|
-
=begin
|
2
|
-
#Pulp 3 API
|
3
|
-
|
4
|
-
#Fetch, Upload, Organize, and Distribute Software Packages
|
5
|
-
|
6
|
-
The version of the OpenAPI document: v3
|
7
|
-
Contact: pulp-list@redhat.com
|
8
|
-
Generated by: https://openapi-generator.tech
|
9
|
-
OpenAPI Generator version: 4.2.3
|
10
|
-
|
11
|
-
=end
|
12
|
-
|
13
|
-
require 'date'
|
14
|
-
|
15
|
-
module PulpAnsibleClient
|
16
|
-
# A serializer for a Collection.
|
17
|
-
class Collection
|
18
|
-
attr_accessor :created_at
|
19
|
-
|
20
|
-
attr_accessor :updated_at
|
21
|
-
|
22
|
-
attr_accessor :deprecated
|
23
|
-
|
24
|
-
# Attribute mapping from ruby-style variable name to JSON key.
|
25
|
-
def self.attribute_map
|
26
|
-
{
|
27
|
-
:'created_at' => :'created_at',
|
28
|
-
:'updated_at' => :'updated_at',
|
29
|
-
:'deprecated' => :'deprecated'
|
30
|
-
}
|
31
|
-
end
|
32
|
-
|
33
|
-
# Attribute type mapping.
|
34
|
-
def self.openapi_types
|
35
|
-
{
|
36
|
-
:'created_at' => :'DateTime',
|
37
|
-
:'updated_at' => :'DateTime',
|
38
|
-
:'deprecated' => :'Boolean'
|
39
|
-
}
|
40
|
-
end
|
41
|
-
|
42
|
-
# List of attributes with nullable: true
|
43
|
-
def self.openapi_nullable
|
44
|
-
Set.new([
|
45
|
-
])
|
46
|
-
end
|
47
|
-
|
48
|
-
# Initializes the object
|
49
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
50
|
-
def initialize(attributes = {})
|
51
|
-
if (!attributes.is_a?(Hash))
|
52
|
-
fail ArgumentError, "The input argument (attributes) must be a hash in `PulpAnsibleClient::Collection` initialize method"
|
53
|
-
end
|
54
|
-
|
55
|
-
# check to see if the attribute exists and convert string to symbol for hash key
|
56
|
-
attributes = attributes.each_with_object({}) { |(k, v), h|
|
57
|
-
if (!self.class.attribute_map.key?(k.to_sym))
|
58
|
-
fail ArgumentError, "`#{k}` is not a valid attribute in `PulpAnsibleClient::Collection`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
59
|
-
end
|
60
|
-
h[k.to_sym] = v
|
61
|
-
}
|
62
|
-
|
63
|
-
if attributes.key?(:'created_at')
|
64
|
-
self.created_at = attributes[:'created_at']
|
65
|
-
end
|
66
|
-
|
67
|
-
if attributes.key?(:'updated_at')
|
68
|
-
self.updated_at = attributes[:'updated_at']
|
69
|
-
end
|
70
|
-
|
71
|
-
if attributes.key?(:'deprecated')
|
72
|
-
self.deprecated = attributes[:'deprecated']
|
73
|
-
end
|
74
|
-
end
|
75
|
-
|
76
|
-
# Show invalid properties with the reasons. Usually used together with valid?
|
77
|
-
# @return Array for valid properties with the reasons
|
78
|
-
def list_invalid_properties
|
79
|
-
invalid_properties = Array.new
|
80
|
-
if @created_at.nil?
|
81
|
-
invalid_properties.push('invalid value for "created_at", created_at cannot be nil.')
|
82
|
-
end
|
83
|
-
|
84
|
-
if @updated_at.nil?
|
85
|
-
invalid_properties.push('invalid value for "updated_at", updated_at cannot be nil.')
|
86
|
-
end
|
87
|
-
|
88
|
-
if @deprecated.nil?
|
89
|
-
invalid_properties.push('invalid value for "deprecated", deprecated cannot be nil.')
|
90
|
-
end
|
91
|
-
|
92
|
-
invalid_properties
|
93
|
-
end
|
94
|
-
|
95
|
-
# Check to see if the all the properties in the model are valid
|
96
|
-
# @return true if the model is valid
|
97
|
-
def valid?
|
98
|
-
return false if @created_at.nil?
|
99
|
-
return false if @updated_at.nil?
|
100
|
-
return false if @deprecated.nil?
|
101
|
-
true
|
102
|
-
end
|
103
|
-
|
104
|
-
# Checks equality by comparing each attribute.
|
105
|
-
# @param [Object] Object to be compared
|
106
|
-
def ==(o)
|
107
|
-
return true if self.equal?(o)
|
108
|
-
self.class == o.class &&
|
109
|
-
created_at == o.created_at &&
|
110
|
-
updated_at == o.updated_at &&
|
111
|
-
deprecated == o.deprecated
|
112
|
-
end
|
113
|
-
|
114
|
-
# @see the `==` method
|
115
|
-
# @param [Object] Object to be compared
|
116
|
-
def eql?(o)
|
117
|
-
self == o
|
118
|
-
end
|
119
|
-
|
120
|
-
# Calculates hash code according to all attributes.
|
121
|
-
# @return [Integer] Hash code
|
122
|
-
def hash
|
123
|
-
[created_at, updated_at, deprecated].hash
|
124
|
-
end
|
125
|
-
|
126
|
-
# Builds the object from hash
|
127
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
128
|
-
# @return [Object] Returns the model itself
|
129
|
-
def self.build_from_hash(attributes)
|
130
|
-
new.build_from_hash(attributes)
|
131
|
-
end
|
132
|
-
|
133
|
-
# Builds the object from hash
|
134
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
135
|
-
# @return [Object] Returns the model itself
|
136
|
-
def build_from_hash(attributes)
|
137
|
-
return nil unless attributes.is_a?(Hash)
|
138
|
-
self.class.openapi_types.each_pair do |key, type|
|
139
|
-
if type =~ /\AArray<(.*)>/i
|
140
|
-
# check to ensure the input is an array given that the attribute
|
141
|
-
# is documented as an array but the input is not
|
142
|
-
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
143
|
-
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
144
|
-
end
|
145
|
-
elsif !attributes[self.class.attribute_map[key]].nil?
|
146
|
-
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
147
|
-
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
148
|
-
end
|
149
|
-
|
150
|
-
self
|
151
|
-
end
|
152
|
-
|
153
|
-
# Deserializes the data based on type
|
154
|
-
# @param string type Data type
|
155
|
-
# @param string value Value to be deserialized
|
156
|
-
# @return [Object] Deserialized data
|
157
|
-
def _deserialize(type, value)
|
158
|
-
case type.to_sym
|
159
|
-
when :DateTime
|
160
|
-
DateTime.parse(value)
|
161
|
-
when :Date
|
162
|
-
Date.parse(value)
|
163
|
-
when :String
|
164
|
-
value.to_s
|
165
|
-
when :Integer
|
166
|
-
value.to_i
|
167
|
-
when :Float
|
168
|
-
value.to_f
|
169
|
-
when :Boolean
|
170
|
-
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
171
|
-
true
|
172
|
-
else
|
173
|
-
false
|
174
|
-
end
|
175
|
-
when :Object
|
176
|
-
# generic object (usually a Hash), return directly
|
177
|
-
value
|
178
|
-
when /\AArray<(?<inner_type>.+)>\z/
|
179
|
-
inner_type = Regexp.last_match[:inner_type]
|
180
|
-
value.map { |v| _deserialize(inner_type, v) }
|
181
|
-
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
182
|
-
k_type = Regexp.last_match[:k_type]
|
183
|
-
v_type = Regexp.last_match[:v_type]
|
184
|
-
{}.tap do |hash|
|
185
|
-
value.each do |k, v|
|
186
|
-
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
187
|
-
end
|
188
|
-
end
|
189
|
-
else # model
|
190
|
-
PulpAnsibleClient.const_get(type).build_from_hash(value)
|
191
|
-
end
|
192
|
-
end
|
193
|
-
|
194
|
-
# Returns the string representation of the object
|
195
|
-
# @return [String] String presentation of the object
|
196
|
-
def to_s
|
197
|
-
to_hash.to_s
|
198
|
-
end
|
199
|
-
|
200
|
-
# to_body is an alias to to_hash (backward compatibility)
|
201
|
-
# @return [Hash] Returns the object in the form of hash
|
202
|
-
def to_body
|
203
|
-
to_hash
|
204
|
-
end
|
205
|
-
|
206
|
-
# Returns the object in the form of hash
|
207
|
-
# @return [Hash] Returns the object in the form of hash
|
208
|
-
def to_hash
|
209
|
-
hash = {}
|
210
|
-
self.class.attribute_map.each_pair do |attr, param|
|
211
|
-
value = self.send(attr)
|
212
|
-
if value.nil?
|
213
|
-
is_nullable = self.class.openapi_nullable.include?(attr)
|
214
|
-
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
215
|
-
end
|
216
|
-
|
217
|
-
hash[param] = _to_hash(value)
|
218
|
-
end
|
219
|
-
hash
|
220
|
-
end
|
221
|
-
|
222
|
-
# Outputs non-array value in the form of hash
|
223
|
-
# For object, use to_hash. Otherwise, just return the value
|
224
|
-
# @param [Object] value Any valid value
|
225
|
-
# @return [Hash] Returns the value in the form of hash
|
226
|
-
def _to_hash(value)
|
227
|
-
if value.is_a?(Array)
|
228
|
-
value.compact.map { |v| _to_hash(v) }
|
229
|
-
elsif value.is_a?(Hash)
|
230
|
-
{}.tap do |hash|
|
231
|
-
value.each { |k, v| hash[k] = _to_hash(v) }
|
232
|
-
end
|
233
|
-
elsif value.respond_to? :to_hash
|
234
|
-
value.to_hash
|
235
|
-
else
|
236
|
-
value
|
237
|
-
end
|
238
|
-
end
|
239
|
-
end
|
240
|
-
end
|