insights-rbac-api-client 1.0.1 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +1 -1
- data/README.md +49 -22
- data/client-meta.json +1 -1
- data/docs/Access.md +10 -9
- data/docs/AccessApi.md +39 -19
- data/docs/AccessPagination.md +12 -11
- data/docs/AddRoleToGroup200Response.md +18 -0
- data/docs/AdditionalGroup.md +12 -11
- data/docs/CrossAccountRequest.md +30 -0
- data/docs/CrossAccountRequestApi.md +386 -0
- data/docs/CrossAccountRequestByAccount.md +36 -0
- data/docs/CrossAccountRequestByUserId.md +32 -0
- data/docs/CrossAccountRequestDetail.md +49 -0
- data/docs/CrossAccountRequestDetailByAccount.md +38 -0
- data/docs/CrossAccountRequestDetailByUseId.md +34 -0
- data/docs/CrossAccountRequestIn.md +26 -0
- data/docs/CrossAccountRequestOut.md +34 -0
- data/docs/CrossAccountRequestPagination.md +22 -0
- data/docs/CrossAccountRequestPaginationAllOfDataInner.md +49 -0
- data/docs/CrossAccountRequestPatch.md +24 -0
- data/docs/CrossAccountRequestUpdateIn.md +22 -0
- data/docs/CrossAccountRequestWithRoles.md +32 -0
- data/docs/CrossAccountRequestWithRolesRolesInner.md +22 -0
- data/docs/Error.md +8 -7
- data/docs/Error403.md +8 -7
- data/docs/Error403ErrorsInner.md +22 -0
- data/docs/ErrorErrorsInner.md +20 -0
- data/docs/ErrorNotFound.md +18 -0
- data/docs/ErrorNotFoundErrorsInner.md +22 -0
- data/docs/Group.md +10 -9
- data/docs/GroupApi.md +369 -163
- data/docs/GroupOut.md +26 -23
- data/docs/GroupPagination.md +12 -11
- data/docs/GroupPrincipalIn.md +8 -7
- data/docs/GroupRoleIn.md +8 -7
- data/docs/GroupRolesPagination.md +12 -11
- data/docs/GroupWithPrincipals.md +18 -17
- data/docs/GroupWithPrincipalsAndRoles.md +20 -19
- data/docs/ListPagination.md +10 -9
- data/docs/PaginationLinks.md +14 -13
- data/docs/PaginationMeta.md +8 -7
- data/docs/Permission.md +26 -0
- data/docs/PermissionApi.md +185 -0
- data/docs/PermissionOptionsPagination.md +22 -0
- data/docs/PermissionPagination.md +22 -0
- data/docs/Policy.md +10 -9
- data/docs/PolicyApi.md +153 -69
- data/docs/PolicyExtended.md +20 -19
- data/docs/PolicyIn.md +14 -13
- data/docs/PolicyPagination.md +12 -11
- data/docs/Principal.md +20 -15
- data/docs/PrincipalApi.md +49 -23
- data/docs/PrincipalExternalSourceId.md +49 -0
- data/docs/PrincipalIn.md +8 -7
- data/docs/PrincipalMinimal.md +18 -0
- data/docs/PrincipalOut.md +22 -17
- data/docs/PrincipalPagination.md +12 -11
- data/docs/PrincipalPaginationAllOfDataInner.md +49 -0
- data/docs/ResourceDefinition.md +8 -7
- data/docs/ResourceDefinitionFilter.md +12 -11
- data/docs/ResourceDefinitionFilterValue.md +49 -0
- data/docs/ResourceDefinitionFilterValueOneOfInner.md +47 -0
- data/docs/Role.md +12 -9
- data/docs/RoleApi.md +279 -89
- data/docs/RoleIn.md +14 -11
- data/docs/RoleOut.md +34 -25
- data/docs/RoleOutDynamic.md +40 -29
- data/docs/RolePagination.md +12 -11
- data/docs/RolePaginationDynamic.md +12 -11
- data/docs/RolePatch.md +22 -0
- data/docs/RoleWithAccess.md +36 -27
- data/docs/Status.md +10 -17
- data/docs/StatusApi.md +27 -10
- data/docs/Timestamped.md +10 -9
- data/docs/UUID.md +8 -7
- data/git_push.sh +3 -4
- data/insights-rbac-api-client.gemspec +3 -4
- data/lib/insights-rbac-api-client/api/access_api.rb +21 -6
- data/lib/insights-rbac-api-client/api/cross_account_request_api.rb +423 -0
- data/lib/insights-rbac-api-client/api/group_api.rb +120 -55
- data/lib/insights-rbac-api-client/api/permission_api.rb +243 -0
- data/lib/insights-rbac-api-client/api/policy_api.rb +38 -23
- data/lib/insights-rbac-api-client/api/principal_api.rb +44 -12
- data/lib/insights-rbac-api-client/api/role_api.rb +154 -41
- data/lib/insights-rbac-api-client/api/status_api.rb +5 -4
- data/lib/insights-rbac-api-client/api_client.rb +57 -51
- data/lib/insights-rbac-api-client/api_error.rb +2 -1
- data/lib/insights-rbac-api-client/configuration.rb +62 -13
- data/lib/insights-rbac-api-client/models/access.rb +34 -22
- data/lib/insights-rbac-api-client/models/access_pagination.rb +32 -23
- data/lib/insights-rbac-api-client/models/{inline_response200.rb → add_role_to_group200_response.rb} +35 -25
- data/lib/insights-rbac-api-client/models/additional_group.rb +30 -22
- data/lib/insights-rbac-api-client/models/cross_account_request.rb +270 -0
- data/lib/insights-rbac-api-client/models/cross_account_request_by_account.rb +304 -0
- data/lib/insights-rbac-api-client/models/cross_account_request_by_user_id.rb +286 -0
- data/lib/insights-rbac-api-client/models/cross_account_request_detail.rb +105 -0
- data/lib/insights-rbac-api-client/models/cross_account_request_detail_by_account.rb +316 -0
- data/lib/insights-rbac-api-client/models/cross_account_request_detail_by_use_id.rb +296 -0
- data/lib/insights-rbac-api-client/models/cross_account_request_in.rb +280 -0
- data/lib/insights-rbac-api-client/models/cross_account_request_out.rb +295 -0
- data/lib/insights-rbac-api-client/models/cross_account_request_pagination.rb +248 -0
- data/lib/insights-rbac-api-client/models/cross_account_request_pagination_all_of_data_inner.rb +105 -0
- data/lib/insights-rbac-api-client/models/cross_account_request_patch.rb +277 -0
- data/lib/insights-rbac-api-client/models/cross_account_request_update_in.rb +255 -0
- data/lib/insights-rbac-api-client/models/cross_account_request_with_roles.rb +279 -0
- data/lib/insights-rbac-api-client/models/cross_account_request_with_roles_roles_inner.rb +234 -0
- data/lib/insights-rbac-api-client/models/error.rb +33 -23
- data/lib/insights-rbac-api-client/models/error403.rb +33 -23
- data/lib/insights-rbac-api-client/models/{policy_extended_all_of.rb → error403_errors_inner.rb} +55 -50
- data/lib/insights-rbac-api-client/models/{group_with_principals_all_of.rb → error_errors_inner.rb} +49 -39
- data/lib/insights-rbac-api-client/models/{policy_in_all_of.rb → error_not_found.rb} +47 -50
- data/lib/insights-rbac-api-client/models/{principal_pagination_all_of.rb → error_not_found_errors_inner.rb} +61 -39
- data/lib/insights-rbac-api-client/models/group.rb +32 -22
- data/lib/insights-rbac-api-client/models/group_out.rb +65 -30
- data/lib/insights-rbac-api-client/models/group_pagination.rb +32 -23
- data/lib/insights-rbac-api-client/models/group_principal_in.rb +32 -22
- data/lib/insights-rbac-api-client/models/group_role_in.rb +32 -22
- data/lib/insights-rbac-api-client/models/group_roles_pagination.rb +32 -23
- data/lib/insights-rbac-api-client/models/group_with_principals.rb +42 -25
- data/lib/insights-rbac-api-client/models/group_with_principals_and_roles.rb +44 -25
- data/lib/insights-rbac-api-client/models/list_pagination.rb +30 -22
- data/lib/insights-rbac-api-client/models/pagination_links.rb +30 -22
- data/lib/insights-rbac-api-client/models/pagination_meta.rb +30 -22
- data/lib/insights-rbac-api-client/models/permission.rb +250 -0
- data/lib/insights-rbac-api-client/models/{policy_pagination_all_of.rb → permission_options_pagination.rb} +62 -27
- data/lib/insights-rbac-api-client/models/{group_pagination_all_of.rb → permission_pagination.rb} +62 -27
- data/lib/insights-rbac-api-client/models/policy.rb +32 -22
- data/lib/insights-rbac-api-client/models/policy_extended.rb +44 -25
- data/lib/insights-rbac-api-client/models/policy_in.rb +37 -24
- data/lib/insights-rbac-api-client/models/policy_pagination.rb +33 -24
- data/lib/insights-rbac-api-client/models/principal.rb +56 -26
- data/lib/insights-rbac-api-client/models/principal_external_source_id.rb +105 -0
- data/lib/insights-rbac-api-client/models/principal_in.rb +32 -22
- data/lib/insights-rbac-api-client/models/{access_pagination_all_of.rb → principal_minimal.rb} +45 -37
- data/lib/insights-rbac-api-client/models/principal_out.rb +55 -23
- data/lib/insights-rbac-api-client/models/principal_pagination.rb +34 -25
- data/lib/insights-rbac-api-client/models/principal_pagination_all_of_data_inner.rb +105 -0
- data/lib/insights-rbac-api-client/models/resource_definition.rb +32 -22
- data/lib/insights-rbac-api-client/models/resource_definition_filter.rb +37 -23
- data/lib/insights-rbac-api-client/models/resource_definition_filter_value.rb +105 -0
- data/lib/insights-rbac-api-client/models/resource_definition_filter_value_one_of_inner.rb +104 -0
- data/lib/insights-rbac-api-client/models/role.rb +42 -23
- data/lib/insights-rbac-api-client/models/role_in.rb +45 -25
- data/lib/insights-rbac-api-client/models/role_out.rb +92 -30
- data/lib/insights-rbac-api-client/models/role_out_dynamic.rb +109 -30
- data/lib/insights-rbac-api-client/models/role_pagination.rb +32 -23
- data/lib/insights-rbac-api-client/models/role_pagination_dynamic.rb +33 -24
- data/lib/insights-rbac-api-client/models/{group_with_principals_and_roles_all_of.rb → role_patch.rb} +55 -52
- data/lib/insights-rbac-api-client/models/role_with_access.rb +91 -28
- data/lib/insights-rbac-api-client/models/status.rb +36 -62
- data/lib/insights-rbac-api-client/models/timestamped.rb +36 -24
- data/lib/insights-rbac-api-client/models/uuid.rb +32 -22
- data/lib/insights-rbac-api-client/version.rb +2 -2
- data/lib/insights-rbac-api-client.rb +31 -13
- data/openapi.json +1741 -162
- data/spec/api/access_api_spec.rb +4 -2
- data/spec/api/cross_account_request_api_spec.rb +105 -0
- data/spec/api/group_api_spec.rb +26 -16
- data/spec/api/permission_api_spec.rb +75 -0
- data/spec/api/policy_api_spec.rb +7 -7
- data/spec/api/principal_api_spec.rb +10 -5
- data/spec/api/role_api_spec.rb +32 -13
- data/spec/api/status_api_spec.rb +2 -2
- data/spec/api_client_spec.rb +6 -4
- data/spec/configuration_spec.rb +4 -4
- data/spec/models/access_pagination_spec.rb +9 -14
- data/spec/models/access_spec.rb +8 -13
- data/spec/models/add_role_to_group200_response_spec.rb +36 -0
- data/spec/models/additional_group_spec.rb +9 -14
- data/spec/models/cross_account_request_by_account_spec.rb +90 -0
- data/spec/models/cross_account_request_by_user_id_spec.rb +78 -0
- data/spec/models/cross_account_request_detail_by_account_spec.rb +96 -0
- data/spec/models/cross_account_request_detail_by_use_id_spec.rb +84 -0
- data/spec/models/cross_account_request_detail_spec.rb +32 -0
- data/spec/models/cross_account_request_in_spec.rb +60 -0
- data/spec/models/cross_account_request_out_spec.rb +84 -0
- data/spec/models/cross_account_request_pagination_all_of_data_inner_spec.rb +32 -0
- data/spec/models/cross_account_request_pagination_spec.rb +48 -0
- data/spec/models/cross_account_request_patch_spec.rb +58 -0
- data/spec/models/cross_account_request_spec.rb +72 -0
- data/spec/models/cross_account_request_update_in_spec.rb +48 -0
- data/spec/models/cross_account_request_with_roles_roles_inner_spec.rb +48 -0
- data/spec/models/cross_account_request_with_roles_spec.rb +78 -0
- data/spec/models/error403_errors_inner_spec.rb +48 -0
- data/spec/models/error403_spec.rb +7 -12
- data/spec/models/error_errors_inner_spec.rb +42 -0
- data/spec/models/error_not_found_errors_inner_spec.rb +48 -0
- data/spec/models/error_not_found_spec.rb +36 -0
- data/spec/models/error_spec.rb +7 -12
- data/spec/models/group_out_spec.rb +21 -20
- data/spec/models/group_pagination_spec.rb +9 -14
- data/spec/models/group_principal_in_spec.rb +7 -12
- data/spec/models/group_role_in_spec.rb +7 -12
- data/spec/models/group_roles_pagination_spec.rb +9 -14
- data/spec/models/group_spec.rb +8 -13
- data/spec/models/group_with_principals_and_roles_spec.rb +13 -18
- data/spec/models/group_with_principals_spec.rb +12 -17
- data/spec/models/list_pagination_spec.rb +8 -13
- data/spec/models/pagination_links_spec.rb +10 -15
- data/spec/models/pagination_meta_spec.rb +7 -12
- data/spec/models/permission_options_pagination_spec.rb +48 -0
- data/spec/models/permission_pagination_spec.rb +48 -0
- data/spec/models/permission_spec.rb +60 -0
- data/spec/models/policy_extended_spec.rb +13 -18
- data/spec/models/policy_in_spec.rb +10 -15
- data/spec/models/policy_pagination_spec.rb +9 -14
- data/spec/models/policy_spec.rb +8 -13
- data/spec/models/principal_external_source_id_spec.rb +32 -0
- data/spec/models/principal_in_spec.rb +7 -12
- data/spec/models/principal_minimal_spec.rb +36 -0
- data/spec/models/principal_out_spec.rb +24 -17
- data/spec/models/principal_pagination_all_of_data_inner_spec.rb +32 -0
- data/spec/models/principal_pagination_spec.rb +9 -14
- data/spec/models/principal_spec.rb +23 -16
- data/spec/models/resource_definition_filter_spec.rb +10 -15
- data/spec/models/resource_definition_filter_value_one_of_inner_spec.rb +32 -0
- data/spec/models/resource_definition_filter_value_spec.rb +32 -0
- data/spec/models/resource_definition_spec.rb +7 -12
- data/spec/models/role_in_spec.rb +15 -14
- data/spec/models/role_out_dynamic_spec.rb +48 -23
- data/spec/models/role_out_spec.rb +40 -21
- data/spec/models/role_pagination_dynamic_spec.rb +9 -14
- data/spec/models/role_pagination_spec.rb +9 -14
- data/spec/models/role_patch_spec.rb +48 -0
- data/spec/models/role_spec.rb +14 -13
- data/spec/models/role_with_access_spec.rb +41 -22
- data/spec/models/status_spec.rb +8 -37
- data/spec/models/timestamped_spec.rb +8 -13
- data/spec/models/uuid_spec.rb +7 -12
- data/spec/spec_helper.rb +1 -1
- metadata +161 -109
- data/docs/AccessPaginationAllOf.md +0 -17
- data/docs/GroupPaginationAllOf.md +0 -17
- data/docs/GroupWithPrincipalsAllOf.md +0 -17
- data/docs/GroupWithPrincipalsAndRolesAllOf.md +0 -19
- data/docs/InlineResponse200.md +0 -17
- data/docs/PolicyExtendedAllOf.md +0 -19
- data/docs/PolicyInAllOf.md +0 -19
- data/docs/PolicyPaginationAllOf.md +0 -17
- data/docs/PrincipalPaginationAllOf.md +0 -17
- data/docs/RoleInAllOf.md +0 -17
- data/docs/RoleOutDynamicAllOf.md +0 -29
- data/docs/RolePaginationDynamicAllOf.md +0 -17
- data/lib/insights-rbac-api-client/models/role_in_all_of.rb +0 -213
- data/lib/insights-rbac-api-client/models/role_out_dynamic_all_of.rb +0 -346
- data/lib/insights-rbac-api-client/models/role_pagination_dynamic_all_of.rb +0 -213
- data/spec/models/access_pagination_all_of_spec.rb +0 -41
- data/spec/models/group_pagination_all_of_spec.rb +0 -41
- data/spec/models/group_with_principals_all_of_spec.rb +0 -41
- data/spec/models/group_with_principals_and_roles_all_of_spec.rb +0 -47
- data/spec/models/inline_response200_spec.rb +0 -41
- data/spec/models/policy_extended_all_of_spec.rb +0 -47
- data/spec/models/policy_in_all_of_spec.rb +0 -47
- data/spec/models/policy_pagination_all_of_spec.rb +0 -41
- data/spec/models/principal_pagination_all_of_spec.rb +0 -41
- data/spec/models/role_in_all_of_spec.rb +0 -41
- data/spec/models/role_out_dynamic_all_of_spec.rb +0 -77
- data/spec/models/role_pagination_dynamic_all_of_spec.rb +0 -41
@@ -6,7 +6,7 @@
|
|
6
6
|
The version of the OpenAPI document: 1.0.0
|
7
7
|
|
8
8
|
Generated by: https://openapi-generator.tech
|
9
|
-
OpenAPI Generator version:
|
9
|
+
OpenAPI Generator version: 7.1.0-SNAPSHOT
|
10
10
|
|
11
11
|
=end
|
12
12
|
|
@@ -19,26 +19,26 @@ module RBACApiClient
|
|
19
19
|
def initialize(api_client = ApiClient.default)
|
20
20
|
@api_client = api_client
|
21
21
|
end
|
22
|
-
# Create a
|
22
|
+
# Create a role for a tenant
|
23
23
|
# @param role_in [RoleIn] Role to create
|
24
24
|
# @param [Hash] opts the optional parameters
|
25
25
|
# @return [RoleWithAccess]
|
26
|
-
def
|
27
|
-
data, _status_code, _headers =
|
26
|
+
def create_role(role_in, opts = {})
|
27
|
+
data, _status_code, _headers = create_role_with_http_info(role_in, opts)
|
28
28
|
data
|
29
29
|
end
|
30
30
|
|
31
|
-
# Create a
|
31
|
+
# Create a role for a tenant
|
32
32
|
# @param role_in [RoleIn] Role to create
|
33
33
|
# @param [Hash] opts the optional parameters
|
34
34
|
# @return [Array<(RoleWithAccess, Integer, Hash)>] RoleWithAccess data, response status code and response headers
|
35
|
-
def
|
35
|
+
def create_role_with_http_info(role_in, opts = {})
|
36
36
|
if @api_client.config.debugging
|
37
|
-
@api_client.config.logger.debug 'Calling API: RoleApi.
|
37
|
+
@api_client.config.logger.debug 'Calling API: RoleApi.create_role ...'
|
38
38
|
end
|
39
39
|
# verify the required parameter 'role_in' is set
|
40
40
|
if @api_client.config.client_side_validation && role_in.nil?
|
41
|
-
fail ArgumentError, "Missing the required parameter 'role_in' when calling RoleApi.
|
41
|
+
fail ArgumentError, "Missing the required parameter 'role_in' when calling RoleApi.create_role"
|
42
42
|
end
|
43
43
|
# resource path
|
44
44
|
local_var_path = '/roles/'
|
@@ -51,21 +51,25 @@ module RBACApiClient
|
|
51
51
|
# HTTP header 'Accept' (if needed)
|
52
52
|
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
53
53
|
# HTTP header 'Content-Type'
|
54
|
-
|
54
|
+
content_type = @api_client.select_header_content_type(['application/json'])
|
55
|
+
if !content_type.nil?
|
56
|
+
header_params['Content-Type'] = content_type
|
57
|
+
end
|
55
58
|
|
56
59
|
# form parameters
|
57
60
|
form_params = opts[:form_params] || {}
|
58
61
|
|
59
62
|
# http body (model)
|
60
|
-
post_body = opts[:
|
63
|
+
post_body = opts[:debug_body] || @api_client.object_to_http_body(role_in)
|
61
64
|
|
62
65
|
# return_type
|
63
|
-
return_type = opts[:
|
66
|
+
return_type = opts[:debug_return_type] || 'RoleWithAccess'
|
64
67
|
|
65
68
|
# auth_names
|
66
|
-
auth_names = opts[:
|
69
|
+
auth_names = opts[:debug_auth_names] || ['basic_auth']
|
67
70
|
|
68
71
|
new_options = opts.merge(
|
72
|
+
:operation => :"RoleApi.create_role",
|
69
73
|
:header_params => header_params,
|
70
74
|
:query_params => query_params,
|
71
75
|
:form_params => form_params,
|
@@ -76,7 +80,7 @@ module RBACApiClient
|
|
76
80
|
|
77
81
|
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
|
78
82
|
if @api_client.config.debugging
|
79
|
-
@api_client.config.logger.debug "API called: RoleApi#
|
83
|
+
@api_client.config.logger.debug "API called: RoleApi#create_role\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
80
84
|
end
|
81
85
|
return data, status_code, headers
|
82
86
|
end
|
@@ -117,15 +121,16 @@ module RBACApiClient
|
|
117
121
|
form_params = opts[:form_params] || {}
|
118
122
|
|
119
123
|
# http body (model)
|
120
|
-
post_body = opts[:
|
124
|
+
post_body = opts[:debug_body]
|
121
125
|
|
122
126
|
# return_type
|
123
|
-
return_type = opts[:
|
127
|
+
return_type = opts[:debug_return_type]
|
124
128
|
|
125
129
|
# auth_names
|
126
|
-
auth_names = opts[:
|
130
|
+
auth_names = opts[:debug_auth_names] || ['basic_auth']
|
127
131
|
|
128
132
|
new_options = opts.merge(
|
133
|
+
:operation => :"RoleApi.delete_role",
|
129
134
|
:header_params => header_params,
|
130
135
|
:query_params => query_params,
|
131
136
|
:form_params => form_params,
|
@@ -144,6 +149,7 @@ module RBACApiClient
|
|
144
149
|
# Get a role in the tenant
|
145
150
|
# @param uuid [String] ID of role to get
|
146
151
|
# @param [Hash] opts the optional parameters
|
152
|
+
# @option opts [String] :scope Parameter for filtering resource by scope. (default to 'account')
|
147
153
|
# @return [RoleWithAccess]
|
148
154
|
def get_role(uuid, opts = {})
|
149
155
|
data, _status_code, _headers = get_role_with_http_info(uuid, opts)
|
@@ -153,6 +159,7 @@ module RBACApiClient
|
|
153
159
|
# Get a role in the tenant
|
154
160
|
# @param uuid [String] ID of role to get
|
155
161
|
# @param [Hash] opts the optional parameters
|
162
|
+
# @option opts [String] :scope Parameter for filtering resource by scope. (default to 'account')
|
156
163
|
# @return [Array<(RoleWithAccess, Integer, Hash)>] RoleWithAccess data, response status code and response headers
|
157
164
|
def get_role_with_http_info(uuid, opts = {})
|
158
165
|
if @api_client.config.debugging
|
@@ -162,11 +169,16 @@ module RBACApiClient
|
|
162
169
|
if @api_client.config.client_side_validation && uuid.nil?
|
163
170
|
fail ArgumentError, "Missing the required parameter 'uuid' when calling RoleApi.get_role"
|
164
171
|
end
|
172
|
+
allowable_values = ["account", "principal"]
|
173
|
+
if @api_client.config.client_side_validation && opts[:'scope'] && !allowable_values.include?(opts[:'scope'])
|
174
|
+
fail ArgumentError, "invalid value for \"scope\", must be one of #{allowable_values}"
|
175
|
+
end
|
165
176
|
# resource path
|
166
177
|
local_var_path = '/roles/{uuid}/'.sub('{' + 'uuid' + '}', CGI.escape(uuid.to_s))
|
167
178
|
|
168
179
|
# query parameters
|
169
180
|
query_params = opts[:query_params] || {}
|
181
|
+
query_params[:'scope'] = opts[:'scope'] if !opts[:'scope'].nil?
|
170
182
|
|
171
183
|
# header parameters
|
172
184
|
header_params = opts[:header_params] || {}
|
@@ -177,15 +189,16 @@ module RBACApiClient
|
|
177
189
|
form_params = opts[:form_params] || {}
|
178
190
|
|
179
191
|
# http body (model)
|
180
|
-
post_body = opts[:
|
192
|
+
post_body = opts[:debug_body]
|
181
193
|
|
182
194
|
# return_type
|
183
|
-
return_type = opts[:
|
195
|
+
return_type = opts[:debug_return_type] || 'RoleWithAccess'
|
184
196
|
|
185
197
|
# auth_names
|
186
|
-
auth_names = opts[:
|
198
|
+
auth_names = opts[:debug_auth_names] || ['basic_auth']
|
187
199
|
|
188
200
|
new_options = opts.merge(
|
201
|
+
:operation => :"RoleApi.get_role",
|
189
202
|
:header_params => header_params,
|
190
203
|
:query_params => query_params,
|
191
204
|
:form_params => form_params,
|
@@ -215,8 +228,8 @@ module RBACApiClient
|
|
215
228
|
# Get access for a role in the tenant
|
216
229
|
# @param uuid [String] ID of the role
|
217
230
|
# @param [Hash] opts the optional parameters
|
218
|
-
# @option opts [Integer] :limit Parameter for selecting the amount of data returned.
|
219
|
-
# @option opts [Integer] :offset Parameter for selecting the offset of data.
|
231
|
+
# @option opts [Integer] :limit Parameter for selecting the amount of data returned. (default to 10)
|
232
|
+
# @option opts [Integer] :offset Parameter for selecting the offset of data. (default to 0)
|
220
233
|
# @return [Array<(AccessPagination, Integer, Hash)>] AccessPagination data, response status code and response headers
|
221
234
|
def get_role_access_with_http_info(uuid, opts = {})
|
222
235
|
if @api_client.config.debugging
|
@@ -255,15 +268,16 @@ module RBACApiClient
|
|
255
268
|
form_params = opts[:form_params] || {}
|
256
269
|
|
257
270
|
# http body (model)
|
258
|
-
post_body = opts[:
|
271
|
+
post_body = opts[:debug_body]
|
259
272
|
|
260
273
|
# return_type
|
261
|
-
return_type = opts[:
|
274
|
+
return_type = opts[:debug_return_type] || 'AccessPagination'
|
262
275
|
|
263
276
|
# auth_names
|
264
|
-
auth_names = opts[:
|
277
|
+
auth_names = opts[:debug_auth_names] || ['basic_auth']
|
265
278
|
|
266
279
|
new_options = opts.merge(
|
280
|
+
:operation => :"RoleApi.get_role_access",
|
267
281
|
:header_params => header_params,
|
268
282
|
:query_params => query_params,
|
269
283
|
:form_params => form_params,
|
@@ -285,10 +299,16 @@ module RBACApiClient
|
|
285
299
|
# @option opts [Integer] :limit Parameter for selecting the amount of data returned. (default to 10)
|
286
300
|
# @option opts [Integer] :offset Parameter for selecting the offset of data. (default to 0)
|
287
301
|
# @option opts [String] :name Parameter for filtering resource by name using string contains search.
|
302
|
+
# @option opts [Boolean] :system Parameter for filtering resource by system flag.
|
303
|
+
# @option opts [String] :display_name Parameter for filtering resource by display_name using string contains search.
|
304
|
+
# @option opts [String] :name_match Parameter for specifying the matching criteria for an object's name or display_name.
|
288
305
|
# @option opts [String] :scope Parameter for filtering resource by scope. (default to 'account')
|
289
|
-
# @option opts [String] :order_by Parameter for ordering
|
306
|
+
# @option opts [String] :order_by Parameter for ordering roles by value. For inverse ordering, supply '-' before the param value, such as: ?order_by=-name
|
290
307
|
# @option opts [Array<String>] :add_fields Parameter for add list of fields to display for roles.
|
291
308
|
# @option opts [String] :username Unique username of the principal to obtain roles for (only available for admins, and if supplied, takes precedence over the identity header).
|
309
|
+
# @option opts [String] :application The application name(s) to filter roles by, from permissions or external tenant name. This is an exact match. You may also use a comma-separated list to match on multiple applications.
|
310
|
+
# @option opts [String] :permission The permission(s) to filter roles by. This is an exact match. You may also use a comma-separated list to match on multiple permissions.
|
311
|
+
# @option opts [String] :external_tenant Parameter for filtering roles by external tenant name using string search.
|
292
312
|
# @return [RolePaginationDynamic]
|
293
313
|
def list_roles(opts = {})
|
294
314
|
data, _status_code, _headers = list_roles_with_http_info(opts)
|
@@ -298,13 +318,19 @@ module RBACApiClient
|
|
298
318
|
# List the roles for a tenant
|
299
319
|
# By default, responses are sorted in ascending order by role name
|
300
320
|
# @param [Hash] opts the optional parameters
|
301
|
-
# @option opts [Integer] :limit Parameter for selecting the amount of data returned.
|
302
|
-
# @option opts [Integer] :offset Parameter for selecting the offset of data.
|
321
|
+
# @option opts [Integer] :limit Parameter for selecting the amount of data returned. (default to 10)
|
322
|
+
# @option opts [Integer] :offset Parameter for selecting the offset of data. (default to 0)
|
303
323
|
# @option opts [String] :name Parameter for filtering resource by name using string contains search.
|
304
|
-
# @option opts [
|
305
|
-
# @option opts [String] :
|
324
|
+
# @option opts [Boolean] :system Parameter for filtering resource by system flag.
|
325
|
+
# @option opts [String] :display_name Parameter for filtering resource by display_name using string contains search.
|
326
|
+
# @option opts [String] :name_match Parameter for specifying the matching criteria for an object's name or display_name.
|
327
|
+
# @option opts [String] :scope Parameter for filtering resource by scope. (default to 'account')
|
328
|
+
# @option opts [String] :order_by Parameter for ordering roles by value. For inverse ordering, supply '-' before the param value, such as: ?order_by=-name
|
306
329
|
# @option opts [Array<String>] :add_fields Parameter for add list of fields to display for roles.
|
307
330
|
# @option opts [String] :username Unique username of the principal to obtain roles for (only available for admins, and if supplied, takes precedence over the identity header).
|
331
|
+
# @option opts [String] :application The application name(s) to filter roles by, from permissions or external tenant name. This is an exact match. You may also use a comma-separated list to match on multiple applications.
|
332
|
+
# @option opts [String] :permission The permission(s) to filter roles by. This is an exact match. You may also use a comma-separated list to match on multiple permissions.
|
333
|
+
# @option opts [String] :external_tenant Parameter for filtering roles by external tenant name using string search.
|
308
334
|
# @return [Array<(RolePaginationDynamic, Integer, Hash)>] RolePaginationDynamic data, response status code and response headers
|
309
335
|
def list_roles_with_http_info(opts = {})
|
310
336
|
if @api_client.config.debugging
|
@@ -322,11 +348,19 @@ module RBACApiClient
|
|
322
348
|
fail ArgumentError, 'invalid value for "opts[:"offset"]" when calling RoleApi.list_roles, must be greater than or equal to 0.'
|
323
349
|
end
|
324
350
|
|
351
|
+
allowable_values = ["partial", "exact"]
|
352
|
+
if @api_client.config.client_side_validation && opts[:'name_match'] && !allowable_values.include?(opts[:'name_match'])
|
353
|
+
fail ArgumentError, "invalid value for \"name_match\", must be one of #{allowable_values}"
|
354
|
+
end
|
325
355
|
allowable_values = ["account", "principal"]
|
326
356
|
if @api_client.config.client_side_validation && opts[:'scope'] && !allowable_values.include?(opts[:'scope'])
|
327
357
|
fail ArgumentError, "invalid value for \"scope\", must be one of #{allowable_values}"
|
328
358
|
end
|
329
|
-
allowable_values = ["
|
359
|
+
allowable_values = ["name", "display_name", "modified", "policyCount"]
|
360
|
+
if @api_client.config.client_side_validation && opts[:'order_by'] && !allowable_values.include?(opts[:'order_by'])
|
361
|
+
fail ArgumentError, "invalid value for \"order_by\", must be one of #{allowable_values}"
|
362
|
+
end
|
363
|
+
allowable_values = ["groups_in", "groups_in_count", "access"]
|
330
364
|
if @api_client.config.client_side_validation && opts[:'add_fields'] && !opts[:'add_fields'].all? { |item| allowable_values.include?(item) }
|
331
365
|
fail ArgumentError, "invalid value for \"add_fields\", must include one of #{allowable_values}"
|
332
366
|
end
|
@@ -338,10 +372,16 @@ module RBACApiClient
|
|
338
372
|
query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
|
339
373
|
query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil?
|
340
374
|
query_params[:'name'] = opts[:'name'] if !opts[:'name'].nil?
|
375
|
+
query_params[:'system'] = opts[:'system'] if !opts[:'system'].nil?
|
376
|
+
query_params[:'display_name'] = opts[:'display_name'] if !opts[:'display_name'].nil?
|
377
|
+
query_params[:'name_match'] = opts[:'name_match'] if !opts[:'name_match'].nil?
|
341
378
|
query_params[:'scope'] = opts[:'scope'] if !opts[:'scope'].nil?
|
342
379
|
query_params[:'order_by'] = opts[:'order_by'] if !opts[:'order_by'].nil?
|
343
380
|
query_params[:'add_fields'] = @api_client.build_collection_param(opts[:'add_fields'], :csv) if !opts[:'add_fields'].nil?
|
344
381
|
query_params[:'username'] = opts[:'username'] if !opts[:'username'].nil?
|
382
|
+
query_params[:'application'] = opts[:'application'] if !opts[:'application'].nil?
|
383
|
+
query_params[:'permission'] = opts[:'permission'] if !opts[:'permission'].nil?
|
384
|
+
query_params[:'external_tenant'] = opts[:'external_tenant'] if !opts[:'external_tenant'].nil?
|
345
385
|
|
346
386
|
# header parameters
|
347
387
|
header_params = opts[:header_params] || {}
|
@@ -352,15 +392,16 @@ module RBACApiClient
|
|
352
392
|
form_params = opts[:form_params] || {}
|
353
393
|
|
354
394
|
# http body (model)
|
355
|
-
post_body = opts[:
|
395
|
+
post_body = opts[:debug_body]
|
356
396
|
|
357
397
|
# return_type
|
358
|
-
return_type = opts[:
|
398
|
+
return_type = opts[:debug_return_type] || 'RolePaginationDynamic'
|
359
399
|
|
360
400
|
# auth_names
|
361
|
-
auth_names = opts[:
|
401
|
+
auth_names = opts[:debug_auth_names] || ['basic_auth']
|
362
402
|
|
363
403
|
new_options = opts.merge(
|
404
|
+
:operation => :"RoleApi.list_roles",
|
364
405
|
:header_params => header_params,
|
365
406
|
:query_params => query_params,
|
366
407
|
:form_params => form_params,
|
@@ -376,9 +417,77 @@ module RBACApiClient
|
|
376
417
|
return data, status_code, headers
|
377
418
|
end
|
378
419
|
|
379
|
-
#
|
420
|
+
# Patch a role in the tenant
|
421
|
+
# @param uuid [String] ID of role to update
|
422
|
+
# @param [Hash] opts the optional parameters
|
423
|
+
# @option opts [RolePatch] :role_patch Patch to a role
|
424
|
+
# @return [RoleWithAccess]
|
425
|
+
def patch_role(uuid, opts = {})
|
426
|
+
data, _status_code, _headers = patch_role_with_http_info(uuid, opts)
|
427
|
+
data
|
428
|
+
end
|
429
|
+
|
430
|
+
# Patch a role in the tenant
|
431
|
+
# @param uuid [String] ID of role to update
|
432
|
+
# @param [Hash] opts the optional parameters
|
433
|
+
# @option opts [RolePatch] :role_patch Patch to a role
|
434
|
+
# @return [Array<(RoleWithAccess, Integer, Hash)>] RoleWithAccess data, response status code and response headers
|
435
|
+
def patch_role_with_http_info(uuid, opts = {})
|
436
|
+
if @api_client.config.debugging
|
437
|
+
@api_client.config.logger.debug 'Calling API: RoleApi.patch_role ...'
|
438
|
+
end
|
439
|
+
# verify the required parameter 'uuid' is set
|
440
|
+
if @api_client.config.client_side_validation && uuid.nil?
|
441
|
+
fail ArgumentError, "Missing the required parameter 'uuid' when calling RoleApi.patch_role"
|
442
|
+
end
|
443
|
+
# resource path
|
444
|
+
local_var_path = '/roles/{uuid}/'.sub('{' + 'uuid' + '}', CGI.escape(uuid.to_s))
|
445
|
+
|
446
|
+
# query parameters
|
447
|
+
query_params = opts[:query_params] || {}
|
448
|
+
|
449
|
+
# header parameters
|
450
|
+
header_params = opts[:header_params] || {}
|
451
|
+
# HTTP header 'Accept' (if needed)
|
452
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
453
|
+
# HTTP header 'Content-Type'
|
454
|
+
content_type = @api_client.select_header_content_type(['application/json'])
|
455
|
+
if !content_type.nil?
|
456
|
+
header_params['Content-Type'] = content_type
|
457
|
+
end
|
458
|
+
|
459
|
+
# form parameters
|
460
|
+
form_params = opts[:form_params] || {}
|
461
|
+
|
462
|
+
# http body (model)
|
463
|
+
post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'role_patch'])
|
464
|
+
|
465
|
+
# return_type
|
466
|
+
return_type = opts[:debug_return_type] || 'RoleWithAccess'
|
467
|
+
|
468
|
+
# auth_names
|
469
|
+
auth_names = opts[:debug_auth_names] || ['basic_auth']
|
470
|
+
|
471
|
+
new_options = opts.merge(
|
472
|
+
:operation => :"RoleApi.patch_role",
|
473
|
+
:header_params => header_params,
|
474
|
+
:query_params => query_params,
|
475
|
+
:form_params => form_params,
|
476
|
+
:body => post_body,
|
477
|
+
:auth_names => auth_names,
|
478
|
+
:return_type => return_type
|
479
|
+
)
|
480
|
+
|
481
|
+
data, status_code, headers = @api_client.call_api(:PATCH, local_var_path, new_options)
|
482
|
+
if @api_client.config.debugging
|
483
|
+
@api_client.config.logger.debug "API called: RoleApi#patch_role\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
484
|
+
end
|
485
|
+
return data, status_code, headers
|
486
|
+
end
|
487
|
+
|
488
|
+
# Update a role in the tenant
|
380
489
|
# @param uuid [String] ID of role to update
|
381
|
-
# @param role_with_access [RoleWithAccess] Update to a
|
490
|
+
# @param role_with_access [RoleWithAccess] Update to a role
|
382
491
|
# @param [Hash] opts the optional parameters
|
383
492
|
# @return [nil]
|
384
493
|
def update_role(uuid, role_with_access, opts = {})
|
@@ -386,9 +495,9 @@ module RBACApiClient
|
|
386
495
|
nil
|
387
496
|
end
|
388
497
|
|
389
|
-
# Update a
|
498
|
+
# Update a role in the tenant
|
390
499
|
# @param uuid [String] ID of role to update
|
391
|
-
# @param role_with_access [RoleWithAccess] Update to a
|
500
|
+
# @param role_with_access [RoleWithAccess] Update to a role
|
392
501
|
# @param [Hash] opts the optional parameters
|
393
502
|
# @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
|
394
503
|
def update_role_with_http_info(uuid, role_with_access, opts = {})
|
@@ -414,21 +523,25 @@ module RBACApiClient
|
|
414
523
|
# HTTP header 'Accept' (if needed)
|
415
524
|
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
416
525
|
# HTTP header 'Content-Type'
|
417
|
-
|
526
|
+
content_type = @api_client.select_header_content_type(['application/json'])
|
527
|
+
if !content_type.nil?
|
528
|
+
header_params['Content-Type'] = content_type
|
529
|
+
end
|
418
530
|
|
419
531
|
# form parameters
|
420
532
|
form_params = opts[:form_params] || {}
|
421
533
|
|
422
534
|
# http body (model)
|
423
|
-
post_body = opts[:
|
535
|
+
post_body = opts[:debug_body] || @api_client.object_to_http_body(role_with_access)
|
424
536
|
|
425
537
|
# return_type
|
426
|
-
return_type = opts[:
|
538
|
+
return_type = opts[:debug_return_type]
|
427
539
|
|
428
540
|
# auth_names
|
429
|
-
auth_names = opts[:
|
541
|
+
auth_names = opts[:debug_auth_names] || ['basic_auth']
|
430
542
|
|
431
543
|
new_options = opts.merge(
|
544
|
+
:operation => :"RoleApi.update_role",
|
432
545
|
:header_params => header_params,
|
433
546
|
:query_params => query_params,
|
434
547
|
:form_params => form_params,
|
@@ -6,7 +6,7 @@
|
|
6
6
|
The version of the OpenAPI document: 1.0.0
|
7
7
|
|
8
8
|
Generated by: https://openapi-generator.tech
|
9
|
-
OpenAPI Generator version:
|
9
|
+
OpenAPI Generator version: 7.1.0-SNAPSHOT
|
10
10
|
|
11
11
|
=end
|
12
12
|
|
@@ -49,15 +49,16 @@ module RBACApiClient
|
|
49
49
|
form_params = opts[:form_params] || {}
|
50
50
|
|
51
51
|
# http body (model)
|
52
|
-
post_body = opts[:
|
52
|
+
post_body = opts[:debug_body]
|
53
53
|
|
54
54
|
# return_type
|
55
|
-
return_type = opts[:
|
55
|
+
return_type = opts[:debug_return_type] || 'Status'
|
56
56
|
|
57
57
|
# auth_names
|
58
|
-
auth_names = opts[:
|
58
|
+
auth_names = opts[:debug_auth_names] || ['basic_auth']
|
59
59
|
|
60
60
|
new_options = opts.merge(
|
61
|
+
:operation => :"StatusApi.get_status",
|
61
62
|
:header_params => header_params,
|
62
63
|
:query_params => query_params,
|
63
64
|
:form_params => form_params,
|
@@ -6,7 +6,7 @@
|
|
6
6
|
The version of the OpenAPI document: 1.0.0
|
7
7
|
|
8
8
|
Generated by: https://openapi-generator.tech
|
9
|
-
OpenAPI Generator version:
|
9
|
+
OpenAPI Generator version: 7.1.0-SNAPSHOT
|
10
10
|
|
11
11
|
=end
|
12
12
|
|
@@ -14,6 +14,7 @@ require 'date'
|
|
14
14
|
require 'json'
|
15
15
|
require 'logger'
|
16
16
|
require 'tempfile'
|
17
|
+
require 'time'
|
17
18
|
require 'typhoeus'
|
18
19
|
|
19
20
|
module RBACApiClient
|
@@ -86,12 +87,13 @@ module RBACApiClient
|
|
86
87
|
# @option opts [Object] :body HTTP body (JSON/XML)
|
87
88
|
# @return [Typhoeus::Request] A Typhoeus Request
|
88
89
|
def build_request(http_method, path, opts = {})
|
89
|
-
url = build_request_url(path)
|
90
|
+
url = build_request_url(path, opts)
|
90
91
|
http_method = http_method.to_sym.downcase
|
91
92
|
|
92
93
|
header_params = @default_headers.merge(opts[:header_params] || {})
|
93
94
|
query_params = opts[:query_params] || {}
|
94
95
|
form_params = opts[:form_params] || {}
|
96
|
+
follow_location = opts[:follow_location] || true
|
95
97
|
|
96
98
|
update_params_for_auth! header_params, query_params, opts[:auth_names]
|
97
99
|
|
@@ -108,7 +110,8 @@ module RBACApiClient
|
|
108
110
|
:ssl_verifyhost => _verify_ssl_host,
|
109
111
|
:sslcert => @config.cert_file,
|
110
112
|
:sslkey => @config.key_file,
|
111
|
-
:verbose => @config.debugging
|
113
|
+
:verbose => @config.debugging,
|
114
|
+
:followlocation => follow_location
|
112
115
|
}
|
113
116
|
|
114
117
|
# set custom cert, if provided
|
@@ -155,6 +158,44 @@ module RBACApiClient
|
|
155
158
|
data
|
156
159
|
end
|
157
160
|
|
161
|
+
# Save response body into a file in (the defined) temporary folder, using the filename
|
162
|
+
# from the "Content-Disposition" header if provided, otherwise a random filename.
|
163
|
+
# The response body is written to the file in chunks in order to handle files which
|
164
|
+
# size is larger than maximum Ruby String or even larger than the maximum memory a Ruby
|
165
|
+
# process can use.
|
166
|
+
#
|
167
|
+
# @see Configuration#temp_folder_path
|
168
|
+
def download_file(request)
|
169
|
+
tempfile = nil
|
170
|
+
encoding = nil
|
171
|
+
request.on_headers do |response|
|
172
|
+
content_disposition = response.headers['Content-Disposition']
|
173
|
+
if content_disposition && content_disposition =~ /filename=/i
|
174
|
+
filename = content_disposition[/filename=['"]?([^'"\s]+)['"]?/, 1]
|
175
|
+
prefix = sanitize_filename(filename)
|
176
|
+
else
|
177
|
+
prefix = 'download-'
|
178
|
+
end
|
179
|
+
prefix = prefix + '-' unless prefix.end_with?('-')
|
180
|
+
encoding = response.body.encoding
|
181
|
+
tempfile = Tempfile.open(prefix, @config.temp_folder_path, encoding: encoding)
|
182
|
+
@tempfile = tempfile
|
183
|
+
end
|
184
|
+
request.on_body do |chunk|
|
185
|
+
chunk.force_encoding(encoding)
|
186
|
+
tempfile.write(chunk)
|
187
|
+
end
|
188
|
+
request.on_complete do |response|
|
189
|
+
if tempfile
|
190
|
+
tempfile.close
|
191
|
+
@config.logger.info "Temp file written to #{tempfile.path}, please copy the file to a proper folder "\
|
192
|
+
"with e.g. `FileUtils.cp(tempfile.path, '/new/file/path')` otherwise the temp file "\
|
193
|
+
"will be deleted automatically with GC. It's also recommended to delete the temp file "\
|
194
|
+
"explicitly with `tempfile.delete`"
|
195
|
+
end
|
196
|
+
end
|
197
|
+
end
|
198
|
+
|
158
199
|
# Check if the given MIME is a JSON MIME.
|
159
200
|
# JSON MIME examples:
|
160
201
|
# application/json
|
@@ -184,14 +225,14 @@ module RBACApiClient
|
|
184
225
|
return body if return_type == 'String'
|
185
226
|
|
186
227
|
# ensuring a default content type
|
187
|
-
content_type = response.headers
|
228
|
+
content_type = response.headers['Content-Type'] || 'application/json'
|
188
229
|
|
189
230
|
fail "Content-Type is not supported: #{content_type}" unless json_mime?(content_type)
|
190
231
|
|
191
232
|
begin
|
192
233
|
data = JSON.parse("[#{body}]", :symbolize_names => true)[0]
|
193
234
|
rescue JSON::ParserError => e
|
194
|
-
if %w(String Date
|
235
|
+
if %w(String Date Time).include?(return_type)
|
195
236
|
data = body
|
196
237
|
else
|
197
238
|
raise e
|
@@ -216,9 +257,9 @@ module RBACApiClient
|
|
216
257
|
data.to_f
|
217
258
|
when 'Boolean'
|
218
259
|
data == true
|
219
|
-
when '
|
260
|
+
when 'Time'
|
220
261
|
# parse date time (expecting ISO 8601 format)
|
221
|
-
|
262
|
+
Time.parse data
|
222
263
|
when 'Date'
|
223
264
|
# parse date time (expecting ISO 8601 format)
|
224
265
|
Date.parse data
|
@@ -236,44 +277,9 @@ module RBACApiClient
|
|
236
277
|
data.each { |k, v| hash[k] = convert_to_type(v, sub_type) }
|
237
278
|
end
|
238
279
|
else
|
239
|
-
# models
|
240
|
-
RBACApiClient.const_get(return_type)
|
241
|
-
|
242
|
-
end
|
243
|
-
|
244
|
-
# Save response body into a file in (the defined) temporary folder, using the filename
|
245
|
-
# from the "Content-Disposition" header if provided, otherwise a random filename.
|
246
|
-
# The response body is written to the file in chunks in order to handle files which
|
247
|
-
# size is larger than maximum Ruby String or even larger than the maximum memory a Ruby
|
248
|
-
# process can use.
|
249
|
-
#
|
250
|
-
# @see Configuration#temp_folder_path
|
251
|
-
def download_file(request)
|
252
|
-
tempfile = nil
|
253
|
-
encoding = nil
|
254
|
-
request.on_headers do |response|
|
255
|
-
content_disposition = response.headers['Content-Disposition']
|
256
|
-
if content_disposition && content_disposition =~ /filename=/i
|
257
|
-
filename = content_disposition[/filename=['"]?([^'"\s]+)['"]?/, 1]
|
258
|
-
prefix = sanitize_filename(filename)
|
259
|
-
else
|
260
|
-
prefix = 'download-'
|
261
|
-
end
|
262
|
-
prefix = prefix + '-' unless prefix.end_with?('-')
|
263
|
-
encoding = response.body.encoding
|
264
|
-
tempfile = Tempfile.open(prefix, @config.temp_folder_path, encoding: encoding)
|
265
|
-
@tempfile = tempfile
|
266
|
-
end
|
267
|
-
request.on_body do |chunk|
|
268
|
-
chunk.force_encoding(encoding)
|
269
|
-
tempfile.write(chunk)
|
270
|
-
end
|
271
|
-
request.on_complete do |response|
|
272
|
-
tempfile.close if tempfile
|
273
|
-
@config.logger.info "Temp file written to #{tempfile.path}, please copy the file to a proper folder "\
|
274
|
-
"with e.g. `FileUtils.cp(tempfile.path, '/new/file/path')` otherwise the temp file "\
|
275
|
-
"will be deleted automatically with GC. It's also recommended to delete the temp file "\
|
276
|
-
"explicitly with `tempfile.delete`"
|
280
|
+
# models (e.g. Pet) or oneOf
|
281
|
+
klass = RBACApiClient.const_get(return_type)
|
282
|
+
klass.respond_to?(:openapi_one_of) ? klass.build(data) : klass.build_from_hash(data)
|
277
283
|
end
|
278
284
|
end
|
279
285
|
|
@@ -286,13 +292,13 @@ module RBACApiClient
|
|
286
292
|
filename.gsub(/.*[\/\\]/, '')
|
287
293
|
end
|
288
294
|
|
289
|
-
def build_request_url(path)
|
295
|
+
def build_request_url(path, opts = {})
|
290
296
|
# Add leading and trailing slashes to path
|
291
297
|
path = "/#{path}".gsub(/\/+/, '/')
|
292
|
-
@config.base_url + path
|
298
|
+
@config.base_url(opts[:operation]) + path
|
293
299
|
end
|
294
300
|
|
295
|
-
# Update
|
301
|
+
# Update header and query params based on authentication settings.
|
296
302
|
#
|
297
303
|
# @param [Hash] header_params Header parameters
|
298
304
|
# @param [Hash] query_params Query parameters
|
@@ -304,7 +310,7 @@ module RBACApiClient
|
|
304
310
|
case auth_setting[:in]
|
305
311
|
when 'header' then header_params[auth_setting[:key]] = auth_setting[:value]
|
306
312
|
when 'query' then query_params[auth_setting[:key]] = auth_setting[:value]
|
307
|
-
else fail ArgumentError, 'Authentication token must be in `query`
|
313
|
+
else fail ArgumentError, 'Authentication token must be in `query` or `header`'
|
308
314
|
end
|
309
315
|
end
|
310
316
|
end
|
@@ -331,8 +337,8 @@ module RBACApiClient
|
|
331
337
|
# @param [Array] content_types array for Content-Type
|
332
338
|
# @return [String] the Content-Type header (e.g. application/json)
|
333
339
|
def select_header_content_type(content_types)
|
334
|
-
#
|
335
|
-
return
|
340
|
+
# return nil by default
|
341
|
+
return if content_types.nil? || content_types.empty?
|
336
342
|
# use JSON when present, otherwise use the first one
|
337
343
|
json_content_type = content_types.find { |s| json_mime?(s) }
|
338
344
|
json_content_type || content_types.first
|
@@ -6,7 +6,7 @@
|
|
6
6
|
The version of the OpenAPI document: 1.0.0
|
7
7
|
|
8
8
|
Generated by: https://openapi-generator.tech
|
9
|
-
OpenAPI Generator version:
|
9
|
+
OpenAPI Generator version: 7.1.0-SNAPSHOT
|
10
10
|
|
11
11
|
=end
|
12
12
|
|
@@ -32,6 +32,7 @@ module RBACApiClient
|
|
32
32
|
end
|
33
33
|
else
|
34
34
|
super arg
|
35
|
+
@message = arg
|
35
36
|
end
|
36
37
|
end
|
37
38
|
|