# frozen_string_literal: true # #Kubernetes # # No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # # The version of the OpenAPI document: unversioned # # Generated by: https://openapi-generator.tech # OpenAPI Generator version: 6.5.0-SNAPSHOT # require 'cgi' module Zilla class AuthorizationV1Api attr_accessor :api_client def initialize(api_client = ApiClient.default) @api_client = api_client end # create a LocalSubjectAccessReview # @param namespace [String] object name and auth scope, such as for teams and projects # @param body [IoK8sApiAuthorizationV1LocalSubjectAccessReview] # @param [Hash] opts the optional parameters # @option opts [String] :dry_run When present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed # @option opts [String] :field_manager fieldManager is a name associated with the actor or entity that is making these changes. The value must be less than or 128 characters long, and only contain printable characters, as defined by https://golang.org/pkg/unicode/#IsPrint. # @option opts [String] :field_validation fieldValidation instructs the server on how to handle objects in the request (POST/PUT/PATCH) containing unknown or duplicate fields, provided that the `ServerSideFieldValidation` feature gate is also enabled. Valid values are: - Ignore: This will ignore any unknown fields that are silently dropped from the object, and will ignore all but the last duplicate field that the decoder encounters. This is the default behavior prior to v1.23 and is the default behavior when the `ServerSideFieldValidation` feature gate is disabled. - Warn: This will send a warning via the standard warning response header for each unknown field that is dropped from the object, and for each duplicate field that is encountered. The request will still succeed if there are no other errors, and will only persist the last of any duplicate fields. This is the default when the `ServerSideFieldValidation` feature gate is enabled. - Strict: This will fail the request with a BadRequest error if any unknown fields would be dropped from the object, or if any duplicate fields are present. The error returned from the server will contain all unknown and duplicate fields encountered. # @option opts [String] :pretty If 'true', then the output is pretty printed. # @return [IoK8sApiAuthorizationV1LocalSubjectAccessReview] def create_authorization_v1_namespaced_local_subject_access_review(namespace, body, opts = {}) data, _status_code, _headers = create_authorization_v1_namespaced_local_subject_access_review_with_http_info( namespace, body, opts ) data end # create a LocalSubjectAccessReview # @param namespace [String] object name and auth scope, such as for teams and projects # @param body [IoK8sApiAuthorizationV1LocalSubjectAccessReview] # @param [Hash] opts the optional parameters # @option opts [String] :dry_run When present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed # @option opts [String] :field_manager fieldManager is a name associated with the actor or entity that is making these changes. The value must be less than or 128 characters long, and only contain printable characters, as defined by https://golang.org/pkg/unicode/#IsPrint. # @option opts [String] :field_validation fieldValidation instructs the server on how to handle objects in the request (POST/PUT/PATCH) containing unknown or duplicate fields, provided that the `ServerSideFieldValidation` feature gate is also enabled. Valid values are: - Ignore: This will ignore any unknown fields that are silently dropped from the object, and will ignore all but the last duplicate field that the decoder encounters. This is the default behavior prior to v1.23 and is the default behavior when the `ServerSideFieldValidation` feature gate is disabled. - Warn: This will send a warning via the standard warning response header for each unknown field that is dropped from the object, and for each duplicate field that is encountered. The request will still succeed if there are no other errors, and will only persist the last of any duplicate fields. This is the default when the `ServerSideFieldValidation` feature gate is enabled. - Strict: This will fail the request with a BadRequest error if any unknown fields would be dropped from the object, or if any duplicate fields are present. The error returned from the server will contain all unknown and duplicate fields encountered. # @option opts [String] :pretty If 'true', then the output is pretty printed. # @return [Array<(IoK8sApiAuthorizationV1LocalSubjectAccessReview, Integer, Hash)>] IoK8sApiAuthorizationV1LocalSubjectAccessReview data, response status code and response headers def create_authorization_v1_namespaced_local_subject_access_review_with_http_info(namespace, body, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: AuthorizationV1Api.create_authorization_v1_namespaced_local_subject_access_review ...' end # verify the required parameter 'namespace' is set if @api_client.config.client_side_validation && namespace.nil? raise ArgumentError, "Missing the required parameter 'namespace' when calling AuthorizationV1Api.create_authorization_v1_namespaced_local_subject_access_review" end # verify the required parameter 'body' is set if @api_client.config.client_side_validation && body.nil? raise ArgumentError, "Missing the required parameter 'body' when calling AuthorizationV1Api.create_authorization_v1_namespaced_local_subject_access_review" end # resource path local_var_path = '/apis/authorization.k8s.io/v1/namespaces/{namespace}/localsubjectaccessreviews'.sub( '{namespace}', CGI.escape(namespace.to_s) ) # query parameters query_params = opts[:query_params] || {} query_params[:dryRun] = opts[:dry_run] unless opts[:dry_run].nil? query_params[:fieldManager] = opts[:field_manager] unless opts[:field_manager].nil? query_params[:fieldValidation] = opts[:field_validation] unless opts[:field_validation].nil? query_params[:pretty] = opts[:pretty] unless opts[:pretty].nil? # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json', 'application/yaml', 'application/vnd.kubernetes.protobuf']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] || @api_client.object_to_http_body(body) # return_type return_type = opts[:debug_return_type] || 'IoK8sApiAuthorizationV1LocalSubjectAccessReview' # auth_names auth_names = opts[:debug_auth_names] || ['BearerToken'] new_options = opts.merge( operation: :'AuthorizationV1Api.create_authorization_v1_namespaced_local_subject_access_review', header_params:, query_params:, form_params:, body: post_body, auth_names:, return_type: ) data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: AuthorizationV1Api#create_authorization_v1_namespaced_local_subject_access_review\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end [data, status_code, headers] end # create a SelfSubjectAccessReview # @param body [IoK8sApiAuthorizationV1SelfSubjectAccessReview] # @param [Hash] opts the optional parameters # @option opts [String] :dry_run When present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed # @option opts [String] :field_manager fieldManager is a name associated with the actor or entity that is making these changes. The value must be less than or 128 characters long, and only contain printable characters, as defined by https://golang.org/pkg/unicode/#IsPrint. # @option opts [String] :field_validation fieldValidation instructs the server on how to handle objects in the request (POST/PUT/PATCH) containing unknown or duplicate fields, provided that the `ServerSideFieldValidation` feature gate is also enabled. Valid values are: - Ignore: This will ignore any unknown fields that are silently dropped from the object, and will ignore all but the last duplicate field that the decoder encounters. This is the default behavior prior to v1.23 and is the default behavior when the `ServerSideFieldValidation` feature gate is disabled. - Warn: This will send a warning via the standard warning response header for each unknown field that is dropped from the object, and for each duplicate field that is encountered. The request will still succeed if there are no other errors, and will only persist the last of any duplicate fields. This is the default when the `ServerSideFieldValidation` feature gate is enabled. - Strict: This will fail the request with a BadRequest error if any unknown fields would be dropped from the object, or if any duplicate fields are present. The error returned from the server will contain all unknown and duplicate fields encountered. # @option opts [String] :pretty If 'true', then the output is pretty printed. # @return [IoK8sApiAuthorizationV1SelfSubjectAccessReview] def create_authorization_v1_self_subject_access_review(body, opts = {}) data, _status_code, _headers = create_authorization_v1_self_subject_access_review_with_http_info(body, opts) data end # create a SelfSubjectAccessReview # @param body [IoK8sApiAuthorizationV1SelfSubjectAccessReview] # @param [Hash] opts the optional parameters # @option opts [String] :dry_run When present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed # @option opts [String] :field_manager fieldManager is a name associated with the actor or entity that is making these changes. The value must be less than or 128 characters long, and only contain printable characters, as defined by https://golang.org/pkg/unicode/#IsPrint. # @option opts [String] :field_validation fieldValidation instructs the server on how to handle objects in the request (POST/PUT/PATCH) containing unknown or duplicate fields, provided that the `ServerSideFieldValidation` feature gate is also enabled. Valid values are: - Ignore: This will ignore any unknown fields that are silently dropped from the object, and will ignore all but the last duplicate field that the decoder encounters. This is the default behavior prior to v1.23 and is the default behavior when the `ServerSideFieldValidation` feature gate is disabled. - Warn: This will send a warning via the standard warning response header for each unknown field that is dropped from the object, and for each duplicate field that is encountered. The request will still succeed if there are no other errors, and will only persist the last of any duplicate fields. This is the default when the `ServerSideFieldValidation` feature gate is enabled. - Strict: This will fail the request with a BadRequest error if any unknown fields would be dropped from the object, or if any duplicate fields are present. The error returned from the server will contain all unknown and duplicate fields encountered. # @option opts [String] :pretty If 'true', then the output is pretty printed. # @return [Array<(IoK8sApiAuthorizationV1SelfSubjectAccessReview, Integer, Hash)>] IoK8sApiAuthorizationV1SelfSubjectAccessReview data, response status code and response headers def create_authorization_v1_self_subject_access_review_with_http_info(body, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: AuthorizationV1Api.create_authorization_v1_self_subject_access_review ...' end # verify the required parameter 'body' is set if @api_client.config.client_side_validation && body.nil? raise ArgumentError, "Missing the required parameter 'body' when calling AuthorizationV1Api.create_authorization_v1_self_subject_access_review" end # resource path local_var_path = '/apis/authorization.k8s.io/v1/selfsubjectaccessreviews' # query parameters query_params = opts[:query_params] || {} query_params[:dryRun] = opts[:dry_run] unless opts[:dry_run].nil? query_params[:fieldManager] = opts[:field_manager] unless opts[:field_manager].nil? query_params[:fieldValidation] = opts[:field_validation] unless opts[:field_validation].nil? query_params[:pretty] = opts[:pretty] unless opts[:pretty].nil? # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json', 'application/yaml', 'application/vnd.kubernetes.protobuf']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] || @api_client.object_to_http_body(body) # return_type return_type = opts[:debug_return_type] || 'IoK8sApiAuthorizationV1SelfSubjectAccessReview' # auth_names auth_names = opts[:debug_auth_names] || ['BearerToken'] new_options = opts.merge( operation: :'AuthorizationV1Api.create_authorization_v1_self_subject_access_review', header_params:, query_params:, form_params:, body: post_body, auth_names:, return_type: ) data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: AuthorizationV1Api#create_authorization_v1_self_subject_access_review\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end [data, status_code, headers] end # create a SelfSubjectRulesReview # @param body [IoK8sApiAuthorizationV1SelfSubjectRulesReview] # @param [Hash] opts the optional parameters # @option opts [String] :dry_run When present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed # @option opts [String] :field_manager fieldManager is a name associated with the actor or entity that is making these changes. The value must be less than or 128 characters long, and only contain printable characters, as defined by https://golang.org/pkg/unicode/#IsPrint. # @option opts [String] :field_validation fieldValidation instructs the server on how to handle objects in the request (POST/PUT/PATCH) containing unknown or duplicate fields, provided that the `ServerSideFieldValidation` feature gate is also enabled. Valid values are: - Ignore: This will ignore any unknown fields that are silently dropped from the object, and will ignore all but the last duplicate field that the decoder encounters. This is the default behavior prior to v1.23 and is the default behavior when the `ServerSideFieldValidation` feature gate is disabled. - Warn: This will send a warning via the standard warning response header for each unknown field that is dropped from the object, and for each duplicate field that is encountered. The request will still succeed if there are no other errors, and will only persist the last of any duplicate fields. This is the default when the `ServerSideFieldValidation` feature gate is enabled. - Strict: This will fail the request with a BadRequest error if any unknown fields would be dropped from the object, or if any duplicate fields are present. The error returned from the server will contain all unknown and duplicate fields encountered. # @option opts [String] :pretty If 'true', then the output is pretty printed. # @return [IoK8sApiAuthorizationV1SelfSubjectRulesReview] def create_authorization_v1_self_subject_rules_review(body, opts = {}) data, _status_code, _headers = create_authorization_v1_self_subject_rules_review_with_http_info(body, opts) data end # create a SelfSubjectRulesReview # @param body [IoK8sApiAuthorizationV1SelfSubjectRulesReview] # @param [Hash] opts the optional parameters # @option opts [String] :dry_run When present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed # @option opts [String] :field_manager fieldManager is a name associated with the actor or entity that is making these changes. The value must be less than or 128 characters long, and only contain printable characters, as defined by https://golang.org/pkg/unicode/#IsPrint. # @option opts [String] :field_validation fieldValidation instructs the server on how to handle objects in the request (POST/PUT/PATCH) containing unknown or duplicate fields, provided that the `ServerSideFieldValidation` feature gate is also enabled. Valid values are: - Ignore: This will ignore any unknown fields that are silently dropped from the object, and will ignore all but the last duplicate field that the decoder encounters. This is the default behavior prior to v1.23 and is the default behavior when the `ServerSideFieldValidation` feature gate is disabled. - Warn: This will send a warning via the standard warning response header for each unknown field that is dropped from the object, and for each duplicate field that is encountered. The request will still succeed if there are no other errors, and will only persist the last of any duplicate fields. This is the default when the `ServerSideFieldValidation` feature gate is enabled. - Strict: This will fail the request with a BadRequest error if any unknown fields would be dropped from the object, or if any duplicate fields are present. The error returned from the server will contain all unknown and duplicate fields encountered. # @option opts [String] :pretty If 'true', then the output is pretty printed. # @return [Array<(IoK8sApiAuthorizationV1SelfSubjectRulesReview, Integer, Hash)>] IoK8sApiAuthorizationV1SelfSubjectRulesReview data, response status code and response headers def create_authorization_v1_self_subject_rules_review_with_http_info(body, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: AuthorizationV1Api.create_authorization_v1_self_subject_rules_review ...' end # verify the required parameter 'body' is set if @api_client.config.client_side_validation && body.nil? raise ArgumentError, "Missing the required parameter 'body' when calling AuthorizationV1Api.create_authorization_v1_self_subject_rules_review" end # resource path local_var_path = '/apis/authorization.k8s.io/v1/selfsubjectrulesreviews' # query parameters query_params = opts[:query_params] || {} query_params[:dryRun] = opts[:dry_run] unless opts[:dry_run].nil? query_params[:fieldManager] = opts[:field_manager] unless opts[:field_manager].nil? query_params[:fieldValidation] = opts[:field_validation] unless opts[:field_validation].nil? query_params[:pretty] = opts[:pretty] unless opts[:pretty].nil? # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json', 'application/yaml', 'application/vnd.kubernetes.protobuf']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] || @api_client.object_to_http_body(body) # return_type return_type = opts[:debug_return_type] || 'IoK8sApiAuthorizationV1SelfSubjectRulesReview' # auth_names auth_names = opts[:debug_auth_names] || ['BearerToken'] new_options = opts.merge( operation: :'AuthorizationV1Api.create_authorization_v1_self_subject_rules_review', header_params:, query_params:, form_params:, body: post_body, auth_names:, return_type: ) data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: AuthorizationV1Api#create_authorization_v1_self_subject_rules_review\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end [data, status_code, headers] end # create a SubjectAccessReview # @param body [IoK8sApiAuthorizationV1SubjectAccessReview] # @param [Hash] opts the optional parameters # @option opts [String] :dry_run When present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed # @option opts [String] :field_manager fieldManager is a name associated with the actor or entity that is making these changes. The value must be less than or 128 characters long, and only contain printable characters, as defined by https://golang.org/pkg/unicode/#IsPrint. # @option opts [String] :field_validation fieldValidation instructs the server on how to handle objects in the request (POST/PUT/PATCH) containing unknown or duplicate fields, provided that the `ServerSideFieldValidation` feature gate is also enabled. Valid values are: - Ignore: This will ignore any unknown fields that are silently dropped from the object, and will ignore all but the last duplicate field that the decoder encounters. This is the default behavior prior to v1.23 and is the default behavior when the `ServerSideFieldValidation` feature gate is disabled. - Warn: This will send a warning via the standard warning response header for each unknown field that is dropped from the object, and for each duplicate field that is encountered. The request will still succeed if there are no other errors, and will only persist the last of any duplicate fields. This is the default when the `ServerSideFieldValidation` feature gate is enabled. - Strict: This will fail the request with a BadRequest error if any unknown fields would be dropped from the object, or if any duplicate fields are present. The error returned from the server will contain all unknown and duplicate fields encountered. # @option opts [String] :pretty If 'true', then the output is pretty printed. # @return [IoK8sApiAuthorizationV1SubjectAccessReview] def create_authorization_v1_subject_access_review(body, opts = {}) data, _status_code, _headers = create_authorization_v1_subject_access_review_with_http_info(body, opts) data end # create a SubjectAccessReview # @param body [IoK8sApiAuthorizationV1SubjectAccessReview] # @param [Hash] opts the optional parameters # @option opts [String] :dry_run When present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed # @option opts [String] :field_manager fieldManager is a name associated with the actor or entity that is making these changes. The value must be less than or 128 characters long, and only contain printable characters, as defined by https://golang.org/pkg/unicode/#IsPrint. # @option opts [String] :field_validation fieldValidation instructs the server on how to handle objects in the request (POST/PUT/PATCH) containing unknown or duplicate fields, provided that the `ServerSideFieldValidation` feature gate is also enabled. Valid values are: - Ignore: This will ignore any unknown fields that are silently dropped from the object, and will ignore all but the last duplicate field that the decoder encounters. This is the default behavior prior to v1.23 and is the default behavior when the `ServerSideFieldValidation` feature gate is disabled. - Warn: This will send a warning via the standard warning response header for each unknown field that is dropped from the object, and for each duplicate field that is encountered. The request will still succeed if there are no other errors, and will only persist the last of any duplicate fields. This is the default when the `ServerSideFieldValidation` feature gate is enabled. - Strict: This will fail the request with a BadRequest error if any unknown fields would be dropped from the object, or if any duplicate fields are present. The error returned from the server will contain all unknown and duplicate fields encountered. # @option opts [String] :pretty If 'true', then the output is pretty printed. # @return [Array<(IoK8sApiAuthorizationV1SubjectAccessReview, Integer, Hash)>] IoK8sApiAuthorizationV1SubjectAccessReview data, response status code and response headers def create_authorization_v1_subject_access_review_with_http_info(body, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: AuthorizationV1Api.create_authorization_v1_subject_access_review ...' end # verify the required parameter 'body' is set if @api_client.config.client_side_validation && body.nil? raise ArgumentError, "Missing the required parameter 'body' when calling AuthorizationV1Api.create_authorization_v1_subject_access_review" end # resource path local_var_path = '/apis/authorization.k8s.io/v1/subjectaccessreviews' # query parameters query_params = opts[:query_params] || {} query_params[:dryRun] = opts[:dry_run] unless opts[:dry_run].nil? query_params[:fieldManager] = opts[:field_manager] unless opts[:field_manager].nil? query_params[:fieldValidation] = opts[:field_validation] unless opts[:field_validation].nil? query_params[:pretty] = opts[:pretty] unless opts[:pretty].nil? # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json', 'application/yaml', 'application/vnd.kubernetes.protobuf']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] || @api_client.object_to_http_body(body) # return_type return_type = opts[:debug_return_type] || 'IoK8sApiAuthorizationV1SubjectAccessReview' # auth_names auth_names = opts[:debug_auth_names] || ['BearerToken'] new_options = opts.merge( operation: :'AuthorizationV1Api.create_authorization_v1_subject_access_review', header_params:, query_params:, form_params:, body: post_body, auth_names:, return_type: ) data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: AuthorizationV1Api#create_authorization_v1_subject_access_review\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end [data, status_code, headers] end # get available resources # @param [Hash] opts the optional parameters # @return [IoK8sApimachineryPkgApisMetaV1APIResourceList] def get_authorization_v1_api_resources(opts = {}) data, _status_code, _headers = get_authorization_v1_api_resources_with_http_info(opts) data end # get available resources # @param [Hash] opts the optional parameters # @return [Array<(IoK8sApimachineryPkgApisMetaV1APIResourceList, Integer, Hash)>] IoK8sApimachineryPkgApisMetaV1APIResourceList data, response status code and response headers def get_authorization_v1_api_resources_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: AuthorizationV1Api.get_authorization_v1_api_resources ...' end # resource path local_var_path = '/apis/authorization.k8s.io/v1/' # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json', 'application/yaml', 'application/vnd.kubernetes.protobuf']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'IoK8sApimachineryPkgApisMetaV1APIResourceList' # auth_names auth_names = opts[:debug_auth_names] || ['BearerToken'] new_options = opts.merge( operation: :'AuthorizationV1Api.get_authorization_v1_api_resources', header_params:, query_params:, form_params:, body: post_body, auth_names:, 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: AuthorizationV1Api#get_authorization_v1_api_resources\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end [data, status_code, headers] end end end