22 * Kubernetes
33 * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
44 *
5- * The version of the OpenAPI document: v1.15.5
5+ * The version of the OpenAPI document: v1.15.10
66 *
77 *
88 * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
@@ -16,8 +16,10 @@ import http = require('http');
1616/* tslint:disable:no-unused-locals */
1717import { V1APIGroup } from '../model/v1APIGroup' ;
1818
19- import { ObjectSerializer , Authentication , VoidAuth } from '../model/models' ;
20- import { ApiKeyAuth } from '../model/models' ;
19+ import { ObjectSerializer , Authentication , VoidAuth , Interceptor } from '../model/models' ;
20+ import { HttpBasicAuth , HttpBearerAuth , ApiKeyAuth , OAuth } from '../model/models' ;
21+
22+ import { HttpError , RequestFile } from './apis' ;
2123
2224let defaultBasePath = 'http://localhost' ;
2325
@@ -31,14 +33,16 @@ export enum AdmissionregistrationApiApiKeys {
3133
3234export class AdmissionregistrationApi {
3335 protected _basePath = defaultBasePath ;
34- protected defaultHeaders : any = { } ;
36+ protected _defaultHeaders : any = { } ;
3537 protected _useQuerystring : boolean = false ;
3638
3739 protected authentications = {
3840 'default' : < Authentication > new VoidAuth ( ) ,
3941 'BearerToken' : new ApiKeyAuth ( 'header' , 'authorization' ) ,
4042 }
4143
44+ protected interceptors : Interceptor [ ] = [ ] ;
45+
4246 constructor ( basePath ?: string ) ;
4347 constructor ( basePathOrUsername : string , password ?: string , basePath ?: string ) {
4448 if ( password ) {
@@ -60,6 +64,14 @@ export class AdmissionregistrationApi {
6064 this . _basePath = basePath ;
6165 }
6266
67+ set defaultHeaders ( defaultHeaders : any ) {
68+ this . _defaultHeaders = defaultHeaders ;
69+ }
70+
71+ get defaultHeaders ( ) {
72+ return this . _defaultHeaders ;
73+ }
74+
6375 get basePath ( ) {
6476 return this . _basePath ;
6577 }
@@ -72,13 +84,24 @@ export class AdmissionregistrationApi {
7284 ( this . authentications as any ) [ AdmissionregistrationApiApiKeys [ key ] ] . apiKey = value ;
7385 }
7486
87+ public addInterceptor ( interceptor : Interceptor ) {
88+ this . interceptors . push ( interceptor ) ;
89+ }
90+
7591 /**
7692 * get information of a group
7793 */
7894 public async getAPIGroup ( options : { headers : { [ name : string ] : string } } = { headers : { } } ) : Promise < { response : http . IncomingMessage ; body : V1APIGroup ; } > {
7995 const localVarPath = this . basePath + '/apis/admissionregistration.k8s.io/' ;
8096 let localVarQueryParameters : any = { } ;
81- let localVarHeaderParams : any = ( < any > Object ) . assign ( { } , this . defaultHeaders ) ;
97+ let localVarHeaderParams : any = ( < any > Object ) . assign ( { } , this . _defaultHeaders ) ;
98+ const produces = [ 'application/json' , 'application/yaml' , 'application/vnd.kubernetes.protobuf' ] ;
99+ // give precedence to 'application/json'
100+ if ( produces . indexOf ( 'application/json' ) >= 0 ) {
101+ localVarHeaderParams . Accept = 'application/json' ;
102+ } else {
103+ localVarHeaderParams . Accept = produces . join ( ',' ) ;
104+ }
82105 let localVarFormParams : any = { } ;
83106
84107 ( < any > Object ) . assign ( localVarHeaderParams , options . headers ) ;
@@ -95,10 +118,17 @@ export class AdmissionregistrationApi {
95118 } ;
96119
97120 let authenticationPromise = Promise . resolve ( ) ;
98- authenticationPromise = authenticationPromise . then ( ( ) => this . authentications . BearerToken . applyToRequest ( localVarRequestOptions ) ) ;
99-
121+ if ( this . authentications . BearerToken . apiKey ) {
122+ authenticationPromise = authenticationPromise . then ( ( ) => this . authentications . BearerToken . applyToRequest ( localVarRequestOptions ) ) ;
123+ }
100124 authenticationPromise = authenticationPromise . then ( ( ) => this . authentications . default . applyToRequest ( localVarRequestOptions ) ) ;
101- return authenticationPromise . then ( ( ) => {
125+
126+ let interceptorPromise = authenticationPromise ;
127+ for ( const interceptor of this . interceptors ) {
128+ interceptorPromise = interceptorPromise . then ( ( ) => interceptor ( localVarRequestOptions ) ) ;
129+ }
130+
131+ return interceptorPromise . then ( ( ) => {
102132 if ( Object . keys ( localVarFormParams ) . length ) {
103133 if ( localVarUseFormData ) {
104134 ( < any > localVarRequestOptions ) . formData = localVarFormParams ;
@@ -115,7 +145,7 @@ export class AdmissionregistrationApi {
115145 if ( response . statusCode && response . statusCode >= 200 && response . statusCode <= 299 ) {
116146 resolve ( { response : response , body : body } ) ;
117147 } else {
118- reject ( { response : response , body : body } ) ;
148+ reject ( new HttpError ( response , body , response . statusCode ) ) ;
119149 }
120150 }
121151 } ) ;
0 commit comments