Class: RBACApiClient::PermissionApi

Inherits:
Object
  • Object
show all
Defined in:
lib/insights-rbac-api-client/api/permission_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ PermissionApi

Returns a new instance of PermissionApi.



19
20
21
# File 'lib/insights-rbac-api-client/api/permission_api.rb', line 19

def initialize(api_client = ApiClient.default)
  @api_client = api_client
end

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



17
18
19
# File 'lib/insights-rbac-api-client/api/permission_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#list_permission_options(field, opts = {}) ⇒ PermissionOptionsPagination

List the available options for fields of permissions for a tenant By default, options of application is returned. And could be resource_type or verb on demand.

Parameters:

  • field (String)

    specify which fields of permission to display

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :limit (Integer)

    Parameter for selecting the amount of data returned. (default to 10)

  • :offset (Integer)

    Parameter for selecting the offset of data. (default to 0)

  • :application (String)

    Filter returned options based on application. You may also use a comma-separated list to filter on multiple applications.

  • :resource_type (String)

    Filter returned options based on resource_type. You may also use a comma-separated list to filter on multiple resource_types.

  • :verb (String)

    Filter returned options based on verb. You may also use a comma-separated list to filter on multiple verbs.

  • :exclude_globals (String)

    If set to 'true', this will exclude any permission option with a global allowance on the supplied '?field=' value of 'application', 'resource_type' or 'verb'. The default is 'false'. (default to ‘false’)

  • :allowed_only (String)

    If set to 'true', this will exclude any permission with a role where the 'application' is not in the role create allow list. (default to ‘false’)

Returns:



34
35
36
37
# File 'lib/insights-rbac-api-client/api/permission_api.rb', line 34

def list_permission_options(field, opts = {})
  data, _status_code, _headers = list_permission_options_with_http_info(field, opts)
  data
end

#list_permission_options_with_http_info(field, opts = {}) ⇒ Array<(PermissionOptionsPagination, Integer, Hash)>

List the available options for fields of permissions for a tenant By default, options of application is returned. And could be resource_type or verb on demand.

Parameters:

  • field (String)

    specify which fields of permission to display

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :limit (Integer)

    Parameter for selecting the amount of data returned. (default to 10)

  • :offset (Integer)

    Parameter for selecting the offset of data. (default to 0)

  • :application (String)

    Filter returned options based on application. You may also use a comma-separated list to filter on multiple applications.

  • :resource_type (String)

    Filter returned options based on resource_type. You may also use a comma-separated list to filter on multiple resource_types.

  • :verb (String)

    Filter returned options based on verb. You may also use a comma-separated list to filter on multiple verbs.

  • :exclude_globals (String)

    If set to &#39;true&#39;, this will exclude any permission option with a global allowance on the supplied &#39;?field&#x3D;&#39; value of &#39;application&#39;, &#39;resource_type&#39; or &#39;verb&#39;. The default is &#39;false&#39;. (default to ‘false’)

  • :allowed_only (String)

    If set to &#39;true&#39;, this will exclude any permission with a role where the &#39;application&#39; is not in the role create allow list. (default to ‘false’)

Returns:

  • (Array<(PermissionOptionsPagination, Integer, Hash)>)

    PermissionOptionsPagination data, response status code and response headers



51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
# File 'lib/insights-rbac-api-client/api/permission_api.rb', line 51

def list_permission_options_with_http_info(field, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: PermissionApi.list_permission_options ...'
  end
  # verify the required parameter 'field' is set
  if @api_client.config.client_side_validation && field.nil?
    fail ArgumentError, "Missing the required parameter 'field' when calling PermissionApi.list_permission_options"
  end
  # verify enum value
  allowable_values = ["application", "resource_type", "verb"]
  if @api_client.config.client_side_validation && !allowable_values.include?(field)
    fail ArgumentError, "invalid value for \"field\", must be one of #{allowable_values}"
  end
  if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 1000
    fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling PermissionApi.list_permission_options, must be smaller than or equal to 1000.'
  end

  if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1
    fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling PermissionApi.list_permission_options, must be greater than or equal to 1.'
  end

  if @api_client.config.client_side_validation && !opts[:'offset'].nil? && opts[:'offset'] < 0
    fail ArgumentError, 'invalid value for "opts[:"offset"]" when calling PermissionApi.list_permission_options, must be greater than or equal to 0.'
  end

  allowable_values = ["true", "false"]
  if @api_client.config.client_side_validation && opts[:'exclude_globals'] && !allowable_values.include?(opts[:'exclude_globals'])
    fail ArgumentError, "invalid value for \"exclude_globals\", must be one of #{allowable_values}"
  end
  allowable_values = ["true", "false"]
  if @api_client.config.client_side_validation && opts[:'allowed_only'] && !allowable_values.include?(opts[:'allowed_only'])
    fail ArgumentError, "invalid value for \"allowed_only\", must be one of #{allowable_values}"
  end
  # resource path
  local_var_path = '/permissions/options/'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'field'] = field
  query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
  query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil?
  query_params[:'application'] = opts[:'application'] if !opts[:'application'].nil?
  query_params[:'resource_type'] = opts[:'resource_type'] if !opts[:'resource_type'].nil?
  query_params[:'verb'] = opts[:'verb'] if !opts[:'verb'].nil?
  query_params[:'exclude_globals'] = opts[:'exclude_globals'] if !opts[:'exclude_globals'].nil?
  query_params[:'allowed_only'] = opts[:'allowed_only'] if !opts[:'allowed_only'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'PermissionOptionsPagination'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['basic_auth']

  new_options = opts.merge(
    :operation => :"PermissionApi.list_permission_options",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: PermissionApi#list_permission_options\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#list_permissions(opts = {}) ⇒ PermissionPagination

List the permissions for a tenant By default, responses are sorted in ascending order by permission application.

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :limit (Integer)

    Parameter for selecting the amount of data returned. (default to 10)

  • :offset (Integer)

    Parameter for selecting the offset of data. (default to 0)

  • :order_by (String)

    Parameter for ordering permissions by value. For inverse ordering, supply &#39;-&#39; before the param value, such as: ?order_by&#x3D;-application

  • :application (String)

    Exact match for the application name of a permission. You may also use a comma-separated list to match on multiple applications.

  • :resource_type (String)

    Exact match for the resource type name of a permission. You may also use a comma-separated list to match on multiple resource_types.

  • :verb (String)

    Exact match for the operation verb name of a permission You may also use a comma-separated list to match on multiple verbs.

  • :permission (String)

    Partial match for the aggregate permission value name of a permission object.

  • :exclude_globals (String)

    If set to &#39;true&#39;, this will exclude any permission with a global allowance on either &#39;application&#39;, &#39;resource_type&#39; or &#39;verb&#39;. The default is &#39;false&#39;. (default to ‘false’)

  • :exclude_roles (String)

    An optional string filter which accepts one or more role UUIDs, comma-separated, to return permissions not associated with the supplied role(s).

  • :allowed_only (String)

    If set to &#39;true&#39;, this will exclude any permission with a role where the &#39;application&#39; is not in the role create allow list. (default to ‘false’)

Returns:



146
147
148
149
# File 'lib/insights-rbac-api-client/api/permission_api.rb', line 146

def list_permissions(opts = {})
  data, _status_code, _headers = list_permissions_with_http_info(opts)
  data
end

#list_permissions_with_http_info(opts = {}) ⇒ Array<(PermissionPagination, Integer, Hash)>

List the permissions for a tenant By default, responses are sorted in ascending order by permission application.

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :limit (Integer)

    Parameter for selecting the amount of data returned. (default to 10)

  • :offset (Integer)

    Parameter for selecting the offset of data. (default to 0)

  • :order_by (String)

    Parameter for ordering permissions by value. For inverse ordering, supply &#39;-&#39; before the param value, such as: ?order_by&#x3D;-application

  • :application (String)

    Exact match for the application name of a permission. You may also use a comma-separated list to match on multiple applications.

  • :resource_type (String)

    Exact match for the resource type name of a permission. You may also use a comma-separated list to match on multiple resource_types.

  • :verb (String)

    Exact match for the operation verb name of a permission You may also use a comma-separated list to match on multiple verbs.

  • :permission (String)

    Partial match for the aggregate permission value name of a permission object.

  • :exclude_globals (String)

    If set to &#39;true&#39;, this will exclude any permission with a global allowance on either &#39;application&#39;, &#39;resource_type&#39; or &#39;verb&#39;. The default is &#39;false&#39;. (default to ‘false’)

  • :exclude_roles (String)

    An optional string filter which accepts one or more role UUIDs, comma-separated, to return permissions not associated with the supplied role(s).

  • :allowed_only (String)

    If set to &#39;true&#39;, this will exclude any permission with a role where the &#39;application&#39; is not in the role create allow list. (default to ‘false’)

Returns:

  • (Array<(PermissionPagination, Integer, Hash)>)

    PermissionPagination data, response status code and response headers



165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
# File 'lib/insights-rbac-api-client/api/permission_api.rb', line 165

def list_permissions_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: PermissionApi.list_permissions ...'
  end
  if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 1000
    fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling PermissionApi.list_permissions, must be smaller than or equal to 1000.'
  end

  if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1
    fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling PermissionApi.list_permissions, must be greater than or equal to 1.'
  end

  if @api_client.config.client_side_validation && !opts[:'offset'].nil? && opts[:'offset'] < 0
    fail ArgumentError, 'invalid value for "opts[:"offset"]" when calling PermissionApi.list_permissions, must be greater than or equal to 0.'
  end

  allowable_values = ["application", "resource_type", "verb", "permission"]
  if @api_client.config.client_side_validation && opts[:'order_by'] && !allowable_values.include?(opts[:'order_by'])
    fail ArgumentError, "invalid value for \"order_by\", must be one of #{allowable_values}"
  end
  allowable_values = ["true", "false"]
  if @api_client.config.client_side_validation && opts[:'exclude_globals'] && !allowable_values.include?(opts[:'exclude_globals'])
    fail ArgumentError, "invalid value for \"exclude_globals\", must be one of #{allowable_values}"
  end
  allowable_values = ["true", "false"]
  if @api_client.config.client_side_validation && opts[:'allowed_only'] && !allowable_values.include?(opts[:'allowed_only'])
    fail ArgumentError, "invalid value for \"allowed_only\", must be one of #{allowable_values}"
  end
  # resource path
  local_var_path = '/permissions/'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
  query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil?
  query_params[:'order_by'] = opts[:'order_by'] if !opts[:'order_by'].nil?
  query_params[:'application'] = opts[:'application'] if !opts[:'application'].nil?
  query_params[:'resource_type'] = opts[:'resource_type'] if !opts[:'resource_type'].nil?
  query_params[:'verb'] = opts[:'verb'] if !opts[:'verb'].nil?
  query_params[:'permission'] = opts[:'permission'] if !opts[:'permission'].nil?
  query_params[:'exclude_globals'] = opts[:'exclude_globals'] if !opts[:'exclude_globals'].nil?
  query_params[:'exclude_roles'] = opts[:'exclude_roles'] if !opts[:'exclude_roles'].nil?
  query_params[:'allowed_only'] = opts[:'allowed_only'] if !opts[:'allowed_only'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'PermissionPagination'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['basic_auth']

  new_options = opts.merge(
    :operation => :"PermissionApi.list_permissions",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: PermissionApi#list_permissions\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end