diff --git a/client/project/create_cluster_service_account_parameters.go b/client/project/create_cluster_service_account_parameters.go new file mode 100644 index 00000000..d553f3f5 --- /dev/null +++ b/client/project/create_cluster_service_account_parameters.go @@ -0,0 +1,188 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package project + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" + + "github.com/kubermatic/go-kubermatic/models" +) + +// NewCreateClusterServiceAccountParams creates a new CreateClusterServiceAccountParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewCreateClusterServiceAccountParams() *CreateClusterServiceAccountParams { + return &CreateClusterServiceAccountParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewCreateClusterServiceAccountParamsWithTimeout creates a new CreateClusterServiceAccountParams object +// with the ability to set a timeout on a request. +func NewCreateClusterServiceAccountParamsWithTimeout(timeout time.Duration) *CreateClusterServiceAccountParams { + return &CreateClusterServiceAccountParams{ + timeout: timeout, + } +} + +// NewCreateClusterServiceAccountParamsWithContext creates a new CreateClusterServiceAccountParams object +// with the ability to set a context for a request. +func NewCreateClusterServiceAccountParamsWithContext(ctx context.Context) *CreateClusterServiceAccountParams { + return &CreateClusterServiceAccountParams{ + Context: ctx, + } +} + +// NewCreateClusterServiceAccountParamsWithHTTPClient creates a new CreateClusterServiceAccountParams object +// with the ability to set a custom HTTPClient for a request. +func NewCreateClusterServiceAccountParamsWithHTTPClient(client *http.Client) *CreateClusterServiceAccountParams { + return &CreateClusterServiceAccountParams{ + HTTPClient: client, + } +} + +/* +CreateClusterServiceAccountParams contains all the parameters to send to the API endpoint + + for the create cluster service account operation. + + Typically these are written to a http.Request. +*/ +type CreateClusterServiceAccountParams struct { + + // Body. + Body *models.ClusterServiceAccount + + // ClusterID. + ClusterID string + + // ProjectID. + ProjectID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the create cluster service account params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *CreateClusterServiceAccountParams) WithDefaults() *CreateClusterServiceAccountParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the create cluster service account params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *CreateClusterServiceAccountParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the create cluster service account params +func (o *CreateClusterServiceAccountParams) WithTimeout(timeout time.Duration) *CreateClusterServiceAccountParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the create cluster service account params +func (o *CreateClusterServiceAccountParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the create cluster service account params +func (o *CreateClusterServiceAccountParams) WithContext(ctx context.Context) *CreateClusterServiceAccountParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the create cluster service account params +func (o *CreateClusterServiceAccountParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the create cluster service account params +func (o *CreateClusterServiceAccountParams) WithHTTPClient(client *http.Client) *CreateClusterServiceAccountParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the create cluster service account params +func (o *CreateClusterServiceAccountParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the create cluster service account params +func (o *CreateClusterServiceAccountParams) WithBody(body *models.ClusterServiceAccount) *CreateClusterServiceAccountParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the create cluster service account params +func (o *CreateClusterServiceAccountParams) SetBody(body *models.ClusterServiceAccount) { + o.Body = body +} + +// WithClusterID adds the clusterID to the create cluster service account params +func (o *CreateClusterServiceAccountParams) WithClusterID(clusterID string) *CreateClusterServiceAccountParams { + o.SetClusterID(clusterID) + return o +} + +// SetClusterID adds the clusterId to the create cluster service account params +func (o *CreateClusterServiceAccountParams) SetClusterID(clusterID string) { + o.ClusterID = clusterID +} + +// WithProjectID adds the projectID to the create cluster service account params +func (o *CreateClusterServiceAccountParams) WithProjectID(projectID string) *CreateClusterServiceAccountParams { + o.SetProjectID(projectID) + return o +} + +// SetProjectID adds the projectId to the create cluster service account params +func (o *CreateClusterServiceAccountParams) SetProjectID(projectID string) { + o.ProjectID = projectID +} + +// WriteToRequest writes these params to a swagger request +func (o *CreateClusterServiceAccountParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + if o.Body != nil { + if err := r.SetBodyParam(o.Body); err != nil { + return err + } + } + + // path param cluster_id + if err := r.SetPathParam("cluster_id", o.ClusterID); err != nil { + return err + } + + // path param project_id + if err := r.SetPathParam("project_id", o.ProjectID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/project/create_cluster_service_account_responses.go b/client/project/create_cluster_service_account_responses.go new file mode 100644 index 00000000..e28371db --- /dev/null +++ b/client/project/create_cluster_service_account_responses.go @@ -0,0 +1,291 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package project + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/kubermatic/go-kubermatic/models" +) + +// CreateClusterServiceAccountReader is a Reader for the CreateClusterServiceAccount structure. +type CreateClusterServiceAccountReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *CreateClusterServiceAccountReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 201: + result := NewCreateClusterServiceAccountCreated() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 401: + result := NewCreateClusterServiceAccountUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewCreateClusterServiceAccountForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + result := NewCreateClusterServiceAccountDefault(response.Code()) + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + if response.Code()/100 == 2 { + return result, nil + } + return nil, result + } +} + +// NewCreateClusterServiceAccountCreated creates a CreateClusterServiceAccountCreated with default headers values +func NewCreateClusterServiceAccountCreated() *CreateClusterServiceAccountCreated { + return &CreateClusterServiceAccountCreated{} +} + +/* +CreateClusterServiceAccountCreated describes a response with status code 201, with default header values. + +ClusterServiceAccount +*/ +type CreateClusterServiceAccountCreated struct { + Payload *models.ClusterServiceAccount +} + +// IsSuccess returns true when this create cluster service account created response has a 2xx status code +func (o *CreateClusterServiceAccountCreated) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this create cluster service account created response has a 3xx status code +func (o *CreateClusterServiceAccountCreated) IsRedirect() bool { + return false +} + +// IsClientError returns true when this create cluster service account created response has a 4xx status code +func (o *CreateClusterServiceAccountCreated) IsClientError() bool { + return false +} + +// IsServerError returns true when this create cluster service account created response has a 5xx status code +func (o *CreateClusterServiceAccountCreated) IsServerError() bool { + return false +} + +// IsCode returns true when this create cluster service account created response a status code equal to that given +func (o *CreateClusterServiceAccountCreated) IsCode(code int) bool { + return code == 201 +} + +func (o *CreateClusterServiceAccountCreated) Error() string { + return fmt.Sprintf("[POST /api/v2/projects/{project_id}/clusters/{cluster_id}/serviceaccount][%d] createClusterServiceAccountCreated %+v", 201, o.Payload) +} + +func (o *CreateClusterServiceAccountCreated) String() string { + return fmt.Sprintf("[POST /api/v2/projects/{project_id}/clusters/{cluster_id}/serviceaccount][%d] createClusterServiceAccountCreated %+v", 201, o.Payload) +} + +func (o *CreateClusterServiceAccountCreated) GetPayload() *models.ClusterServiceAccount { + return o.Payload +} + +func (o *CreateClusterServiceAccountCreated) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.ClusterServiceAccount) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewCreateClusterServiceAccountUnauthorized creates a CreateClusterServiceAccountUnauthorized with default headers values +func NewCreateClusterServiceAccountUnauthorized() *CreateClusterServiceAccountUnauthorized { + return &CreateClusterServiceAccountUnauthorized{} +} + +/* +CreateClusterServiceAccountUnauthorized describes a response with status code 401, with default header values. + +EmptyResponse is a empty response +*/ +type CreateClusterServiceAccountUnauthorized struct { +} + +// IsSuccess returns true when this create cluster service account unauthorized response has a 2xx status code +func (o *CreateClusterServiceAccountUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this create cluster service account unauthorized response has a 3xx status code +func (o *CreateClusterServiceAccountUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this create cluster service account unauthorized response has a 4xx status code +func (o *CreateClusterServiceAccountUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this create cluster service account unauthorized response has a 5xx status code +func (o *CreateClusterServiceAccountUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this create cluster service account unauthorized response a status code equal to that given +func (o *CreateClusterServiceAccountUnauthorized) IsCode(code int) bool { + return code == 401 +} + +func (o *CreateClusterServiceAccountUnauthorized) Error() string { + return fmt.Sprintf("[POST /api/v2/projects/{project_id}/clusters/{cluster_id}/serviceaccount][%d] createClusterServiceAccountUnauthorized ", 401) +} + +func (o *CreateClusterServiceAccountUnauthorized) String() string { + return fmt.Sprintf("[POST /api/v2/projects/{project_id}/clusters/{cluster_id}/serviceaccount][%d] createClusterServiceAccountUnauthorized ", 401) +} + +func (o *CreateClusterServiceAccountUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewCreateClusterServiceAccountForbidden creates a CreateClusterServiceAccountForbidden with default headers values +func NewCreateClusterServiceAccountForbidden() *CreateClusterServiceAccountForbidden { + return &CreateClusterServiceAccountForbidden{} +} + +/* +CreateClusterServiceAccountForbidden describes a response with status code 403, with default header values. + +EmptyResponse is a empty response +*/ +type CreateClusterServiceAccountForbidden struct { +} + +// IsSuccess returns true when this create cluster service account forbidden response has a 2xx status code +func (o *CreateClusterServiceAccountForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this create cluster service account forbidden response has a 3xx status code +func (o *CreateClusterServiceAccountForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this create cluster service account forbidden response has a 4xx status code +func (o *CreateClusterServiceAccountForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this create cluster service account forbidden response has a 5xx status code +func (o *CreateClusterServiceAccountForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this create cluster service account forbidden response a status code equal to that given +func (o *CreateClusterServiceAccountForbidden) IsCode(code int) bool { + return code == 403 +} + +func (o *CreateClusterServiceAccountForbidden) Error() string { + return fmt.Sprintf("[POST /api/v2/projects/{project_id}/clusters/{cluster_id}/serviceaccount][%d] createClusterServiceAccountForbidden ", 403) +} + +func (o *CreateClusterServiceAccountForbidden) String() string { + return fmt.Sprintf("[POST /api/v2/projects/{project_id}/clusters/{cluster_id}/serviceaccount][%d] createClusterServiceAccountForbidden ", 403) +} + +func (o *CreateClusterServiceAccountForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewCreateClusterServiceAccountDefault creates a CreateClusterServiceAccountDefault with default headers values +func NewCreateClusterServiceAccountDefault(code int) *CreateClusterServiceAccountDefault { + return &CreateClusterServiceAccountDefault{ + _statusCode: code, + } +} + +/* +CreateClusterServiceAccountDefault describes a response with status code -1, with default header values. + +errorResponse +*/ +type CreateClusterServiceAccountDefault struct { + _statusCode int + + Payload *models.ErrorResponse +} + +// Code gets the status code for the create cluster service account default response +func (o *CreateClusterServiceAccountDefault) Code() int { + return o._statusCode +} + +// IsSuccess returns true when this create cluster service account default response has a 2xx status code +func (o *CreateClusterServiceAccountDefault) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this create cluster service account default response has a 3xx status code +func (o *CreateClusterServiceAccountDefault) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this create cluster service account default response has a 4xx status code +func (o *CreateClusterServiceAccountDefault) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this create cluster service account default response has a 5xx status code +func (o *CreateClusterServiceAccountDefault) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this create cluster service account default response a status code equal to that given +func (o *CreateClusterServiceAccountDefault) IsCode(code int) bool { + return o._statusCode == code +} + +func (o *CreateClusterServiceAccountDefault) Error() string { + return fmt.Sprintf("[POST /api/v2/projects/{project_id}/clusters/{cluster_id}/serviceaccount][%d] createClusterServiceAccount default %+v", o._statusCode, o.Payload) +} + +func (o *CreateClusterServiceAccountDefault) String() string { + return fmt.Sprintf("[POST /api/v2/projects/{project_id}/clusters/{cluster_id}/serviceaccount][%d] createClusterServiceAccount default %+v", o._statusCode, o.Payload) +} + +func (o *CreateClusterServiceAccountDefault) GetPayload() *models.ErrorResponse { + return o.Payload +} + +func (o *CreateClusterServiceAccountDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.ErrorResponse) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/client/project/delete_cluster_service_account_parameters.go b/client/project/delete_cluster_service_account_parameters.go new file mode 100644 index 00000000..11485366 --- /dev/null +++ b/client/project/delete_cluster_service_account_parameters.go @@ -0,0 +1,205 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package project + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// NewDeleteClusterServiceAccountParams creates a new DeleteClusterServiceAccountParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewDeleteClusterServiceAccountParams() *DeleteClusterServiceAccountParams { + return &DeleteClusterServiceAccountParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewDeleteClusterServiceAccountParamsWithTimeout creates a new DeleteClusterServiceAccountParams object +// with the ability to set a timeout on a request. +func NewDeleteClusterServiceAccountParamsWithTimeout(timeout time.Duration) *DeleteClusterServiceAccountParams { + return &DeleteClusterServiceAccountParams{ + timeout: timeout, + } +} + +// NewDeleteClusterServiceAccountParamsWithContext creates a new DeleteClusterServiceAccountParams object +// with the ability to set a context for a request. +func NewDeleteClusterServiceAccountParamsWithContext(ctx context.Context) *DeleteClusterServiceAccountParams { + return &DeleteClusterServiceAccountParams{ + Context: ctx, + } +} + +// NewDeleteClusterServiceAccountParamsWithHTTPClient creates a new DeleteClusterServiceAccountParams object +// with the ability to set a custom HTTPClient for a request. +func NewDeleteClusterServiceAccountParamsWithHTTPClient(client *http.Client) *DeleteClusterServiceAccountParams { + return &DeleteClusterServiceAccountParams{ + HTTPClient: client, + } +} + +/* +DeleteClusterServiceAccountParams contains all the parameters to send to the API endpoint + + for the delete cluster service account operation. + + Typically these are written to a http.Request. +*/ +type DeleteClusterServiceAccountParams struct { + + // ClusterID. + ClusterID string + + // Namespace. + Namespace string + + // ProjectID. + ProjectID string + + // ServiceAccountID. + ServiceAccountID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the delete cluster service account params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DeleteClusterServiceAccountParams) WithDefaults() *DeleteClusterServiceAccountParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the delete cluster service account params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DeleteClusterServiceAccountParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the delete cluster service account params +func (o *DeleteClusterServiceAccountParams) WithTimeout(timeout time.Duration) *DeleteClusterServiceAccountParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the delete cluster service account params +func (o *DeleteClusterServiceAccountParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the delete cluster service account params +func (o *DeleteClusterServiceAccountParams) WithContext(ctx context.Context) *DeleteClusterServiceAccountParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the delete cluster service account params +func (o *DeleteClusterServiceAccountParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the delete cluster service account params +func (o *DeleteClusterServiceAccountParams) WithHTTPClient(client *http.Client) *DeleteClusterServiceAccountParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the delete cluster service account params +func (o *DeleteClusterServiceAccountParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithClusterID adds the clusterID to the delete cluster service account params +func (o *DeleteClusterServiceAccountParams) WithClusterID(clusterID string) *DeleteClusterServiceAccountParams { + o.SetClusterID(clusterID) + return o +} + +// SetClusterID adds the clusterId to the delete cluster service account params +func (o *DeleteClusterServiceAccountParams) SetClusterID(clusterID string) { + o.ClusterID = clusterID +} + +// WithNamespace adds the namespace to the delete cluster service account params +func (o *DeleteClusterServiceAccountParams) WithNamespace(namespace string) *DeleteClusterServiceAccountParams { + o.SetNamespace(namespace) + return o +} + +// SetNamespace adds the namespace to the delete cluster service account params +func (o *DeleteClusterServiceAccountParams) SetNamespace(namespace string) { + o.Namespace = namespace +} + +// WithProjectID adds the projectID to the delete cluster service account params +func (o *DeleteClusterServiceAccountParams) WithProjectID(projectID string) *DeleteClusterServiceAccountParams { + o.SetProjectID(projectID) + return o +} + +// SetProjectID adds the projectId to the delete cluster service account params +func (o *DeleteClusterServiceAccountParams) SetProjectID(projectID string) { + o.ProjectID = projectID +} + +// WithServiceAccountID adds the serviceAccountID to the delete cluster service account params +func (o *DeleteClusterServiceAccountParams) WithServiceAccountID(serviceAccountID string) *DeleteClusterServiceAccountParams { + o.SetServiceAccountID(serviceAccountID) + return o +} + +// SetServiceAccountID adds the serviceAccountId to the delete cluster service account params +func (o *DeleteClusterServiceAccountParams) SetServiceAccountID(serviceAccountID string) { + o.ServiceAccountID = serviceAccountID +} + +// WriteToRequest writes these params to a swagger request +func (o *DeleteClusterServiceAccountParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param cluster_id + if err := r.SetPathParam("cluster_id", o.ClusterID); err != nil { + return err + } + + // path param namespace + if err := r.SetPathParam("namespace", o.Namespace); err != nil { + return err + } + + // path param project_id + if err := r.SetPathParam("project_id", o.ProjectID); err != nil { + return err + } + + // path param service_account_id + if err := r.SetPathParam("service_account_id", o.ServiceAccountID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/project/delete_cluster_service_account_responses.go b/client/project/delete_cluster_service_account_responses.go new file mode 100644 index 00000000..c6bc2dc8 --- /dev/null +++ b/client/project/delete_cluster_service_account_responses.go @@ -0,0 +1,279 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package project + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/kubermatic/go-kubermatic/models" +) + +// DeleteClusterServiceAccountReader is a Reader for the DeleteClusterServiceAccount structure. +type DeleteClusterServiceAccountReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *DeleteClusterServiceAccountReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewDeleteClusterServiceAccountOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 401: + result := NewDeleteClusterServiceAccountUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewDeleteClusterServiceAccountForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + result := NewDeleteClusterServiceAccountDefault(response.Code()) + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + if response.Code()/100 == 2 { + return result, nil + } + return nil, result + } +} + +// NewDeleteClusterServiceAccountOK creates a DeleteClusterServiceAccountOK with default headers values +func NewDeleteClusterServiceAccountOK() *DeleteClusterServiceAccountOK { + return &DeleteClusterServiceAccountOK{} +} + +/* +DeleteClusterServiceAccountOK describes a response with status code 200, with default header values. + +EmptyResponse is a empty response +*/ +type DeleteClusterServiceAccountOK struct { +} + +// IsSuccess returns true when this delete cluster service account o k response has a 2xx status code +func (o *DeleteClusterServiceAccountOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this delete cluster service account o k response has a 3xx status code +func (o *DeleteClusterServiceAccountOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this delete cluster service account o k response has a 4xx status code +func (o *DeleteClusterServiceAccountOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this delete cluster service account o k response has a 5xx status code +func (o *DeleteClusterServiceAccountOK) IsServerError() bool { + return false +} + +// IsCode returns true when this delete cluster service account o k response a status code equal to that given +func (o *DeleteClusterServiceAccountOK) IsCode(code int) bool { + return code == 200 +} + +func (o *DeleteClusterServiceAccountOK) Error() string { + return fmt.Sprintf("[DELETE /api/v2/projects/{project_id}/clusters/{cluster_id}/serviceaccount/{namespace}/{service_account_id}][%d] deleteClusterServiceAccountOK ", 200) +} + +func (o *DeleteClusterServiceAccountOK) String() string { + return fmt.Sprintf("[DELETE /api/v2/projects/{project_id}/clusters/{cluster_id}/serviceaccount/{namespace}/{service_account_id}][%d] deleteClusterServiceAccountOK ", 200) +} + +func (o *DeleteClusterServiceAccountOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewDeleteClusterServiceAccountUnauthorized creates a DeleteClusterServiceAccountUnauthorized with default headers values +func NewDeleteClusterServiceAccountUnauthorized() *DeleteClusterServiceAccountUnauthorized { + return &DeleteClusterServiceAccountUnauthorized{} +} + +/* +DeleteClusterServiceAccountUnauthorized describes a response with status code 401, with default header values. + +EmptyResponse is a empty response +*/ +type DeleteClusterServiceAccountUnauthorized struct { +} + +// IsSuccess returns true when this delete cluster service account unauthorized response has a 2xx status code +func (o *DeleteClusterServiceAccountUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this delete cluster service account unauthorized response has a 3xx status code +func (o *DeleteClusterServiceAccountUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this delete cluster service account unauthorized response has a 4xx status code +func (o *DeleteClusterServiceAccountUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this delete cluster service account unauthorized response has a 5xx status code +func (o *DeleteClusterServiceAccountUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this delete cluster service account unauthorized response a status code equal to that given +func (o *DeleteClusterServiceAccountUnauthorized) IsCode(code int) bool { + return code == 401 +} + +func (o *DeleteClusterServiceAccountUnauthorized) Error() string { + return fmt.Sprintf("[DELETE /api/v2/projects/{project_id}/clusters/{cluster_id}/serviceaccount/{namespace}/{service_account_id}][%d] deleteClusterServiceAccountUnauthorized ", 401) +} + +func (o *DeleteClusterServiceAccountUnauthorized) String() string { + return fmt.Sprintf("[DELETE /api/v2/projects/{project_id}/clusters/{cluster_id}/serviceaccount/{namespace}/{service_account_id}][%d] deleteClusterServiceAccountUnauthorized ", 401) +} + +func (o *DeleteClusterServiceAccountUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewDeleteClusterServiceAccountForbidden creates a DeleteClusterServiceAccountForbidden with default headers values +func NewDeleteClusterServiceAccountForbidden() *DeleteClusterServiceAccountForbidden { + return &DeleteClusterServiceAccountForbidden{} +} + +/* +DeleteClusterServiceAccountForbidden describes a response with status code 403, with default header values. + +EmptyResponse is a empty response +*/ +type DeleteClusterServiceAccountForbidden struct { +} + +// IsSuccess returns true when this delete cluster service account forbidden response has a 2xx status code +func (o *DeleteClusterServiceAccountForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this delete cluster service account forbidden response has a 3xx status code +func (o *DeleteClusterServiceAccountForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this delete cluster service account forbidden response has a 4xx status code +func (o *DeleteClusterServiceAccountForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this delete cluster service account forbidden response has a 5xx status code +func (o *DeleteClusterServiceAccountForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this delete cluster service account forbidden response a status code equal to that given +func (o *DeleteClusterServiceAccountForbidden) IsCode(code int) bool { + return code == 403 +} + +func (o *DeleteClusterServiceAccountForbidden) Error() string { + return fmt.Sprintf("[DELETE /api/v2/projects/{project_id}/clusters/{cluster_id}/serviceaccount/{namespace}/{service_account_id}][%d] deleteClusterServiceAccountForbidden ", 403) +} + +func (o *DeleteClusterServiceAccountForbidden) String() string { + return fmt.Sprintf("[DELETE /api/v2/projects/{project_id}/clusters/{cluster_id}/serviceaccount/{namespace}/{service_account_id}][%d] deleteClusterServiceAccountForbidden ", 403) +} + +func (o *DeleteClusterServiceAccountForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewDeleteClusterServiceAccountDefault creates a DeleteClusterServiceAccountDefault with default headers values +func NewDeleteClusterServiceAccountDefault(code int) *DeleteClusterServiceAccountDefault { + return &DeleteClusterServiceAccountDefault{ + _statusCode: code, + } +} + +/* +DeleteClusterServiceAccountDefault describes a response with status code -1, with default header values. + +errorResponse +*/ +type DeleteClusterServiceAccountDefault struct { + _statusCode int + + Payload *models.ErrorResponse +} + +// Code gets the status code for the delete cluster service account default response +func (o *DeleteClusterServiceAccountDefault) Code() int { + return o._statusCode +} + +// IsSuccess returns true when this delete cluster service account default response has a 2xx status code +func (o *DeleteClusterServiceAccountDefault) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this delete cluster service account default response has a 3xx status code +func (o *DeleteClusterServiceAccountDefault) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this delete cluster service account default response has a 4xx status code +func (o *DeleteClusterServiceAccountDefault) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this delete cluster service account default response has a 5xx status code +func (o *DeleteClusterServiceAccountDefault) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this delete cluster service account default response a status code equal to that given +func (o *DeleteClusterServiceAccountDefault) IsCode(code int) bool { + return o._statusCode == code +} + +func (o *DeleteClusterServiceAccountDefault) Error() string { + return fmt.Sprintf("[DELETE /api/v2/projects/{project_id}/clusters/{cluster_id}/serviceaccount/{namespace}/{service_account_id}][%d] deleteClusterServiceAccount default %+v", o._statusCode, o.Payload) +} + +func (o *DeleteClusterServiceAccountDefault) String() string { + return fmt.Sprintf("[DELETE /api/v2/projects/{project_id}/clusters/{cluster_id}/serviceaccount/{namespace}/{service_account_id}][%d] deleteClusterServiceAccount default %+v", o._statusCode, o.Payload) +} + +func (o *DeleteClusterServiceAccountDefault) GetPayload() *models.ErrorResponse { + return o.Payload +} + +func (o *DeleteClusterServiceAccountDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.ErrorResponse) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/client/project/get_cluster_service_account_kubeconfig_parameters.go b/client/project/get_cluster_service_account_kubeconfig_parameters.go new file mode 100644 index 00000000..0eb1a433 --- /dev/null +++ b/client/project/get_cluster_service_account_kubeconfig_parameters.go @@ -0,0 +1,205 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package project + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// NewGetClusterServiceAccountKubeconfigParams creates a new GetClusterServiceAccountKubeconfigParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewGetClusterServiceAccountKubeconfigParams() *GetClusterServiceAccountKubeconfigParams { + return &GetClusterServiceAccountKubeconfigParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewGetClusterServiceAccountKubeconfigParamsWithTimeout creates a new GetClusterServiceAccountKubeconfigParams object +// with the ability to set a timeout on a request. +func NewGetClusterServiceAccountKubeconfigParamsWithTimeout(timeout time.Duration) *GetClusterServiceAccountKubeconfigParams { + return &GetClusterServiceAccountKubeconfigParams{ + timeout: timeout, + } +} + +// NewGetClusterServiceAccountKubeconfigParamsWithContext creates a new GetClusterServiceAccountKubeconfigParams object +// with the ability to set a context for a request. +func NewGetClusterServiceAccountKubeconfigParamsWithContext(ctx context.Context) *GetClusterServiceAccountKubeconfigParams { + return &GetClusterServiceAccountKubeconfigParams{ + Context: ctx, + } +} + +// NewGetClusterServiceAccountKubeconfigParamsWithHTTPClient creates a new GetClusterServiceAccountKubeconfigParams object +// with the ability to set a custom HTTPClient for a request. +func NewGetClusterServiceAccountKubeconfigParamsWithHTTPClient(client *http.Client) *GetClusterServiceAccountKubeconfigParams { + return &GetClusterServiceAccountKubeconfigParams{ + HTTPClient: client, + } +} + +/* +GetClusterServiceAccountKubeconfigParams contains all the parameters to send to the API endpoint + + for the get cluster service account kubeconfig operation. + + Typically these are written to a http.Request. +*/ +type GetClusterServiceAccountKubeconfigParams struct { + + // ClusterID. + ClusterID string + + // Namespace. + Namespace string + + // ProjectID. + ProjectID string + + // ServiceAccountID. + ServiceAccountID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the get cluster service account kubeconfig params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetClusterServiceAccountKubeconfigParams) WithDefaults() *GetClusterServiceAccountKubeconfigParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get cluster service account kubeconfig params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetClusterServiceAccountKubeconfigParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the get cluster service account kubeconfig params +func (o *GetClusterServiceAccountKubeconfigParams) WithTimeout(timeout time.Duration) *GetClusterServiceAccountKubeconfigParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the get cluster service account kubeconfig params +func (o *GetClusterServiceAccountKubeconfigParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the get cluster service account kubeconfig params +func (o *GetClusterServiceAccountKubeconfigParams) WithContext(ctx context.Context) *GetClusterServiceAccountKubeconfigParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the get cluster service account kubeconfig params +func (o *GetClusterServiceAccountKubeconfigParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the get cluster service account kubeconfig params +func (o *GetClusterServiceAccountKubeconfigParams) WithHTTPClient(client *http.Client) *GetClusterServiceAccountKubeconfigParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the get cluster service account kubeconfig params +func (o *GetClusterServiceAccountKubeconfigParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithClusterID adds the clusterID to the get cluster service account kubeconfig params +func (o *GetClusterServiceAccountKubeconfigParams) WithClusterID(clusterID string) *GetClusterServiceAccountKubeconfigParams { + o.SetClusterID(clusterID) + return o +} + +// SetClusterID adds the clusterId to the get cluster service account kubeconfig params +func (o *GetClusterServiceAccountKubeconfigParams) SetClusterID(clusterID string) { + o.ClusterID = clusterID +} + +// WithNamespace adds the namespace to the get cluster service account kubeconfig params +func (o *GetClusterServiceAccountKubeconfigParams) WithNamespace(namespace string) *GetClusterServiceAccountKubeconfigParams { + o.SetNamespace(namespace) + return o +} + +// SetNamespace adds the namespace to the get cluster service account kubeconfig params +func (o *GetClusterServiceAccountKubeconfigParams) SetNamespace(namespace string) { + o.Namespace = namespace +} + +// WithProjectID adds the projectID to the get cluster service account kubeconfig params +func (o *GetClusterServiceAccountKubeconfigParams) WithProjectID(projectID string) *GetClusterServiceAccountKubeconfigParams { + o.SetProjectID(projectID) + return o +} + +// SetProjectID adds the projectId to the get cluster service account kubeconfig params +func (o *GetClusterServiceAccountKubeconfigParams) SetProjectID(projectID string) { + o.ProjectID = projectID +} + +// WithServiceAccountID adds the serviceAccountID to the get cluster service account kubeconfig params +func (o *GetClusterServiceAccountKubeconfigParams) WithServiceAccountID(serviceAccountID string) *GetClusterServiceAccountKubeconfigParams { + o.SetServiceAccountID(serviceAccountID) + return o +} + +// SetServiceAccountID adds the serviceAccountId to the get cluster service account kubeconfig params +func (o *GetClusterServiceAccountKubeconfigParams) SetServiceAccountID(serviceAccountID string) { + o.ServiceAccountID = serviceAccountID +} + +// WriteToRequest writes these params to a swagger request +func (o *GetClusterServiceAccountKubeconfigParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param cluster_id + if err := r.SetPathParam("cluster_id", o.ClusterID); err != nil { + return err + } + + // path param namespace + if err := r.SetPathParam("namespace", o.Namespace); err != nil { + return err + } + + // path param project_id + if err := r.SetPathParam("project_id", o.ProjectID); err != nil { + return err + } + + // path param service_account_id + if err := r.SetPathParam("service_account_id", o.ServiceAccountID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/project/get_cluster_service_account_kubeconfig_responses.go b/client/project/get_cluster_service_account_kubeconfig_responses.go new file mode 100644 index 00000000..2ef73a26 --- /dev/null +++ b/client/project/get_cluster_service_account_kubeconfig_responses.go @@ -0,0 +1,289 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package project + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/kubermatic/go-kubermatic/models" +) + +// GetClusterServiceAccountKubeconfigReader is a Reader for the GetClusterServiceAccountKubeconfig structure. +type GetClusterServiceAccountKubeconfigReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *GetClusterServiceAccountKubeconfigReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewGetClusterServiceAccountKubeconfigOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 401: + result := NewGetClusterServiceAccountKubeconfigUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewGetClusterServiceAccountKubeconfigForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + result := NewGetClusterServiceAccountKubeconfigDefault(response.Code()) + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + if response.Code()/100 == 2 { + return result, nil + } + return nil, result + } +} + +// NewGetClusterServiceAccountKubeconfigOK creates a GetClusterServiceAccountKubeconfigOK with default headers values +func NewGetClusterServiceAccountKubeconfigOK() *GetClusterServiceAccountKubeconfigOK { + return &GetClusterServiceAccountKubeconfigOK{} +} + +/* +GetClusterServiceAccountKubeconfigOK describes a response with status code 200, with default header values. + +Kubeconfig is a clusters kubeconfig +*/ +type GetClusterServiceAccountKubeconfigOK struct { + Payload []uint8 +} + +// IsSuccess returns true when this get cluster service account kubeconfig o k response has a 2xx status code +func (o *GetClusterServiceAccountKubeconfigOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this get cluster service account kubeconfig o k response has a 3xx status code +func (o *GetClusterServiceAccountKubeconfigOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this get cluster service account kubeconfig o k response has a 4xx status code +func (o *GetClusterServiceAccountKubeconfigOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this get cluster service account kubeconfig o k response has a 5xx status code +func (o *GetClusterServiceAccountKubeconfigOK) IsServerError() bool { + return false +} + +// IsCode returns true when this get cluster service account kubeconfig o k response a status code equal to that given +func (o *GetClusterServiceAccountKubeconfigOK) IsCode(code int) bool { + return code == 200 +} + +func (o *GetClusterServiceAccountKubeconfigOK) Error() string { + return fmt.Sprintf("[GET /api/v2/projects/{project_id}/clusters/{cluster_id}/serviceaccount/{namespace}/{service_account_id}/kubeconfig][%d] getClusterServiceAccountKubeconfigOK %+v", 200, o.Payload) +} + +func (o *GetClusterServiceAccountKubeconfigOK) String() string { + return fmt.Sprintf("[GET /api/v2/projects/{project_id}/clusters/{cluster_id}/serviceaccount/{namespace}/{service_account_id}/kubeconfig][%d] getClusterServiceAccountKubeconfigOK %+v", 200, o.Payload) +} + +func (o *GetClusterServiceAccountKubeconfigOK) GetPayload() []uint8 { + return o.Payload +} + +func (o *GetClusterServiceAccountKubeconfigOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + // response payload + if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewGetClusterServiceAccountKubeconfigUnauthorized creates a GetClusterServiceAccountKubeconfigUnauthorized with default headers values +func NewGetClusterServiceAccountKubeconfigUnauthorized() *GetClusterServiceAccountKubeconfigUnauthorized { + return &GetClusterServiceAccountKubeconfigUnauthorized{} +} + +/* +GetClusterServiceAccountKubeconfigUnauthorized describes a response with status code 401, with default header values. + +EmptyResponse is a empty response +*/ +type GetClusterServiceAccountKubeconfigUnauthorized struct { +} + +// IsSuccess returns true when this get cluster service account kubeconfig unauthorized response has a 2xx status code +func (o *GetClusterServiceAccountKubeconfigUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this get cluster service account kubeconfig unauthorized response has a 3xx status code +func (o *GetClusterServiceAccountKubeconfigUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this get cluster service account kubeconfig unauthorized response has a 4xx status code +func (o *GetClusterServiceAccountKubeconfigUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this get cluster service account kubeconfig unauthorized response has a 5xx status code +func (o *GetClusterServiceAccountKubeconfigUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this get cluster service account kubeconfig unauthorized response a status code equal to that given +func (o *GetClusterServiceAccountKubeconfigUnauthorized) IsCode(code int) bool { + return code == 401 +} + +func (o *GetClusterServiceAccountKubeconfigUnauthorized) Error() string { + return fmt.Sprintf("[GET /api/v2/projects/{project_id}/clusters/{cluster_id}/serviceaccount/{namespace}/{service_account_id}/kubeconfig][%d] getClusterServiceAccountKubeconfigUnauthorized ", 401) +} + +func (o *GetClusterServiceAccountKubeconfigUnauthorized) String() string { + return fmt.Sprintf("[GET /api/v2/projects/{project_id}/clusters/{cluster_id}/serviceaccount/{namespace}/{service_account_id}/kubeconfig][%d] getClusterServiceAccountKubeconfigUnauthorized ", 401) +} + +func (o *GetClusterServiceAccountKubeconfigUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewGetClusterServiceAccountKubeconfigForbidden creates a GetClusterServiceAccountKubeconfigForbidden with default headers values +func NewGetClusterServiceAccountKubeconfigForbidden() *GetClusterServiceAccountKubeconfigForbidden { + return &GetClusterServiceAccountKubeconfigForbidden{} +} + +/* +GetClusterServiceAccountKubeconfigForbidden describes a response with status code 403, with default header values. + +EmptyResponse is a empty response +*/ +type GetClusterServiceAccountKubeconfigForbidden struct { +} + +// IsSuccess returns true when this get cluster service account kubeconfig forbidden response has a 2xx status code +func (o *GetClusterServiceAccountKubeconfigForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this get cluster service account kubeconfig forbidden response has a 3xx status code +func (o *GetClusterServiceAccountKubeconfigForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this get cluster service account kubeconfig forbidden response has a 4xx status code +func (o *GetClusterServiceAccountKubeconfigForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this get cluster service account kubeconfig forbidden response has a 5xx status code +func (o *GetClusterServiceAccountKubeconfigForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this get cluster service account kubeconfig forbidden response a status code equal to that given +func (o *GetClusterServiceAccountKubeconfigForbidden) IsCode(code int) bool { + return code == 403 +} + +func (o *GetClusterServiceAccountKubeconfigForbidden) Error() string { + return fmt.Sprintf("[GET /api/v2/projects/{project_id}/clusters/{cluster_id}/serviceaccount/{namespace}/{service_account_id}/kubeconfig][%d] getClusterServiceAccountKubeconfigForbidden ", 403) +} + +func (o *GetClusterServiceAccountKubeconfigForbidden) String() string { + return fmt.Sprintf("[GET /api/v2/projects/{project_id}/clusters/{cluster_id}/serviceaccount/{namespace}/{service_account_id}/kubeconfig][%d] getClusterServiceAccountKubeconfigForbidden ", 403) +} + +func (o *GetClusterServiceAccountKubeconfigForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewGetClusterServiceAccountKubeconfigDefault creates a GetClusterServiceAccountKubeconfigDefault with default headers values +func NewGetClusterServiceAccountKubeconfigDefault(code int) *GetClusterServiceAccountKubeconfigDefault { + return &GetClusterServiceAccountKubeconfigDefault{ + _statusCode: code, + } +} + +/* +GetClusterServiceAccountKubeconfigDefault describes a response with status code -1, with default header values. + +errorResponse +*/ +type GetClusterServiceAccountKubeconfigDefault struct { + _statusCode int + + Payload *models.ErrorResponse +} + +// Code gets the status code for the get cluster service account kubeconfig default response +func (o *GetClusterServiceAccountKubeconfigDefault) Code() int { + return o._statusCode +} + +// IsSuccess returns true when this get cluster service account kubeconfig default response has a 2xx status code +func (o *GetClusterServiceAccountKubeconfigDefault) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this get cluster service account kubeconfig default response has a 3xx status code +func (o *GetClusterServiceAccountKubeconfigDefault) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this get cluster service account kubeconfig default response has a 4xx status code +func (o *GetClusterServiceAccountKubeconfigDefault) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this get cluster service account kubeconfig default response has a 5xx status code +func (o *GetClusterServiceAccountKubeconfigDefault) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this get cluster service account kubeconfig default response a status code equal to that given +func (o *GetClusterServiceAccountKubeconfigDefault) IsCode(code int) bool { + return o._statusCode == code +} + +func (o *GetClusterServiceAccountKubeconfigDefault) Error() string { + return fmt.Sprintf("[GET /api/v2/projects/{project_id}/clusters/{cluster_id}/serviceaccount/{namespace}/{service_account_id}/kubeconfig][%d] getClusterServiceAccountKubeconfig default %+v", o._statusCode, o.Payload) +} + +func (o *GetClusterServiceAccountKubeconfigDefault) String() string { + return fmt.Sprintf("[GET /api/v2/projects/{project_id}/clusters/{cluster_id}/serviceaccount/{namespace}/{service_account_id}/kubeconfig][%d] getClusterServiceAccountKubeconfig default %+v", o._statusCode, o.Payload) +} + +func (o *GetClusterServiceAccountKubeconfigDefault) GetPayload() *models.ErrorResponse { + return o.Payload +} + +func (o *GetClusterServiceAccountKubeconfigDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.ErrorResponse) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/client/project/list_cluster_service_account_parameters.go b/client/project/list_cluster_service_account_parameters.go new file mode 100644 index 00000000..c9ac321d --- /dev/null +++ b/client/project/list_cluster_service_account_parameters.go @@ -0,0 +1,167 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package project + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// NewListClusterServiceAccountParams creates a new ListClusterServiceAccountParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewListClusterServiceAccountParams() *ListClusterServiceAccountParams { + return &ListClusterServiceAccountParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewListClusterServiceAccountParamsWithTimeout creates a new ListClusterServiceAccountParams object +// with the ability to set a timeout on a request. +func NewListClusterServiceAccountParamsWithTimeout(timeout time.Duration) *ListClusterServiceAccountParams { + return &ListClusterServiceAccountParams{ + timeout: timeout, + } +} + +// NewListClusterServiceAccountParamsWithContext creates a new ListClusterServiceAccountParams object +// with the ability to set a context for a request. +func NewListClusterServiceAccountParamsWithContext(ctx context.Context) *ListClusterServiceAccountParams { + return &ListClusterServiceAccountParams{ + Context: ctx, + } +} + +// NewListClusterServiceAccountParamsWithHTTPClient creates a new ListClusterServiceAccountParams object +// with the ability to set a custom HTTPClient for a request. +func NewListClusterServiceAccountParamsWithHTTPClient(client *http.Client) *ListClusterServiceAccountParams { + return &ListClusterServiceAccountParams{ + HTTPClient: client, + } +} + +/* +ListClusterServiceAccountParams contains all the parameters to send to the API endpoint + + for the list cluster service account operation. + + Typically these are written to a http.Request. +*/ +type ListClusterServiceAccountParams struct { + + // ClusterID. + ClusterID string + + // ProjectID. + ProjectID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the list cluster service account params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ListClusterServiceAccountParams) WithDefaults() *ListClusterServiceAccountParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the list cluster service account params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ListClusterServiceAccountParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the list cluster service account params +func (o *ListClusterServiceAccountParams) WithTimeout(timeout time.Duration) *ListClusterServiceAccountParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the list cluster service account params +func (o *ListClusterServiceAccountParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the list cluster service account params +func (o *ListClusterServiceAccountParams) WithContext(ctx context.Context) *ListClusterServiceAccountParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the list cluster service account params +func (o *ListClusterServiceAccountParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the list cluster service account params +func (o *ListClusterServiceAccountParams) WithHTTPClient(client *http.Client) *ListClusterServiceAccountParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the list cluster service account params +func (o *ListClusterServiceAccountParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithClusterID adds the clusterID to the list cluster service account params +func (o *ListClusterServiceAccountParams) WithClusterID(clusterID string) *ListClusterServiceAccountParams { + o.SetClusterID(clusterID) + return o +} + +// SetClusterID adds the clusterId to the list cluster service account params +func (o *ListClusterServiceAccountParams) SetClusterID(clusterID string) { + o.ClusterID = clusterID +} + +// WithProjectID adds the projectID to the list cluster service account params +func (o *ListClusterServiceAccountParams) WithProjectID(projectID string) *ListClusterServiceAccountParams { + o.SetProjectID(projectID) + return o +} + +// SetProjectID adds the projectId to the list cluster service account params +func (o *ListClusterServiceAccountParams) SetProjectID(projectID string) { + o.ProjectID = projectID +} + +// WriteToRequest writes these params to a swagger request +func (o *ListClusterServiceAccountParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param cluster_id + if err := r.SetPathParam("cluster_id", o.ClusterID); err != nil { + return err + } + + // path param project_id + if err := r.SetPathParam("project_id", o.ProjectID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/project/list_cluster_service_account_responses.go b/client/project/list_cluster_service_account_responses.go new file mode 100644 index 00000000..9e5a881b --- /dev/null +++ b/client/project/list_cluster_service_account_responses.go @@ -0,0 +1,289 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package project + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/kubermatic/go-kubermatic/models" +) + +// ListClusterServiceAccountReader is a Reader for the ListClusterServiceAccount structure. +type ListClusterServiceAccountReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *ListClusterServiceAccountReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewListClusterServiceAccountOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 401: + result := NewListClusterServiceAccountUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewListClusterServiceAccountForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + result := NewListClusterServiceAccountDefault(response.Code()) + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + if response.Code()/100 == 2 { + return result, nil + } + return nil, result + } +} + +// NewListClusterServiceAccountOK creates a ListClusterServiceAccountOK with default headers values +func NewListClusterServiceAccountOK() *ListClusterServiceAccountOK { + return &ListClusterServiceAccountOK{} +} + +/* +ListClusterServiceAccountOK describes a response with status code 200, with default header values. + +ClusterServiceAccount +*/ +type ListClusterServiceAccountOK struct { + Payload []*models.ClusterServiceAccount +} + +// IsSuccess returns true when this list cluster service account o k response has a 2xx status code +func (o *ListClusterServiceAccountOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this list cluster service account o k response has a 3xx status code +func (o *ListClusterServiceAccountOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this list cluster service account o k response has a 4xx status code +func (o *ListClusterServiceAccountOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this list cluster service account o k response has a 5xx status code +func (o *ListClusterServiceAccountOK) IsServerError() bool { + return false +} + +// IsCode returns true when this list cluster service account o k response a status code equal to that given +func (o *ListClusterServiceAccountOK) IsCode(code int) bool { + return code == 200 +} + +func (o *ListClusterServiceAccountOK) Error() string { + return fmt.Sprintf("[GET /api/v2/projects/{project_id}/clusters/{cluster_id}/serviceaccount][%d] listClusterServiceAccountOK %+v", 200, o.Payload) +} + +func (o *ListClusterServiceAccountOK) String() string { + return fmt.Sprintf("[GET /api/v2/projects/{project_id}/clusters/{cluster_id}/serviceaccount][%d] listClusterServiceAccountOK %+v", 200, o.Payload) +} + +func (o *ListClusterServiceAccountOK) GetPayload() []*models.ClusterServiceAccount { + return o.Payload +} + +func (o *ListClusterServiceAccountOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + // response payload + if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewListClusterServiceAccountUnauthorized creates a ListClusterServiceAccountUnauthorized with default headers values +func NewListClusterServiceAccountUnauthorized() *ListClusterServiceAccountUnauthorized { + return &ListClusterServiceAccountUnauthorized{} +} + +/* +ListClusterServiceAccountUnauthorized describes a response with status code 401, with default header values. + +EmptyResponse is a empty response +*/ +type ListClusterServiceAccountUnauthorized struct { +} + +// IsSuccess returns true when this list cluster service account unauthorized response has a 2xx status code +func (o *ListClusterServiceAccountUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this list cluster service account unauthorized response has a 3xx status code +func (o *ListClusterServiceAccountUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this list cluster service account unauthorized response has a 4xx status code +func (o *ListClusterServiceAccountUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this list cluster service account unauthorized response has a 5xx status code +func (o *ListClusterServiceAccountUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this list cluster service account unauthorized response a status code equal to that given +func (o *ListClusterServiceAccountUnauthorized) IsCode(code int) bool { + return code == 401 +} + +func (o *ListClusterServiceAccountUnauthorized) Error() string { + return fmt.Sprintf("[GET /api/v2/projects/{project_id}/clusters/{cluster_id}/serviceaccount][%d] listClusterServiceAccountUnauthorized ", 401) +} + +func (o *ListClusterServiceAccountUnauthorized) String() string { + return fmt.Sprintf("[GET /api/v2/projects/{project_id}/clusters/{cluster_id}/serviceaccount][%d] listClusterServiceAccountUnauthorized ", 401) +} + +func (o *ListClusterServiceAccountUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewListClusterServiceAccountForbidden creates a ListClusterServiceAccountForbidden with default headers values +func NewListClusterServiceAccountForbidden() *ListClusterServiceAccountForbidden { + return &ListClusterServiceAccountForbidden{} +} + +/* +ListClusterServiceAccountForbidden describes a response with status code 403, with default header values. + +EmptyResponse is a empty response +*/ +type ListClusterServiceAccountForbidden struct { +} + +// IsSuccess returns true when this list cluster service account forbidden response has a 2xx status code +func (o *ListClusterServiceAccountForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this list cluster service account forbidden response has a 3xx status code +func (o *ListClusterServiceAccountForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this list cluster service account forbidden response has a 4xx status code +func (o *ListClusterServiceAccountForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this list cluster service account forbidden response has a 5xx status code +func (o *ListClusterServiceAccountForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this list cluster service account forbidden response a status code equal to that given +func (o *ListClusterServiceAccountForbidden) IsCode(code int) bool { + return code == 403 +} + +func (o *ListClusterServiceAccountForbidden) Error() string { + return fmt.Sprintf("[GET /api/v2/projects/{project_id}/clusters/{cluster_id}/serviceaccount][%d] listClusterServiceAccountForbidden ", 403) +} + +func (o *ListClusterServiceAccountForbidden) String() string { + return fmt.Sprintf("[GET /api/v2/projects/{project_id}/clusters/{cluster_id}/serviceaccount][%d] listClusterServiceAccountForbidden ", 403) +} + +func (o *ListClusterServiceAccountForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewListClusterServiceAccountDefault creates a ListClusterServiceAccountDefault with default headers values +func NewListClusterServiceAccountDefault(code int) *ListClusterServiceAccountDefault { + return &ListClusterServiceAccountDefault{ + _statusCode: code, + } +} + +/* +ListClusterServiceAccountDefault describes a response with status code -1, with default header values. + +errorResponse +*/ +type ListClusterServiceAccountDefault struct { + _statusCode int + + Payload *models.ErrorResponse +} + +// Code gets the status code for the list cluster service account default response +func (o *ListClusterServiceAccountDefault) Code() int { + return o._statusCode +} + +// IsSuccess returns true when this list cluster service account default response has a 2xx status code +func (o *ListClusterServiceAccountDefault) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this list cluster service account default response has a 3xx status code +func (o *ListClusterServiceAccountDefault) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this list cluster service account default response has a 4xx status code +func (o *ListClusterServiceAccountDefault) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this list cluster service account default response has a 5xx status code +func (o *ListClusterServiceAccountDefault) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this list cluster service account default response a status code equal to that given +func (o *ListClusterServiceAccountDefault) IsCode(code int) bool { + return o._statusCode == code +} + +func (o *ListClusterServiceAccountDefault) Error() string { + return fmt.Sprintf("[GET /api/v2/projects/{project_id}/clusters/{cluster_id}/serviceaccount][%d] listClusterServiceAccount default %+v", o._statusCode, o.Payload) +} + +func (o *ListClusterServiceAccountDefault) String() string { + return fmt.Sprintf("[GET /api/v2/projects/{project_id}/clusters/{cluster_id}/serviceaccount][%d] listClusterServiceAccount default %+v", o._statusCode, o.Payload) +} + +func (o *ListClusterServiceAccountDefault) GetPayload() *models.ErrorResponse { + return o.Payload +} + +func (o *ListClusterServiceAccountDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.ErrorResponse) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/client/project/project_client.go b/client/project/project_client.go index 7f4f496f..db445093 100644 --- a/client/project/project_client.go +++ b/client/project/project_client.go @@ -44,6 +44,8 @@ type ClientService interface { CreateClusterRole(params *CreateClusterRoleParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*CreateClusterRoleCreated, error) + CreateClusterServiceAccount(params *CreateClusterServiceAccountParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*CreateClusterServiceAccountCreated, error) + CreateClusterTemplate(params *CreateClusterTemplateParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*CreateClusterTemplateCreated, error) CreateClusterTemplateInstance(params *CreateClusterTemplateInstanceParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*CreateClusterTemplateInstanceCreated, error) @@ -74,6 +76,8 @@ type ClientService interface { DeleteClusterRole(params *DeleteClusterRoleParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeleteClusterRoleOK, error) + DeleteClusterServiceAccount(params *DeleteClusterServiceAccountParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeleteClusterServiceAccountOK, error) + DeleteClusterTemplate(params *DeleteClusterTemplateParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeleteClusterTemplateOK, error) DeleteClusterV2(params *DeleteClusterV2Params, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeleteClusterV2OK, error) @@ -134,6 +138,8 @@ type ClientService interface { GetClusterRole(params *GetClusterRoleParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetClusterRoleOK, error) + GetClusterServiceAccountKubeconfig(params *GetClusterServiceAccountKubeconfigParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetClusterServiceAccountKubeconfigOK, error) + GetClusterTemplate(params *GetClusterTemplateParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetClusterTemplateOK, error) GetClusterUpgrades(params *GetClusterUpgradesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetClusterUpgradesOK, error) @@ -194,6 +200,8 @@ type ClientService interface { ListClusterRoleV2(params *ListClusterRoleV2Params, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ListClusterRoleV2OK, error) + ListClusterServiceAccount(params *ListClusterServiceAccountParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ListClusterServiceAccountOK, error) + ListClusterTemplates(params *ListClusterTemplatesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ListClusterTemplatesOK, error) ListClusters(params *ListClustersParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ListClustersOK, error) @@ -623,6 +631,44 @@ func (a *Client) CreateClusterRole(params *CreateClusterRoleParams, authInfo run return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) } +/* +CreateClusterServiceAccount creates a service account in cluster +*/ +func (a *Client) CreateClusterServiceAccount(params *CreateClusterServiceAccountParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*CreateClusterServiceAccountCreated, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewCreateClusterServiceAccountParams() + } + op := &runtime.ClientOperation{ + ID: "createClusterServiceAccount", + Method: "POST", + PathPattern: "/api/v2/projects/{project_id}/clusters/{cluster_id}/serviceaccount", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"https"}, + Params: params, + Reader: &CreateClusterServiceAccountReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*CreateClusterServiceAccountCreated) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*CreateClusterServiceAccountDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + /* CreateClusterTemplate creates a cluster templates for the given project */ @@ -1195,6 +1241,44 @@ func (a *Client) DeleteClusterRole(params *DeleteClusterRoleParams, authInfo run return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) } +/* +DeleteClusterServiceAccount deletes service account in cluster +*/ +func (a *Client) DeleteClusterServiceAccount(params *DeleteClusterServiceAccountParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeleteClusterServiceAccountOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewDeleteClusterServiceAccountParams() + } + op := &runtime.ClientOperation{ + ID: "deleteClusterServiceAccount", + Method: "DELETE", + PathPattern: "/api/v2/projects/{project_id}/clusters/{cluster_id}/serviceaccount/{namespace}/{service_account_id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"https"}, + Params: params, + Reader: &DeleteClusterServiceAccountReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*DeleteClusterServiceAccountOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*DeleteClusterServiceAccountDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + /* DeleteClusterTemplate deletes cluster template */ @@ -2337,6 +2421,44 @@ func (a *Client) GetClusterRole(params *GetClusterRoleParams, authInfo runtime.C return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) } +/* +GetClusterServiceAccountKubeconfig gets the kubeconfig for the specified service account in cluster +*/ +func (a *Client) GetClusterServiceAccountKubeconfig(params *GetClusterServiceAccountKubeconfigParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetClusterServiceAccountKubeconfigOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewGetClusterServiceAccountKubeconfigParams() + } + op := &runtime.ClientOperation{ + ID: "getClusterServiceAccountKubeconfig", + Method: "GET", + PathPattern: "/api/v2/projects/{project_id}/clusters/{cluster_id}/serviceaccount/{namespace}/{service_account_id}/kubeconfig", + ProducesMediaTypes: []string{"application/octet-stream"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"https"}, + Params: params, + Reader: &GetClusterServiceAccountKubeconfigReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*GetClusterServiceAccountKubeconfigOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*GetClusterServiceAccountKubeconfigDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + /* GetClusterTemplate gets cluster template */ @@ -3477,6 +3599,44 @@ func (a *Client) ListClusterRoleV2(params *ListClusterRoleV2Params, authInfo run return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) } +/* +ListClusterServiceAccount lists service accounts in cluster +*/ +func (a *Client) ListClusterServiceAccount(params *ListClusterServiceAccountParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ListClusterServiceAccountOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewListClusterServiceAccountParams() + } + op := &runtime.ClientOperation{ + ID: "listClusterServiceAccount", + Method: "GET", + PathPattern: "/api/v2/projects/{project_id}/clusters/{cluster_id}/serviceaccount", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"https"}, + Params: params, + Reader: &ListClusterServiceAccountReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*ListClusterServiceAccountOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*ListClusterServiceAccountDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + /* ListClusterTemplates lists cluster templates for the given project */ diff --git a/models/cluster_service_account.go b/models/cluster_service_account.go new file mode 100644 index 00000000..10e3a2c3 --- /dev/null +++ b/models/cluster_service_account.go @@ -0,0 +1,106 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// ClusterServiceAccount ClusterServiceAccount represent a k8s service account to access cluster. +// +// swagger:model ClusterServiceAccount +type ClusterServiceAccount struct { + + // Annotations that can be added to the resource + Annotations map[string]string `json:"annotations,omitempty"` + + // CreationTimestamp is a timestamp representing the server time when this object was created. + // Format: date-time + CreationTimestamp strfmt.DateTime `json:"creationTimestamp,omitempty"` + + // DeletionTimestamp is a timestamp representing the server time when this object was deleted. + // Format: date-time + DeletionTimestamp strfmt.DateTime `json:"deletionTimestamp,omitempty"` + + // ID unique value that identifies the resource generated by the server. Read-Only. + ID string `json:"id,omitempty"` + + // Name represents human readable name for the resource + Name string `json:"name,omitempty"` + + // namespace + Namespace string `json:"namespace,omitempty"` +} + +// Validate validates this cluster service account +func (m *ClusterServiceAccount) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateCreationTimestamp(formats); err != nil { + res = append(res, err) + } + + if err := m.validateDeletionTimestamp(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *ClusterServiceAccount) validateCreationTimestamp(formats strfmt.Registry) error { + if swag.IsZero(m.CreationTimestamp) { // not required + return nil + } + + if err := validate.FormatOf("creationTimestamp", "body", "date-time", m.CreationTimestamp.String(), formats); err != nil { + return err + } + + return nil +} + +func (m *ClusterServiceAccount) validateDeletionTimestamp(formats strfmt.Registry) error { + if swag.IsZero(m.DeletionTimestamp) { // not required + return nil + } + + if err := validate.FormatOf("deletionTimestamp", "body", "date-time", m.DeletionTimestamp.String(), formats); err != nil { + return err + } + + return nil +} + +// ContextValidate validates this cluster service account based on context it is used +func (m *ClusterServiceAccount) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *ClusterServiceAccount) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *ClusterServiceAccount) UnmarshalBinary(b []byte) error { + var res ClusterServiceAccount + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +}