diff --git a/dcos/client.go b/dcos/client.go index 83d699a..1dfd458 100644 --- a/dcos/client.go +++ b/dcos/client.go @@ -3,13 +3,28 @@ package dcos import ( "fmt" "net/http" + "net/url" + + secretsclient "github.com/dcos/client-go/dcos/secrets/client" + + cosmosclient "github.com/dcos/client-go/dcos/cosmos/client" + + iamclient "github.com/dcos/client-go/dcos/iam/client" + iamlogin "github.com/dcos/client-go/dcos/iam/client/login" + iammodels "github.com/dcos/client-go/dcos/iam/models" + + "github.com/go-openapi/runtime" + runtimeClient "github.com/go-openapi/runtime/client" ) // Client is a client for DC/OS. type Client struct { HTTPClient *http.Client Config *Config - UserAgent string + + IAM *iamclient.IdentityAndAccessManagement + Secrets *secretsclient.DCOSSecrets + Cosmos *cosmosclient.Cosmos } // NewClient returns a Client which will detect its Config through the well @@ -38,9 +53,102 @@ func NewClientWithOptions(httpClient *http.Client, config *Config) (*Client, err return nil, fmt.Errorf("config cannot be nil") } + iamClient, err := newIamClient(config.URL(), httpClient) + if err != nil { + return nil, fmt.Errorf("could not create IAM client: %s", err) + } + + secretsClient, err := newSecretsClient(config.URL(), httpClient) + if err != nil { + return nil, fmt.Errorf("could not create Secrets client: %s", err) + } + + cosmosClient, err := newCosmosClient(config.URL(), httpClient) + if err != nil { + return nil, fmt.Errorf("could not create Cosmos client: %s", err) + } + return &Client{ HTTPClient: httpClient, Config: config, - UserAgent: fmt.Sprintf("%s(%s)", ClientName, Version), + IAM: iamClient, + Secrets: secretsClient, + Cosmos: cosmosClient, }, nil } + +// Login uses the IAM client to create a new authentication token for the given +// username and password +func (c *Client) Login(username, password string) (string, error) { + loginObject := &iammodels.LoginObject{UID: username, Password: password} + params := iamlogin.NewPostAuthLoginParams().WithLoginObject(loginObject) + + result, err := c.IAM.Login.PostAuthLogin(params) + if err != nil { + return "", err + } + + return *result.Payload.Token, nil +} + +func newIamClient(clusterURL string, client *http.Client) (*iamclient.IdentityAndAccessManagement, error) { + dcosURL, err := url.Parse(clusterURL) + if err != nil { + return nil, fmt.Errorf("Invalid DC/OS cluster URL '%s': %v", clusterURL, err) + } + + iamRuntime := runtimeClient.NewWithClient( + dcosURL.Host, + iamclient.DefaultBasePath, + []string{dcosURL.Scheme}, + client, + ) + + return iamclient.New(iamRuntime, nil), nil +} + +func newSecretsClient(clusterURL string, client *http.Client) (*secretsclient.DCOSSecrets, error) { + dcosURL, err := url.Parse(clusterURL) + if err != nil { + return nil, fmt.Errorf("Invalid DC/OS cluster URL '%s': %v", clusterURL, err) + } + + secretsRuntime := runtimeClient.NewWithClient( + dcosURL.Host, + secretsclient.DefaultBasePath, + []string{dcosURL.Scheme}, + client, + ) + + return secretsclient.New(secretsRuntime, nil), nil +} + +func newCosmosClient(clusterURL string, client *http.Client) (*cosmosclient.Cosmos, error) { + dcosURL, err := url.Parse(clusterURL) + if err != nil { + return nil, fmt.Errorf("Invalid DC/OS cluster URL '%s': %v", clusterURL, err) + } + + cosmosRuntime := runtimeClient.NewWithClient( + dcosURL.Host, + cosmosclient.DefaultBasePath, + []string{dcosURL.Scheme}, + client, + ) + + cosmosRuntime.Consumers["application/vnd.dcos.package.install-response+json"] = cosmosRuntime.Consumers[runtime.JSONMime] + cosmosRuntime.Producers["application/vnd.dcos.package.install-request+json;charset=utf-8;version=v1"] = cosmosRuntime.Producers[runtime.JSONMime] + cosmosRuntime.Consumers["application/vnd.dcos.package.uninstall-response+json"] = cosmosRuntime.Consumers[runtime.JSONMime] + cosmosRuntime.Producers["application/vnd.dcos.package.uninstall-request+json;charset=utf-8;version=v1"] = cosmosRuntime.Producers[runtime.JSONMime] + cosmosRuntime.Consumers["application/vnd.dcos.package.error+json"] = cosmosRuntime.Consumers[runtime.JSONMime] + cosmosRuntime.Consumers["application/vnd.dcos.service.update-response+json"] = cosmosRuntime.Consumers[runtime.JSONMime] + cosmosRuntime.Producers["application/vnd.dcos.service.update-request+json;charset=utf-8;version=v1"] = cosmosRuntime.Producers[runtime.JSONMime] + cosmosRuntime.Consumers["application/vnd.dcos.package.repository.add-response+json"] = cosmosRuntime.Consumers[runtime.JSONMime] + cosmosRuntime.Producers["application/vnd.dcos.package.repository.add-request+json;charset=utf-8;version=v1"] = cosmosRuntime.Producers[runtime.JSONMime] + cosmosRuntime.Consumers["application/vnd.dcos.package.repository.delete-response+json"] = cosmosRuntime.Consumers[runtime.JSONMime] + cosmosRuntime.Producers["application/vnd.dcos.package.repository.delete-request+json;charset=utf-8;version=v1"] = cosmosRuntime.Producers[runtime.JSONMime] + cosmosRuntime.Consumers["application/vnd.dcos.service.describe-response+json"] = cosmosRuntime.Consumers[runtime.JSONMime] + cosmosRuntime.Producers["application/vnd.dcos.service.describe-request+json;charset=utf-8;version=v1"] = cosmosRuntime.Producers[runtime.JSONMime] + + return cosmosclient.New(cosmosRuntime, nil), nil +} diff --git a/dcos/cosmos/client/cosmos_client.go b/dcos/cosmos/client/cosmos_client.go new file mode 100644 index 0000000..fc5530e --- /dev/null +++ b/dcos/cosmos/client/cosmos_client.go @@ -0,0 +1,117 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package client + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "github.com/go-openapi/runtime" + httptransport "github.com/go-openapi/runtime/client" + + strfmt "github.com/go-openapi/strfmt" + + "github.com/dcos/client-go/dcos/cosmos/client/operations" +) + +// Default cosmos HTTP client. +var Default = NewHTTPClient(nil) + +const ( + // DefaultHost is the default Host + // found in Meta (info) section of spec file + DefaultHost string = "localhost" + // DefaultBasePath is the default BasePath + // found in Meta (info) section of spec file + DefaultBasePath string = "/" +) + +// DefaultSchemes are the default schemes found in Meta (info) section of spec file +var DefaultSchemes = []string{"https"} + +// NewHTTPClient creates a new cosmos HTTP client. +func NewHTTPClient(formats strfmt.Registry) *Cosmos { + return NewHTTPClientWithConfig(formats, nil) +} + +// NewHTTPClientWithConfig creates a new cosmos HTTP client, +// using a customizable transport config. +func NewHTTPClientWithConfig(formats strfmt.Registry, cfg *TransportConfig) *Cosmos { + // ensure nullable parameters have default + if cfg == nil { + cfg = DefaultTransportConfig() + } + + // create transport and client + transport := httptransport.New(cfg.Host, cfg.BasePath, cfg.Schemes) + return New(transport, formats) +} + +// New creates a new cosmos client +func New(transport runtime.ClientTransport, formats strfmt.Registry) *Cosmos { + // ensure nullable parameters have default + if formats == nil { + formats = strfmt.Default + } + + cli := new(Cosmos) + cli.Transport = transport + + cli.Operations = operations.New(transport, formats) + + return cli +} + +// DefaultTransportConfig creates a TransportConfig with the +// default settings taken from the meta section of the spec file. +func DefaultTransportConfig() *TransportConfig { + return &TransportConfig{ + Host: DefaultHost, + BasePath: DefaultBasePath, + Schemes: DefaultSchemes, + } +} + +// TransportConfig contains the transport related info, +// found in the meta section of the spec file. +type TransportConfig struct { + Host string + BasePath string + Schemes []string +} + +// WithHost overrides the default host, +// provided by the meta section of the spec file. +func (cfg *TransportConfig) WithHost(host string) *TransportConfig { + cfg.Host = host + return cfg +} + +// WithBasePath overrides the default basePath, +// provided by the meta section of the spec file. +func (cfg *TransportConfig) WithBasePath(basePath string) *TransportConfig { + cfg.BasePath = basePath + return cfg +} + +// WithSchemes overrides the default schemes, +// provided by the meta section of the spec file. +func (cfg *TransportConfig) WithSchemes(schemes []string) *TransportConfig { + cfg.Schemes = schemes + return cfg +} + +// Cosmos is a client for cosmos +type Cosmos struct { + Operations *operations.Client + + Transport runtime.ClientTransport +} + +// SetTransport changes the transport on the client and all its subresources +func (c *Cosmos) SetTransport(transport runtime.ClientTransport) { + c.Transport = transport + + c.Operations.SetTransport(transport) + +} diff --git a/dcos/cosmos/client/operations/dcos_system_health_parameters.go b/dcos/cosmos/client/operations/dcos_system_health_parameters.go new file mode 100644 index 0000000..36ed967 --- /dev/null +++ b/dcos/cosmos/client/operations/dcos_system_health_parameters.go @@ -0,0 +1,113 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package operations + +// 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" + + strfmt "github.com/go-openapi/strfmt" +) + +// NewDCOSSystemHealthParams creates a new DCOSSystemHealthParams object +// with the default values initialized. +func NewDCOSSystemHealthParams() *DCOSSystemHealthParams { + + return &DCOSSystemHealthParams{ + + timeout: cr.DefaultTimeout, + } +} + +// NewDCOSSystemHealthParamsWithTimeout creates a new DCOSSystemHealthParams object +// with the default values initialized, and the ability to set a timeout on a request +func NewDCOSSystemHealthParamsWithTimeout(timeout time.Duration) *DCOSSystemHealthParams { + + return &DCOSSystemHealthParams{ + + timeout: timeout, + } +} + +// NewDCOSSystemHealthParamsWithContext creates a new DCOSSystemHealthParams object +// with the default values initialized, and the ability to set a context for a request +func NewDCOSSystemHealthParamsWithContext(ctx context.Context) *DCOSSystemHealthParams { + + return &DCOSSystemHealthParams{ + + Context: ctx, + } +} + +// NewDCOSSystemHealthParamsWithHTTPClient creates a new DCOSSystemHealthParams object +// with the default values initialized, and the ability to set a custom HTTPClient for a request +func NewDCOSSystemHealthParamsWithHTTPClient(client *http.Client) *DCOSSystemHealthParams { + + return &DCOSSystemHealthParams{ + HTTPClient: client, + } +} + +/*DCOSSystemHealthParams contains all the parameters to send to the API endpoint +for the dcos system health operation typically these are written to a http.Request +*/ +type DCOSSystemHealthParams struct { + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithTimeout adds the timeout to the dcos system health params +func (o *DCOSSystemHealthParams) WithTimeout(timeout time.Duration) *DCOSSystemHealthParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the dcos system health params +func (o *DCOSSystemHealthParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the dcos system health params +func (o *DCOSSystemHealthParams) WithContext(ctx context.Context) *DCOSSystemHealthParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the dcos system health params +func (o *DCOSSystemHealthParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the dcos system health params +func (o *DCOSSystemHealthParams) WithHTTPClient(client *http.Client) *DCOSSystemHealthParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the dcos system health params +func (o *DCOSSystemHealthParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WriteToRequest writes these params to a swagger request +func (o *DCOSSystemHealthParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/dcos/cosmos/client/operations/dcos_system_health_responses.go b/dcos/cosmos/client/operations/dcos_system_health_responses.go new file mode 100644 index 0000000..cf5948b --- /dev/null +++ b/dcos/cosmos/client/operations/dcos_system_health_responses.go @@ -0,0 +1,112 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package operations + +// 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" + + strfmt "github.com/go-openapi/strfmt" + + models "github.com/dcos/client-go/dcos/cosmos/models" +) + +// DCOSSystemHealthReader is a Reader for the DCOSSystemHealth structure. +type DCOSSystemHealthReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *DCOSSystemHealthReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + + case 200: + result := NewDCOSSystemHealthOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + + default: + result := NewDCOSSystemHealthDefault(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 + } +} + +// NewDCOSSystemHealthOK creates a DCOSSystemHealthOK with default headers values +func NewDCOSSystemHealthOK() *DCOSSystemHealthOK { + return &DCOSSystemHealthOK{} +} + +/*DCOSSystemHealthOK handles this case with default header values. + +System is healthy. +*/ +type DCOSSystemHealthOK struct { + Payload *models.SystemHealth +} + +func (o *DCOSSystemHealthOK) Error() string { + return fmt.Sprintf("[GET /system/health/v1][%d] dcosSystemHealthOK %+v", 200, o.Payload) +} + +func (o *DCOSSystemHealthOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.SystemHealth) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewDCOSSystemHealthDefault creates a DCOSSystemHealthDefault with default headers values +func NewDCOSSystemHealthDefault(code int) *DCOSSystemHealthDefault { + return &DCOSSystemHealthDefault{ + _statusCode: code, + } +} + +/*DCOSSystemHealthDefault handles this case with default header values. + +Unexpected error. +*/ +type DCOSSystemHealthDefault struct { + _statusCode int + + Payload *models.Error +} + +// Code gets the status code for the dcos system health default response +func (o *DCOSSystemHealthDefault) Code() int { + return o._statusCode +} + +func (o *DCOSSystemHealthDefault) Error() string { + return fmt.Sprintf("[GET /system/health/v1][%d] dcos-system-health default %+v", o._statusCode, o.Payload) +} + +func (o *DCOSSystemHealthDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Error) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/dcos/cosmos/client/operations/dcos_system_nodes_parameters.go b/dcos/cosmos/client/operations/dcos_system_nodes_parameters.go new file mode 100644 index 0000000..5c1ece0 --- /dev/null +++ b/dcos/cosmos/client/operations/dcos_system_nodes_parameters.go @@ -0,0 +1,113 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package operations + +// 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" + + strfmt "github.com/go-openapi/strfmt" +) + +// NewDCOSSystemNodesParams creates a new DCOSSystemNodesParams object +// with the default values initialized. +func NewDCOSSystemNodesParams() *DCOSSystemNodesParams { + + return &DCOSSystemNodesParams{ + + timeout: cr.DefaultTimeout, + } +} + +// NewDCOSSystemNodesParamsWithTimeout creates a new DCOSSystemNodesParams object +// with the default values initialized, and the ability to set a timeout on a request +func NewDCOSSystemNodesParamsWithTimeout(timeout time.Duration) *DCOSSystemNodesParams { + + return &DCOSSystemNodesParams{ + + timeout: timeout, + } +} + +// NewDCOSSystemNodesParamsWithContext creates a new DCOSSystemNodesParams object +// with the default values initialized, and the ability to set a context for a request +func NewDCOSSystemNodesParamsWithContext(ctx context.Context) *DCOSSystemNodesParams { + + return &DCOSSystemNodesParams{ + + Context: ctx, + } +} + +// NewDCOSSystemNodesParamsWithHTTPClient creates a new DCOSSystemNodesParams object +// with the default values initialized, and the ability to set a custom HTTPClient for a request +func NewDCOSSystemNodesParamsWithHTTPClient(client *http.Client) *DCOSSystemNodesParams { + + return &DCOSSystemNodesParams{ + HTTPClient: client, + } +} + +/*DCOSSystemNodesParams contains all the parameters to send to the API endpoint +for the dcos system nodes operation typically these are written to a http.Request +*/ +type DCOSSystemNodesParams struct { + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithTimeout adds the timeout to the dcos system nodes params +func (o *DCOSSystemNodesParams) WithTimeout(timeout time.Duration) *DCOSSystemNodesParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the dcos system nodes params +func (o *DCOSSystemNodesParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the dcos system nodes params +func (o *DCOSSystemNodesParams) WithContext(ctx context.Context) *DCOSSystemNodesParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the dcos system nodes params +func (o *DCOSSystemNodesParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the dcos system nodes params +func (o *DCOSSystemNodesParams) WithHTTPClient(client *http.Client) *DCOSSystemNodesParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the dcos system nodes params +func (o *DCOSSystemNodesParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WriteToRequest writes these params to a swagger request +func (o *DCOSSystemNodesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/dcos/cosmos/client/operations/dcos_system_nodes_responses.go b/dcos/cosmos/client/operations/dcos_system_nodes_responses.go new file mode 100644 index 0000000..3d328dd --- /dev/null +++ b/dcos/cosmos/client/operations/dcos_system_nodes_responses.go @@ -0,0 +1,112 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package operations + +// 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" + + strfmt "github.com/go-openapi/strfmt" + + models "github.com/dcos/client-go/dcos/cosmos/models" +) + +// DCOSSystemNodesReader is a Reader for the DCOSSystemNodes structure. +type DCOSSystemNodesReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *DCOSSystemNodesReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + + case 200: + result := NewDCOSSystemNodesOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + + default: + result := NewDCOSSystemNodesDefault(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 + } +} + +// NewDCOSSystemNodesOK creates a DCOSSystemNodesOK with default headers values +func NewDCOSSystemNodesOK() *DCOSSystemNodesOK { + return &DCOSSystemNodesOK{} +} + +/*DCOSSystemNodesOK handles this case with default header values. + +The nodes. +*/ +type DCOSSystemNodesOK struct { + Payload *models.SystemNodes +} + +func (o *DCOSSystemNodesOK) Error() string { + return fmt.Sprintf("[GET /system/health/v1/nodes][%d] dcosSystemNodesOK %+v", 200, o.Payload) +} + +func (o *DCOSSystemNodesOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.SystemNodes) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewDCOSSystemNodesDefault creates a DCOSSystemNodesDefault with default headers values +func NewDCOSSystemNodesDefault(code int) *DCOSSystemNodesDefault { + return &DCOSSystemNodesDefault{ + _statusCode: code, + } +} + +/*DCOSSystemNodesDefault handles this case with default header values. + +Unexpected error. +*/ +type DCOSSystemNodesDefault struct { + _statusCode int + + Payload *models.Error +} + +// Code gets the status code for the dcos system nodes default response +func (o *DCOSSystemNodesDefault) Code() int { + return o._statusCode +} + +func (o *DCOSSystemNodesDefault) Error() string { + return fmt.Sprintf("[GET /system/health/v1/nodes][%d] dcos-system-nodes default %+v", o._statusCode, o.Payload) +} + +func (o *DCOSSystemNodesDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Error) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/dcos/cosmos/client/operations/healthchech_service_parameters.go b/dcos/cosmos/client/operations/healthchech_service_parameters.go new file mode 100644 index 0000000..32452bf --- /dev/null +++ b/dcos/cosmos/client/operations/healthchech_service_parameters.go @@ -0,0 +1,133 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package operations + +// 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" + + strfmt "github.com/go-openapi/strfmt" +) + +// NewHealthchechServiceParams creates a new HealthchechServiceParams object +// with the default values initialized. +func NewHealthchechServiceParams() *HealthchechServiceParams { + var () + return &HealthchechServiceParams{ + + timeout: cr.DefaultTimeout, + } +} + +// NewHealthchechServiceParamsWithTimeout creates a new HealthchechServiceParams object +// with the default values initialized, and the ability to set a timeout on a request +func NewHealthchechServiceParamsWithTimeout(timeout time.Duration) *HealthchechServiceParams { + var () + return &HealthchechServiceParams{ + + timeout: timeout, + } +} + +// NewHealthchechServiceParamsWithContext creates a new HealthchechServiceParams object +// with the default values initialized, and the ability to set a context for a request +func NewHealthchechServiceParamsWithContext(ctx context.Context) *HealthchechServiceParams { + var () + return &HealthchechServiceParams{ + + Context: ctx, + } +} + +// NewHealthchechServiceParamsWithHTTPClient creates a new HealthchechServiceParams object +// with the default values initialized, and the ability to set a custom HTTPClient for a request +func NewHealthchechServiceParamsWithHTTPClient(client *http.Client) *HealthchechServiceParams { + var () + return &HealthchechServiceParams{ + HTTPClient: client, + } +} + +/*HealthchechServiceParams contains all the parameters to send to the API endpoint +for the healthchech service operation typically these are written to a http.Request +*/ +type HealthchechServiceParams struct { + + /*AppID*/ + AppID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithTimeout adds the timeout to the healthchech service params +func (o *HealthchechServiceParams) WithTimeout(timeout time.Duration) *HealthchechServiceParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the healthchech service params +func (o *HealthchechServiceParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the healthchech service params +func (o *HealthchechServiceParams) WithContext(ctx context.Context) *HealthchechServiceParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the healthchech service params +func (o *HealthchechServiceParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the healthchech service params +func (o *HealthchechServiceParams) WithHTTPClient(client *http.Client) *HealthchechServiceParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the healthchech service params +func (o *HealthchechServiceParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithAppID adds the appID to the healthchech service params +func (o *HealthchechServiceParams) WithAppID(appID string) *HealthchechServiceParams { + o.SetAppID(appID) + return o +} + +// SetAppID adds the appId to the healthchech service params +func (o *HealthchechServiceParams) SetAppID(appID string) { + o.AppID = appID +} + +// WriteToRequest writes these params to a swagger request +func (o *HealthchechServiceParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param appId + if err := r.SetPathParam("appId", o.AppID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/dcos/cosmos/client/operations/healthchech_service_responses.go b/dcos/cosmos/client/operations/healthchech_service_responses.go new file mode 100644 index 0000000..756f13a --- /dev/null +++ b/dcos/cosmos/client/operations/healthchech_service_responses.go @@ -0,0 +1,95 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package operations + +// 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" + + strfmt "github.com/go-openapi/strfmt" + + models "github.com/dcos/client-go/dcos/cosmos/models" +) + +// HealthchechServiceReader is a Reader for the HealthchechService structure. +type HealthchechServiceReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *HealthchechServiceReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + + case 200: + result := NewHealthchechServiceOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + + case 404: + result := NewHealthchechServiceNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + + default: + return nil, runtime.NewAPIError("unknown error", response, response.Code()) + } +} + +// NewHealthchechServiceOK creates a HealthchechServiceOK with default headers values +func NewHealthchechServiceOK() *HealthchechServiceOK { + return &HealthchechServiceOK{} +} + +/*HealthchechServiceOK handles this case with default header values. + +Service is healthy. +*/ +type HealthchechServiceOK struct { +} + +func (o *HealthchechServiceOK) Error() string { + return fmt.Sprintf("[GET /service/{appId}/v1/health][%d] healthchechServiceOK ", 200) +} + +func (o *HealthchechServiceOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewHealthchechServiceNotFound creates a HealthchechServiceNotFound with default headers values +func NewHealthchechServiceNotFound() *HealthchechServiceNotFound { + return &HealthchechServiceNotFound{} +} + +/*HealthchechServiceNotFound handles this case with default header values. + +Service not found. +*/ +type HealthchechServiceNotFound struct { + Payload *models.Error +} + +func (o *HealthchechServiceNotFound) Error() string { + return fmt.Sprintf("[GET /service/{appId}/v1/health][%d] healthchechServiceNotFound %+v", 404, o.Payload) +} + +func (o *HealthchechServiceNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Error) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/dcos/cosmos/client/operations/kubernetes_auth_data_parameters.go b/dcos/cosmos/client/operations/kubernetes_auth_data_parameters.go new file mode 100644 index 0000000..2946314 --- /dev/null +++ b/dcos/cosmos/client/operations/kubernetes_auth_data_parameters.go @@ -0,0 +1,133 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package operations + +// 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" + + strfmt "github.com/go-openapi/strfmt" +) + +// NewKubernetesAuthDataParams creates a new KubernetesAuthDataParams object +// with the default values initialized. +func NewKubernetesAuthDataParams() *KubernetesAuthDataParams { + var () + return &KubernetesAuthDataParams{ + + timeout: cr.DefaultTimeout, + } +} + +// NewKubernetesAuthDataParamsWithTimeout creates a new KubernetesAuthDataParams object +// with the default values initialized, and the ability to set a timeout on a request +func NewKubernetesAuthDataParamsWithTimeout(timeout time.Duration) *KubernetesAuthDataParams { + var () + return &KubernetesAuthDataParams{ + + timeout: timeout, + } +} + +// NewKubernetesAuthDataParamsWithContext creates a new KubernetesAuthDataParams object +// with the default values initialized, and the ability to set a context for a request +func NewKubernetesAuthDataParamsWithContext(ctx context.Context) *KubernetesAuthDataParams { + var () + return &KubernetesAuthDataParams{ + + Context: ctx, + } +} + +// NewKubernetesAuthDataParamsWithHTTPClient creates a new KubernetesAuthDataParams object +// with the default values initialized, and the ability to set a custom HTTPClient for a request +func NewKubernetesAuthDataParamsWithHTTPClient(client *http.Client) *KubernetesAuthDataParams { + var () + return &KubernetesAuthDataParams{ + HTTPClient: client, + } +} + +/*KubernetesAuthDataParams contains all the parameters to send to the API endpoint +for the kubernetes auth data operation typically these are written to a http.Request +*/ +type KubernetesAuthDataParams struct { + + /*AppID*/ + AppID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithTimeout adds the timeout to the kubernetes auth data params +func (o *KubernetesAuthDataParams) WithTimeout(timeout time.Duration) *KubernetesAuthDataParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the kubernetes auth data params +func (o *KubernetesAuthDataParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the kubernetes auth data params +func (o *KubernetesAuthDataParams) WithContext(ctx context.Context) *KubernetesAuthDataParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the kubernetes auth data params +func (o *KubernetesAuthDataParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the kubernetes auth data params +func (o *KubernetesAuthDataParams) WithHTTPClient(client *http.Client) *KubernetesAuthDataParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the kubernetes auth data params +func (o *KubernetesAuthDataParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithAppID adds the appID to the kubernetes auth data params +func (o *KubernetesAuthDataParams) WithAppID(appID string) *KubernetesAuthDataParams { + o.SetAppID(appID) + return o +} + +// SetAppID adds the appId to the kubernetes auth data params +func (o *KubernetesAuthDataParams) SetAppID(appID string) { + o.AppID = appID +} + +// WriteToRequest writes these params to a swagger request +func (o *KubernetesAuthDataParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param appId + if err := r.SetPathParam("appId", o.AppID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/dcos/cosmos/client/operations/kubernetes_auth_data_responses.go b/dcos/cosmos/client/operations/kubernetes_auth_data_responses.go new file mode 100644 index 0000000..44e427f --- /dev/null +++ b/dcos/cosmos/client/operations/kubernetes_auth_data_responses.go @@ -0,0 +1,103 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package operations + +// 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" + + strfmt "github.com/go-openapi/strfmt" + + models "github.com/dcos/client-go/dcos/cosmos/models" +) + +// KubernetesAuthDataReader is a Reader for the KubernetesAuthData structure. +type KubernetesAuthDataReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *KubernetesAuthDataReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + + case 200: + result := NewKubernetesAuthDataOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + + case 404: + result := NewKubernetesAuthDataNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + + default: + return nil, runtime.NewAPIError("unknown error", response, response.Code()) + } +} + +// NewKubernetesAuthDataOK creates a KubernetesAuthDataOK with default headers values +func NewKubernetesAuthDataOK() *KubernetesAuthDataOK { + return &KubernetesAuthDataOK{} +} + +/*KubernetesAuthDataOK handles this case with default header values. + +KubernetesAuthDataOK kubernetes auth data o k +*/ +type KubernetesAuthDataOK struct { + Payload *models.KubernetesAuthDataResponse +} + +func (o *KubernetesAuthDataOK) Error() string { + return fmt.Sprintf("[GET /service/{appId}/v1/auth/data][%d] kubernetesAuthDataOK %+v", 200, o.Payload) +} + +func (o *KubernetesAuthDataOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.KubernetesAuthDataResponse) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewKubernetesAuthDataNotFound creates a KubernetesAuthDataNotFound with default headers values +func NewKubernetesAuthDataNotFound() *KubernetesAuthDataNotFound { + return &KubernetesAuthDataNotFound{} +} + +/*KubernetesAuthDataNotFound handles this case with default header values. + +Service not found. +*/ +type KubernetesAuthDataNotFound struct { + Payload *models.Error +} + +func (o *KubernetesAuthDataNotFound) Error() string { + return fmt.Sprintf("[GET /service/{appId}/v1/auth/data][%d] kubernetesAuthDataNotFound %+v", 404, o.Payload) +} + +func (o *KubernetesAuthDataNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Error) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/dcos/cosmos/client/operations/operations_client.go b/dcos/cosmos/client/operations/operations_client.go new file mode 100644 index 0000000..c38c184 --- /dev/null +++ b/dcos/cosmos/client/operations/operations_client.go @@ -0,0 +1,369 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package operations + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "github.com/go-openapi/runtime" + + strfmt "github.com/go-openapi/strfmt" +) + +// New creates a new operations API client. +func New(transport runtime.ClientTransport, formats strfmt.Registry) *Client { + return &Client{transport: transport, formats: formats} +} + +/* +Client for operations API +*/ +type Client struct { + transport runtime.ClientTransport + formats strfmt.Registry +} + +/* +DCOSSystemHealth DC/OS system health. +*/ +func (a *Client) DCOSSystemHealth(params *DCOSSystemHealthParams) (*DCOSSystemHealthOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewDCOSSystemHealthParams() + } + + result, err := a.transport.Submit(&runtime.ClientOperation{ + ID: "dcos-system-health", + Method: "GET", + PathPattern: "/system/health/v1", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"https"}, + Params: params, + Reader: &DCOSSystemHealthReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + }) + if err != nil { + return nil, err + } + return result.(*DCOSSystemHealthOK), nil + +} + +/* +DCOSSystemNodes DC/OS nodes. +*/ +func (a *Client) DCOSSystemNodes(params *DCOSSystemNodesParams) (*DCOSSystemNodesOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewDCOSSystemNodesParams() + } + + result, err := a.transport.Submit(&runtime.ClientOperation{ + ID: "dcos-system-nodes", + Method: "GET", + PathPattern: "/system/health/v1/nodes", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"https"}, + Params: params, + Reader: &DCOSSystemNodesReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + }) + if err != nil { + return nil, err + } + return result.(*DCOSSystemNodesOK), nil + +} + +/* +HealthchechService Healthcheck service. +*/ +func (a *Client) HealthchechService(params *HealthchechServiceParams) (*HealthchechServiceOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewHealthchechServiceParams() + } + + result, err := a.transport.Submit(&runtime.ClientOperation{ + ID: "healthchech-service", + Method: "GET", + PathPattern: "/service/{appId}/v1/health", + ProducesMediaTypes: []string{"text/plain"}, + ConsumesMediaTypes: []string{"text/plain"}, + Schemes: []string{"https"}, + Params: params, + Reader: &HealthchechServiceReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + }) + if err != nil { + return nil, err + } + return result.(*HealthchechServiceOK), nil + +} + +/* +KubernetesAuthData Kuberentes Auth Data +*/ +func (a *Client) KubernetesAuthData(params *KubernetesAuthDataParams) (*KubernetesAuthDataOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewKubernetesAuthDataParams() + } + + result, err := a.transport.Submit(&runtime.ClientOperation{ + ID: "kubernetes-auth-data", + Method: "GET", + PathPattern: "/service/{appId}/v1/auth/data", + ProducesMediaTypes: []string{"text/plain"}, + ConsumesMediaTypes: []string{"text/plain"}, + Schemes: []string{"https"}, + Params: params, + Reader: &KubernetesAuthDataReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + }) + if err != nil { + return nil, err + } + return result.(*KubernetesAuthDataOK), nil + +} + +/* +PackageDescribe Show information about the package, including the required resources and configuration to start the service, and command line extensions that are included with the package. +*/ +func (a *Client) PackageDescribe(params *PackageDescribeParams) (*PackageDescribeOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPackageDescribeParams() + } + + result, err := a.transport.Submit(&runtime.ClientOperation{ + ID: "package-describe", + Method: "POST", + PathPattern: "/package/describe", + ProducesMediaTypes: []string{"application/vnd.dcos.package.describe-response+json;charset=utf-8;version=v3"}, + ConsumesMediaTypes: []string{"application/vnd.dcos.package.describe-request+json;charset=utf-8;version=v1"}, + Schemes: []string{"https"}, + Params: params, + Reader: &PackageDescribeReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + }) + if err != nil { + return nil, err + } + return result.(*PackageDescribeOK), nil + +} + +/* +PackageInstall Runs a service from a Universe package. +*/ +func (a *Client) PackageInstall(params *PackageInstallParams) (*PackageInstallOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPackageInstallParams() + } + + result, err := a.transport.Submit(&runtime.ClientOperation{ + ID: "package-install", + Method: "POST", + PathPattern: "/package/install", + ProducesMediaTypes: []string{"application/vnd.dcos.package.install-response+json;charset=utf-8;version=v1"}, + ConsumesMediaTypes: []string{"application/vnd.dcos.package.install-request+json;charset=utf-8;version=v1"}, + Schemes: []string{"https"}, + Params: params, + Reader: &PackageInstallReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + }) + if err != nil { + return nil, err + } + return result.(*PackageInstallOK), nil + +} + +/* +PackageRepositoryAdd Adds a package repository (for example Universe) for use by DC/OS. To add a package +repository to the beginning of the list set the index to zero (0). To add a package +repository to the end of the list do not specify an index. + +*/ +func (a *Client) PackageRepositoryAdd(params *PackageRepositoryAddParams) (*PackageRepositoryAddOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPackageRepositoryAddParams() + } + + result, err := a.transport.Submit(&runtime.ClientOperation{ + ID: "package-repository-add", + Method: "POST", + PathPattern: "/package/repository/add", + ProducesMediaTypes: []string{"application/vnd.dcos.package.repository.add-response+json;charset=utf-8;version=v1"}, + ConsumesMediaTypes: []string{"application/vnd.dcos.package.repository.add-request+json;charset=utf-8;version=v1"}, + Schemes: []string{"https"}, + Params: params, + Reader: &PackageRepositoryAddReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + }) + if err != nil { + return nil, err + } + return result.(*PackageRepositoryAddOK), nil + +} + +/* +PackageRepositoryDelete Deletes a package repository (for example Universe) from DC/OS. +*/ +func (a *Client) PackageRepositoryDelete(params *PackageRepositoryDeleteParams) (*PackageRepositoryDeleteOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPackageRepositoryDeleteParams() + } + + result, err := a.transport.Submit(&runtime.ClientOperation{ + ID: "package-repository-delete", + Method: "POST", + PathPattern: "/package/repository/delete", + ProducesMediaTypes: []string{"application/vnd.dcos.package.repository.delete-response+json;charset=utf-8;version=v1"}, + ConsumesMediaTypes: []string{"application/vnd.dcos.package.repository.delete-request+json;charset=utf-8;version=v1"}, + Schemes: []string{"https"}, + Params: params, + Reader: &PackageRepositoryDeleteReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + }) + if err != nil { + return nil, err + } + return result.(*PackageRepositoryDeleteOK), nil + +} + +/* +PackageUninstall package uninstall API +*/ +func (a *Client) PackageUninstall(params *PackageUninstallParams) (*PackageUninstallOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPackageUninstallParams() + } + + result, err := a.transport.Submit(&runtime.ClientOperation{ + ID: "package-uninstall", + Method: "POST", + PathPattern: "/package/uninstall", + ProducesMediaTypes: []string{"application/vnd.dcos.package.uninstall-response+json;charset=utf-8;version=v1"}, + ConsumesMediaTypes: []string{"application/vnd.dcos.package.uninstall-request+json;charset=utf-8;version=v1"}, + Schemes: []string{"https"}, + Params: params, + Reader: &PackageUninstallReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + }) + if err != nil { + return nil, err + } + return result.(*PackageUninstallOK), nil + +} + +/* +ServiceDescribe Describes a DC/OS Service +*/ +func (a *Client) ServiceDescribe(params *ServiceDescribeParams) (*ServiceDescribeOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewServiceDescribeParams() + } + + result, err := a.transport.Submit(&runtime.ClientOperation{ + ID: "service-describe", + Method: "POST", + PathPattern: "/cosmos/service/describe", + ProducesMediaTypes: []string{"application/vnd.dcos.service.describe-response+json;charset=utf-8;version=v1"}, + ConsumesMediaTypes: []string{"application/vnd.dcos.service.describe-request+json;charset=utf-8;version=v1"}, + Schemes: []string{"https"}, + Params: params, + Reader: &ServiceDescribeReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + }) + if err != nil { + return nil, err + } + return result.(*ServiceDescribeOK), nil + +} + +/* +ServicePlan Service plan. +*/ +func (a *Client) ServicePlan(params *ServicePlanParams) (*ServicePlanOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewServicePlanParams() + } + + result, err := a.transport.Submit(&runtime.ClientOperation{ + ID: "service-plan", + Method: "GET", + PathPattern: "/service/{appId}/v1/plans/{plan}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"https"}, + Params: params, + Reader: &ServicePlanReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + }) + if err != nil { + return nil, err + } + return result.(*ServicePlanOK), nil + +} + +/* +ServiceUpdate Runs a service update. +*/ +func (a *Client) ServiceUpdate(params *ServiceUpdateParams) (*ServiceUpdateOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewServiceUpdateParams() + } + + result, err := a.transport.Submit(&runtime.ClientOperation{ + ID: "service-update", + Method: "POST", + PathPattern: "/cosmos/service/update", + ProducesMediaTypes: []string{"application/vnd.dcos.service.update-response+json;charset=utf-8;version=v1"}, + ConsumesMediaTypes: []string{"application/vnd.dcos.service.update-request+json;charset=utf-8;version=v1"}, + Schemes: []string{"https"}, + Params: params, + Reader: &ServiceUpdateReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + }) + if err != nil { + return nil, err + } + return result.(*ServiceUpdateOK), nil + +} + +// SetTransport changes the transport on the client +func (a *Client) SetTransport(transport runtime.ClientTransport) { + a.transport = transport +} diff --git a/dcos/cosmos/client/operations/package_describe_parameters.go b/dcos/cosmos/client/operations/package_describe_parameters.go new file mode 100644 index 0000000..826b01c --- /dev/null +++ b/dcos/cosmos/client/operations/package_describe_parameters.go @@ -0,0 +1,136 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package operations + +// 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" + + strfmt "github.com/go-openapi/strfmt" + + models "github.com/dcos/client-go/dcos/cosmos/models" +) + +// NewPackageDescribeParams creates a new PackageDescribeParams object +// with the default values initialized. +func NewPackageDescribeParams() *PackageDescribeParams { + var () + return &PackageDescribeParams{ + + timeout: cr.DefaultTimeout, + } +} + +// NewPackageDescribeParamsWithTimeout creates a new PackageDescribeParams object +// with the default values initialized, and the ability to set a timeout on a request +func NewPackageDescribeParamsWithTimeout(timeout time.Duration) *PackageDescribeParams { + var () + return &PackageDescribeParams{ + + timeout: timeout, + } +} + +// NewPackageDescribeParamsWithContext creates a new PackageDescribeParams object +// with the default values initialized, and the ability to set a context for a request +func NewPackageDescribeParamsWithContext(ctx context.Context) *PackageDescribeParams { + var () + return &PackageDescribeParams{ + + Context: ctx, + } +} + +// NewPackageDescribeParamsWithHTTPClient creates a new PackageDescribeParams object +// with the default values initialized, and the ability to set a custom HTTPClient for a request +func NewPackageDescribeParamsWithHTTPClient(client *http.Client) *PackageDescribeParams { + var () + return &PackageDescribeParams{ + HTTPClient: client, + } +} + +/*PackageDescribeParams contains all the parameters to send to the API endpoint +for the package describe operation typically these are written to a http.Request +*/ +type PackageDescribeParams struct { + + /*Body*/ + Body *models.PackageDescribeRequest + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithTimeout adds the timeout to the package describe params +func (o *PackageDescribeParams) WithTimeout(timeout time.Duration) *PackageDescribeParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the package describe params +func (o *PackageDescribeParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the package describe params +func (o *PackageDescribeParams) WithContext(ctx context.Context) *PackageDescribeParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the package describe params +func (o *PackageDescribeParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the package describe params +func (o *PackageDescribeParams) WithHTTPClient(client *http.Client) *PackageDescribeParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the package describe params +func (o *PackageDescribeParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the package describe params +func (o *PackageDescribeParams) WithBody(body *models.PackageDescribeRequest) *PackageDescribeParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the package describe params +func (o *PackageDescribeParams) SetBody(body *models.PackageDescribeRequest) { + o.Body = body +} + +// WriteToRequest writes these params to a swagger request +func (o *PackageDescribeParams) 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 + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/dcos/cosmos/client/operations/package_describe_responses.go b/dcos/cosmos/client/operations/package_describe_responses.go new file mode 100644 index 0000000..5c0c251 --- /dev/null +++ b/dcos/cosmos/client/operations/package_describe_responses.go @@ -0,0 +1,103 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package operations + +// 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" + + strfmt "github.com/go-openapi/strfmt" + + models "github.com/dcos/client-go/dcos/cosmos/models" +) + +// PackageDescribeReader is a Reader for the PackageDescribe structure. +type PackageDescribeReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PackageDescribeReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + + case 200: + result := NewPackageDescribeOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + + case 400: + result := NewPackageDescribeBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + + default: + return nil, runtime.NewAPIError("unknown error", response, response.Code()) + } +} + +// NewPackageDescribeOK creates a PackageDescribeOK with default headers values +func NewPackageDescribeOK() *PackageDescribeOK { + return &PackageDescribeOK{} +} + +/*PackageDescribeOK handles this case with default header values. + +PackageDescribeOK package describe o k +*/ +type PackageDescribeOK struct { + Payload *models.V3PackageDescribeResponse +} + +func (o *PackageDescribeOK) Error() string { + return fmt.Sprintf("[POST /package/describe][%d] packageDescribeOK %+v", 200, o.Payload) +} + +func (o *PackageDescribeOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.V3PackageDescribeResponse) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewPackageDescribeBadRequest creates a PackageDescribeBadRequest with default headers values +func NewPackageDescribeBadRequest() *PackageDescribeBadRequest { + return &PackageDescribeBadRequest{} +} + +/*PackageDescribeBadRequest handles this case with default header values. + +PackageDescribeBadRequest package describe bad request +*/ +type PackageDescribeBadRequest struct { + Payload *models.Error +} + +func (o *PackageDescribeBadRequest) Error() string { + return fmt.Sprintf("[POST /package/describe][%d] packageDescribeBadRequest %+v", 400, o.Payload) +} + +func (o *PackageDescribeBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Error) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/dcos/cosmos/client/operations/package_install_parameters.go b/dcos/cosmos/client/operations/package_install_parameters.go new file mode 100644 index 0000000..1335146 --- /dev/null +++ b/dcos/cosmos/client/operations/package_install_parameters.go @@ -0,0 +1,136 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package operations + +// 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" + + strfmt "github.com/go-openapi/strfmt" + + models "github.com/dcos/client-go/dcos/cosmos/models" +) + +// NewPackageInstallParams creates a new PackageInstallParams object +// with the default values initialized. +func NewPackageInstallParams() *PackageInstallParams { + var () + return &PackageInstallParams{ + + timeout: cr.DefaultTimeout, + } +} + +// NewPackageInstallParamsWithTimeout creates a new PackageInstallParams object +// with the default values initialized, and the ability to set a timeout on a request +func NewPackageInstallParamsWithTimeout(timeout time.Duration) *PackageInstallParams { + var () + return &PackageInstallParams{ + + timeout: timeout, + } +} + +// NewPackageInstallParamsWithContext creates a new PackageInstallParams object +// with the default values initialized, and the ability to set a context for a request +func NewPackageInstallParamsWithContext(ctx context.Context) *PackageInstallParams { + var () + return &PackageInstallParams{ + + Context: ctx, + } +} + +// NewPackageInstallParamsWithHTTPClient creates a new PackageInstallParams object +// with the default values initialized, and the ability to set a custom HTTPClient for a request +func NewPackageInstallParamsWithHTTPClient(client *http.Client) *PackageInstallParams { + var () + return &PackageInstallParams{ + HTTPClient: client, + } +} + +/*PackageInstallParams contains all the parameters to send to the API endpoint +for the package install operation typically these are written to a http.Request +*/ +type PackageInstallParams struct { + + /*Body*/ + Body *models.InstallRequest + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithTimeout adds the timeout to the package install params +func (o *PackageInstallParams) WithTimeout(timeout time.Duration) *PackageInstallParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the package install params +func (o *PackageInstallParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the package install params +func (o *PackageInstallParams) WithContext(ctx context.Context) *PackageInstallParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the package install params +func (o *PackageInstallParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the package install params +func (o *PackageInstallParams) WithHTTPClient(client *http.Client) *PackageInstallParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the package install params +func (o *PackageInstallParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the package install params +func (o *PackageInstallParams) WithBody(body *models.InstallRequest) *PackageInstallParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the package install params +func (o *PackageInstallParams) SetBody(body *models.InstallRequest) { + o.Body = body +} + +// WriteToRequest writes these params to a swagger request +func (o *PackageInstallParams) 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 + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/dcos/cosmos/client/operations/package_install_responses.go b/dcos/cosmos/client/operations/package_install_responses.go new file mode 100644 index 0000000..22586a3 --- /dev/null +++ b/dcos/cosmos/client/operations/package_install_responses.go @@ -0,0 +1,139 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package operations + +// 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" + + strfmt "github.com/go-openapi/strfmt" + + models "github.com/dcos/client-go/dcos/cosmos/models" +) + +// PackageInstallReader is a Reader for the PackageInstall structure. +type PackageInstallReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PackageInstallReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + + case 200: + result := NewPackageInstallOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + + case 400: + result := NewPackageInstallBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + + case 409: + result := NewPackageInstallConflict() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + + default: + return nil, runtime.NewAPIError("unknown error", response, response.Code()) + } +} + +// NewPackageInstallOK creates a PackageInstallOK with default headers values +func NewPackageInstallOK() *PackageInstallOK { + return &PackageInstallOK{} +} + +/*PackageInstallOK handles this case with default header values. + +PackageInstallOK package install o k +*/ +type PackageInstallOK struct { + Payload *models.InstallResponse +} + +func (o *PackageInstallOK) Error() string { + return fmt.Sprintf("[POST /package/install][%d] packageInstallOK %+v", 200, o.Payload) +} + +func (o *PackageInstallOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.InstallResponse) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewPackageInstallBadRequest creates a PackageInstallBadRequest with default headers values +func NewPackageInstallBadRequest() *PackageInstallBadRequest { + return &PackageInstallBadRequest{} +} + +/*PackageInstallBadRequest handles this case with default header values. + +PackageInstallBadRequest package install bad request +*/ +type PackageInstallBadRequest struct { + Payload *models.Error +} + +func (o *PackageInstallBadRequest) Error() string { + return fmt.Sprintf("[POST /package/install][%d] packageInstallBadRequest %+v", 400, o.Payload) +} + +func (o *PackageInstallBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Error) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewPackageInstallConflict creates a PackageInstallConflict with default headers values +func NewPackageInstallConflict() *PackageInstallConflict { + return &PackageInstallConflict{} +} + +/*PackageInstallConflict handles this case with default header values. + +PackageInstallConflict package install conflict +*/ +type PackageInstallConflict struct { + Payload *models.Error +} + +func (o *PackageInstallConflict) Error() string { + return fmt.Sprintf("[POST /package/install][%d] packageInstallConflict %+v", 409, o.Payload) +} + +func (o *PackageInstallConflict) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Error) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/dcos/cosmos/client/operations/package_repository_add_parameters.go b/dcos/cosmos/client/operations/package_repository_add_parameters.go new file mode 100644 index 0000000..092c842 --- /dev/null +++ b/dcos/cosmos/client/operations/package_repository_add_parameters.go @@ -0,0 +1,136 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package operations + +// 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" + + strfmt "github.com/go-openapi/strfmt" + + models "github.com/dcos/client-go/dcos/cosmos/models" +) + +// NewPackageRepositoryAddParams creates a new PackageRepositoryAddParams object +// with the default values initialized. +func NewPackageRepositoryAddParams() *PackageRepositoryAddParams { + var () + return &PackageRepositoryAddParams{ + + timeout: cr.DefaultTimeout, + } +} + +// NewPackageRepositoryAddParamsWithTimeout creates a new PackageRepositoryAddParams object +// with the default values initialized, and the ability to set a timeout on a request +func NewPackageRepositoryAddParamsWithTimeout(timeout time.Duration) *PackageRepositoryAddParams { + var () + return &PackageRepositoryAddParams{ + + timeout: timeout, + } +} + +// NewPackageRepositoryAddParamsWithContext creates a new PackageRepositoryAddParams object +// with the default values initialized, and the ability to set a context for a request +func NewPackageRepositoryAddParamsWithContext(ctx context.Context) *PackageRepositoryAddParams { + var () + return &PackageRepositoryAddParams{ + + Context: ctx, + } +} + +// NewPackageRepositoryAddParamsWithHTTPClient creates a new PackageRepositoryAddParams object +// with the default values initialized, and the ability to set a custom HTTPClient for a request +func NewPackageRepositoryAddParamsWithHTTPClient(client *http.Client) *PackageRepositoryAddParams { + var () + return &PackageRepositoryAddParams{ + HTTPClient: client, + } +} + +/*PackageRepositoryAddParams contains all the parameters to send to the API endpoint +for the package repository add operation typically these are written to a http.Request +*/ +type PackageRepositoryAddParams struct { + + /*Body*/ + Body *models.PackageAddRepoRequest + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithTimeout adds the timeout to the package repository add params +func (o *PackageRepositoryAddParams) WithTimeout(timeout time.Duration) *PackageRepositoryAddParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the package repository add params +func (o *PackageRepositoryAddParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the package repository add params +func (o *PackageRepositoryAddParams) WithContext(ctx context.Context) *PackageRepositoryAddParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the package repository add params +func (o *PackageRepositoryAddParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the package repository add params +func (o *PackageRepositoryAddParams) WithHTTPClient(client *http.Client) *PackageRepositoryAddParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the package repository add params +func (o *PackageRepositoryAddParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the package repository add params +func (o *PackageRepositoryAddParams) WithBody(body *models.PackageAddRepoRequest) *PackageRepositoryAddParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the package repository add params +func (o *PackageRepositoryAddParams) SetBody(body *models.PackageAddRepoRequest) { + o.Body = body +} + +// WriteToRequest writes these params to a swagger request +func (o *PackageRepositoryAddParams) 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 + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/dcos/cosmos/client/operations/package_repository_add_responses.go b/dcos/cosmos/client/operations/package_repository_add_responses.go new file mode 100644 index 0000000..ccdc0a7 --- /dev/null +++ b/dcos/cosmos/client/operations/package_repository_add_responses.go @@ -0,0 +1,139 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package operations + +// 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" + + strfmt "github.com/go-openapi/strfmt" + + models "github.com/dcos/client-go/dcos/cosmos/models" +) + +// PackageRepositoryAddReader is a Reader for the PackageRepositoryAdd structure. +type PackageRepositoryAddReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PackageRepositoryAddReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + + case 200: + result := NewPackageRepositoryAddOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + + case 400: + result := NewPackageRepositoryAddBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + + case 409: + result := NewPackageRepositoryAddConflict() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + + default: + return nil, runtime.NewAPIError("unknown error", response, response.Code()) + } +} + +// NewPackageRepositoryAddOK creates a PackageRepositoryAddOK with default headers values +func NewPackageRepositoryAddOK() *PackageRepositoryAddOK { + return &PackageRepositoryAddOK{} +} + +/*PackageRepositoryAddOK handles this case with default header values. + +PackageRepositoryAddOK package repository add o k +*/ +type PackageRepositoryAddOK struct { + Payload *models.PackageAddRepoResponse +} + +func (o *PackageRepositoryAddOK) Error() string { + return fmt.Sprintf("[POST /package/repository/add][%d] packageRepositoryAddOK %+v", 200, o.Payload) +} + +func (o *PackageRepositoryAddOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.PackageAddRepoResponse) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewPackageRepositoryAddBadRequest creates a PackageRepositoryAddBadRequest with default headers values +func NewPackageRepositoryAddBadRequest() *PackageRepositoryAddBadRequest { + return &PackageRepositoryAddBadRequest{} +} + +/*PackageRepositoryAddBadRequest handles this case with default header values. + +PackageRepositoryAddBadRequest package repository add bad request +*/ +type PackageRepositoryAddBadRequest struct { + Payload *models.Error +} + +func (o *PackageRepositoryAddBadRequest) Error() string { + return fmt.Sprintf("[POST /package/repository/add][%d] packageRepositoryAddBadRequest %+v", 400, o.Payload) +} + +func (o *PackageRepositoryAddBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Error) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewPackageRepositoryAddConflict creates a PackageRepositoryAddConflict with default headers values +func NewPackageRepositoryAddConflict() *PackageRepositoryAddConflict { + return &PackageRepositoryAddConflict{} +} + +/*PackageRepositoryAddConflict handles this case with default header values. + +PackageRepositoryAddConflict package repository add conflict +*/ +type PackageRepositoryAddConflict struct { + Payload *models.Error +} + +func (o *PackageRepositoryAddConflict) Error() string { + return fmt.Sprintf("[POST /package/repository/add][%d] packageRepositoryAddConflict %+v", 409, o.Payload) +} + +func (o *PackageRepositoryAddConflict) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Error) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/dcos/cosmos/client/operations/package_repository_delete_parameters.go b/dcos/cosmos/client/operations/package_repository_delete_parameters.go new file mode 100644 index 0000000..02df83a --- /dev/null +++ b/dcos/cosmos/client/operations/package_repository_delete_parameters.go @@ -0,0 +1,136 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package operations + +// 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" + + strfmt "github.com/go-openapi/strfmt" + + models "github.com/dcos/client-go/dcos/cosmos/models" +) + +// NewPackageRepositoryDeleteParams creates a new PackageRepositoryDeleteParams object +// with the default values initialized. +func NewPackageRepositoryDeleteParams() *PackageRepositoryDeleteParams { + var () + return &PackageRepositoryDeleteParams{ + + timeout: cr.DefaultTimeout, + } +} + +// NewPackageRepositoryDeleteParamsWithTimeout creates a new PackageRepositoryDeleteParams object +// with the default values initialized, and the ability to set a timeout on a request +func NewPackageRepositoryDeleteParamsWithTimeout(timeout time.Duration) *PackageRepositoryDeleteParams { + var () + return &PackageRepositoryDeleteParams{ + + timeout: timeout, + } +} + +// NewPackageRepositoryDeleteParamsWithContext creates a new PackageRepositoryDeleteParams object +// with the default values initialized, and the ability to set a context for a request +func NewPackageRepositoryDeleteParamsWithContext(ctx context.Context) *PackageRepositoryDeleteParams { + var () + return &PackageRepositoryDeleteParams{ + + Context: ctx, + } +} + +// NewPackageRepositoryDeleteParamsWithHTTPClient creates a new PackageRepositoryDeleteParams object +// with the default values initialized, and the ability to set a custom HTTPClient for a request +func NewPackageRepositoryDeleteParamsWithHTTPClient(client *http.Client) *PackageRepositoryDeleteParams { + var () + return &PackageRepositoryDeleteParams{ + HTTPClient: client, + } +} + +/*PackageRepositoryDeleteParams contains all the parameters to send to the API endpoint +for the package repository delete operation typically these are written to a http.Request +*/ +type PackageRepositoryDeleteParams struct { + + /*Body*/ + Body *models.PackageDeleteRepoRequest + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithTimeout adds the timeout to the package repository delete params +func (o *PackageRepositoryDeleteParams) WithTimeout(timeout time.Duration) *PackageRepositoryDeleteParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the package repository delete params +func (o *PackageRepositoryDeleteParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the package repository delete params +func (o *PackageRepositoryDeleteParams) WithContext(ctx context.Context) *PackageRepositoryDeleteParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the package repository delete params +func (o *PackageRepositoryDeleteParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the package repository delete params +func (o *PackageRepositoryDeleteParams) WithHTTPClient(client *http.Client) *PackageRepositoryDeleteParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the package repository delete params +func (o *PackageRepositoryDeleteParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the package repository delete params +func (o *PackageRepositoryDeleteParams) WithBody(body *models.PackageDeleteRepoRequest) *PackageRepositoryDeleteParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the package repository delete params +func (o *PackageRepositoryDeleteParams) SetBody(body *models.PackageDeleteRepoRequest) { + o.Body = body +} + +// WriteToRequest writes these params to a swagger request +func (o *PackageRepositoryDeleteParams) 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 + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/dcos/cosmos/client/operations/package_repository_delete_responses.go b/dcos/cosmos/client/operations/package_repository_delete_responses.go new file mode 100644 index 0000000..b642e68 --- /dev/null +++ b/dcos/cosmos/client/operations/package_repository_delete_responses.go @@ -0,0 +1,139 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package operations + +// 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" + + strfmt "github.com/go-openapi/strfmt" + + models "github.com/dcos/client-go/dcos/cosmos/models" +) + +// PackageRepositoryDeleteReader is a Reader for the PackageRepositoryDelete structure. +type PackageRepositoryDeleteReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PackageRepositoryDeleteReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + + case 200: + result := NewPackageRepositoryDeleteOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + + case 400: + result := NewPackageRepositoryDeleteBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + + case 404: + result := NewPackageRepositoryDeleteNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + + default: + return nil, runtime.NewAPIError("unknown error", response, response.Code()) + } +} + +// NewPackageRepositoryDeleteOK creates a PackageRepositoryDeleteOK with default headers values +func NewPackageRepositoryDeleteOK() *PackageRepositoryDeleteOK { + return &PackageRepositoryDeleteOK{} +} + +/*PackageRepositoryDeleteOK handles this case with default header values. + +PackageRepositoryDeleteOK package repository delete o k +*/ +type PackageRepositoryDeleteOK struct { + Payload *models.PackageDeleteRepoResponse +} + +func (o *PackageRepositoryDeleteOK) Error() string { + return fmt.Sprintf("[POST /package/repository/delete][%d] packageRepositoryDeleteOK %+v", 200, o.Payload) +} + +func (o *PackageRepositoryDeleteOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.PackageDeleteRepoResponse) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewPackageRepositoryDeleteBadRequest creates a PackageRepositoryDeleteBadRequest with default headers values +func NewPackageRepositoryDeleteBadRequest() *PackageRepositoryDeleteBadRequest { + return &PackageRepositoryDeleteBadRequest{} +} + +/*PackageRepositoryDeleteBadRequest handles this case with default header values. + +PackageRepositoryDeleteBadRequest package repository delete bad request +*/ +type PackageRepositoryDeleteBadRequest struct { + Payload *models.Error +} + +func (o *PackageRepositoryDeleteBadRequest) Error() string { + return fmt.Sprintf("[POST /package/repository/delete][%d] packageRepositoryDeleteBadRequest %+v", 400, o.Payload) +} + +func (o *PackageRepositoryDeleteBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Error) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewPackageRepositoryDeleteNotFound creates a PackageRepositoryDeleteNotFound with default headers values +func NewPackageRepositoryDeleteNotFound() *PackageRepositoryDeleteNotFound { + return &PackageRepositoryDeleteNotFound{} +} + +/*PackageRepositoryDeleteNotFound handles this case with default header values. + +PackageRepositoryDeleteNotFound package repository delete not found +*/ +type PackageRepositoryDeleteNotFound struct { + Payload *models.Error +} + +func (o *PackageRepositoryDeleteNotFound) Error() string { + return fmt.Sprintf("[POST /package/repository/delete][%d] packageRepositoryDeleteNotFound %+v", 404, o.Payload) +} + +func (o *PackageRepositoryDeleteNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Error) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/dcos/cosmos/client/operations/package_uninstall_parameters.go b/dcos/cosmos/client/operations/package_uninstall_parameters.go new file mode 100644 index 0000000..165a3d2 --- /dev/null +++ b/dcos/cosmos/client/operations/package_uninstall_parameters.go @@ -0,0 +1,158 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package operations + +// 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" + + strfmt "github.com/go-openapi/strfmt" + + models "github.com/dcos/client-go/dcos/cosmos/models" +) + +// NewPackageUninstallParams creates a new PackageUninstallParams object +// with the default values initialized. +func NewPackageUninstallParams() *PackageUninstallParams { + var () + return &PackageUninstallParams{ + + timeout: cr.DefaultTimeout, + } +} + +// NewPackageUninstallParamsWithTimeout creates a new PackageUninstallParams object +// with the default values initialized, and the ability to set a timeout on a request +func NewPackageUninstallParamsWithTimeout(timeout time.Duration) *PackageUninstallParams { + var () + return &PackageUninstallParams{ + + timeout: timeout, + } +} + +// NewPackageUninstallParamsWithContext creates a new PackageUninstallParams object +// with the default values initialized, and the ability to set a context for a request +func NewPackageUninstallParamsWithContext(ctx context.Context) *PackageUninstallParams { + var () + return &PackageUninstallParams{ + + Context: ctx, + } +} + +// NewPackageUninstallParamsWithHTTPClient creates a new PackageUninstallParams object +// with the default values initialized, and the ability to set a custom HTTPClient for a request +func NewPackageUninstallParamsWithHTTPClient(client *http.Client) *PackageUninstallParams { + var () + return &PackageUninstallParams{ + HTTPClient: client, + } +} + +/*PackageUninstallParams contains all the parameters to send to the API endpoint +for the package uninstall operation typically these are written to a http.Request +*/ +type PackageUninstallParams struct { + + /*Accept*/ + Accept *string + /*Body*/ + Body *models.UninstallRequest + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithTimeout adds the timeout to the package uninstall params +func (o *PackageUninstallParams) WithTimeout(timeout time.Duration) *PackageUninstallParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the package uninstall params +func (o *PackageUninstallParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the package uninstall params +func (o *PackageUninstallParams) WithContext(ctx context.Context) *PackageUninstallParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the package uninstall params +func (o *PackageUninstallParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the package uninstall params +func (o *PackageUninstallParams) WithHTTPClient(client *http.Client) *PackageUninstallParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the package uninstall params +func (o *PackageUninstallParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithAccept adds the accept to the package uninstall params +func (o *PackageUninstallParams) WithAccept(accept *string) *PackageUninstallParams { + o.SetAccept(accept) + return o +} + +// SetAccept adds the accept to the package uninstall params +func (o *PackageUninstallParams) SetAccept(accept *string) { + o.Accept = accept +} + +// WithBody adds the body to the package uninstall params +func (o *PackageUninstallParams) WithBody(body *models.UninstallRequest) *PackageUninstallParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the package uninstall params +func (o *PackageUninstallParams) SetBody(body *models.UninstallRequest) { + o.Body = body +} + +// WriteToRequest writes these params to a swagger request +func (o *PackageUninstallParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.Accept != nil { + + // header param Accept + if err := r.SetHeaderParam("Accept", *o.Accept); err != nil { + return err + } + + } + + if o.Body != nil { + if err := r.SetBodyParam(o.Body); err != nil { + return err + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/dcos/cosmos/client/operations/package_uninstall_responses.go b/dcos/cosmos/client/operations/package_uninstall_responses.go new file mode 100644 index 0000000..b25a2eb --- /dev/null +++ b/dcos/cosmos/client/operations/package_uninstall_responses.go @@ -0,0 +1,175 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package operations + +// 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" + + strfmt "github.com/go-openapi/strfmt" + + models "github.com/dcos/client-go/dcos/cosmos/models" +) + +// PackageUninstallReader is a Reader for the PackageUninstall structure. +type PackageUninstallReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PackageUninstallReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + + case 200: + result := NewPackageUninstallOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + + case 400: + result := NewPackageUninstallBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + + case 404: + result := NewPackageUninstallNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + + case 409: + result := NewPackageUninstallConflict() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + + default: + return nil, runtime.NewAPIError("unknown error", response, response.Code()) + } +} + +// NewPackageUninstallOK creates a PackageUninstallOK with default headers values +func NewPackageUninstallOK() *PackageUninstallOK { + return &PackageUninstallOK{} +} + +/*PackageUninstallOK handles this case with default header values. + +PackageUninstallOK package uninstall o k +*/ +type PackageUninstallOK struct { + Payload *models.UninstallResponse +} + +func (o *PackageUninstallOK) Error() string { + return fmt.Sprintf("[POST /package/uninstall][%d] packageUninstallOK %+v", 200, o.Payload) +} + +func (o *PackageUninstallOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.UninstallResponse) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewPackageUninstallBadRequest creates a PackageUninstallBadRequest with default headers values +func NewPackageUninstallBadRequest() *PackageUninstallBadRequest { + return &PackageUninstallBadRequest{} +} + +/*PackageUninstallBadRequest handles this case with default header values. + +PackageUninstallBadRequest package uninstall bad request +*/ +type PackageUninstallBadRequest struct { + Payload *models.Error +} + +func (o *PackageUninstallBadRequest) Error() string { + return fmt.Sprintf("[POST /package/uninstall][%d] packageUninstallBadRequest %+v", 400, o.Payload) +} + +func (o *PackageUninstallBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Error) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewPackageUninstallNotFound creates a PackageUninstallNotFound with default headers values +func NewPackageUninstallNotFound() *PackageUninstallNotFound { + return &PackageUninstallNotFound{} +} + +/*PackageUninstallNotFound handles this case with default header values. + +PackageUninstallNotFound package uninstall not found +*/ +type PackageUninstallNotFound struct { + Payload *models.Error +} + +func (o *PackageUninstallNotFound) Error() string { + return fmt.Sprintf("[POST /package/uninstall][%d] packageUninstallNotFound %+v", 404, o.Payload) +} + +func (o *PackageUninstallNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Error) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewPackageUninstallConflict creates a PackageUninstallConflict with default headers values +func NewPackageUninstallConflict() *PackageUninstallConflict { + return &PackageUninstallConflict{} +} + +/*PackageUninstallConflict handles this case with default header values. + +PackageUninstallConflict package uninstall conflict +*/ +type PackageUninstallConflict struct { + Payload *models.Error +} + +func (o *PackageUninstallConflict) Error() string { + return fmt.Sprintf("[POST /package/uninstall][%d] packageUninstallConflict %+v", 409, o.Payload) +} + +func (o *PackageUninstallConflict) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Error) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/dcos/cosmos/client/operations/service_describe_parameters.go b/dcos/cosmos/client/operations/service_describe_parameters.go new file mode 100644 index 0000000..1b44146 --- /dev/null +++ b/dcos/cosmos/client/operations/service_describe_parameters.go @@ -0,0 +1,136 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package operations + +// 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" + + strfmt "github.com/go-openapi/strfmt" + + models "github.com/dcos/client-go/dcos/cosmos/models" +) + +// NewServiceDescribeParams creates a new ServiceDescribeParams object +// with the default values initialized. +func NewServiceDescribeParams() *ServiceDescribeParams { + var () + return &ServiceDescribeParams{ + + timeout: cr.DefaultTimeout, + } +} + +// NewServiceDescribeParamsWithTimeout creates a new ServiceDescribeParams object +// with the default values initialized, and the ability to set a timeout on a request +func NewServiceDescribeParamsWithTimeout(timeout time.Duration) *ServiceDescribeParams { + var () + return &ServiceDescribeParams{ + + timeout: timeout, + } +} + +// NewServiceDescribeParamsWithContext creates a new ServiceDescribeParams object +// with the default values initialized, and the ability to set a context for a request +func NewServiceDescribeParamsWithContext(ctx context.Context) *ServiceDescribeParams { + var () + return &ServiceDescribeParams{ + + Context: ctx, + } +} + +// NewServiceDescribeParamsWithHTTPClient creates a new ServiceDescribeParams object +// with the default values initialized, and the ability to set a custom HTTPClient for a request +func NewServiceDescribeParamsWithHTTPClient(client *http.Client) *ServiceDescribeParams { + var () + return &ServiceDescribeParams{ + HTTPClient: client, + } +} + +/*ServiceDescribeParams contains all the parameters to send to the API endpoint +for the service describe operation typically these are written to a http.Request +*/ +type ServiceDescribeParams struct { + + /*Body*/ + Body *models.ServiceDescribeRequest + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithTimeout adds the timeout to the service describe params +func (o *ServiceDescribeParams) WithTimeout(timeout time.Duration) *ServiceDescribeParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the service describe params +func (o *ServiceDescribeParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the service describe params +func (o *ServiceDescribeParams) WithContext(ctx context.Context) *ServiceDescribeParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the service describe params +func (o *ServiceDescribeParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the service describe params +func (o *ServiceDescribeParams) WithHTTPClient(client *http.Client) *ServiceDescribeParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the service describe params +func (o *ServiceDescribeParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the service describe params +func (o *ServiceDescribeParams) WithBody(body *models.ServiceDescribeRequest) *ServiceDescribeParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the service describe params +func (o *ServiceDescribeParams) SetBody(body *models.ServiceDescribeRequest) { + o.Body = body +} + +// WriteToRequest writes these params to a swagger request +func (o *ServiceDescribeParams) 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 + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/dcos/cosmos/client/operations/service_describe_responses.go b/dcos/cosmos/client/operations/service_describe_responses.go new file mode 100644 index 0000000..a8d4c11 --- /dev/null +++ b/dcos/cosmos/client/operations/service_describe_responses.go @@ -0,0 +1,103 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package operations + +// 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" + + strfmt "github.com/go-openapi/strfmt" + + models "github.com/dcos/client-go/dcos/cosmos/models" +) + +// ServiceDescribeReader is a Reader for the ServiceDescribe structure. +type ServiceDescribeReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *ServiceDescribeReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + + case 200: + result := NewServiceDescribeOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + + case 400: + result := NewServiceDescribeBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + + default: + return nil, runtime.NewAPIError("unknown error", response, response.Code()) + } +} + +// NewServiceDescribeOK creates a ServiceDescribeOK with default headers values +func NewServiceDescribeOK() *ServiceDescribeOK { + return &ServiceDescribeOK{} +} + +/*ServiceDescribeOK handles this case with default header values. + +ServiceDescribeOK service describe o k +*/ +type ServiceDescribeOK struct { + Payload *models.ServiceDescribeResponse +} + +func (o *ServiceDescribeOK) Error() string { + return fmt.Sprintf("[POST /cosmos/service/describe][%d] serviceDescribeOK %+v", 200, o.Payload) +} + +func (o *ServiceDescribeOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.ServiceDescribeResponse) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewServiceDescribeBadRequest creates a ServiceDescribeBadRequest with default headers values +func NewServiceDescribeBadRequest() *ServiceDescribeBadRequest { + return &ServiceDescribeBadRequest{} +} + +/*ServiceDescribeBadRequest handles this case with default header values. + +ServiceDescribeBadRequest service describe bad request +*/ +type ServiceDescribeBadRequest struct { + Payload *models.Error +} + +func (o *ServiceDescribeBadRequest) Error() string { + return fmt.Sprintf("[POST /cosmos/service/describe][%d] serviceDescribeBadRequest %+v", 400, o.Payload) +} + +func (o *ServiceDescribeBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Error) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/dcos/cosmos/client/operations/service_plan_parameters.go b/dcos/cosmos/client/operations/service_plan_parameters.go new file mode 100644 index 0000000..4f393fb --- /dev/null +++ b/dcos/cosmos/client/operations/service_plan_parameters.go @@ -0,0 +1,151 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package operations + +// 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" + + strfmt "github.com/go-openapi/strfmt" +) + +// NewServicePlanParams creates a new ServicePlanParams object +// with the default values initialized. +func NewServicePlanParams() *ServicePlanParams { + var () + return &ServicePlanParams{ + + timeout: cr.DefaultTimeout, + } +} + +// NewServicePlanParamsWithTimeout creates a new ServicePlanParams object +// with the default values initialized, and the ability to set a timeout on a request +func NewServicePlanParamsWithTimeout(timeout time.Duration) *ServicePlanParams { + var () + return &ServicePlanParams{ + + timeout: timeout, + } +} + +// NewServicePlanParamsWithContext creates a new ServicePlanParams object +// with the default values initialized, and the ability to set a context for a request +func NewServicePlanParamsWithContext(ctx context.Context) *ServicePlanParams { + var () + return &ServicePlanParams{ + + Context: ctx, + } +} + +// NewServicePlanParamsWithHTTPClient creates a new ServicePlanParams object +// with the default values initialized, and the ability to set a custom HTTPClient for a request +func NewServicePlanParamsWithHTTPClient(client *http.Client) *ServicePlanParams { + var () + return &ServicePlanParams{ + HTTPClient: client, + } +} + +/*ServicePlanParams contains all the parameters to send to the API endpoint +for the service plan operation typically these are written to a http.Request +*/ +type ServicePlanParams struct { + + /*AppID*/ + AppID string + /*Plan*/ + Plan string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithTimeout adds the timeout to the service plan params +func (o *ServicePlanParams) WithTimeout(timeout time.Duration) *ServicePlanParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the service plan params +func (o *ServicePlanParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the service plan params +func (o *ServicePlanParams) WithContext(ctx context.Context) *ServicePlanParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the service plan params +func (o *ServicePlanParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the service plan params +func (o *ServicePlanParams) WithHTTPClient(client *http.Client) *ServicePlanParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the service plan params +func (o *ServicePlanParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithAppID adds the appID to the service plan params +func (o *ServicePlanParams) WithAppID(appID string) *ServicePlanParams { + o.SetAppID(appID) + return o +} + +// SetAppID adds the appId to the service plan params +func (o *ServicePlanParams) SetAppID(appID string) { + o.AppID = appID +} + +// WithPlan adds the plan to the service plan params +func (o *ServicePlanParams) WithPlan(plan string) *ServicePlanParams { + o.SetPlan(plan) + return o +} + +// SetPlan adds the plan to the service plan params +func (o *ServicePlanParams) SetPlan(plan string) { + o.Plan = plan +} + +// WriteToRequest writes these params to a swagger request +func (o *ServicePlanParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param appId + if err := r.SetPathParam("appId", o.AppID); err != nil { + return err + } + + // path param plan + if err := r.SetPathParam("plan", o.Plan); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/dcos/cosmos/client/operations/service_plan_responses.go b/dcos/cosmos/client/operations/service_plan_responses.go new file mode 100644 index 0000000..639840d --- /dev/null +++ b/dcos/cosmos/client/operations/service_plan_responses.go @@ -0,0 +1,103 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package operations + +// 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" + + strfmt "github.com/go-openapi/strfmt" + + models "github.com/dcos/client-go/dcos/cosmos/models" +) + +// ServicePlanReader is a Reader for the ServicePlan structure. +type ServicePlanReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *ServicePlanReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + + case 200: + result := NewServicePlanOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + + case 404: + result := NewServicePlanNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + + default: + return nil, runtime.NewAPIError("unknown error", response, response.Code()) + } +} + +// NewServicePlanOK creates a ServicePlanOK with default headers values +func NewServicePlanOK() *ServicePlanOK { + return &ServicePlanOK{} +} + +/*ServicePlanOK handles this case with default header values. + +Service plan. +*/ +type ServicePlanOK struct { + Payload *models.PlanDefinition +} + +func (o *ServicePlanOK) Error() string { + return fmt.Sprintf("[GET /service/{appId}/v1/plans/{plan}][%d] servicePlanOK %+v", 200, o.Payload) +} + +func (o *ServicePlanOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.PlanDefinition) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewServicePlanNotFound creates a ServicePlanNotFound with default headers values +func NewServicePlanNotFound() *ServicePlanNotFound { + return &ServicePlanNotFound{} +} + +/*ServicePlanNotFound handles this case with default header values. + +Service plan not found. +*/ +type ServicePlanNotFound struct { + Payload *models.Error +} + +func (o *ServicePlanNotFound) Error() string { + return fmt.Sprintf("[GET /service/{appId}/v1/plans/{plan}][%d] servicePlanNotFound %+v", 404, o.Payload) +} + +func (o *ServicePlanNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Error) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/dcos/cosmos/client/operations/service_update_parameters.go b/dcos/cosmos/client/operations/service_update_parameters.go new file mode 100644 index 0000000..6deec86 --- /dev/null +++ b/dcos/cosmos/client/operations/service_update_parameters.go @@ -0,0 +1,136 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package operations + +// 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" + + strfmt "github.com/go-openapi/strfmt" + + models "github.com/dcos/client-go/dcos/cosmos/models" +) + +// NewServiceUpdateParams creates a new ServiceUpdateParams object +// with the default values initialized. +func NewServiceUpdateParams() *ServiceUpdateParams { + var () + return &ServiceUpdateParams{ + + timeout: cr.DefaultTimeout, + } +} + +// NewServiceUpdateParamsWithTimeout creates a new ServiceUpdateParams object +// with the default values initialized, and the ability to set a timeout on a request +func NewServiceUpdateParamsWithTimeout(timeout time.Duration) *ServiceUpdateParams { + var () + return &ServiceUpdateParams{ + + timeout: timeout, + } +} + +// NewServiceUpdateParamsWithContext creates a new ServiceUpdateParams object +// with the default values initialized, and the ability to set a context for a request +func NewServiceUpdateParamsWithContext(ctx context.Context) *ServiceUpdateParams { + var () + return &ServiceUpdateParams{ + + Context: ctx, + } +} + +// NewServiceUpdateParamsWithHTTPClient creates a new ServiceUpdateParams object +// with the default values initialized, and the ability to set a custom HTTPClient for a request +func NewServiceUpdateParamsWithHTTPClient(client *http.Client) *ServiceUpdateParams { + var () + return &ServiceUpdateParams{ + HTTPClient: client, + } +} + +/*ServiceUpdateParams contains all the parameters to send to the API endpoint +for the service update operation typically these are written to a http.Request +*/ +type ServiceUpdateParams struct { + + /*Body*/ + Body *models.ServiceUpdateRequest + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithTimeout adds the timeout to the service update params +func (o *ServiceUpdateParams) WithTimeout(timeout time.Duration) *ServiceUpdateParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the service update params +func (o *ServiceUpdateParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the service update params +func (o *ServiceUpdateParams) WithContext(ctx context.Context) *ServiceUpdateParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the service update params +func (o *ServiceUpdateParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the service update params +func (o *ServiceUpdateParams) WithHTTPClient(client *http.Client) *ServiceUpdateParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the service update params +func (o *ServiceUpdateParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the service update params +func (o *ServiceUpdateParams) WithBody(body *models.ServiceUpdateRequest) *ServiceUpdateParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the service update params +func (o *ServiceUpdateParams) SetBody(body *models.ServiceUpdateRequest) { + o.Body = body +} + +// WriteToRequest writes these params to a swagger request +func (o *ServiceUpdateParams) 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 + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/dcos/cosmos/client/operations/service_update_responses.go b/dcos/cosmos/client/operations/service_update_responses.go new file mode 100644 index 0000000..2228a3b --- /dev/null +++ b/dcos/cosmos/client/operations/service_update_responses.go @@ -0,0 +1,175 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package operations + +// 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" + + strfmt "github.com/go-openapi/strfmt" + + models "github.com/dcos/client-go/dcos/cosmos/models" +) + +// ServiceUpdateReader is a Reader for the ServiceUpdate structure. +type ServiceUpdateReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *ServiceUpdateReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + + case 200: + result := NewServiceUpdateOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + + case 400: + result := NewServiceUpdateBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + + case 404: + result := NewServiceUpdateNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + + case 409: + result := NewServiceUpdateConflict() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + + default: + return nil, runtime.NewAPIError("unknown error", response, response.Code()) + } +} + +// NewServiceUpdateOK creates a ServiceUpdateOK with default headers values +func NewServiceUpdateOK() *ServiceUpdateOK { + return &ServiceUpdateOK{} +} + +/*ServiceUpdateOK handles this case with default header values. + +ServiceUpdateOK service update o k +*/ +type ServiceUpdateOK struct { + Payload *models.ServiceUpdateResponse +} + +func (o *ServiceUpdateOK) Error() string { + return fmt.Sprintf("[POST /cosmos/service/update][%d] serviceUpdateOK %+v", 200, o.Payload) +} + +func (o *ServiceUpdateOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.ServiceUpdateResponse) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewServiceUpdateBadRequest creates a ServiceUpdateBadRequest with default headers values +func NewServiceUpdateBadRequest() *ServiceUpdateBadRequest { + return &ServiceUpdateBadRequest{} +} + +/*ServiceUpdateBadRequest handles this case with default header values. + +ServiceUpdateBadRequest service update bad request +*/ +type ServiceUpdateBadRequest struct { + Payload *models.Error +} + +func (o *ServiceUpdateBadRequest) Error() string { + return fmt.Sprintf("[POST /cosmos/service/update][%d] serviceUpdateBadRequest %+v", 400, o.Payload) +} + +func (o *ServiceUpdateBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Error) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewServiceUpdateNotFound creates a ServiceUpdateNotFound with default headers values +func NewServiceUpdateNotFound() *ServiceUpdateNotFound { + return &ServiceUpdateNotFound{} +} + +/*ServiceUpdateNotFound handles this case with default header values. + +ServiceUpdateNotFound service update not found +*/ +type ServiceUpdateNotFound struct { + Payload *models.Error +} + +func (o *ServiceUpdateNotFound) Error() string { + return fmt.Sprintf("[POST /cosmos/service/update][%d] serviceUpdateNotFound %+v", 404, o.Payload) +} + +func (o *ServiceUpdateNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Error) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewServiceUpdateConflict creates a ServiceUpdateConflict with default headers values +func NewServiceUpdateConflict() *ServiceUpdateConflict { + return &ServiceUpdateConflict{} +} + +/*ServiceUpdateConflict handles this case with default header values. + +ServiceUpdateConflict service update conflict +*/ +type ServiceUpdateConflict struct { + Payload *models.Error +} + +func (o *ServiceUpdateConflict) Error() string { + return fmt.Sprintf("[POST /cosmos/service/update][%d] serviceUpdateConflict %+v", 409, o.Payload) +} + +func (o *ServiceUpdateConflict) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Error) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/dcos/cosmos/models/algo.go b/dcos/cosmos/models/algo.go new file mode 100644 index 0000000..0e76ca3 --- /dev/null +++ b/dcos/cosmos/models/algo.go @@ -0,0 +1,60 @@ +// 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 ( + "encoding/json" + + strfmt "github.com/go-openapi/strfmt" + + "github.com/go-openapi/errors" + "github.com/go-openapi/validate" +) + +// Algo algo +// swagger:model algo +type Algo string + +const ( + + // AlgoSha256 captures enum value "sha256" + AlgoSha256 Algo = "sha256" +) + +// for schema +var algoEnum []interface{} + +func init() { + var res []Algo + if err := json.Unmarshal([]byte(`["sha256"]`), &res); err != nil { + panic(err) + } + for _, v := range res { + algoEnum = append(algoEnum, v) + } +} + +func (m Algo) validateAlgoEnum(path, location string, value Algo) error { + if err := validate.Enum(path, location, value, algoEnum); err != nil { + return err + } + return nil +} + +// Validate validates this algo +func (m Algo) Validate(formats strfmt.Registry) error { + var res []error + + // value enum + if err := m.validateAlgoEnum("", "body", m); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/dcos/cosmos/models/assets.go b/dcos/cosmos/models/assets.go new file mode 100644 index 0000000..85938d9 --- /dev/null +++ b/dcos/cosmos/models/assets.go @@ -0,0 +1,150 @@ +// 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 ( + strfmt "github.com/go-openapi/strfmt" + + "github.com/go-openapi/errors" + "github.com/go-openapi/swag" +) + +// Assets assets +// swagger:model assets +type Assets struct { + + // container + Container *AssetsContainer `json:"container,omitempty"` + + // uris + Uris Uris `json:"uris,omitempty"` +} + +// Validate validates this assets +func (m *Assets) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateContainer(formats); err != nil { + res = append(res, err) + } + + if err := m.validateUris(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Assets) validateContainer(formats strfmt.Registry) error { + + if swag.IsZero(m.Container) { // not required + return nil + } + + if m.Container != nil { + if err := m.Container.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("container") + } + return err + } + } + + return nil +} + +func (m *Assets) validateUris(formats strfmt.Registry) error { + + if swag.IsZero(m.Uris) { // not required + return nil + } + + if err := m.Uris.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("uris") + } + return err + } + + return nil +} + +// MarshalBinary interface implementation +func (m *Assets) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *Assets) UnmarshalBinary(b []byte) error { + var res Assets + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} + +// AssetsContainer assets container +// swagger:model AssetsContainer +type AssetsContainer struct { + + // docker + Docker Docker `json:"docker,omitempty"` +} + +// Validate validates this assets container +func (m *AssetsContainer) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateDocker(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *AssetsContainer) validateDocker(formats strfmt.Registry) error { + + if swag.IsZero(m.Docker) { // not required + return nil + } + + if err := m.Docker.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("container" + "." + "docker") + } + return err + } + + return nil +} + +// MarshalBinary interface implementation +func (m *AssetsContainer) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *AssetsContainer) UnmarshalBinary(b []byte) error { + var res AssetsContainer + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/dcos/cosmos/models/base64_string.go b/dcos/cosmos/models/base64_string.go new file mode 100644 index 0000000..8a20fee --- /dev/null +++ b/dcos/cosmos/models/base64_string.go @@ -0,0 +1,31 @@ +// 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 ( + strfmt "github.com/go-openapi/strfmt" + + "github.com/go-openapi/errors" + "github.com/go-openapi/validate" +) + +// Base64String base64 string +// swagger:model base64String +type Base64String string + +// Validate validates this base64 string +func (m Base64String) Validate(formats strfmt.Registry) error { + var res []error + + if err := validate.Pattern("", "body", string(m), `^([A-Za-z0-9+/]{4})*([A-Za-z0-9+/]{4}|[A-Za-z0-9+/]{3}=|[A-Za-z0-9+/]{2}==)$`); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/dcos/cosmos/models/binaries.go b/dcos/cosmos/models/binaries.go new file mode 100644 index 0000000..f7161d9 --- /dev/null +++ b/dcos/cosmos/models/binaries.go @@ -0,0 +1,121 @@ +// 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 ( + strfmt "github.com/go-openapi/strfmt" + + "github.com/go-openapi/errors" + "github.com/go-openapi/swag" +) + +// Binaries binaries +// swagger:model binaries +type Binaries struct { + + // darwin + Darwin *Os `json:"darwin,omitempty"` + + // linux + Linux *Os `json:"linux,omitempty"` + + // windows + Windows *Os `json:"windows,omitempty"` +} + +// Validate validates this binaries +func (m *Binaries) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateDarwin(formats); err != nil { + res = append(res, err) + } + + if err := m.validateLinux(formats); err != nil { + res = append(res, err) + } + + if err := m.validateWindows(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Binaries) validateDarwin(formats strfmt.Registry) error { + + if swag.IsZero(m.Darwin) { // not required + return nil + } + + if m.Darwin != nil { + if err := m.Darwin.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("darwin") + } + return err + } + } + + return nil +} + +func (m *Binaries) validateLinux(formats strfmt.Registry) error { + + if swag.IsZero(m.Linux) { // not required + return nil + } + + if m.Linux != nil { + if err := m.Linux.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("linux") + } + return err + } + } + + return nil +} + +func (m *Binaries) validateWindows(formats strfmt.Registry) error { + + if swag.IsZero(m.Windows) { // not required + return nil + } + + if m.Windows != nil { + if err := m.Windows.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("windows") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *Binaries) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *Binaries) UnmarshalBinary(b []byte) error { + var res Binaries + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/dcos/cosmos/models/cli.go b/dcos/cosmos/models/cli.go new file mode 100644 index 0000000..e8d86ff --- /dev/null +++ b/dcos/cosmos/models/cli.go @@ -0,0 +1,73 @@ +// 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 ( + strfmt "github.com/go-openapi/strfmt" + + "github.com/go-openapi/errors" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// Cli cli +// swagger:model cli +type Cli struct { + + // binaries + // Required: true + Binaries *Binaries `json:"binaries"` +} + +// Validate validates this cli +func (m *Cli) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateBinaries(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Cli) validateBinaries(formats strfmt.Registry) error { + + if err := validate.Required("binaries", "body", m.Binaries); err != nil { + return err + } + + if m.Binaries != nil { + if err := m.Binaries.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("binaries") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *Cli) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *Cli) UnmarshalBinary(b []byte) error { + var res Cli + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/dcos/cosmos/models/cli_info.go b/dcos/cosmos/models/cli_info.go new file mode 100644 index 0000000..8e76f60 --- /dev/null +++ b/dcos/cosmos/models/cli_info.go @@ -0,0 +1,163 @@ +// 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 ( + "encoding/json" + "strconv" + + strfmt "github.com/go-openapi/strfmt" + + "github.com/go-openapi/errors" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// CliInfo cli info +// swagger:model cliInfo +type CliInfo struct { + + // content hash + // Required: true + // Min Items: 1 + ContentHash []*Hash `json:"contentHash"` + + // kind + // Required: true + // Enum: [executable zip] + Kind *string `json:"kind"` + + // url + // Required: true + // Format: uri + URL URL `json:"url"` +} + +// Validate validates this cli info +func (m *CliInfo) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateContentHash(formats); err != nil { + res = append(res, err) + } + + if err := m.validateKind(formats); err != nil { + res = append(res, err) + } + + if err := m.validateURL(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *CliInfo) validateContentHash(formats strfmt.Registry) error { + + if err := validate.Required("contentHash", "body", m.ContentHash); err != nil { + return err + } + + iContentHashSize := int64(len(m.ContentHash)) + + if err := validate.MinItems("contentHash", "body", iContentHashSize, 1); err != nil { + return err + } + + for i := 0; i < len(m.ContentHash); i++ { + if swag.IsZero(m.ContentHash[i]) { // not required + continue + } + + if m.ContentHash[i] != nil { + if err := m.ContentHash[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("contentHash" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +var cliInfoTypeKindPropEnum []interface{} + +func init() { + var res []string + if err := json.Unmarshal([]byte(`["executable","zip"]`), &res); err != nil { + panic(err) + } + for _, v := range res { + cliInfoTypeKindPropEnum = append(cliInfoTypeKindPropEnum, v) + } +} + +const ( + + // CliInfoKindExecutable captures enum value "executable" + CliInfoKindExecutable string = "executable" + + // CliInfoKindZip captures enum value "zip" + CliInfoKindZip string = "zip" +) + +// prop value enum +func (m *CliInfo) validateKindEnum(path, location string, value string) error { + if err := validate.Enum(path, location, value, cliInfoTypeKindPropEnum); err != nil { + return err + } + return nil +} + +func (m *CliInfo) validateKind(formats strfmt.Registry) error { + + if err := validate.Required("kind", "body", m.Kind); err != nil { + return err + } + + // value enum + if err := m.validateKindEnum("kind", "body", *m.Kind); err != nil { + return err + } + + return nil +} + +func (m *CliInfo) validateURL(formats strfmt.Registry) error { + + if err := m.URL.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("url") + } + return err + } + + return nil +} + +// MarshalBinary interface implementation +func (m *CliInfo) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *CliInfo) UnmarshalBinary(b []byte) error { + var res CliInfo + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/dcos/cosmos/models/command.go b/dcos/cosmos/models/command.go new file mode 100644 index 0000000..185d145 --- /dev/null +++ b/dcos/cosmos/models/command.go @@ -0,0 +1,64 @@ +// 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 ( + strfmt "github.com/go-openapi/strfmt" + + "github.com/go-openapi/errors" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// Command command +// swagger:model command +type Command struct { + + // [Deprecated v3.x] An array of strings representing of the requirements file to use for installing the subcommand for Pip. Each item is interpreted as a line in the requirements file. + // Required: true + Pip []string `json:"pip"` +} + +// Validate validates this command +func (m *Command) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validatePip(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Command) validatePip(formats strfmt.Registry) error { + + if err := validate.Required("pip", "body", m.Pip); err != nil { + return err + } + + return nil +} + +// MarshalBinary interface implementation +func (m *Command) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *Command) UnmarshalBinary(b []byte) error { + var res Command + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/dcos/cosmos/models/config.go b/dcos/cosmos/models/config.go new file mode 100644 index 0000000..b0ec277 --- /dev/null +++ b/dcos/cosmos/models/config.go @@ -0,0 +1,10 @@ +// 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 + +// Config config +// swagger:model config +type Config interface{} diff --git a/dcos/cosmos/models/docker.go b/dcos/cosmos/models/docker.go new file mode 100644 index 0000000..236644c --- /dev/null +++ b/dcos/cosmos/models/docker.go @@ -0,0 +1,19 @@ +// 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 ( + strfmt "github.com/go-openapi/strfmt" +) + +// Docker docker +// swagger:model docker +type Docker map[string]string + +// Validate validates this docker +func (m Docker) Validate(formats strfmt.Registry) error { + return nil +} diff --git a/dcos/cosmos/models/error.go b/dcos/cosmos/models/error.go new file mode 100644 index 0000000..bfd9baf --- /dev/null +++ b/dcos/cosmos/models/error.go @@ -0,0 +1,84 @@ +// 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 ( + strfmt "github.com/go-openapi/strfmt" + + "github.com/go-openapi/errors" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// Error error +// swagger:model error +type Error struct { + + // data + Data interface{} `json:"data,omitempty"` + + // message + // Required: true + Message *string `json:"message"` + + // type + // Required: true + Type *string `json:"type"` +} + +// Validate validates this error +func (m *Error) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateMessage(formats); err != nil { + res = append(res, err) + } + + if err := m.validateType(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Error) validateMessage(formats strfmt.Registry) error { + + if err := validate.Required("message", "body", m.Message); err != nil { + return err + } + + return nil +} + +func (m *Error) validateType(formats strfmt.Registry) error { + + if err := validate.Required("type", "body", m.Type); err != nil { + return err + } + + return nil +} + +// MarshalBinary interface implementation +func (m *Error) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *Error) UnmarshalBinary(b []byte) error { + var res Error + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/dcos/cosmos/models/hash.go b/dcos/cosmos/models/hash.go new file mode 100644 index 0000000..c047f4a --- /dev/null +++ b/dcos/cosmos/models/hash.go @@ -0,0 +1,84 @@ +// 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 ( + strfmt "github.com/go-openapi/strfmt" + + "github.com/go-openapi/errors" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// Hash hash +// swagger:model hash +type Hash struct { + + // algo + // Required: true + Algo Algo `json:"algo"` + + // value + // Required: true + Value *string `json:"value"` +} + +// Validate validates this hash +func (m *Hash) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateAlgo(formats); err != nil { + res = append(res, err) + } + + if err := m.validateValue(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Hash) validateAlgo(formats strfmt.Registry) error { + + if err := m.Algo.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("algo") + } + return err + } + + return nil +} + +func (m *Hash) validateValue(formats strfmt.Registry) error { + + if err := validate.Required("value", "body", m.Value); err != nil { + return err + } + + return nil +} + +// MarshalBinary interface implementation +func (m *Hash) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *Hash) UnmarshalBinary(b []byte) error { + var res Hash + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/dcos/cosmos/models/images.go b/dcos/cosmos/models/images.go new file mode 100644 index 0000000..a02d4e2 --- /dev/null +++ b/dcos/cosmos/models/images.go @@ -0,0 +1,52 @@ +// 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 ( + strfmt "github.com/go-openapi/strfmt" + + "github.com/go-openapi/swag" +) + +// Images images +// swagger:model images +type Images struct { + + // PNG icon URL, preferably 256 by 256 pixels. + IconLarge string `json:"icon-large,omitempty"` + + // PNG icon URL, preferably 128 by 128 pixels. + IconMedium string `json:"icon-medium,omitempty"` + + // PNG icon URL, preferably 48 by 48 pixels. + IconSmall string `json:"icon-small,omitempty"` + + // screenshots + Screenshots []string `json:"screenshots"` +} + +// Validate validates this images +func (m *Images) Validate(formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *Images) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *Images) UnmarshalBinary(b []byte) error { + var res Images + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/dcos/cosmos/models/install_request.go b/dcos/cosmos/models/install_request.go new file mode 100644 index 0000000..826cc57 --- /dev/null +++ b/dcos/cosmos/models/install_request.go @@ -0,0 +1,73 @@ +// 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 ( + strfmt "github.com/go-openapi/strfmt" + + "github.com/go-openapi/errors" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// InstallRequest install request +// swagger:model installRequest +type InstallRequest struct { + + // app Id + AppID string `json:"appId,omitempty"` + + // options + Options interface{} `json:"options,omitempty"` + + // package name + // Required: true + PackageName *string `json:"packageName"` + + // package version + PackageVersion string `json:"packageVersion,omitempty"` +} + +// Validate validates this install request +func (m *InstallRequest) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validatePackageName(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *InstallRequest) validatePackageName(formats strfmt.Registry) error { + + if err := validate.Required("packageName", "body", m.PackageName); err != nil { + return err + } + + return nil +} + +// MarshalBinary interface implementation +func (m *InstallRequest) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *InstallRequest) UnmarshalBinary(b []byte) error { + var res InstallRequest + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/dcos/cosmos/models/install_response.go b/dcos/cosmos/models/install_response.go new file mode 100644 index 0000000..1085821 --- /dev/null +++ b/dcos/cosmos/models/install_response.go @@ -0,0 +1,112 @@ +// 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 ( + strfmt "github.com/go-openapi/strfmt" + + "github.com/go-openapi/errors" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// InstallResponse install response +// swagger:model installResponse +type InstallResponse struct { + + // app Id + AppID string `json:"appId,omitempty"` + + // cli + Cli *Cli `json:"cli,omitempty"` + + // package name + // Required: true + PackageName *string `json:"packageName"` + + // package version + // Required: true + PackageVersion *string `json:"packageVersion"` + + // post install notes + PostInstallNotes string `json:"postInstallNotes,omitempty"` +} + +// Validate validates this install response +func (m *InstallResponse) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateCli(formats); err != nil { + res = append(res, err) + } + + if err := m.validatePackageName(formats); err != nil { + res = append(res, err) + } + + if err := m.validatePackageVersion(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *InstallResponse) validateCli(formats strfmt.Registry) error { + + if swag.IsZero(m.Cli) { // not required + return nil + } + + if m.Cli != nil { + if err := m.Cli.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("cli") + } + return err + } + } + + return nil +} + +func (m *InstallResponse) validatePackageName(formats strfmt.Registry) error { + + if err := validate.Required("packageName", "body", m.PackageName); err != nil { + return err + } + + return nil +} + +func (m *InstallResponse) validatePackageVersion(formats strfmt.Registry) error { + + if err := validate.Required("packageVersion", "body", m.PackageVersion); err != nil { + return err + } + + return nil +} + +// MarshalBinary interface implementation +func (m *InstallResponse) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *InstallResponse) UnmarshalBinary(b []byte) error { + var res InstallResponse + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/dcos/cosmos/models/kubernetes_auth_data_response.go b/dcos/cosmos/models/kubernetes_auth_data_response.go new file mode 100644 index 0000000..93d8f86 --- /dev/null +++ b/dcos/cosmos/models/kubernetes_auth_data_response.go @@ -0,0 +1,81 @@ +// 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 ( + strfmt "github.com/go-openapi/strfmt" + + "github.com/go-openapi/errors" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// KubernetesAuthDataResponse kubernetes auth data response +// swagger:model kubernetesAuthDataResponse +type KubernetesAuthDataResponse struct { + + // ca crt + // Required: true + CaCrt *string `json:"caCrt"` + + // token + // Required: true + Token *string `json:"token"` +} + +// Validate validates this kubernetes auth data response +func (m *KubernetesAuthDataResponse) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateCaCrt(formats); err != nil { + res = append(res, err) + } + + if err := m.validateToken(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *KubernetesAuthDataResponse) validateCaCrt(formats strfmt.Registry) error { + + if err := validate.Required("caCrt", "body", m.CaCrt); err != nil { + return err + } + + return nil +} + +func (m *KubernetesAuthDataResponse) validateToken(formats strfmt.Registry) error { + + if err := validate.Required("token", "body", m.Token); err != nil { + return err + } + + return nil +} + +// MarshalBinary interface implementation +func (m *KubernetesAuthDataResponse) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *KubernetesAuthDataResponse) UnmarshalBinary(b []byte) error { + var res KubernetesAuthDataResponse + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/dcos/cosmos/models/licence.go b/dcos/cosmos/models/licence.go new file mode 100644 index 0000000..f9a1e77 --- /dev/null +++ b/dcos/cosmos/models/licence.go @@ -0,0 +1,85 @@ +// 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 ( + strfmt "github.com/go-openapi/strfmt" + + "github.com/go-openapi/errors" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// Licence licence +// swagger:model licence +type Licence struct { + + // The name of the license. For example one of [Apache License Version 2.0 | MIT License | BSD License | Proprietary] + // Required: true + Name *string `json:"name"` + + // url + // Required: true + // Format: uri + URL URL `json:"url"` +} + +// Validate validates this licence +func (m *Licence) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateName(formats); err != nil { + res = append(res, err) + } + + if err := m.validateURL(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Licence) validateName(formats strfmt.Registry) error { + + if err := validate.Required("name", "body", m.Name); err != nil { + return err + } + + return nil +} + +func (m *Licence) validateURL(formats strfmt.Registry) error { + + if err := m.URL.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("url") + } + return err + } + + return nil +} + +// MarshalBinary interface implementation +func (m *Licence) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *Licence) UnmarshalBinary(b []byte) error { + var res Licence + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/dcos/cosmos/models/licences.go b/dcos/cosmos/models/licences.go new file mode 100644 index 0000000..9976181 --- /dev/null +++ b/dcos/cosmos/models/licences.go @@ -0,0 +1,45 @@ +// 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 ( + "strconv" + + strfmt "github.com/go-openapi/strfmt" + + "github.com/go-openapi/errors" + "github.com/go-openapi/swag" +) + +// Licences licences +// swagger:model licences +type Licences []*Licence + +// Validate validates this licences +func (m Licences) Validate(formats strfmt.Registry) error { + var res []error + + for i := 0; i < len(m); i++ { + if swag.IsZero(m[i]) { // not required + continue + } + + if m[i] != nil { + if err := m[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName(strconv.Itoa(i)) + } + return err + } + } + + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/dcos/cosmos/models/manager.go b/dcos/cosmos/models/manager.go new file mode 100644 index 0000000..387cc11 --- /dev/null +++ b/dcos/cosmos/models/manager.go @@ -0,0 +1,67 @@ +// 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 ( + strfmt "github.com/go-openapi/strfmt" + + "github.com/go-openapi/errors" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// Manager manager +// swagger:model manager +type Manager struct { + + // min package version + MinPackageVersion string `json:"minPackageVersion,omitempty"` + + // package name + // Required: true + PackageName *string `json:"packageName"` +} + +// Validate validates this manager +func (m *Manager) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validatePackageName(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Manager) validatePackageName(formats strfmt.Registry) error { + + if err := validate.Required("packageName", "body", m.PackageName); err != nil { + return err + } + + return nil +} + +// MarshalBinary interface implementation +func (m *Manager) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *Manager) UnmarshalBinary(b []byte) error { + var res Manager + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/dcos/cosmos/models/marathon.go b/dcos/cosmos/models/marathon.go new file mode 100644 index 0000000..d581a45 --- /dev/null +++ b/dcos/cosmos/models/marathon.go @@ -0,0 +1,66 @@ +// 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 ( + strfmt "github.com/go-openapi/strfmt" + + "github.com/go-openapi/errors" + "github.com/go-openapi/swag" +) + +// Marathon marathon +// swagger:model marathon +type Marathon struct { + + // v2 app mustache template + // Required: true + V2AppMustacheTemplate Base64String `json:"v2AppMustacheTemplate"` +} + +// Validate validates this marathon +func (m *Marathon) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateV2AppMustacheTemplate(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Marathon) validateV2AppMustacheTemplate(formats strfmt.Registry) error { + + if err := m.V2AppMustacheTemplate.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("v2AppMustacheTemplate") + } + return err + } + + return nil +} + +// MarshalBinary interface implementation +func (m *Marathon) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *Marathon) UnmarshalBinary(b []byte) error { + var res Marathon + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/dcos/cosmos/models/os.go b/dcos/cosmos/models/os.go new file mode 100644 index 0000000..7ba1999 --- /dev/null +++ b/dcos/cosmos/models/os.go @@ -0,0 +1,73 @@ +// 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 ( + strfmt "github.com/go-openapi/strfmt" + + "github.com/go-openapi/errors" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// Os os +// swagger:model os +type Os struct { + + // x86 64 + // Required: true + X8664 *CliInfo `json:"x86-64"` +} + +// Validate validates this os +func (m *Os) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateX8664(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Os) validateX8664(formats strfmt.Registry) error { + + if err := validate.Required("x86-64", "body", m.X8664); err != nil { + return err + } + + if m.X8664 != nil { + if err := m.X8664.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("x86-64") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *Os) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *Os) UnmarshalBinary(b []byte) error { + var res Os + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/dcos/cosmos/models/package_add_repo_request.go b/dcos/cosmos/models/package_add_repo_request.go new file mode 100644 index 0000000..b25ec41 --- /dev/null +++ b/dcos/cosmos/models/package_add_repo_request.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 ( + strfmt "github.com/go-openapi/strfmt" + + "github.com/go-openapi/errors" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// PackageAddRepoRequest package add repo request +// swagger:model packageAddRepoRequest +type PackageAddRepoRequest struct { + + // index + // Minimum: 0 + Index *int64 `json:"index,omitempty"` + + // name + // Required: true + Name *string `json:"name"` + + // uri + // Required: true + // Format: uri + URI URL `json:"uri"` +} + +// Validate validates this package add repo request +func (m *PackageAddRepoRequest) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateIndex(formats); err != nil { + res = append(res, err) + } + + if err := m.validateName(formats); err != nil { + res = append(res, err) + } + + if err := m.validateURI(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *PackageAddRepoRequest) validateIndex(formats strfmt.Registry) error { + + if swag.IsZero(m.Index) { // not required + return nil + } + + if err := validate.MinimumInt("index", "body", int64(*m.Index), 0, false); err != nil { + return err + } + + return nil +} + +func (m *PackageAddRepoRequest) validateName(formats strfmt.Registry) error { + + if err := validate.Required("name", "body", m.Name); err != nil { + return err + } + + return nil +} + +func (m *PackageAddRepoRequest) validateURI(formats strfmt.Registry) error { + + if err := m.URI.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("uri") + } + return err + } + + return nil +} + +// MarshalBinary interface implementation +func (m *PackageAddRepoRequest) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *PackageAddRepoRequest) UnmarshalBinary(b []byte) error { + var res PackageAddRepoRequest + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/dcos/cosmos/models/package_add_repo_response.go b/dcos/cosmos/models/package_add_repo_response.go new file mode 100644 index 0000000..de8a51c --- /dev/null +++ b/dcos/cosmos/models/package_add_repo_response.go @@ -0,0 +1,82 @@ +// 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 ( + "strconv" + + strfmt "github.com/go-openapi/strfmt" + + "github.com/go-openapi/errors" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// PackageAddRepoResponse package add repo response +// swagger:model packageAddRepoResponse +type PackageAddRepoResponse struct { + + // repositories + // Required: true + Repositories []*PkgRepo `json:"repositories"` +} + +// Validate validates this package add repo response +func (m *PackageAddRepoResponse) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateRepositories(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *PackageAddRepoResponse) validateRepositories(formats strfmt.Registry) error { + + if err := validate.Required("repositories", "body", m.Repositories); err != nil { + return err + } + + for i := 0; i < len(m.Repositories); i++ { + if swag.IsZero(m.Repositories[i]) { // not required + continue + } + + if m.Repositories[i] != nil { + if err := m.Repositories[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("repositories" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// MarshalBinary interface implementation +func (m *PackageAddRepoResponse) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *PackageAddRepoResponse) UnmarshalBinary(b []byte) error { + var res PackageAddRepoResponse + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/dcos/cosmos/models/package_delete_repo_request.go b/dcos/cosmos/models/package_delete_repo_request.go new file mode 100644 index 0000000..cc6eed4 --- /dev/null +++ b/dcos/cosmos/models/package_delete_repo_request.go @@ -0,0 +1,73 @@ +// 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 ( + strfmt "github.com/go-openapi/strfmt" + + "github.com/go-openapi/errors" + "github.com/go-openapi/swag" +) + +// PackageDeleteRepoRequest package delete repo request +// swagger:model packageDeleteRepoRequest +type PackageDeleteRepoRequest struct { + + // name + Name string `json:"name,omitempty"` + + // uri + // Format: uri + URI URL `json:"uri,omitempty"` +} + +// Validate validates this package delete repo request +func (m *PackageDeleteRepoRequest) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateURI(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *PackageDeleteRepoRequest) validateURI(formats strfmt.Registry) error { + + if swag.IsZero(m.URI) { // not required + return nil + } + + if err := m.URI.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("uri") + } + return err + } + + return nil +} + +// MarshalBinary interface implementation +func (m *PackageDeleteRepoRequest) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *PackageDeleteRepoRequest) UnmarshalBinary(b []byte) error { + var res PackageDeleteRepoRequest + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/dcos/cosmos/models/package_delete_repo_response.go b/dcos/cosmos/models/package_delete_repo_response.go new file mode 100644 index 0000000..3ef8122 --- /dev/null +++ b/dcos/cosmos/models/package_delete_repo_response.go @@ -0,0 +1,82 @@ +// 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 ( + "strconv" + + strfmt "github.com/go-openapi/strfmt" + + "github.com/go-openapi/errors" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// PackageDeleteRepoResponse package delete repo response +// swagger:model packageDeleteRepoResponse +type PackageDeleteRepoResponse struct { + + // repositories + // Required: true + Repositories []*PkgRepo `json:"repositories"` +} + +// Validate validates this package delete repo response +func (m *PackageDeleteRepoResponse) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateRepositories(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *PackageDeleteRepoResponse) validateRepositories(formats strfmt.Registry) error { + + if err := validate.Required("repositories", "body", m.Repositories); err != nil { + return err + } + + for i := 0; i < len(m.Repositories); i++ { + if swag.IsZero(m.Repositories[i]) { // not required + continue + } + + if m.Repositories[i] != nil { + if err := m.Repositories[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("repositories" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// MarshalBinary interface implementation +func (m *PackageDeleteRepoResponse) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *PackageDeleteRepoResponse) UnmarshalBinary(b []byte) error { + var res PackageDeleteRepoResponse + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/dcos/cosmos/models/package_describe_request.go b/dcos/cosmos/models/package_describe_request.go new file mode 100644 index 0000000..2cf5771 --- /dev/null +++ b/dcos/cosmos/models/package_describe_request.go @@ -0,0 +1,67 @@ +// 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 ( + strfmt "github.com/go-openapi/strfmt" + + "github.com/go-openapi/errors" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// PackageDescribeRequest package describe request +// swagger:model packageDescribeRequest +type PackageDescribeRequest struct { + + // package name + // Required: true + PackageName *string `json:"packageName"` + + // package version + PackageVersion string `json:"packageVersion,omitempty"` +} + +// Validate validates this package describe request +func (m *PackageDescribeRequest) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validatePackageName(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *PackageDescribeRequest) validatePackageName(formats strfmt.Registry) error { + + if err := validate.Required("packageName", "body", m.PackageName); err != nil { + return err + } + + return nil +} + +// MarshalBinary interface implementation +func (m *PackageDescribeRequest) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *PackageDescribeRequest) UnmarshalBinary(b []byte) error { + var res PackageDescribeRequest + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/dcos/cosmos/models/package_details.go b/dcos/cosmos/models/package_details.go new file mode 100644 index 0000000..adb53fc --- /dev/null +++ b/dcos/cosmos/models/package_details.go @@ -0,0 +1,224 @@ +// 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 ( + "strconv" + + strfmt "github.com/go-openapi/strfmt" + + "github.com/go-openapi/errors" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// PackageDetails package details +// swagger:model packageDetails +type PackageDetails struct { + + // description + // Required: true + Description *string `json:"description"` + + // True if this package installs a new Mesos framework. + Framework *bool `json:"framework,omitempty"` + + // licenses + Licenses Licences `json:"licenses,omitempty"` + + // maintainer + // Required: true + Maintainer *string `json:"maintainer"` + + // name + // Required: true + Name *string `json:"name"` + + // packaging version + // Required: true + PackagingVersion *string `json:"packagingVersion"` + + // Post installation notes that would be useful to the user of this package. + PostInstallNotes string `json:"postInstallNotes,omitempty"` + + // Post uninstallation notes that would be useful to the user of this package. + PostUninstallNotes string `json:"postUninstallNotes,omitempty"` + + // Pre installation notes that would be useful to the user of this package. + PreInstallNotes string `json:"preInstallNotes,omitempty"` + + // Corresponds to the revision index from the universe directory structure + // Minimum: 0 + ReleaseVersion *int64 `json:"releaseVersion,omitempty"` + + // scm + Scm string `json:"scm,omitempty"` + + // Flag indicating if the package is selected in search results + Selected *bool `json:"selected,omitempty"` + + // tags + // Required: true + Tags []string `json:"tags"` + + // version + // Required: true + Version *string `json:"version"` + + // website + Website string `json:"website,omitempty"` +} + +// Validate validates this package details +func (m *PackageDetails) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateDescription(formats); err != nil { + res = append(res, err) + } + + if err := m.validateLicenses(formats); err != nil { + res = append(res, err) + } + + if err := m.validateMaintainer(formats); err != nil { + res = append(res, err) + } + + if err := m.validateName(formats); err != nil { + res = append(res, err) + } + + if err := m.validatePackagingVersion(formats); err != nil { + res = append(res, err) + } + + if err := m.validateReleaseVersion(formats); err != nil { + res = append(res, err) + } + + if err := m.validateTags(formats); err != nil { + res = append(res, err) + } + + if err := m.validateVersion(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *PackageDetails) validateDescription(formats strfmt.Registry) error { + + if err := validate.Required("description", "body", m.Description); err != nil { + return err + } + + return nil +} + +func (m *PackageDetails) validateLicenses(formats strfmt.Registry) error { + + if swag.IsZero(m.Licenses) { // not required + return nil + } + + if err := m.Licenses.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("licenses") + } + return err + } + + return nil +} + +func (m *PackageDetails) validateMaintainer(formats strfmt.Registry) error { + + if err := validate.Required("maintainer", "body", m.Maintainer); err != nil { + return err + } + + return nil +} + +func (m *PackageDetails) validateName(formats strfmt.Registry) error { + + if err := validate.Required("name", "body", m.Name); err != nil { + return err + } + + return nil +} + +func (m *PackageDetails) validatePackagingVersion(formats strfmt.Registry) error { + + if err := validate.Required("packagingVersion", "body", m.PackagingVersion); err != nil { + return err + } + + return nil +} + +func (m *PackageDetails) validateReleaseVersion(formats strfmt.Registry) error { + + if swag.IsZero(m.ReleaseVersion) { // not required + return nil + } + + if err := validate.MinimumInt("releaseVersion", "body", int64(*m.ReleaseVersion), 0, false); err != nil { + return err + } + + return nil +} + +func (m *PackageDetails) validateTags(formats strfmt.Registry) error { + + if err := validate.Required("tags", "body", m.Tags); err != nil { + return err + } + + for i := 0; i < len(m.Tags); i++ { + + if err := validate.Pattern("tags"+"."+strconv.Itoa(i), "body", string(m.Tags[i]), `^[^\s]+$`); err != nil { + return err + } + + } + + return nil +} + +func (m *PackageDetails) validateVersion(formats strfmt.Registry) error { + + if err := validate.Required("version", "body", m.Version); err != nil { + return err + } + + return nil +} + +// MarshalBinary interface implementation +func (m *PackageDetails) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *PackageDetails) UnmarshalBinary(b []byte) error { + var res PackageDetails + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/dcos/cosmos/models/phase_step.go b/dcos/cosmos/models/phase_step.go new file mode 100644 index 0000000..22e56f8 --- /dev/null +++ b/dcos/cosmos/models/phase_step.go @@ -0,0 +1,52 @@ +// 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 ( + strfmt "github.com/go-openapi/strfmt" + + "github.com/go-openapi/swag" +) + +// PhaseStep phase step +// swagger:model phaseStep +type PhaseStep struct { + + // id + ID string `json:"id,omitempty"` + + // message + Message string `json:"message,omitempty"` + + // name + Name string `json:"name,omitempty"` + + // status + Status string `json:"status,omitempty"` +} + +// Validate validates this phase step +func (m *PhaseStep) Validate(formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *PhaseStep) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *PhaseStep) UnmarshalBinary(b []byte) error { + var res PhaseStep + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/dcos/cosmos/models/pkg_repo.go b/dcos/cosmos/models/pkg_repo.go new file mode 100644 index 0000000..78351ad --- /dev/null +++ b/dcos/cosmos/models/pkg_repo.go @@ -0,0 +1,85 @@ +// 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 ( + strfmt "github.com/go-openapi/strfmt" + + "github.com/go-openapi/errors" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// PkgRepo pkg repo +// swagger:model pkgRepo +type PkgRepo struct { + + // name + // Required: true + Name *string `json:"name"` + + // uri + // Required: true + // Format: uri + URI URL `json:"uri"` +} + +// Validate validates this pkg repo +func (m *PkgRepo) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateName(formats); err != nil { + res = append(res, err) + } + + if err := m.validateURI(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *PkgRepo) validateName(formats strfmt.Registry) error { + + if err := validate.Required("name", "body", m.Name); err != nil { + return err + } + + return nil +} + +func (m *PkgRepo) validateURI(formats strfmt.Registry) error { + + if err := m.URI.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("uri") + } + return err + } + + return nil +} + +// MarshalBinary interface implementation +func (m *PkgRepo) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *PkgRepo) UnmarshalBinary(b []byte) error { + var res PkgRepo + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/dcos/cosmos/models/plan_definition.go b/dcos/cosmos/models/plan_definition.go new file mode 100644 index 0000000..92c9c55 --- /dev/null +++ b/dcos/cosmos/models/plan_definition.go @@ -0,0 +1,101 @@ +// 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 ( + "strconv" + + strfmt "github.com/go-openapi/strfmt" + + "github.com/go-openapi/errors" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// PlanDefinition plan definition +// swagger:model planDefinition +type PlanDefinition struct { + + // errors + Errors []string `json:"errors"` + + // phases + Phases []*PlanPhase `json:"phases"` + + // status + // Required: true + Status *string `json:"status"` +} + +// Validate validates this plan definition +func (m *PlanDefinition) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validatePhases(formats); err != nil { + res = append(res, err) + } + + if err := m.validateStatus(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *PlanDefinition) validatePhases(formats strfmt.Registry) error { + + if swag.IsZero(m.Phases) { // not required + return nil + } + + for i := 0; i < len(m.Phases); i++ { + if swag.IsZero(m.Phases[i]) { // not required + continue + } + + if m.Phases[i] != nil { + if err := m.Phases[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("phases" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *PlanDefinition) validateStatus(formats strfmt.Registry) error { + + if err := validate.Required("status", "body", m.Status); err != nil { + return err + } + + return nil +} + +// MarshalBinary interface implementation +func (m *PlanDefinition) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *PlanDefinition) UnmarshalBinary(b []byte) error { + var res PlanDefinition + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/dcos/cosmos/models/plan_phase.go b/dcos/cosmos/models/plan_phase.go new file mode 100644 index 0000000..6ea8325 --- /dev/null +++ b/dcos/cosmos/models/plan_phase.go @@ -0,0 +1,92 @@ +// 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 ( + "strconv" + + strfmt "github.com/go-openapi/strfmt" + + "github.com/go-openapi/errors" + "github.com/go-openapi/swag" +) + +// PlanPhase plan phase +// swagger:model planPhase +type PlanPhase struct { + + // id + ID string `json:"id,omitempty"` + + // name + Name string `json:"name,omitempty"` + + // status + Status string `json:"status,omitempty"` + + // steps + Steps []*PhaseStep `json:"steps"` + + // strategy + Strategy string `json:"strategy,omitempty"` +} + +// Validate validates this plan phase +func (m *PlanPhase) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateSteps(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *PlanPhase) validateSteps(formats strfmt.Registry) error { + + if swag.IsZero(m.Steps) { // not required + return nil + } + + for i := 0; i < len(m.Steps); i++ { + if swag.IsZero(m.Steps[i]) { // not required + continue + } + + if m.Steps[i] != nil { + if err := m.Steps[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("steps" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// MarshalBinary interface implementation +func (m *PlanPhase) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *PlanPhase) UnmarshalBinary(b []byte) error { + var res PlanPhase + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/dcos/cosmos/models/service_describe_request.go b/dcos/cosmos/models/service_describe_request.go new file mode 100644 index 0000000..7b28e7c --- /dev/null +++ b/dcos/cosmos/models/service_describe_request.go @@ -0,0 +1,81 @@ +// 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 ( + strfmt "github.com/go-openapi/strfmt" + + "github.com/go-openapi/errors" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// ServiceDescribeRequest service describe request +// swagger:model serviceDescribeRequest +type ServiceDescribeRequest struct { + + // app Id + // Required: true + AppID *string `json:"appId"` + + // manager Id + // Required: true + ManagerID *string `json:"managerId"` +} + +// Validate validates this service describe request +func (m *ServiceDescribeRequest) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateAppID(formats); err != nil { + res = append(res, err) + } + + if err := m.validateManagerID(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *ServiceDescribeRequest) validateAppID(formats strfmt.Registry) error { + + if err := validate.Required("appId", "body", m.AppID); err != nil { + return err + } + + return nil +} + +func (m *ServiceDescribeRequest) validateManagerID(formats strfmt.Registry) error { + + if err := validate.Required("managerId", "body", m.ManagerID); err != nil { + return err + } + + return nil +} + +// MarshalBinary interface implementation +func (m *ServiceDescribeRequest) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *ServiceDescribeRequest) UnmarshalBinary(b []byte) error { + var res ServiceDescribeRequest + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/dcos/cosmos/models/service_describe_response.go b/dcos/cosmos/models/service_describe_response.go new file mode 100644 index 0000000..635dc97 --- /dev/null +++ b/dcos/cosmos/models/service_describe_response.go @@ -0,0 +1,113 @@ +// 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 ( + strfmt "github.com/go-openapi/strfmt" + + "github.com/go-openapi/errors" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// ServiceDescribeResponse service describe response +// swagger:model serviceDescribeResponse +type ServiceDescribeResponse struct { + + // downgrades to + // Required: true + DowngradesTo []string `json:"downgradesTo"` + + // package + // Required: true + Package *V50PackageDefinition `json:"package"` + + // The result of merging the default package options with the user supplied options + ResolvedOptions interface{} `json:"resolvedOptions,omitempty"` + + // upgrades to + // Required: true + UpgradesTo []string `json:"upgradesTo"` + + // The options the user provided to run the service + UserProvidedOptions interface{} `json:"userProvidedOptions,omitempty"` +} + +// Validate validates this service describe response +func (m *ServiceDescribeResponse) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateDowngradesTo(formats); err != nil { + res = append(res, err) + } + + if err := m.validatePackage(formats); err != nil { + res = append(res, err) + } + + if err := m.validateUpgradesTo(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *ServiceDescribeResponse) validateDowngradesTo(formats strfmt.Registry) error { + + if err := validate.Required("downgradesTo", "body", m.DowngradesTo); err != nil { + return err + } + + return nil +} + +func (m *ServiceDescribeResponse) validatePackage(formats strfmt.Registry) error { + + if err := validate.Required("package", "body", m.Package); err != nil { + return err + } + + if m.Package != nil { + if err := m.Package.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("package") + } + return err + } + } + + return nil +} + +func (m *ServiceDescribeResponse) validateUpgradesTo(formats strfmt.Registry) error { + + if err := validate.Required("upgradesTo", "body", m.UpgradesTo); err != nil { + return err + } + + return nil +} + +// MarshalBinary interface implementation +func (m *ServiceDescribeResponse) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *ServiceDescribeResponse) UnmarshalBinary(b []byte) error { + var res ServiceDescribeResponse + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/dcos/cosmos/models/service_update_request.go b/dcos/cosmos/models/service_update_request.go new file mode 100644 index 0000000..b6e1687 --- /dev/null +++ b/dcos/cosmos/models/service_update_request.go @@ -0,0 +1,90 @@ +// 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 ( + strfmt "github.com/go-openapi/strfmt" + + "github.com/go-openapi/errors" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// ServiceUpdateRequest service update request +// swagger:model serviceUpdateRequest +type ServiceUpdateRequest struct { + + // app Id + // Required: true + AppID *string `json:"appId"` + + // options + Options interface{} `json:"options,omitempty"` + + // package name + PackageName string `json:"packageName,omitempty"` + + // package version + PackageVersion string `json:"packageVersion,omitempty"` + + // If true any stored configuration will be ignored when producing the updated service configuration. + // Required: true + Replace *bool `json:"replace"` +} + +// Validate validates this service update request +func (m *ServiceUpdateRequest) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateAppID(formats); err != nil { + res = append(res, err) + } + + if err := m.validateReplace(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *ServiceUpdateRequest) validateAppID(formats strfmt.Registry) error { + + if err := validate.Required("appId", "body", m.AppID); err != nil { + return err + } + + return nil +} + +func (m *ServiceUpdateRequest) validateReplace(formats strfmt.Registry) error { + + if err := validate.Required("replace", "body", m.Replace); err != nil { + return err + } + + return nil +} + +// MarshalBinary interface implementation +func (m *ServiceUpdateRequest) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *ServiceUpdateRequest) UnmarshalBinary(b []byte) error { + var res ServiceUpdateRequest + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/dcos/cosmos/models/service_update_response.go b/dcos/cosmos/models/service_update_response.go new file mode 100644 index 0000000..8d2c36e --- /dev/null +++ b/dcos/cosmos/models/service_update_response.go @@ -0,0 +1,103 @@ +// 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 ( + strfmt "github.com/go-openapi/strfmt" + + "github.com/go-openapi/errors" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// ServiceUpdateResponse service update response +// swagger:model serviceUpdateResponse +type ServiceUpdateResponse struct { + + // marathon deployment Id + // Required: true + MarathonDeploymentID *string `json:"marathonDeploymentId"` + + // package + // Required: true + Package *V50PackageDefinition `json:"package"` + + // The result of merging the default package options with the user supplied options + // Required: true + ResolvedOptions interface{} `json:"resolvedOptions"` +} + +// Validate validates this service update response +func (m *ServiceUpdateResponse) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateMarathonDeploymentID(formats); err != nil { + res = append(res, err) + } + + if err := m.validatePackage(formats); err != nil { + res = append(res, err) + } + + if err := m.validateResolvedOptions(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *ServiceUpdateResponse) validateMarathonDeploymentID(formats strfmt.Registry) error { + + if err := validate.Required("marathonDeploymentId", "body", m.MarathonDeploymentID); err != nil { + return err + } + + return nil +} + +func (m *ServiceUpdateResponse) validatePackage(formats strfmt.Registry) error { + + if err := validate.Required("package", "body", m.Package); err != nil { + return err + } + + if m.Package != nil { + if err := m.Package.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("package") + } + return err + } + } + + return nil +} + +func (m *ServiceUpdateResponse) validateResolvedOptions(formats strfmt.Registry) error { + + return nil +} + +// MarshalBinary interface implementation +func (m *ServiceUpdateResponse) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *ServiceUpdateResponse) UnmarshalBinary(b []byte) error { + var res ServiceUpdateResponse + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/dcos/cosmos/models/system_health.go b/dcos/cosmos/models/system_health.go new file mode 100644 index 0000000..d24e632 --- /dev/null +++ b/dcos/cosmos/models/system_health.go @@ -0,0 +1,98 @@ +// 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 ( + "strconv" + + strfmt "github.com/go-openapi/strfmt" + + "github.com/go-openapi/errors" + "github.com/go-openapi/swag" +) + +// SystemHealth system health +// swagger:model systemHealth +type SystemHealth struct { + + // dcos diagnostics version + DCOSDiagnosticsVersion string `json:"dcosDiagnosticsVersion,omitempty"` + + // dcos version + DCOSVersion string `json:"dcosVersion,omitempty"` + + // hostname + Hostname string `json:"hostname,omitempty"` + + // ip + IP string `json:"ip,omitempty"` + + // mesos ID + MesosID string `json:"mesosID,omitempty"` + + // node role + NodeRole string `json:"nodeRole,omitempty"` + + // units + Units []*UnitHealth `json:"units"` +} + +// Validate validates this system health +func (m *SystemHealth) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateUnits(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *SystemHealth) validateUnits(formats strfmt.Registry) error { + + if swag.IsZero(m.Units) { // not required + return nil + } + + for i := 0; i < len(m.Units); i++ { + if swag.IsZero(m.Units[i]) { // not required + continue + } + + if m.Units[i] != nil { + if err := m.Units[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("units" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// MarshalBinary interface implementation +func (m *SystemHealth) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *SystemHealth) UnmarshalBinary(b []byte) error { + var res SystemHealth + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/dcos/cosmos/models/system_node.go b/dcos/cosmos/models/system_node.go new file mode 100644 index 0000000..6b50bd2 --- /dev/null +++ b/dcos/cosmos/models/system_node.go @@ -0,0 +1,49 @@ +// 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 ( + strfmt "github.com/go-openapi/strfmt" + + "github.com/go-openapi/swag" +) + +// SystemNode system node +// swagger:model systemNode +type SystemNode struct { + + // health + Health int64 `json:"health,omitempty"` + + // host ip + HostIP string `json:"host_ip,omitempty"` + + // role + Role string `json:"role,omitempty"` +} + +// Validate validates this system node +func (m *SystemNode) Validate(formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *SystemNode) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *SystemNode) UnmarshalBinary(b []byte) error { + var res SystemNode + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/dcos/cosmos/models/system_nodes.go b/dcos/cosmos/models/system_nodes.go new file mode 100644 index 0000000..7e89b16 --- /dev/null +++ b/dcos/cosmos/models/system_nodes.go @@ -0,0 +1,80 @@ +// 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 ( + "strconv" + + strfmt "github.com/go-openapi/strfmt" + + "github.com/go-openapi/errors" + "github.com/go-openapi/swag" +) + +// SystemNodes system nodes +// swagger:model systemNodes +type SystemNodes struct { + + // nodes + Nodes []*SystemNode `json:"nodes"` +} + +// Validate validates this system nodes +func (m *SystemNodes) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateNodes(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *SystemNodes) validateNodes(formats strfmt.Registry) error { + + if swag.IsZero(m.Nodes) { // not required + return nil + } + + for i := 0; i < len(m.Nodes); i++ { + if swag.IsZero(m.Nodes[i]) { // not required + continue + } + + if m.Nodes[i] != nil { + if err := m.Nodes[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("nodes" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// MarshalBinary interface implementation +func (m *SystemNodes) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *SystemNodes) UnmarshalBinary(b []byte) error { + var res SystemNodes + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/dcos/cosmos/models/uninstall_request.go b/dcos/cosmos/models/uninstall_request.go new file mode 100644 index 0000000..256926f --- /dev/null +++ b/dcos/cosmos/models/uninstall_request.go @@ -0,0 +1,70 @@ +// 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 ( + strfmt "github.com/go-openapi/strfmt" + + "github.com/go-openapi/errors" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// UninstallRequest uninstall request +// swagger:model uninstallRequest +type UninstallRequest struct { + + // all + All bool `json:"all,omitempty"` + + // app Id + AppID string `json:"appId,omitempty"` + + // package name + // Required: true + PackageName *string `json:"packageName"` +} + +// Validate validates this uninstall request +func (m *UninstallRequest) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validatePackageName(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *UninstallRequest) validatePackageName(formats strfmt.Registry) error { + + if err := validate.Required("packageName", "body", m.PackageName); err != nil { + return err + } + + return nil +} + +// MarshalBinary interface implementation +func (m *UninstallRequest) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *UninstallRequest) UnmarshalBinary(b []byte) error { + var res UninstallRequest + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/dcos/cosmos/models/uninstall_response.go b/dcos/cosmos/models/uninstall_response.go new file mode 100644 index 0000000..87109e6 --- /dev/null +++ b/dcos/cosmos/models/uninstall_response.go @@ -0,0 +1,87 @@ +// 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 ( + strfmt "github.com/go-openapi/strfmt" + + "github.com/go-openapi/errors" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// UninstallResponse uninstall response +// swagger:model uninstallResponse +type UninstallResponse struct { + + // app Id + // Required: true + AppID *string `json:"appId"` + + // package name + // Required: true + PackageName *string `json:"packageName"` + + // package version + PackageVersion string `json:"packageVersion,omitempty"` + + // post uninstall notes + PostUninstallNotes string `json:"postUninstallNotes,omitempty"` +} + +// Validate validates this uninstall response +func (m *UninstallResponse) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateAppID(formats); err != nil { + res = append(res, err) + } + + if err := m.validatePackageName(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *UninstallResponse) validateAppID(formats strfmt.Registry) error { + + if err := validate.Required("appId", "body", m.AppID); err != nil { + return err + } + + return nil +} + +func (m *UninstallResponse) validatePackageName(formats strfmt.Registry) error { + + if err := validate.Required("packageName", "body", m.PackageName); err != nil { + return err + } + + return nil +} + +// MarshalBinary interface implementation +func (m *UninstallResponse) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *UninstallResponse) UnmarshalBinary(b []byte) error { + var res UninstallResponse + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/dcos/cosmos/models/unit_health.go b/dcos/cosmos/models/unit_health.go new file mode 100644 index 0000000..80e218f --- /dev/null +++ b/dcos/cosmos/models/unit_health.go @@ -0,0 +1,58 @@ +// 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 ( + strfmt "github.com/go-openapi/strfmt" + + "github.com/go-openapi/swag" +) + +// UnitHealth unit health +// swagger:model unitHealth +type UnitHealth struct { + + // description + Description string `json:"description,omitempty"` + + // health + Health int64 `json:"health,omitempty"` + + // help + Help string `json:"help,omitempty"` + + // id + ID string `json:"id,omitempty"` + + // name + Name string `json:"name,omitempty"` + + // output + Output string `json:"output,omitempty"` +} + +// Validate validates this unit health +func (m *UnitHealth) Validate(formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *UnitHealth) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *UnitHealth) UnmarshalBinary(b []byte) error { + var res UnitHealth + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/dcos/cosmos/models/uris.go b/dcos/cosmos/models/uris.go new file mode 100644 index 0000000..b6a5e1b --- /dev/null +++ b/dcos/cosmos/models/uris.go @@ -0,0 +1,19 @@ +// 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 ( + strfmt "github.com/go-openapi/strfmt" +) + +// Uris uris +// swagger:model uris +type Uris map[string]string + +// Validate validates this uris +func (m Uris) Validate(formats strfmt.Registry) error { + return nil +} diff --git a/dcos/cosmos/models/url.go b/dcos/cosmos/models/url.go new file mode 100644 index 0000000..2c71cb5 --- /dev/null +++ b/dcos/cosmos/models/url.go @@ -0,0 +1,35 @@ +// 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 ( + strfmt "github.com/go-openapi/strfmt" + + "github.com/go-openapi/errors" + "github.com/go-openapi/validate" +) + +// URL url +// swagger:model url +type URL strfmt.URI + +// Validate validates this url +func (m URL) Validate(formats strfmt.Registry) error { + var res []error + + if err := validate.Pattern("", "body", string(m), `^https?://`); err != nil { + return err + } + + if err := validate.FormatOf("", "body", "uri", strfmt.URI(m).String(), formats); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/dcos/cosmos/models/v30_resource.go b/dcos/cosmos/models/v30_resource.go new file mode 100644 index 0000000..eccde06 --- /dev/null +++ b/dcos/cosmos/models/v30_resource.go @@ -0,0 +1,121 @@ +// 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 ( + strfmt "github.com/go-openapi/strfmt" + + "github.com/go-openapi/errors" + "github.com/go-openapi/swag" +) + +// V30Resource v30 resource +// swagger:model v30Resource +type V30Resource struct { + + // assets + Assets *Assets `json:"assets,omitempty"` + + // cli + Cli *Cli `json:"cli,omitempty"` + + // images + Images *Images `json:"images,omitempty"` +} + +// Validate validates this v30 resource +func (m *V30Resource) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateAssets(formats); err != nil { + res = append(res, err) + } + + if err := m.validateCli(formats); err != nil { + res = append(res, err) + } + + if err := m.validateImages(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *V30Resource) validateAssets(formats strfmt.Registry) error { + + if swag.IsZero(m.Assets) { // not required + return nil + } + + if m.Assets != nil { + if err := m.Assets.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("assets") + } + return err + } + } + + return nil +} + +func (m *V30Resource) validateCli(formats strfmt.Registry) error { + + if swag.IsZero(m.Cli) { // not required + return nil + } + + if m.Cli != nil { + if err := m.Cli.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("cli") + } + return err + } + } + + return nil +} + +func (m *V30Resource) validateImages(formats strfmt.Registry) error { + + if swag.IsZero(m.Images) { // not required + return nil + } + + if m.Images != nil { + if err := m.Images.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("images") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *V30Resource) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *V30Resource) UnmarshalBinary(b []byte) error { + var res V30Resource + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/dcos/cosmos/models/v3_package_describe_response.go b/dcos/cosmos/models/v3_package_describe_response.go new file mode 100644 index 0000000..c9e283e --- /dev/null +++ b/dcos/cosmos/models/v3_package_describe_response.go @@ -0,0 +1,73 @@ +// 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 ( + strfmt "github.com/go-openapi/strfmt" + + "github.com/go-openapi/errors" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// V3PackageDescribeResponse v3 package describe response +// swagger:model v3PackageDescribeResponse +type V3PackageDescribeResponse struct { + + // package + // Required: true + Package *V50PackageDefinition `json:"package"` +} + +// Validate validates this v3 package describe response +func (m *V3PackageDescribeResponse) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validatePackage(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *V3PackageDescribeResponse) validatePackage(formats strfmt.Registry) error { + + if err := validate.Required("package", "body", m.Package); err != nil { + return err + } + + if m.Package != nil { + if err := m.Package.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("package") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *V3PackageDescribeResponse) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *V3PackageDescribeResponse) UnmarshalBinary(b []byte) error { + var res V3PackageDescribeResponse + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/dcos/cosmos/models/v50_package_definition.go b/dcos/cosmos/models/v50_package_definition.go new file mode 100644 index 0000000..7cdccd9 --- /dev/null +++ b/dcos/cosmos/models/v50_package_definition.go @@ -0,0 +1,393 @@ +// 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 ( + "encoding/json" + "strconv" + + strfmt "github.com/go-openapi/strfmt" + + "github.com/go-openapi/errors" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// V50PackageDefinition v50 package definition +// swagger:model v50PackageDefinition +type V50PackageDefinition struct { + + // command + Command *Command `json:"command,omitempty"` + + // config + Config Config `json:"config,omitempty"` + + // description + // Required: true + Description *string `json:"description"` + + // List of versions that this package can downgrade to. If the property is a list containing the string '*', this package can downgrade to any version. If the property is not set or the empty list, this package cannot downgrade. + DowngradesTo []string `json:"downgradesTo"` + + // True if this package installs a new Mesos framework. + Framework *bool `json:"framework,omitempty"` + + // licenses + Licenses Licences `json:"licenses,omitempty"` + + // maintainer + // Required: true + Maintainer *string `json:"maintainer"` + + // manager + Manager *Manager `json:"manager,omitempty"` + + // marathon + Marathon *Marathon `json:"marathon,omitempty"` + + // The minimum DC/OS Release Version the package can run on. + // Pattern: ^(?:0|[1-9][0-9]*)(?:\.(?:0|[1-9][0-9]*))*$ + MinDCOSReleaseVersion string `json:"minDcosReleaseVersion,omitempty"` + + // name + // Required: true + Name *string `json:"name"` + + // packaging version + // Required: true + // Enum: [5.0] + PackagingVersion *string `json:"packagingVersion"` + + // Post installation notes that would be useful to the user of this package. + PostInstallNotes string `json:"postInstallNotes,omitempty"` + + // Post uninstallation notes that would be useful to the user of this package. + PostUninstallNotes string `json:"postUninstallNotes,omitempty"` + + // Pre installation notes that would be useful to the user of this package. + PreInstallNotes string `json:"preInstallNotes,omitempty"` + + // Corresponds to the revision index from the universe directory structure + // Required: true + // Minimum: 0 + ReleaseVersion *int64 `json:"releaseVersion"` + + // resource + Resource *V30Resource `json:"resource,omitempty"` + + // scm + Scm string `json:"scm,omitempty"` + + // Flag indicating if the package is selected in search results + Selected *bool `json:"selected,omitempty"` + + // tags + // Required: true + Tags []string `json:"tags"` + + // List of versions that can upgrade to this package. If the property is a list containing the string '*', any version can upgrade to this package. If the property is not set or the empty list, no version can upgrade to this package. + UpgradesFrom []string `json:"upgradesFrom"` + + // version + // Required: true + // Pattern: ^[-a-zA-Z0-9.]+$ + Version *string `json:"version"` + + // website + Website string `json:"website,omitempty"` +} + +// Validate validates this v50 package definition +func (m *V50PackageDefinition) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateCommand(formats); err != nil { + res = append(res, err) + } + + if err := m.validateDescription(formats); err != nil { + res = append(res, err) + } + + if err := m.validateLicenses(formats); err != nil { + res = append(res, err) + } + + if err := m.validateMaintainer(formats); err != nil { + res = append(res, err) + } + + if err := m.validateManager(formats); err != nil { + res = append(res, err) + } + + if err := m.validateMarathon(formats); err != nil { + res = append(res, err) + } + + if err := m.validateMinDCOSReleaseVersion(formats); err != nil { + res = append(res, err) + } + + if err := m.validateName(formats); err != nil { + res = append(res, err) + } + + if err := m.validatePackagingVersion(formats); err != nil { + res = append(res, err) + } + + if err := m.validateReleaseVersion(formats); err != nil { + res = append(res, err) + } + + if err := m.validateResource(formats); err != nil { + res = append(res, err) + } + + if err := m.validateTags(formats); err != nil { + res = append(res, err) + } + + if err := m.validateVersion(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *V50PackageDefinition) validateCommand(formats strfmt.Registry) error { + + if swag.IsZero(m.Command) { // not required + return nil + } + + if m.Command != nil { + if err := m.Command.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("command") + } + return err + } + } + + return nil +} + +func (m *V50PackageDefinition) validateDescription(formats strfmt.Registry) error { + + if err := validate.Required("description", "body", m.Description); err != nil { + return err + } + + return nil +} + +func (m *V50PackageDefinition) validateLicenses(formats strfmt.Registry) error { + + if swag.IsZero(m.Licenses) { // not required + return nil + } + + if err := m.Licenses.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("licenses") + } + return err + } + + return nil +} + +func (m *V50PackageDefinition) validateMaintainer(formats strfmt.Registry) error { + + if err := validate.Required("maintainer", "body", m.Maintainer); err != nil { + return err + } + + return nil +} + +func (m *V50PackageDefinition) validateManager(formats strfmt.Registry) error { + + if swag.IsZero(m.Manager) { // not required + return nil + } + + if m.Manager != nil { + if err := m.Manager.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("manager") + } + return err + } + } + + return nil +} + +func (m *V50PackageDefinition) validateMarathon(formats strfmt.Registry) error { + + if swag.IsZero(m.Marathon) { // not required + return nil + } + + if m.Marathon != nil { + if err := m.Marathon.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("marathon") + } + return err + } + } + + return nil +} + +func (m *V50PackageDefinition) validateMinDCOSReleaseVersion(formats strfmt.Registry) error { + + if swag.IsZero(m.MinDCOSReleaseVersion) { // not required + return nil + } + + if err := validate.Pattern("minDcosReleaseVersion", "body", string(m.MinDCOSReleaseVersion), `^(?:0|[1-9][0-9]*)(?:\.(?:0|[1-9][0-9]*))*$`); err != nil { + return err + } + + return nil +} + +func (m *V50PackageDefinition) validateName(formats strfmt.Registry) error { + + if err := validate.Required("name", "body", m.Name); err != nil { + return err + } + + return nil +} + +var v50PackageDefinitionTypePackagingVersionPropEnum []interface{} + +func init() { + var res []string + if err := json.Unmarshal([]byte(`["5.0"]`), &res); err != nil { + panic(err) + } + for _, v := range res { + v50PackageDefinitionTypePackagingVersionPropEnum = append(v50PackageDefinitionTypePackagingVersionPropEnum, v) + } +} + +const ( + + // V50PackageDefinitionPackagingVersionNr50 captures enum value "5.0" + V50PackageDefinitionPackagingVersionNr50 string = "5.0" +) + +// prop value enum +func (m *V50PackageDefinition) validatePackagingVersionEnum(path, location string, value string) error { + if err := validate.Enum(path, location, value, v50PackageDefinitionTypePackagingVersionPropEnum); err != nil { + return err + } + return nil +} + +func (m *V50PackageDefinition) validatePackagingVersion(formats strfmt.Registry) error { + + if err := validate.Required("packagingVersion", "body", m.PackagingVersion); err != nil { + return err + } + + // value enum + if err := m.validatePackagingVersionEnum("packagingVersion", "body", *m.PackagingVersion); err != nil { + return err + } + + return nil +} + +func (m *V50PackageDefinition) validateReleaseVersion(formats strfmt.Registry) error { + + if err := validate.Required("releaseVersion", "body", m.ReleaseVersion); err != nil { + return err + } + + if err := validate.MinimumInt("releaseVersion", "body", int64(*m.ReleaseVersion), 0, false); err != nil { + return err + } + + return nil +} + +func (m *V50PackageDefinition) validateResource(formats strfmt.Registry) error { + + if swag.IsZero(m.Resource) { // not required + return nil + } + + if m.Resource != nil { + if err := m.Resource.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("resource") + } + return err + } + } + + return nil +} + +func (m *V50PackageDefinition) validateTags(formats strfmt.Registry) error { + + if err := validate.Required("tags", "body", m.Tags); err != nil { + return err + } + + for i := 0; i < len(m.Tags); i++ { + + if err := validate.Pattern("tags"+"."+strconv.Itoa(i), "body", string(m.Tags[i]), `^[^\s]+$`); err != nil { + return err + } + + } + + return nil +} + +func (m *V50PackageDefinition) validateVersion(formats strfmt.Registry) error { + + if err := validate.Required("version", "body", m.Version); err != nil { + return err + } + + if err := validate.Pattern("version", "body", string(*m.Version), `^[-a-zA-Z0-9.]+$`); err != nil { + return err + } + + return nil +} + +// MarshalBinary interface implementation +func (m *V50PackageDefinition) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *V50PackageDefinition) UnmarshalBinary(b []byte) error { + var res V50PackageDefinition + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/dcos/cosmos/package_options.go b/dcos/cosmos/package_options.go new file mode 100644 index 0000000..9d21f88 --- /dev/null +++ b/dcos/cosmos/package_options.go @@ -0,0 +1,22 @@ +package cosmos + +// PackageSecurityOptions describes the security options available when +// installing a package +type PackageSecurityOptions struct { + StrictMode bool `json:"strict-mode,omitempty"` +} + +// PackageServiceOptions describes the service options available when +// installing a package +type PackageServiceOptions struct { + SecretName string `json:"secretName,omitempty"` + Principal string `json:"principal,omitempty"` + MesosProtocol string `json:"mesosProtocol,omitempty"` +} + +// PackageOptions describes the options available when installing a package +type PackageOptions struct { + Service PackageServiceOptions `json:"service,omitempty"` + + Security PackageSecurityOptions `json:"security,omitempty"` +} diff --git a/dcos/httpclient.go b/dcos/httpclient.go index 2184a69..e64c554 100644 --- a/dcos/httpclient.go +++ b/dcos/httpclient.go @@ -5,7 +5,11 @@ import ( "fmt" "net" "net/http" + "net/http/httputil" + "os" "time" + + "github.com/sirupsen/logrus" ) const ( @@ -25,6 +29,7 @@ const ( type DefaultTransport struct { Config *Config Base http.RoundTripper + Logger *logrus.Logger } func (t *DefaultTransport) base() http.RoundTripper { @@ -39,8 +44,29 @@ func (t *DefaultTransport) RoundTrip(req *http.Request) (*http.Response, error) // meet the requirements of RoundTripper and only modify a copy req2 := cloneRequest(req) req2.Header.Set("Authorization", fmt.Sprintf("token=%s", t.Config.ACSToken())) + req2.Header.Set("User-Agent", fmt.Sprintf("%s(%s)", ClientName, Version)) + + if t.Logger != nil && os.Getenv("DCOS_DEBUG") != "" { + reqDump, err := httputil.DumpRequestOut(req2, false) + if err != nil { + t.Logger.Debugf("Couldn't dump request: %s", err) + } else { + t.Logger.Debug(string(reqDump)) + } + } + + resp, err := t.base().RoundTrip(req2) - return t.base().RoundTrip(req2) + if t.Logger != nil && os.Getenv("DCOS_DEBUG") != "" { + respDump, err := httputil.DumpResponse(resp, false) + if err != nil { + t.Logger.Debugf("Couldn't dump response: %s", err) + } else { + t.Logger.Debug(string(respDump)) + } + } + + return resp, err } func cloneRequest(req *http.Request) *http.Request { @@ -61,9 +87,8 @@ func NewHTTPClient(config *Config) (*http.Client, error) { if config == nil { return nil, fmt.Errorf("Config should not be nil") } - client := &http.Client{} - client.Transport = &http.Transport{ + baseTransport := &http.Transport{ // Allow http_proxy, https_proxy, and no_proxy. Proxy: http.ProxyFromEnvironment, @@ -84,7 +109,19 @@ func NewHTTPClient(config *Config) (*http.Client, error) { MaxIdleConnsPerHost: defaultTransportMaxIdleConns, } - return AddTransportHTTPClient(client, config), nil + logger := logrus.New() + if os.Getenv("DCOS_DEBUG") != "" { + logger.SetLevel(logrus.DebugLevel) + } + + client := &http.Client{} + client.Transport = &DefaultTransport{ + Config: config, + Base: baseTransport, + Logger: logger, + } + + return client, nil } // AddTransportHTTPClient adds dcos.DefaultTransport to http.Client to add dcos authentication diff --git a/dcos/iam/client/groups/delete_groups_gid_parameters.go b/dcos/iam/client/groups/delete_groups_gid_parameters.go new file mode 100644 index 0000000..37fd7f0 --- /dev/null +++ b/dcos/iam/client/groups/delete_groups_gid_parameters.go @@ -0,0 +1,136 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package groups + +// 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" + + strfmt "github.com/go-openapi/strfmt" +) + +// NewDeleteGroupsGidParams creates a new DeleteGroupsGidParams object +// with the default values initialized. +func NewDeleteGroupsGidParams() *DeleteGroupsGidParams { + var () + return &DeleteGroupsGidParams{ + + timeout: cr.DefaultTimeout, + } +} + +// NewDeleteGroupsGidParamsWithTimeout creates a new DeleteGroupsGidParams object +// with the default values initialized, and the ability to set a timeout on a request +func NewDeleteGroupsGidParamsWithTimeout(timeout time.Duration) *DeleteGroupsGidParams { + var () + return &DeleteGroupsGidParams{ + + timeout: timeout, + } +} + +// NewDeleteGroupsGidParamsWithContext creates a new DeleteGroupsGidParams object +// with the default values initialized, and the ability to set a context for a request +func NewDeleteGroupsGidParamsWithContext(ctx context.Context) *DeleteGroupsGidParams { + var () + return &DeleteGroupsGidParams{ + + Context: ctx, + } +} + +// NewDeleteGroupsGidParamsWithHTTPClient creates a new DeleteGroupsGidParams object +// with the default values initialized, and the ability to set a custom HTTPClient for a request +func NewDeleteGroupsGidParamsWithHTTPClient(client *http.Client) *DeleteGroupsGidParams { + var () + return &DeleteGroupsGidParams{ + HTTPClient: client, + } +} + +/*DeleteGroupsGidParams contains all the parameters to send to the API endpoint +for the delete groups gid operation typically these are written to a http.Request +*/ +type DeleteGroupsGidParams struct { + + /*Gid + The ID of the group to delete. + + */ + Gid string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithTimeout adds the timeout to the delete groups gid params +func (o *DeleteGroupsGidParams) WithTimeout(timeout time.Duration) *DeleteGroupsGidParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the delete groups gid params +func (o *DeleteGroupsGidParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the delete groups gid params +func (o *DeleteGroupsGidParams) WithContext(ctx context.Context) *DeleteGroupsGidParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the delete groups gid params +func (o *DeleteGroupsGidParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the delete groups gid params +func (o *DeleteGroupsGidParams) WithHTTPClient(client *http.Client) *DeleteGroupsGidParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the delete groups gid params +func (o *DeleteGroupsGidParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithGid adds the gid to the delete groups gid params +func (o *DeleteGroupsGidParams) WithGid(gid string) *DeleteGroupsGidParams { + o.SetGid(gid) + return o +} + +// SetGid adds the gid to the delete groups gid params +func (o *DeleteGroupsGidParams) SetGid(gid string) { + o.Gid = gid +} + +// WriteToRequest writes these params to a swagger request +func (o *DeleteGroupsGidParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param gid + if err := r.SetPathParam("gid", o.Gid); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/dcos/iam/client/groups/delete_groups_gid_responses.go b/dcos/iam/client/groups/delete_groups_gid_responses.go new file mode 100644 index 0000000..bbc2334 --- /dev/null +++ b/dcos/iam/client/groups/delete_groups_gid_responses.go @@ -0,0 +1,56 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package groups + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + + "github.com/go-openapi/runtime" + + strfmt "github.com/go-openapi/strfmt" +) + +// DeleteGroupsGidReader is a Reader for the DeleteGroupsGid structure. +type DeleteGroupsGidReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *DeleteGroupsGidReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + + case 204: + result := NewDeleteGroupsGidNoContent() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + + default: + return nil, runtime.NewAPIError("unknown error", response, response.Code()) + } +} + +// NewDeleteGroupsGidNoContent creates a DeleteGroupsGidNoContent with default headers values +func NewDeleteGroupsGidNoContent() *DeleteGroupsGidNoContent { + return &DeleteGroupsGidNoContent{} +} + +/*DeleteGroupsGidNoContent handles this case with default header values. + +Success +*/ +type DeleteGroupsGidNoContent struct { +} + +func (o *DeleteGroupsGidNoContent) Error() string { + return fmt.Sprintf("[DELETE /groups/{gid}][%d] deleteGroupsGidNoContent ", 204) +} + +func (o *DeleteGroupsGidNoContent) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/dcos/iam/client/groups/delete_groups_gid_users_uid_parameters.go b/dcos/iam/client/groups/delete_groups_gid_users_uid_parameters.go new file mode 100644 index 0000000..356a516 --- /dev/null +++ b/dcos/iam/client/groups/delete_groups_gid_users_uid_parameters.go @@ -0,0 +1,157 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package groups + +// 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" + + strfmt "github.com/go-openapi/strfmt" +) + +// NewDeleteGroupsGidUsersUIDParams creates a new DeleteGroupsGidUsersUIDParams object +// with the default values initialized. +func NewDeleteGroupsGidUsersUIDParams() *DeleteGroupsGidUsersUIDParams { + var () + return &DeleteGroupsGidUsersUIDParams{ + + timeout: cr.DefaultTimeout, + } +} + +// NewDeleteGroupsGidUsersUIDParamsWithTimeout creates a new DeleteGroupsGidUsersUIDParams object +// with the default values initialized, and the ability to set a timeout on a request +func NewDeleteGroupsGidUsersUIDParamsWithTimeout(timeout time.Duration) *DeleteGroupsGidUsersUIDParams { + var () + return &DeleteGroupsGidUsersUIDParams{ + + timeout: timeout, + } +} + +// NewDeleteGroupsGidUsersUIDParamsWithContext creates a new DeleteGroupsGidUsersUIDParams object +// with the default values initialized, and the ability to set a context for a request +func NewDeleteGroupsGidUsersUIDParamsWithContext(ctx context.Context) *DeleteGroupsGidUsersUIDParams { + var () + return &DeleteGroupsGidUsersUIDParams{ + + Context: ctx, + } +} + +// NewDeleteGroupsGidUsersUIDParamsWithHTTPClient creates a new DeleteGroupsGidUsersUIDParams object +// with the default values initialized, and the ability to set a custom HTTPClient for a request +func NewDeleteGroupsGidUsersUIDParamsWithHTTPClient(client *http.Client) *DeleteGroupsGidUsersUIDParams { + var () + return &DeleteGroupsGidUsersUIDParams{ + HTTPClient: client, + } +} + +/*DeleteGroupsGidUsersUIDParams contains all the parameters to send to the API endpoint +for the delete groups gid users UID operation typically these are written to a http.Request +*/ +type DeleteGroupsGidUsersUIDParams struct { + + /*Gid + The ID of the group to delete from. + + */ + Gid string + /*UID + The ID of the user account. + + */ + UID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithTimeout adds the timeout to the delete groups gid users UID params +func (o *DeleteGroupsGidUsersUIDParams) WithTimeout(timeout time.Duration) *DeleteGroupsGidUsersUIDParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the delete groups gid users UID params +func (o *DeleteGroupsGidUsersUIDParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the delete groups gid users UID params +func (o *DeleteGroupsGidUsersUIDParams) WithContext(ctx context.Context) *DeleteGroupsGidUsersUIDParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the delete groups gid users UID params +func (o *DeleteGroupsGidUsersUIDParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the delete groups gid users UID params +func (o *DeleteGroupsGidUsersUIDParams) WithHTTPClient(client *http.Client) *DeleteGroupsGidUsersUIDParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the delete groups gid users UID params +func (o *DeleteGroupsGidUsersUIDParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithGid adds the gid to the delete groups gid users UID params +func (o *DeleteGroupsGidUsersUIDParams) WithGid(gid string) *DeleteGroupsGidUsersUIDParams { + o.SetGid(gid) + return o +} + +// SetGid adds the gid to the delete groups gid users UID params +func (o *DeleteGroupsGidUsersUIDParams) SetGid(gid string) { + o.Gid = gid +} + +// WithUID adds the uid to the delete groups gid users UID params +func (o *DeleteGroupsGidUsersUIDParams) WithUID(uid string) *DeleteGroupsGidUsersUIDParams { + o.SetUID(uid) + return o +} + +// SetUID adds the uid to the delete groups gid users UID params +func (o *DeleteGroupsGidUsersUIDParams) SetUID(uid string) { + o.UID = uid +} + +// WriteToRequest writes these params to a swagger request +func (o *DeleteGroupsGidUsersUIDParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param gid + if err := r.SetPathParam("gid", o.Gid); err != nil { + return err + } + + // path param uid + if err := r.SetPathParam("uid", o.UID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/dcos/iam/client/groups/delete_groups_gid_users_uid_responses.go b/dcos/iam/client/groups/delete_groups_gid_users_uid_responses.go new file mode 100644 index 0000000..a48895d --- /dev/null +++ b/dcos/iam/client/groups/delete_groups_gid_users_uid_responses.go @@ -0,0 +1,56 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package groups + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + + "github.com/go-openapi/runtime" + + strfmt "github.com/go-openapi/strfmt" +) + +// DeleteGroupsGidUsersUIDReader is a Reader for the DeleteGroupsGidUsersUID structure. +type DeleteGroupsGidUsersUIDReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *DeleteGroupsGidUsersUIDReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + + case 204: + result := NewDeleteGroupsGidUsersUIDNoContent() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + + default: + return nil, runtime.NewAPIError("unknown error", response, response.Code()) + } +} + +// NewDeleteGroupsGidUsersUIDNoContent creates a DeleteGroupsGidUsersUIDNoContent with default headers values +func NewDeleteGroupsGidUsersUIDNoContent() *DeleteGroupsGidUsersUIDNoContent { + return &DeleteGroupsGidUsersUIDNoContent{} +} + +/*DeleteGroupsGidUsersUIDNoContent handles this case with default header values. + +Success. +*/ +type DeleteGroupsGidUsersUIDNoContent struct { +} + +func (o *DeleteGroupsGidUsersUIDNoContent) Error() string { + return fmt.Sprintf("[DELETE /groups/{gid}/users/{uid}][%d] deleteGroupsGidUsersUidNoContent ", 204) +} + +func (o *DeleteGroupsGidUsersUIDNoContent) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/dcos/iam/client/groups/get_groups_gid_parameters.go b/dcos/iam/client/groups/get_groups_gid_parameters.go new file mode 100644 index 0000000..cfffaa9 --- /dev/null +++ b/dcos/iam/client/groups/get_groups_gid_parameters.go @@ -0,0 +1,136 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package groups + +// 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" + + strfmt "github.com/go-openapi/strfmt" +) + +// NewGetGroupsGidParams creates a new GetGroupsGidParams object +// with the default values initialized. +func NewGetGroupsGidParams() *GetGroupsGidParams { + var () + return &GetGroupsGidParams{ + + timeout: cr.DefaultTimeout, + } +} + +// NewGetGroupsGidParamsWithTimeout creates a new GetGroupsGidParams object +// with the default values initialized, and the ability to set a timeout on a request +func NewGetGroupsGidParamsWithTimeout(timeout time.Duration) *GetGroupsGidParams { + var () + return &GetGroupsGidParams{ + + timeout: timeout, + } +} + +// NewGetGroupsGidParamsWithContext creates a new GetGroupsGidParams object +// with the default values initialized, and the ability to set a context for a request +func NewGetGroupsGidParamsWithContext(ctx context.Context) *GetGroupsGidParams { + var () + return &GetGroupsGidParams{ + + Context: ctx, + } +} + +// NewGetGroupsGidParamsWithHTTPClient creates a new GetGroupsGidParams object +// with the default values initialized, and the ability to set a custom HTTPClient for a request +func NewGetGroupsGidParamsWithHTTPClient(client *http.Client) *GetGroupsGidParams { + var () + return &GetGroupsGidParams{ + HTTPClient: client, + } +} + +/*GetGroupsGidParams contains all the parameters to send to the API endpoint +for the get groups gid operation typically these are written to a http.Request +*/ +type GetGroupsGidParams struct { + + /*Gid + The ID of the group to retrieve. + + */ + Gid string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithTimeout adds the timeout to the get groups gid params +func (o *GetGroupsGidParams) WithTimeout(timeout time.Duration) *GetGroupsGidParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the get groups gid params +func (o *GetGroupsGidParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the get groups gid params +func (o *GetGroupsGidParams) WithContext(ctx context.Context) *GetGroupsGidParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the get groups gid params +func (o *GetGroupsGidParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the get groups gid params +func (o *GetGroupsGidParams) WithHTTPClient(client *http.Client) *GetGroupsGidParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the get groups gid params +func (o *GetGroupsGidParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithGid adds the gid to the get groups gid params +func (o *GetGroupsGidParams) WithGid(gid string) *GetGroupsGidParams { + o.SetGid(gid) + return o +} + +// SetGid adds the gid to the get groups gid params +func (o *GetGroupsGidParams) SetGid(gid string) { + o.Gid = gid +} + +// WriteToRequest writes these params to a swagger request +func (o *GetGroupsGidParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param gid + if err := r.SetPathParam("gid", o.Gid); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/dcos/iam/client/groups/get_groups_gid_permissions_parameters.go b/dcos/iam/client/groups/get_groups_gid_permissions_parameters.go new file mode 100644 index 0000000..ceabe48 --- /dev/null +++ b/dcos/iam/client/groups/get_groups_gid_permissions_parameters.go @@ -0,0 +1,136 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package groups + +// 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" + + strfmt "github.com/go-openapi/strfmt" +) + +// NewGetGroupsGidPermissionsParams creates a new GetGroupsGidPermissionsParams object +// with the default values initialized. +func NewGetGroupsGidPermissionsParams() *GetGroupsGidPermissionsParams { + var () + return &GetGroupsGidPermissionsParams{ + + timeout: cr.DefaultTimeout, + } +} + +// NewGetGroupsGidPermissionsParamsWithTimeout creates a new GetGroupsGidPermissionsParams object +// with the default values initialized, and the ability to set a timeout on a request +func NewGetGroupsGidPermissionsParamsWithTimeout(timeout time.Duration) *GetGroupsGidPermissionsParams { + var () + return &GetGroupsGidPermissionsParams{ + + timeout: timeout, + } +} + +// NewGetGroupsGidPermissionsParamsWithContext creates a new GetGroupsGidPermissionsParams object +// with the default values initialized, and the ability to set a context for a request +func NewGetGroupsGidPermissionsParamsWithContext(ctx context.Context) *GetGroupsGidPermissionsParams { + var () + return &GetGroupsGidPermissionsParams{ + + Context: ctx, + } +} + +// NewGetGroupsGidPermissionsParamsWithHTTPClient creates a new GetGroupsGidPermissionsParams object +// with the default values initialized, and the ability to set a custom HTTPClient for a request +func NewGetGroupsGidPermissionsParamsWithHTTPClient(client *http.Client) *GetGroupsGidPermissionsParams { + var () + return &GetGroupsGidPermissionsParams{ + HTTPClient: client, + } +} + +/*GetGroupsGidPermissionsParams contains all the parameters to send to the API endpoint +for the get groups gid permissions operation typically these are written to a http.Request +*/ +type GetGroupsGidPermissionsParams struct { + + /*Gid + The group ID. + + */ + Gid string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithTimeout adds the timeout to the get groups gid permissions params +func (o *GetGroupsGidPermissionsParams) WithTimeout(timeout time.Duration) *GetGroupsGidPermissionsParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the get groups gid permissions params +func (o *GetGroupsGidPermissionsParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the get groups gid permissions params +func (o *GetGroupsGidPermissionsParams) WithContext(ctx context.Context) *GetGroupsGidPermissionsParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the get groups gid permissions params +func (o *GetGroupsGidPermissionsParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the get groups gid permissions params +func (o *GetGroupsGidPermissionsParams) WithHTTPClient(client *http.Client) *GetGroupsGidPermissionsParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the get groups gid permissions params +func (o *GetGroupsGidPermissionsParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithGid adds the gid to the get groups gid permissions params +func (o *GetGroupsGidPermissionsParams) WithGid(gid string) *GetGroupsGidPermissionsParams { + o.SetGid(gid) + return o +} + +// SetGid adds the gid to the get groups gid permissions params +func (o *GetGroupsGidPermissionsParams) SetGid(gid string) { + o.Gid = gid +} + +// WriteToRequest writes these params to a swagger request +func (o *GetGroupsGidPermissionsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param gid + if err := r.SetPathParam("gid", o.Gid); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/dcos/iam/client/groups/get_groups_gid_permissions_responses.go b/dcos/iam/client/groups/get_groups_gid_permissions_responses.go new file mode 100644 index 0000000..34bbf47 --- /dev/null +++ b/dcos/iam/client/groups/get_groups_gid_permissions_responses.go @@ -0,0 +1,67 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package groups + +// 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" + + strfmt "github.com/go-openapi/strfmt" + + models "github.com/dcos/client-go/dcos/iam/models" +) + +// GetGroupsGidPermissionsReader is a Reader for the GetGroupsGidPermissions structure. +type GetGroupsGidPermissionsReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *GetGroupsGidPermissionsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + + case 200: + result := NewGetGroupsGidPermissionsOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + + default: + return nil, runtime.NewAPIError("unknown error", response, response.Code()) + } +} + +// NewGetGroupsGidPermissionsOK creates a GetGroupsGidPermissionsOK with default headers values +func NewGetGroupsGidPermissionsOK() *GetGroupsGidPermissionsOK { + return &GetGroupsGidPermissionsOK{} +} + +/*GetGroupsGidPermissionsOK handles this case with default header values. + +Success. +*/ +type GetGroupsGidPermissionsOK struct { + Payload *models.GroupPermissions +} + +func (o *GetGroupsGidPermissionsOK) Error() string { + return fmt.Sprintf("[GET /groups/{gid}/permissions][%d] getGroupsGidPermissionsOK %+v", 200, o.Payload) +} + +func (o *GetGroupsGidPermissionsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.GroupPermissions) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/dcos/iam/client/groups/get_groups_gid_responses.go b/dcos/iam/client/groups/get_groups_gid_responses.go new file mode 100644 index 0000000..885faa2 --- /dev/null +++ b/dcos/iam/client/groups/get_groups_gid_responses.go @@ -0,0 +1,67 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package groups + +// 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" + + strfmt "github.com/go-openapi/strfmt" + + models "github.com/dcos/client-go/dcos/iam/models" +) + +// GetGroupsGidReader is a Reader for the GetGroupsGid structure. +type GetGroupsGidReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *GetGroupsGidReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + + case 200: + result := NewGetGroupsGidOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + + default: + return nil, runtime.NewAPIError("unknown error", response, response.Code()) + } +} + +// NewGetGroupsGidOK creates a GetGroupsGidOK with default headers values +func NewGetGroupsGidOK() *GetGroupsGidOK { + return &GetGroupsGidOK{} +} + +/*GetGroupsGidOK handles this case with default header values. + +Success. +*/ +type GetGroupsGidOK struct { + Payload *models.Group +} + +func (o *GetGroupsGidOK) Error() string { + return fmt.Sprintf("[GET /groups/{gid}][%d] getGroupsGidOK %+v", 200, o.Payload) +} + +func (o *GetGroupsGidOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Group) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/dcos/iam/client/groups/get_groups_gid_users_parameters.go b/dcos/iam/client/groups/get_groups_gid_users_parameters.go new file mode 100644 index 0000000..99cb35e --- /dev/null +++ b/dcos/iam/client/groups/get_groups_gid_users_parameters.go @@ -0,0 +1,168 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package groups + +// 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" + + strfmt "github.com/go-openapi/strfmt" +) + +// NewGetGroupsGidUsersParams creates a new GetGroupsGidUsersParams object +// with the default values initialized. +func NewGetGroupsGidUsersParams() *GetGroupsGidUsersParams { + var () + return &GetGroupsGidUsersParams{ + + timeout: cr.DefaultTimeout, + } +} + +// NewGetGroupsGidUsersParamsWithTimeout creates a new GetGroupsGidUsersParams object +// with the default values initialized, and the ability to set a timeout on a request +func NewGetGroupsGidUsersParamsWithTimeout(timeout time.Duration) *GetGroupsGidUsersParams { + var () + return &GetGroupsGidUsersParams{ + + timeout: timeout, + } +} + +// NewGetGroupsGidUsersParamsWithContext creates a new GetGroupsGidUsersParams object +// with the default values initialized, and the ability to set a context for a request +func NewGetGroupsGidUsersParamsWithContext(ctx context.Context) *GetGroupsGidUsersParams { + var () + return &GetGroupsGidUsersParams{ + + Context: ctx, + } +} + +// NewGetGroupsGidUsersParamsWithHTTPClient creates a new GetGroupsGidUsersParams object +// with the default values initialized, and the ability to set a custom HTTPClient for a request +func NewGetGroupsGidUsersParamsWithHTTPClient(client *http.Client) *GetGroupsGidUsersParams { + var () + return &GetGroupsGidUsersParams{ + HTTPClient: client, + } +} + +/*GetGroupsGidUsersParams contains all the parameters to send to the API endpoint +for the get groups gid users operation typically these are written to a http.Request +*/ +type GetGroupsGidUsersParams struct { + + /*Gid + The group ID. + + */ + Gid string + /*Type + If set to `service`, list only service accounts. If unset, default to only listing user accounts members of a group. + + */ + Type *string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithTimeout adds the timeout to the get groups gid users params +func (o *GetGroupsGidUsersParams) WithTimeout(timeout time.Duration) *GetGroupsGidUsersParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the get groups gid users params +func (o *GetGroupsGidUsersParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the get groups gid users params +func (o *GetGroupsGidUsersParams) WithContext(ctx context.Context) *GetGroupsGidUsersParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the get groups gid users params +func (o *GetGroupsGidUsersParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the get groups gid users params +func (o *GetGroupsGidUsersParams) WithHTTPClient(client *http.Client) *GetGroupsGidUsersParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the get groups gid users params +func (o *GetGroupsGidUsersParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithGid adds the gid to the get groups gid users params +func (o *GetGroupsGidUsersParams) WithGid(gid string) *GetGroupsGidUsersParams { + o.SetGid(gid) + return o +} + +// SetGid adds the gid to the get groups gid users params +func (o *GetGroupsGidUsersParams) SetGid(gid string) { + o.Gid = gid +} + +// WithType adds the typeVar to the get groups gid users params +func (o *GetGroupsGidUsersParams) WithType(typeVar *string) *GetGroupsGidUsersParams { + o.SetType(typeVar) + return o +} + +// SetType adds the type to the get groups gid users params +func (o *GetGroupsGidUsersParams) SetType(typeVar *string) { + o.Type = typeVar +} + +// WriteToRequest writes these params to a swagger request +func (o *GetGroupsGidUsersParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param gid + if err := r.SetPathParam("gid", o.Gid); err != nil { + return err + } + + if o.Type != nil { + + // query param type + var qrType string + if o.Type != nil { + qrType = *o.Type + } + qType := qrType + if qType != "" { + if err := r.SetQueryParam("type", qType); err != nil { + return err + } + } + + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/dcos/iam/client/groups/get_groups_gid_users_responses.go b/dcos/iam/client/groups/get_groups_gid_users_responses.go new file mode 100644 index 0000000..977c886 --- /dev/null +++ b/dcos/iam/client/groups/get_groups_gid_users_responses.go @@ -0,0 +1,67 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package groups + +// 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" + + strfmt "github.com/go-openapi/strfmt" + + models "github.com/dcos/client-go/dcos/iam/models" +) + +// GetGroupsGidUsersReader is a Reader for the GetGroupsGidUsers structure. +type GetGroupsGidUsersReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *GetGroupsGidUsersReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + + case 200: + result := NewGetGroupsGidUsersOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + + default: + return nil, runtime.NewAPIError("unknown error", response, response.Code()) + } +} + +// NewGetGroupsGidUsersOK creates a GetGroupsGidUsersOK with default headers values +func NewGetGroupsGidUsersOK() *GetGroupsGidUsersOK { + return &GetGroupsGidUsersOK{} +} + +/*GetGroupsGidUsersOK handles this case with default header values. + +Success. +*/ +type GetGroupsGidUsersOK struct { + Payload *models.GroupUsers +} + +func (o *GetGroupsGidUsersOK) Error() string { + return fmt.Sprintf("[GET /groups/{gid}/users][%d] getGroupsGidUsersOK %+v", 200, o.Payload) +} + +func (o *GetGroupsGidUsersOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.GroupUsers) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/dcos/iam/client/groups/get_groups_parameters.go b/dcos/iam/client/groups/get_groups_parameters.go new file mode 100644 index 0000000..20ddfae --- /dev/null +++ b/dcos/iam/client/groups/get_groups_parameters.go @@ -0,0 +1,113 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package groups + +// 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" + + strfmt "github.com/go-openapi/strfmt" +) + +// NewGetGroupsParams creates a new GetGroupsParams object +// with the default values initialized. +func NewGetGroupsParams() *GetGroupsParams { + + return &GetGroupsParams{ + + timeout: cr.DefaultTimeout, + } +} + +// NewGetGroupsParamsWithTimeout creates a new GetGroupsParams object +// with the default values initialized, and the ability to set a timeout on a request +func NewGetGroupsParamsWithTimeout(timeout time.Duration) *GetGroupsParams { + + return &GetGroupsParams{ + + timeout: timeout, + } +} + +// NewGetGroupsParamsWithContext creates a new GetGroupsParams object +// with the default values initialized, and the ability to set a context for a request +func NewGetGroupsParamsWithContext(ctx context.Context) *GetGroupsParams { + + return &GetGroupsParams{ + + Context: ctx, + } +} + +// NewGetGroupsParamsWithHTTPClient creates a new GetGroupsParams object +// with the default values initialized, and the ability to set a custom HTTPClient for a request +func NewGetGroupsParamsWithHTTPClient(client *http.Client) *GetGroupsParams { + + return &GetGroupsParams{ + HTTPClient: client, + } +} + +/*GetGroupsParams contains all the parameters to send to the API endpoint +for the get groups operation typically these are written to a http.Request +*/ +type GetGroupsParams struct { + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithTimeout adds the timeout to the get groups params +func (o *GetGroupsParams) WithTimeout(timeout time.Duration) *GetGroupsParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the get groups params +func (o *GetGroupsParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the get groups params +func (o *GetGroupsParams) WithContext(ctx context.Context) *GetGroupsParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the get groups params +func (o *GetGroupsParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the get groups params +func (o *GetGroupsParams) WithHTTPClient(client *http.Client) *GetGroupsParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the get groups params +func (o *GetGroupsParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WriteToRequest writes these params to a swagger request +func (o *GetGroupsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/dcos/iam/client/groups/get_groups_responses.go b/dcos/iam/client/groups/get_groups_responses.go new file mode 100644 index 0000000..574fbac --- /dev/null +++ b/dcos/iam/client/groups/get_groups_responses.go @@ -0,0 +1,136 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package groups + +// 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" + "strconv" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + "github.com/go-openapi/swag" + + strfmt "github.com/go-openapi/strfmt" + + models "github.com/dcos/client-go/dcos/iam/models" +) + +// GetGroupsReader is a Reader for the GetGroups structure. +type GetGroupsReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *GetGroupsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + + case 200: + result := NewGetGroupsOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + + default: + return nil, runtime.NewAPIError("unknown error", response, response.Code()) + } +} + +// NewGetGroupsOK creates a GetGroupsOK with default headers values +func NewGetGroupsOK() *GetGroupsOK { + return &GetGroupsOK{} +} + +/*GetGroupsOK handles this case with default header values. + +Success. +*/ +type GetGroupsOK struct { + Payload *GetGroupsOKBody +} + +func (o *GetGroupsOK) Error() string { + return fmt.Sprintf("[GET /groups][%d] getGroupsOK %+v", 200, o.Payload) +} + +func (o *GetGroupsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(GetGroupsOKBody) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +/*GetGroupsOKBody get groups o k body +swagger:model GetGroupsOKBody +*/ +type GetGroupsOKBody struct { + + // array + Array []*models.Group `json:"array"` +} + +// Validate validates this get groups o k body +func (o *GetGroupsOKBody) Validate(formats strfmt.Registry) error { + var res []error + + if err := o.validateArray(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (o *GetGroupsOKBody) validateArray(formats strfmt.Registry) error { + + if swag.IsZero(o.Array) { // not required + return nil + } + + for i := 0; i < len(o.Array); i++ { + if swag.IsZero(o.Array[i]) { // not required + continue + } + + if o.Array[i] != nil { + if err := o.Array[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("getGroupsOK" + "." + "array" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// MarshalBinary interface implementation +func (o *GetGroupsOKBody) MarshalBinary() ([]byte, error) { + if o == nil { + return nil, nil + } + return swag.WriteJSON(o) +} + +// UnmarshalBinary interface implementation +func (o *GetGroupsOKBody) UnmarshalBinary(b []byte) error { + var res GetGroupsOKBody + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *o = res + return nil +} diff --git a/dcos/iam/client/groups/groups_client.go b/dcos/iam/client/groups/groups_client.go new file mode 100644 index 0000000..0445a3e --- /dev/null +++ b/dcos/iam/client/groups/groups_client.go @@ -0,0 +1,300 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package groups + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "github.com/go-openapi/runtime" + + strfmt "github.com/go-openapi/strfmt" +) + +// New creates a new groups API client. +func New(transport runtime.ClientTransport, formats strfmt.Registry) *Client { + return &Client{transport: transport, formats: formats} +} + +/* +Client for groups API +*/ +type Client struct { + transport runtime.ClientTransport + formats strfmt.Registry +} + +/* +DeleteGroupsGid deletes group + +Delete group. +*/ +func (a *Client) DeleteGroupsGid(params *DeleteGroupsGidParams) (*DeleteGroupsGidNoContent, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewDeleteGroupsGidParams() + } + + result, err := a.transport.Submit(&runtime.ClientOperation{ + ID: "DeleteGroupsGid", + Method: "DELETE", + PathPattern: "/groups/{gid}", + ProducesMediaTypes: []string{""}, + ConsumesMediaTypes: []string{""}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &DeleteGroupsGidReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + }) + if err != nil { + return nil, err + } + return result.(*DeleteGroupsGidNoContent), nil + +} + +/* +DeleteGroupsGidUsersUID deletes user account from group + +Delete user account from group. +*/ +func (a *Client) DeleteGroupsGidUsersUID(params *DeleteGroupsGidUsersUIDParams) (*DeleteGroupsGidUsersUIDNoContent, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewDeleteGroupsGidUsersUIDParams() + } + + result, err := a.transport.Submit(&runtime.ClientOperation{ + ID: "DeleteGroupsGidUsersUID", + Method: "DELETE", + PathPattern: "/groups/{gid}/users/{uid}", + ProducesMediaTypes: []string{""}, + ConsumesMediaTypes: []string{""}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &DeleteGroupsGidUsersUIDReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + }) + if err != nil { + return nil, err + } + return result.(*DeleteGroupsGidUsersUIDNoContent), nil + +} + +/* +GetGroups retrieves all group objects + +Retrieve array of `Group` objects. +*/ +func (a *Client) GetGroups(params *GetGroupsParams) (*GetGroupsOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewGetGroupsParams() + } + + result, err := a.transport.Submit(&runtime.ClientOperation{ + ID: "GetGroups", + Method: "GET", + PathPattern: "/groups", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{""}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &GetGroupsReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + }) + if err != nil { + return nil, err + } + return result.(*GetGroupsOK), nil + +} + +/* +GetGroupsGid gets single group object + +Get specific `Group` object. +*/ +func (a *Client) GetGroupsGid(params *GetGroupsGidParams) (*GetGroupsGidOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewGetGroupsGidParams() + } + + result, err := a.transport.Submit(&runtime.ClientOperation{ + ID: "GetGroupsGid", + Method: "GET", + PathPattern: "/groups/{gid}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{""}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &GetGroupsGidReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + }) + if err != nil { + return nil, err + } + return result.(*GetGroupsGidOK), nil + +} + +/* +GetGroupsGidPermissions retrieves group permissions + +Retrieve permissions of this group. +*/ +func (a *Client) GetGroupsGidPermissions(params *GetGroupsGidPermissionsParams) (*GetGroupsGidPermissionsOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewGetGroupsGidPermissionsParams() + } + + result, err := a.transport.Submit(&runtime.ClientOperation{ + ID: "GetGroupsGidPermissions", + Method: "GET", + PathPattern: "/groups/{gid}/permissions", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{""}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &GetGroupsGidPermissionsReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + }) + if err != nil { + return nil, err + } + return result.(*GetGroupsGidPermissionsOK), nil + +} + +/* +GetGroupsGidUsers retrieves members of a group + +Retrieve users that are member of this group. Allows to query service accounts, defaults to list only user accounts. +*/ +func (a *Client) GetGroupsGidUsers(params *GetGroupsGidUsersParams) (*GetGroupsGidUsersOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewGetGroupsGidUsersParams() + } + + result, err := a.transport.Submit(&runtime.ClientOperation{ + ID: "GetGroupsGidUsers", + Method: "GET", + PathPattern: "/groups/{gid}/users", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{""}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &GetGroupsGidUsersReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + }) + if err != nil { + return nil, err + } + return result.(*GetGroupsGidUsersOK), nil + +} + +/* +PatchGroupsGid updates group + +Update existing group (description). +*/ +func (a *Client) PatchGroupsGid(params *PatchGroupsGidParams) (*PatchGroupsGidNoContent, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPatchGroupsGidParams() + } + + result, err := a.transport.Submit(&runtime.ClientOperation{ + ID: "PatchGroupsGid", + Method: "PATCH", + PathPattern: "/groups/{gid}", + ProducesMediaTypes: []string{""}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &PatchGroupsGidReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + }) + if err != nil { + return nil, err + } + return result.(*PatchGroupsGidNoContent), nil + +} + +/* +PutGroupsGid creates a group + +Create a group. +*/ +func (a *Client) PutGroupsGid(params *PutGroupsGidParams) (*PutGroupsGidCreated, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPutGroupsGidParams() + } + + result, err := a.transport.Submit(&runtime.ClientOperation{ + ID: "PutGroupsGid", + Method: "PUT", + PathPattern: "/groups/{gid}", + ProducesMediaTypes: []string{""}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &PutGroupsGidReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + }) + if err != nil { + return nil, err + } + return result.(*PutGroupsGidCreated), nil + +} + +/* +PutGroupsGidUsersUID adds account to group + +Add account to group. +*/ +func (a *Client) PutGroupsGidUsersUID(params *PutGroupsGidUsersUIDParams) (*PutGroupsGidUsersUIDNoContent, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPutGroupsGidUsersUIDParams() + } + + result, err := a.transport.Submit(&runtime.ClientOperation{ + ID: "PutGroupsGidUsersUID", + Method: "PUT", + PathPattern: "/groups/{gid}/users/{uid}", + ProducesMediaTypes: []string{""}, + ConsumesMediaTypes: []string{""}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &PutGroupsGidUsersUIDReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + }) + if err != nil { + return nil, err + } + return result.(*PutGroupsGidUsersUIDNoContent), nil + +} + +// SetTransport changes the transport on the client +func (a *Client) SetTransport(transport runtime.ClientTransport) { + a.transport = transport +} diff --git a/dcos/iam/client/groups/patch_groups_gid_parameters.go b/dcos/iam/client/groups/patch_groups_gid_parameters.go new file mode 100644 index 0000000..818e10f --- /dev/null +++ b/dcos/iam/client/groups/patch_groups_gid_parameters.go @@ -0,0 +1,157 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package groups + +// 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" + + strfmt "github.com/go-openapi/strfmt" + + models "github.com/dcos/client-go/dcos/iam/models" +) + +// NewPatchGroupsGidParams creates a new PatchGroupsGidParams object +// with the default values initialized. +func NewPatchGroupsGidParams() *PatchGroupsGidParams { + var () + return &PatchGroupsGidParams{ + + timeout: cr.DefaultTimeout, + } +} + +// NewPatchGroupsGidParamsWithTimeout creates a new PatchGroupsGidParams object +// with the default values initialized, and the ability to set a timeout on a request +func NewPatchGroupsGidParamsWithTimeout(timeout time.Duration) *PatchGroupsGidParams { + var () + return &PatchGroupsGidParams{ + + timeout: timeout, + } +} + +// NewPatchGroupsGidParamsWithContext creates a new PatchGroupsGidParams object +// with the default values initialized, and the ability to set a context for a request +func NewPatchGroupsGidParamsWithContext(ctx context.Context) *PatchGroupsGidParams { + var () + return &PatchGroupsGidParams{ + + Context: ctx, + } +} + +// NewPatchGroupsGidParamsWithHTTPClient creates a new PatchGroupsGidParams object +// with the default values initialized, and the ability to set a custom HTTPClient for a request +func NewPatchGroupsGidParamsWithHTTPClient(client *http.Client) *PatchGroupsGidParams { + var () + return &PatchGroupsGidParams{ + HTTPClient: client, + } +} + +/*PatchGroupsGidParams contains all the parameters to send to the API endpoint +for the patch groups gid operation typically these are written to a http.Request +*/ +type PatchGroupsGidParams struct { + + /*GroupUpdateObject*/ + GroupUpdateObject *models.GroupUpdate + /*Gid + The ID of the group to modify. + + */ + Gid string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithTimeout adds the timeout to the patch groups gid params +func (o *PatchGroupsGidParams) WithTimeout(timeout time.Duration) *PatchGroupsGidParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the patch groups gid params +func (o *PatchGroupsGidParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the patch groups gid params +func (o *PatchGroupsGidParams) WithContext(ctx context.Context) *PatchGroupsGidParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the patch groups gid params +func (o *PatchGroupsGidParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the patch groups gid params +func (o *PatchGroupsGidParams) WithHTTPClient(client *http.Client) *PatchGroupsGidParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the patch groups gid params +func (o *PatchGroupsGidParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithGroupUpdateObject adds the groupUpdateObject to the patch groups gid params +func (o *PatchGroupsGidParams) WithGroupUpdateObject(groupUpdateObject *models.GroupUpdate) *PatchGroupsGidParams { + o.SetGroupUpdateObject(groupUpdateObject) + return o +} + +// SetGroupUpdateObject adds the groupUpdateObject to the patch groups gid params +func (o *PatchGroupsGidParams) SetGroupUpdateObject(groupUpdateObject *models.GroupUpdate) { + o.GroupUpdateObject = groupUpdateObject +} + +// WithGid adds the gid to the patch groups gid params +func (o *PatchGroupsGidParams) WithGid(gid string) *PatchGroupsGidParams { + o.SetGid(gid) + return o +} + +// SetGid adds the gid to the patch groups gid params +func (o *PatchGroupsGidParams) SetGid(gid string) { + o.Gid = gid +} + +// WriteToRequest writes these params to a swagger request +func (o *PatchGroupsGidParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.GroupUpdateObject != nil { + if err := r.SetBodyParam(o.GroupUpdateObject); err != nil { + return err + } + } + + // path param gid + if err := r.SetPathParam("gid", o.Gid); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/dcos/iam/client/groups/patch_groups_gid_responses.go b/dcos/iam/client/groups/patch_groups_gid_responses.go new file mode 100644 index 0000000..416d826 --- /dev/null +++ b/dcos/iam/client/groups/patch_groups_gid_responses.go @@ -0,0 +1,56 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package groups + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + + "github.com/go-openapi/runtime" + + strfmt "github.com/go-openapi/strfmt" +) + +// PatchGroupsGidReader is a Reader for the PatchGroupsGid structure. +type PatchGroupsGidReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PatchGroupsGidReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + + case 204: + result := NewPatchGroupsGidNoContent() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + + default: + return nil, runtime.NewAPIError("unknown error", response, response.Code()) + } +} + +// NewPatchGroupsGidNoContent creates a PatchGroupsGidNoContent with default headers values +func NewPatchGroupsGidNoContent() *PatchGroupsGidNoContent { + return &PatchGroupsGidNoContent{} +} + +/*PatchGroupsGidNoContent handles this case with default header values. + +Update applied. +*/ +type PatchGroupsGidNoContent struct { +} + +func (o *PatchGroupsGidNoContent) Error() string { + return fmt.Sprintf("[PATCH /groups/{gid}][%d] patchGroupsGidNoContent ", 204) +} + +func (o *PatchGroupsGidNoContent) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/dcos/iam/client/groups/put_groups_gid_parameters.go b/dcos/iam/client/groups/put_groups_gid_parameters.go new file mode 100644 index 0000000..eff1cb0 --- /dev/null +++ b/dcos/iam/client/groups/put_groups_gid_parameters.go @@ -0,0 +1,157 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package groups + +// 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" + + strfmt "github.com/go-openapi/strfmt" + + models "github.com/dcos/client-go/dcos/iam/models" +) + +// NewPutGroupsGidParams creates a new PutGroupsGidParams object +// with the default values initialized. +func NewPutGroupsGidParams() *PutGroupsGidParams { + var () + return &PutGroupsGidParams{ + + timeout: cr.DefaultTimeout, + } +} + +// NewPutGroupsGidParamsWithTimeout creates a new PutGroupsGidParams object +// with the default values initialized, and the ability to set a timeout on a request +func NewPutGroupsGidParamsWithTimeout(timeout time.Duration) *PutGroupsGidParams { + var () + return &PutGroupsGidParams{ + + timeout: timeout, + } +} + +// NewPutGroupsGidParamsWithContext creates a new PutGroupsGidParams object +// with the default values initialized, and the ability to set a context for a request +func NewPutGroupsGidParamsWithContext(ctx context.Context) *PutGroupsGidParams { + var () + return &PutGroupsGidParams{ + + Context: ctx, + } +} + +// NewPutGroupsGidParamsWithHTTPClient creates a new PutGroupsGidParams object +// with the default values initialized, and the ability to set a custom HTTPClient for a request +func NewPutGroupsGidParamsWithHTTPClient(client *http.Client) *PutGroupsGidParams { + var () + return &PutGroupsGidParams{ + HTTPClient: client, + } +} + +/*PutGroupsGidParams contains all the parameters to send to the API endpoint +for the put groups gid operation typically these are written to a http.Request +*/ +type PutGroupsGidParams struct { + + /*GroupCreationObject*/ + GroupCreationObject *models.GroupCreate + /*Gid + The ID of the group. + + */ + Gid string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithTimeout adds the timeout to the put groups gid params +func (o *PutGroupsGidParams) WithTimeout(timeout time.Duration) *PutGroupsGidParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the put groups gid params +func (o *PutGroupsGidParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the put groups gid params +func (o *PutGroupsGidParams) WithContext(ctx context.Context) *PutGroupsGidParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the put groups gid params +func (o *PutGroupsGidParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the put groups gid params +func (o *PutGroupsGidParams) WithHTTPClient(client *http.Client) *PutGroupsGidParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the put groups gid params +func (o *PutGroupsGidParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithGroupCreationObject adds the groupCreationObject to the put groups gid params +func (o *PutGroupsGidParams) WithGroupCreationObject(groupCreationObject *models.GroupCreate) *PutGroupsGidParams { + o.SetGroupCreationObject(groupCreationObject) + return o +} + +// SetGroupCreationObject adds the groupCreationObject to the put groups gid params +func (o *PutGroupsGidParams) SetGroupCreationObject(groupCreationObject *models.GroupCreate) { + o.GroupCreationObject = groupCreationObject +} + +// WithGid adds the gid to the put groups gid params +func (o *PutGroupsGidParams) WithGid(gid string) *PutGroupsGidParams { + o.SetGid(gid) + return o +} + +// SetGid adds the gid to the put groups gid params +func (o *PutGroupsGidParams) SetGid(gid string) { + o.Gid = gid +} + +// WriteToRequest writes these params to a swagger request +func (o *PutGroupsGidParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.GroupCreationObject != nil { + if err := r.SetBodyParam(o.GroupCreationObject); err != nil { + return err + } + } + + // path param gid + if err := r.SetPathParam("gid", o.Gid); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/dcos/iam/client/groups/put_groups_gid_responses.go b/dcos/iam/client/groups/put_groups_gid_responses.go new file mode 100644 index 0000000..919902d --- /dev/null +++ b/dcos/iam/client/groups/put_groups_gid_responses.go @@ -0,0 +1,84 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package groups + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + + "github.com/go-openapi/runtime" + + strfmt "github.com/go-openapi/strfmt" +) + +// PutGroupsGidReader is a Reader for the PutGroupsGid structure. +type PutGroupsGidReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PutGroupsGidReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + + case 201: + result := NewPutGroupsGidCreated() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + + case 409: + result := NewPutGroupsGidConflict() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + + default: + return nil, runtime.NewAPIError("unknown error", response, response.Code()) + } +} + +// NewPutGroupsGidCreated creates a PutGroupsGidCreated with default headers values +func NewPutGroupsGidCreated() *PutGroupsGidCreated { + return &PutGroupsGidCreated{} +} + +/*PutGroupsGidCreated handles this case with default header values. + +Group created. +*/ +type PutGroupsGidCreated struct { +} + +func (o *PutGroupsGidCreated) Error() string { + return fmt.Sprintf("[PUT /groups/{gid}][%d] putGroupsGidCreated ", 201) +} + +func (o *PutGroupsGidCreated) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewPutGroupsGidConflict creates a PutGroupsGidConflict with default headers values +func NewPutGroupsGidConflict() *PutGroupsGidConflict { + return &PutGroupsGidConflict{} +} + +/*PutGroupsGidConflict handles this case with default header values. + +Group exists. +*/ +type PutGroupsGidConflict struct { +} + +func (o *PutGroupsGidConflict) Error() string { + return fmt.Sprintf("[PUT /groups/{gid}][%d] putGroupsGidConflict ", 409) +} + +func (o *PutGroupsGidConflict) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/dcos/iam/client/groups/put_groups_gid_users_uid_parameters.go b/dcos/iam/client/groups/put_groups_gid_users_uid_parameters.go new file mode 100644 index 0000000..54c028e --- /dev/null +++ b/dcos/iam/client/groups/put_groups_gid_users_uid_parameters.go @@ -0,0 +1,157 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package groups + +// 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" + + strfmt "github.com/go-openapi/strfmt" +) + +// NewPutGroupsGidUsersUIDParams creates a new PutGroupsGidUsersUIDParams object +// with the default values initialized. +func NewPutGroupsGidUsersUIDParams() *PutGroupsGidUsersUIDParams { + var () + return &PutGroupsGidUsersUIDParams{ + + timeout: cr.DefaultTimeout, + } +} + +// NewPutGroupsGidUsersUIDParamsWithTimeout creates a new PutGroupsGidUsersUIDParams object +// with the default values initialized, and the ability to set a timeout on a request +func NewPutGroupsGidUsersUIDParamsWithTimeout(timeout time.Duration) *PutGroupsGidUsersUIDParams { + var () + return &PutGroupsGidUsersUIDParams{ + + timeout: timeout, + } +} + +// NewPutGroupsGidUsersUIDParamsWithContext creates a new PutGroupsGidUsersUIDParams object +// with the default values initialized, and the ability to set a context for a request +func NewPutGroupsGidUsersUIDParamsWithContext(ctx context.Context) *PutGroupsGidUsersUIDParams { + var () + return &PutGroupsGidUsersUIDParams{ + + Context: ctx, + } +} + +// NewPutGroupsGidUsersUIDParamsWithHTTPClient creates a new PutGroupsGidUsersUIDParams object +// with the default values initialized, and the ability to set a custom HTTPClient for a request +func NewPutGroupsGidUsersUIDParamsWithHTTPClient(client *http.Client) *PutGroupsGidUsersUIDParams { + var () + return &PutGroupsGidUsersUIDParams{ + HTTPClient: client, + } +} + +/*PutGroupsGidUsersUIDParams contains all the parameters to send to the API endpoint +for the put groups gid users UID operation typically these are written to a http.Request +*/ +type PutGroupsGidUsersUIDParams struct { + + /*Gid + The ID of the group to add the user account to. + + */ + Gid string + /*UID + The ID of the account to add. + + */ + UID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithTimeout adds the timeout to the put groups gid users UID params +func (o *PutGroupsGidUsersUIDParams) WithTimeout(timeout time.Duration) *PutGroupsGidUsersUIDParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the put groups gid users UID params +func (o *PutGroupsGidUsersUIDParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the put groups gid users UID params +func (o *PutGroupsGidUsersUIDParams) WithContext(ctx context.Context) *PutGroupsGidUsersUIDParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the put groups gid users UID params +func (o *PutGroupsGidUsersUIDParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the put groups gid users UID params +func (o *PutGroupsGidUsersUIDParams) WithHTTPClient(client *http.Client) *PutGroupsGidUsersUIDParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the put groups gid users UID params +func (o *PutGroupsGidUsersUIDParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithGid adds the gid to the put groups gid users UID params +func (o *PutGroupsGidUsersUIDParams) WithGid(gid string) *PutGroupsGidUsersUIDParams { + o.SetGid(gid) + return o +} + +// SetGid adds the gid to the put groups gid users UID params +func (o *PutGroupsGidUsersUIDParams) SetGid(gid string) { + o.Gid = gid +} + +// WithUID adds the uid to the put groups gid users UID params +func (o *PutGroupsGidUsersUIDParams) WithUID(uid string) *PutGroupsGidUsersUIDParams { + o.SetUID(uid) + return o +} + +// SetUID adds the uid to the put groups gid users UID params +func (o *PutGroupsGidUsersUIDParams) SetUID(uid string) { + o.UID = uid +} + +// WriteToRequest writes these params to a swagger request +func (o *PutGroupsGidUsersUIDParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param gid + if err := r.SetPathParam("gid", o.Gid); err != nil { + return err + } + + // path param uid + if err := r.SetPathParam("uid", o.UID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/dcos/iam/client/groups/put_groups_gid_users_uid_responses.go b/dcos/iam/client/groups/put_groups_gid_users_uid_responses.go new file mode 100644 index 0000000..00615a1 --- /dev/null +++ b/dcos/iam/client/groups/put_groups_gid_users_uid_responses.go @@ -0,0 +1,84 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package groups + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + + "github.com/go-openapi/runtime" + + strfmt "github.com/go-openapi/strfmt" +) + +// PutGroupsGidUsersUIDReader is a Reader for the PutGroupsGidUsersUID structure. +type PutGroupsGidUsersUIDReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PutGroupsGidUsersUIDReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + + case 204: + result := NewPutGroupsGidUsersUIDNoContent() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + + case 409: + result := NewPutGroupsGidUsersUIDConflict() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + + default: + return nil, runtime.NewAPIError("unknown error", response, response.Code()) + } +} + +// NewPutGroupsGidUsersUIDNoContent creates a PutGroupsGidUsersUIDNoContent with default headers values +func NewPutGroupsGidUsersUIDNoContent() *PutGroupsGidUsersUIDNoContent { + return &PutGroupsGidUsersUIDNoContent{} +} + +/*PutGroupsGidUsersUIDNoContent handles this case with default header values. + +Success +*/ +type PutGroupsGidUsersUIDNoContent struct { +} + +func (o *PutGroupsGidUsersUIDNoContent) Error() string { + return fmt.Sprintf("[PUT /groups/{gid}/users/{uid}][%d] putGroupsGidUsersUidNoContent ", 204) +} + +func (o *PutGroupsGidUsersUIDNoContent) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewPutGroupsGidUsersUIDConflict creates a PutGroupsGidUsersUIDConflict with default headers values +func NewPutGroupsGidUsersUIDConflict() *PutGroupsGidUsersUIDConflict { + return &PutGroupsGidUsersUIDConflict{} +} + +/*PutGroupsGidUsersUIDConflict handles this case with default header values. + +account is already part of the group. +*/ +type PutGroupsGidUsersUIDConflict struct { +} + +func (o *PutGroupsGidUsersUIDConflict) Error() string { + return fmt.Sprintf("[PUT /groups/{gid}/users/{uid}][%d] putGroupsGidUsersUidConflict ", 409) +} + +func (o *PutGroupsGidUsersUIDConflict) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/dcos/iam/client/identity_and_access_management_client.go b/dcos/iam/client/identity_and_access_management_client.go new file mode 100644 index 0000000..6f0f2e2 --- /dev/null +++ b/dcos/iam/client/identity_and_access_management_client.go @@ -0,0 +1,166 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package client + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "github.com/go-openapi/runtime" + httptransport "github.com/go-openapi/runtime/client" + + strfmt "github.com/go-openapi/strfmt" + + "github.com/dcos/client-go/dcos/iam/client/groups" + "github.com/dcos/client-go/dcos/iam/client/ldap" + "github.com/dcos/client-go/dcos/iam/client/login" + "github.com/dcos/client-go/dcos/iam/client/oidc" + "github.com/dcos/client-go/dcos/iam/client/operations" + "github.com/dcos/client-go/dcos/iam/client/permissions" + "github.com/dcos/client-go/dcos/iam/client/saml" + "github.com/dcos/client-go/dcos/iam/client/users" +) + +// Default identity and access management HTTP client. +var Default = NewHTTPClient(nil) + +const ( + // DefaultHost is the default Host + // found in Meta (info) section of spec file + DefaultHost string = "localhost" + // DefaultBasePath is the default BasePath + // found in Meta (info) section of spec file + DefaultBasePath string = "/acs/api/v1" +) + +// DefaultSchemes are the default schemes found in Meta (info) section of spec file +var DefaultSchemes = []string{"http", "https"} + +// NewHTTPClient creates a new identity and access management HTTP client. +func NewHTTPClient(formats strfmt.Registry) *IdentityAndAccessManagement { + return NewHTTPClientWithConfig(formats, nil) +} + +// NewHTTPClientWithConfig creates a new identity and access management HTTP client, +// using a customizable transport config. +func NewHTTPClientWithConfig(formats strfmt.Registry, cfg *TransportConfig) *IdentityAndAccessManagement { + // ensure nullable parameters have default + if cfg == nil { + cfg = DefaultTransportConfig() + } + + // create transport and client + transport := httptransport.New(cfg.Host, cfg.BasePath, cfg.Schemes) + return New(transport, formats) +} + +// New creates a new identity and access management client +func New(transport runtime.ClientTransport, formats strfmt.Registry) *IdentityAndAccessManagement { + // ensure nullable parameters have default + if formats == nil { + formats = strfmt.Default + } + + cli := new(IdentityAndAccessManagement) + cli.Transport = transport + + cli.Groups = groups.New(transport, formats) + + cli.Ldap = ldap.New(transport, formats) + + cli.Login = login.New(transport, formats) + + cli.Oidc = oidc.New(transport, formats) + + cli.Operations = operations.New(transport, formats) + + cli.Permissions = permissions.New(transport, formats) + + cli.Saml = saml.New(transport, formats) + + cli.Users = users.New(transport, formats) + + return cli +} + +// DefaultTransportConfig creates a TransportConfig with the +// default settings taken from the meta section of the spec file. +func DefaultTransportConfig() *TransportConfig { + return &TransportConfig{ + Host: DefaultHost, + BasePath: DefaultBasePath, + Schemes: DefaultSchemes, + } +} + +// TransportConfig contains the transport related info, +// found in the meta section of the spec file. +type TransportConfig struct { + Host string + BasePath string + Schemes []string +} + +// WithHost overrides the default host, +// provided by the meta section of the spec file. +func (cfg *TransportConfig) WithHost(host string) *TransportConfig { + cfg.Host = host + return cfg +} + +// WithBasePath overrides the default basePath, +// provided by the meta section of the spec file. +func (cfg *TransportConfig) WithBasePath(basePath string) *TransportConfig { + cfg.BasePath = basePath + return cfg +} + +// WithSchemes overrides the default schemes, +// provided by the meta section of the spec file. +func (cfg *TransportConfig) WithSchemes(schemes []string) *TransportConfig { + cfg.Schemes = schemes + return cfg +} + +// IdentityAndAccessManagement is a client for identity and access management +type IdentityAndAccessManagement struct { + Groups *groups.Client + + Ldap *ldap.Client + + Login *login.Client + + Oidc *oidc.Client + + Operations *operations.Client + + Permissions *permissions.Client + + Saml *saml.Client + + Users *users.Client + + Transport runtime.ClientTransport +} + +// SetTransport changes the transport on the client and all its subresources +func (c *IdentityAndAccessManagement) SetTransport(transport runtime.ClientTransport) { + c.Transport = transport + + c.Groups.SetTransport(transport) + + c.Ldap.SetTransport(transport) + + c.Login.SetTransport(transport) + + c.Oidc.SetTransport(transport) + + c.Operations.SetTransport(transport) + + c.Permissions.SetTransport(transport) + + c.Saml.SetTransport(transport) + + c.Users.SetTransport(transport) + +} diff --git a/dcos/iam/client/ldap/delete_ldap_config_parameters.go b/dcos/iam/client/ldap/delete_ldap_config_parameters.go new file mode 100644 index 0000000..fdd144b --- /dev/null +++ b/dcos/iam/client/ldap/delete_ldap_config_parameters.go @@ -0,0 +1,113 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package ldap + +// 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" + + strfmt "github.com/go-openapi/strfmt" +) + +// NewDeleteLdapConfigParams creates a new DeleteLdapConfigParams object +// with the default values initialized. +func NewDeleteLdapConfigParams() *DeleteLdapConfigParams { + + return &DeleteLdapConfigParams{ + + timeout: cr.DefaultTimeout, + } +} + +// NewDeleteLdapConfigParamsWithTimeout creates a new DeleteLdapConfigParams object +// with the default values initialized, and the ability to set a timeout on a request +func NewDeleteLdapConfigParamsWithTimeout(timeout time.Duration) *DeleteLdapConfigParams { + + return &DeleteLdapConfigParams{ + + timeout: timeout, + } +} + +// NewDeleteLdapConfigParamsWithContext creates a new DeleteLdapConfigParams object +// with the default values initialized, and the ability to set a context for a request +func NewDeleteLdapConfigParamsWithContext(ctx context.Context) *DeleteLdapConfigParams { + + return &DeleteLdapConfigParams{ + + Context: ctx, + } +} + +// NewDeleteLdapConfigParamsWithHTTPClient creates a new DeleteLdapConfigParams object +// with the default values initialized, and the ability to set a custom HTTPClient for a request +func NewDeleteLdapConfigParamsWithHTTPClient(client *http.Client) *DeleteLdapConfigParams { + + return &DeleteLdapConfigParams{ + HTTPClient: client, + } +} + +/*DeleteLdapConfigParams contains all the parameters to send to the API endpoint +for the delete ldap config operation typically these are written to a http.Request +*/ +type DeleteLdapConfigParams struct { + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithTimeout adds the timeout to the delete ldap config params +func (o *DeleteLdapConfigParams) WithTimeout(timeout time.Duration) *DeleteLdapConfigParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the delete ldap config params +func (o *DeleteLdapConfigParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the delete ldap config params +func (o *DeleteLdapConfigParams) WithContext(ctx context.Context) *DeleteLdapConfigParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the delete ldap config params +func (o *DeleteLdapConfigParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the delete ldap config params +func (o *DeleteLdapConfigParams) WithHTTPClient(client *http.Client) *DeleteLdapConfigParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the delete ldap config params +func (o *DeleteLdapConfigParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WriteToRequest writes these params to a swagger request +func (o *DeleteLdapConfigParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/dcos/iam/client/ldap/delete_ldap_config_responses.go b/dcos/iam/client/ldap/delete_ldap_config_responses.go new file mode 100644 index 0000000..0dd0a0b --- /dev/null +++ b/dcos/iam/client/ldap/delete_ldap_config_responses.go @@ -0,0 +1,84 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package ldap + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + + "github.com/go-openapi/runtime" + + strfmt "github.com/go-openapi/strfmt" +) + +// DeleteLdapConfigReader is a Reader for the DeleteLdapConfig structure. +type DeleteLdapConfigReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *DeleteLdapConfigReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + + case 204: + result := NewDeleteLdapConfigNoContent() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + + case 400: + result := NewDeleteLdapConfigBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + + default: + return nil, runtime.NewAPIError("unknown error", response, response.Code()) + } +} + +// NewDeleteLdapConfigNoContent creates a DeleteLdapConfigNoContent with default headers values +func NewDeleteLdapConfigNoContent() *DeleteLdapConfigNoContent { + return &DeleteLdapConfigNoContent{} +} + +/*DeleteLdapConfigNoContent handles this case with default header values. + +Configuration deleted. +*/ +type DeleteLdapConfigNoContent struct { +} + +func (o *DeleteLdapConfigNoContent) Error() string { + return fmt.Sprintf("[DELETE /ldap/config][%d] deleteLdapConfigNoContent ", 204) +} + +func (o *DeleteLdapConfigNoContent) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewDeleteLdapConfigBadRequest creates a DeleteLdapConfigBadRequest with default headers values +func NewDeleteLdapConfigBadRequest() *DeleteLdapConfigBadRequest { + return &DeleteLdapConfigBadRequest{} +} + +/*DeleteLdapConfigBadRequest handles this case with default header values. + +Various errors. If no config has yet been stored, the custom error code `ERR_LDAP_CONFIG_NOT_AVAILABLE` is set in the response. +*/ +type DeleteLdapConfigBadRequest struct { +} + +func (o *DeleteLdapConfigBadRequest) Error() string { + return fmt.Sprintf("[DELETE /ldap/config][%d] deleteLdapConfigBadRequest ", 400) +} + +func (o *DeleteLdapConfigBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/dcos/iam/client/ldap/get_ldap_config_parameters.go b/dcos/iam/client/ldap/get_ldap_config_parameters.go new file mode 100644 index 0000000..f2bcc44 --- /dev/null +++ b/dcos/iam/client/ldap/get_ldap_config_parameters.go @@ -0,0 +1,113 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package ldap + +// 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" + + strfmt "github.com/go-openapi/strfmt" +) + +// NewGetLdapConfigParams creates a new GetLdapConfigParams object +// with the default values initialized. +func NewGetLdapConfigParams() *GetLdapConfigParams { + + return &GetLdapConfigParams{ + + timeout: cr.DefaultTimeout, + } +} + +// NewGetLdapConfigParamsWithTimeout creates a new GetLdapConfigParams object +// with the default values initialized, and the ability to set a timeout on a request +func NewGetLdapConfigParamsWithTimeout(timeout time.Duration) *GetLdapConfigParams { + + return &GetLdapConfigParams{ + + timeout: timeout, + } +} + +// NewGetLdapConfigParamsWithContext creates a new GetLdapConfigParams object +// with the default values initialized, and the ability to set a context for a request +func NewGetLdapConfigParamsWithContext(ctx context.Context) *GetLdapConfigParams { + + return &GetLdapConfigParams{ + + Context: ctx, + } +} + +// NewGetLdapConfigParamsWithHTTPClient creates a new GetLdapConfigParams object +// with the default values initialized, and the ability to set a custom HTTPClient for a request +func NewGetLdapConfigParamsWithHTTPClient(client *http.Client) *GetLdapConfigParams { + + return &GetLdapConfigParams{ + HTTPClient: client, + } +} + +/*GetLdapConfigParams contains all the parameters to send to the API endpoint +for the get ldap config operation typically these are written to a http.Request +*/ +type GetLdapConfigParams struct { + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithTimeout adds the timeout to the get ldap config params +func (o *GetLdapConfigParams) WithTimeout(timeout time.Duration) *GetLdapConfigParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the get ldap config params +func (o *GetLdapConfigParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the get ldap config params +func (o *GetLdapConfigParams) WithContext(ctx context.Context) *GetLdapConfigParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the get ldap config params +func (o *GetLdapConfigParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the get ldap config params +func (o *GetLdapConfigParams) WithHTTPClient(client *http.Client) *GetLdapConfigParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the get ldap config params +func (o *GetLdapConfigParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WriteToRequest writes these params to a swagger request +func (o *GetLdapConfigParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/dcos/iam/client/ldap/get_ldap_config_responses.go b/dcos/iam/client/ldap/get_ldap_config_responses.go new file mode 100644 index 0000000..95b4192 --- /dev/null +++ b/dcos/iam/client/ldap/get_ldap_config_responses.go @@ -0,0 +1,95 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package ldap + +// 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" + + strfmt "github.com/go-openapi/strfmt" + + models "github.com/dcos/client-go/dcos/iam/models" +) + +// GetLdapConfigReader is a Reader for the GetLdapConfig structure. +type GetLdapConfigReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *GetLdapConfigReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + + case 200: + result := NewGetLdapConfigOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + + case 400: + result := NewGetLdapConfigBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + + default: + return nil, runtime.NewAPIError("unknown error", response, response.Code()) + } +} + +// NewGetLdapConfigOK creates a GetLdapConfigOK with default headers values +func NewGetLdapConfigOK() *GetLdapConfigOK { + return &GetLdapConfigOK{} +} + +/*GetLdapConfigOK handles this case with default header values. + +The response body contains a JSON object providing the current configuration. +*/ +type GetLdapConfigOK struct { + Payload *models.LDAPConfiguration +} + +func (o *GetLdapConfigOK) Error() string { + return fmt.Sprintf("[GET /ldap/config][%d] getLdapConfigOK %+v", 200, o.Payload) +} + +func (o *GetLdapConfigOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.LDAPConfiguration) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewGetLdapConfigBadRequest creates a GetLdapConfigBadRequest with default headers values +func NewGetLdapConfigBadRequest() *GetLdapConfigBadRequest { + return &GetLdapConfigBadRequest{} +} + +/*GetLdapConfigBadRequest handles this case with default header values. + +Various errors. If no config has yet been stored, the custom error code `ERR_LDAP_CONFIG_NOT_AVAILABLE` is set in the response. +*/ +type GetLdapConfigBadRequest struct { +} + +func (o *GetLdapConfigBadRequest) Error() string { + return fmt.Sprintf("[GET /ldap/config][%d] getLdapConfigBadRequest ", 400) +} + +func (o *GetLdapConfigBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/dcos/iam/client/ldap/ldap_client.go b/dcos/iam/client/ldap/ldap_client.go new file mode 100644 index 0000000..2be0c42 --- /dev/null +++ b/dcos/iam/client/ldap/ldap_client.go @@ -0,0 +1,210 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package ldap + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "github.com/go-openapi/runtime" + + strfmt "github.com/go-openapi/strfmt" +) + +// New creates a new ldap API client. +func New(transport runtime.ClientTransport, formats strfmt.Registry) *Client { + return &Client{transport: transport, formats: formats} +} + +/* +Client for ldap API +*/ +type Client struct { + transport runtime.ClientTransport + formats strfmt.Registry +} + +/* +DeleteLdapConfig deletes current l d a p configuration + +Delete current directory (LDAP) back-end configuration. This deactivates the LDAP authentication. +*/ +func (a *Client) DeleteLdapConfig(params *DeleteLdapConfigParams) (*DeleteLdapConfigNoContent, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewDeleteLdapConfigParams() + } + + result, err := a.transport.Submit(&runtime.ClientOperation{ + ID: "DeleteLdapConfig", + Method: "DELETE", + PathPattern: "/ldap/config", + ProducesMediaTypes: []string{""}, + ConsumesMediaTypes: []string{""}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &DeleteLdapConfigReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + }) + if err != nil { + return nil, err + } + return result.(*DeleteLdapConfigNoContent), nil + +} + +/* +GetLdapConfig retrieves current l d a p configuration + +Retrieve current directory (LDAP) back-end configuration. +*/ +func (a *Client) GetLdapConfig(params *GetLdapConfigParams) (*GetLdapConfigOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewGetLdapConfigParams() + } + + result, err := a.transport.Submit(&runtime.ClientOperation{ + ID: "GetLdapConfig", + Method: "GET", + PathPattern: "/ldap/config", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{""}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &GetLdapConfigReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + }) + if err != nil { + return nil, err + } + return result.(*GetLdapConfigOK), nil + +} + +/* +PostLdapConfigTest tests connection to the l d a p back end + +Perform basic feature tests. Verify that the current directory (LDAP) configuration parameters allow for a successful connection to the directory back-end. For instance, this endpoint simulates the procedure for authentication via LDAP, but provides more useful feedback upon failure than the actual login endpoint. +*/ +func (a *Client) PostLdapConfigTest(params *PostLdapConfigTestParams) (*PostLdapConfigTestOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPostLdapConfigTestParams() + } + + result, err := a.transport.Submit(&runtime.ClientOperation{ + ID: "PostLdapConfigTest", + Method: "POST", + PathPattern: "/ldap/config/test", + ProducesMediaTypes: []string{""}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &PostLdapConfigTestReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + }) + if err != nil { + return nil, err + } + return result.(*PostLdapConfigTestOK), nil + +} + +/* +PostLdapImportgroup imports an l d a p group + +Attempt to import a group of users from the configured directory (LDAP) back-end. See docs/ldap.md for details on group import. +*/ +func (a *Client) PostLdapImportgroup(params *PostLdapImportgroupParams) (*PostLdapImportgroupCreated, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPostLdapImportgroupParams() + } + + result, err := a.transport.Submit(&runtime.ClientOperation{ + ID: "PostLdapImportgroup", + Method: "POST", + PathPattern: "/ldap/importgroup", + ProducesMediaTypes: []string{""}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &PostLdapImportgroupReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + }) + if err != nil { + return nil, err + } + return result.(*PostLdapImportgroupCreated), nil + +} + +/* +PostLdapImportuser imports an l d a p user + +Attempt to import a user from the configured directory (LDAP) back-end. +*/ +func (a *Client) PostLdapImportuser(params *PostLdapImportuserParams) (*PostLdapImportuserCreated, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPostLdapImportuserParams() + } + + result, err := a.transport.Submit(&runtime.ClientOperation{ + ID: "PostLdapImportuser", + Method: "POST", + PathPattern: "/ldap/importuser", + ProducesMediaTypes: []string{""}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &PostLdapImportuserReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + }) + if err != nil { + return nil, err + } + return result.(*PostLdapImportuserCreated), nil + +} + +/* +PutLdapConfig sets new l d a p configuration + +Set new directory (LDAP) back-end configuration. Replace current configuration, if existing. +*/ +func (a *Client) PutLdapConfig(params *PutLdapConfigParams) (*PutLdapConfigOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPutLdapConfigParams() + } + + result, err := a.transport.Submit(&runtime.ClientOperation{ + ID: "PutLdapConfig", + Method: "PUT", + PathPattern: "/ldap/config", + ProducesMediaTypes: []string{""}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &PutLdapConfigReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + }) + if err != nil { + return nil, err + } + return result.(*PutLdapConfigOK), nil + +} + +// SetTransport changes the transport on the client +func (a *Client) SetTransport(transport runtime.ClientTransport) { + a.transport = transport +} diff --git a/dcos/iam/client/ldap/post_ldap_config_test_swagger_parameters.go b/dcos/iam/client/ldap/post_ldap_config_test_swagger_parameters.go new file mode 100644 index 0000000..2fe5517 --- /dev/null +++ b/dcos/iam/client/ldap/post_ldap_config_test_swagger_parameters.go @@ -0,0 +1,139 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package ldap + +// 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" + + strfmt "github.com/go-openapi/strfmt" + + models "github.com/dcos/client-go/dcos/iam/models" +) + +// NewPostLdapConfigTestParams creates a new PostLdapConfigTestParams object +// with the default values initialized. +func NewPostLdapConfigTestParams() *PostLdapConfigTestParams { + var () + return &PostLdapConfigTestParams{ + + timeout: cr.DefaultTimeout, + } +} + +// NewPostLdapConfigTestParamsWithTimeout creates a new PostLdapConfigTestParams object +// with the default values initialized, and the ability to set a timeout on a request +func NewPostLdapConfigTestParamsWithTimeout(timeout time.Duration) *PostLdapConfigTestParams { + var () + return &PostLdapConfigTestParams{ + + timeout: timeout, + } +} + +// NewPostLdapConfigTestParamsWithContext creates a new PostLdapConfigTestParams object +// with the default values initialized, and the ability to set a context for a request +func NewPostLdapConfigTestParamsWithContext(ctx context.Context) *PostLdapConfigTestParams { + var () + return &PostLdapConfigTestParams{ + + Context: ctx, + } +} + +// NewPostLdapConfigTestParamsWithHTTPClient creates a new PostLdapConfigTestParams object +// with the default values initialized, and the ability to set a custom HTTPClient for a request +func NewPostLdapConfigTestParamsWithHTTPClient(client *http.Client) *PostLdapConfigTestParams { + var () + return &PostLdapConfigTestParams{ + HTTPClient: client, + } +} + +/*PostLdapConfigTestParams contains all the parameters to send to the API endpoint +for the post ldap config test operation typically these are written to a http.Request +*/ +type PostLdapConfigTestParams struct { + + /*TestUserCredentials + JSON object containing `uid` and password of an LDAP user. For the most expressive test result, choose credentials different from the lookup credentials. The `uid` is the string the user is supposed to log in with after successful LDAP back-end configuration. + + */ + TestUserCredentials *models.LDAPTestCredentials + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithTimeout adds the timeout to the post ldap config test params +func (o *PostLdapConfigTestParams) WithTimeout(timeout time.Duration) *PostLdapConfigTestParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the post ldap config test params +func (o *PostLdapConfigTestParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the post ldap config test params +func (o *PostLdapConfigTestParams) WithContext(ctx context.Context) *PostLdapConfigTestParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the post ldap config test params +func (o *PostLdapConfigTestParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the post ldap config test params +func (o *PostLdapConfigTestParams) WithHTTPClient(client *http.Client) *PostLdapConfigTestParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the post ldap config test params +func (o *PostLdapConfigTestParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithTestUserCredentials adds the testUserCredentials to the post ldap config test params +func (o *PostLdapConfigTestParams) WithTestUserCredentials(testUserCredentials *models.LDAPTestCredentials) *PostLdapConfigTestParams { + o.SetTestUserCredentials(testUserCredentials) + return o +} + +// SetTestUserCredentials adds the testUserCredentials to the post ldap config test params +func (o *PostLdapConfigTestParams) SetTestUserCredentials(testUserCredentials *models.LDAPTestCredentials) { + o.TestUserCredentials = testUserCredentials +} + +// WriteToRequest writes these params to a swagger request +func (o *PostLdapConfigTestParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.TestUserCredentials != nil { + if err := r.SetBodyParam(o.TestUserCredentials); err != nil { + return err + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/dcos/iam/client/ldap/post_ldap_config_test_swagger_responses.go b/dcos/iam/client/ldap/post_ldap_config_test_swagger_responses.go new file mode 100644 index 0000000..3e04e14 --- /dev/null +++ b/dcos/iam/client/ldap/post_ldap_config_test_swagger_responses.go @@ -0,0 +1,103 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package ldap + +// 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" + + strfmt "github.com/go-openapi/strfmt" + + models "github.com/dcos/client-go/dcos/iam/models" +) + +// PostLdapConfigTestReader is a Reader for the PostLdapConfigTest structure. +type PostLdapConfigTestReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PostLdapConfigTestReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + + case 200: + result := NewPostLdapConfigTestOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + + case 502: + result := NewPostLdapConfigTestBadGateway() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + + default: + return nil, runtime.NewAPIError("unknown error", response, response.Code()) + } +} + +// NewPostLdapConfigTestOK creates a PostLdapConfigTestOK with default headers values +func NewPostLdapConfigTestOK() *PostLdapConfigTestOK { + return &PostLdapConfigTestOK{} +} + +/*PostLdapConfigTestOK handles this case with default header values. + +Directory back-end was reached and all feature tests passed. +*/ +type PostLdapConfigTestOK struct { + Payload *models.LDAPTestResultObject +} + +func (o *PostLdapConfigTestOK) Error() string { + return fmt.Sprintf("[POST /ldap/config/test][%d] postLdapConfigTestOK %+v", 200, o.Payload) +} + +func (o *PostLdapConfigTestOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.LDAPTestResultObject) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewPostLdapConfigTestBadGateway creates a PostLdapConfigTestBadGateway with default headers values +func NewPostLdapConfigTestBadGateway() *PostLdapConfigTestBadGateway { + return &PostLdapConfigTestBadGateway{} +} + +/*PostLdapConfigTestBadGateway handles this case with default header values. + +Either there was a connection error or one of the feature tests failed. To distinguish this response from a proxy-generated 502, a JSON object is included in the response. It contains a message in its `description` property, describing the problem in more detail. +*/ +type PostLdapConfigTestBadGateway struct { + Payload *models.LDAPTestResultObject +} + +func (o *PostLdapConfigTestBadGateway) Error() string { + return fmt.Sprintf("[POST /ldap/config/test][%d] postLdapConfigTestBadGateway %+v", 502, o.Payload) +} + +func (o *PostLdapConfigTestBadGateway) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.LDAPTestResultObject) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/dcos/iam/client/ldap/post_ldap_importgroup_parameters.go b/dcos/iam/client/ldap/post_ldap_importgroup_parameters.go new file mode 100644 index 0000000..0fbf4e0 --- /dev/null +++ b/dcos/iam/client/ldap/post_ldap_importgroup_parameters.go @@ -0,0 +1,139 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package ldap + +// 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" + + strfmt "github.com/go-openapi/strfmt" + + models "github.com/dcos/client-go/dcos/iam/models" +) + +// NewPostLdapImportgroupParams creates a new PostLdapImportgroupParams object +// with the default values initialized. +func NewPostLdapImportgroupParams() *PostLdapImportgroupParams { + var () + return &PostLdapImportgroupParams{ + + timeout: cr.DefaultTimeout, + } +} + +// NewPostLdapImportgroupParamsWithTimeout creates a new PostLdapImportgroupParams object +// with the default values initialized, and the ability to set a timeout on a request +func NewPostLdapImportgroupParamsWithTimeout(timeout time.Duration) *PostLdapImportgroupParams { + var () + return &PostLdapImportgroupParams{ + + timeout: timeout, + } +} + +// NewPostLdapImportgroupParamsWithContext creates a new PostLdapImportgroupParams object +// with the default values initialized, and the ability to set a context for a request +func NewPostLdapImportgroupParamsWithContext(ctx context.Context) *PostLdapImportgroupParams { + var () + return &PostLdapImportgroupParams{ + + Context: ctx, + } +} + +// NewPostLdapImportgroupParamsWithHTTPClient creates a new PostLdapImportgroupParams object +// with the default values initialized, and the ability to set a custom HTTPClient for a request +func NewPostLdapImportgroupParamsWithHTTPClient(client *http.Client) *PostLdapImportgroupParams { + var () + return &PostLdapImportgroupParams{ + HTTPClient: client, + } +} + +/*PostLdapImportgroupParams contains all the parameters to send to the API endpoint +for the post ldap importgroup operation typically these are written to a http.Request +*/ +type PostLdapImportgroupParams struct { + + /*LDAPGroupname + A JSON object specifying the name of the group to be imported. The meaning of the name depends on the group search settings. + + */ + LDAPGroupname *models.LDApimportGroupObject + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithTimeout adds the timeout to the post ldap importgroup params +func (o *PostLdapImportgroupParams) WithTimeout(timeout time.Duration) *PostLdapImportgroupParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the post ldap importgroup params +func (o *PostLdapImportgroupParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the post ldap importgroup params +func (o *PostLdapImportgroupParams) WithContext(ctx context.Context) *PostLdapImportgroupParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the post ldap importgroup params +func (o *PostLdapImportgroupParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the post ldap importgroup params +func (o *PostLdapImportgroupParams) WithHTTPClient(client *http.Client) *PostLdapImportgroupParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the post ldap importgroup params +func (o *PostLdapImportgroupParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithLDAPGroupname adds the lDAPGroupname to the post ldap importgroup params +func (o *PostLdapImportgroupParams) WithLDAPGroupname(lDAPGroupname *models.LDApimportGroupObject) *PostLdapImportgroupParams { + o.SetLDAPGroupname(lDAPGroupname) + return o +} + +// SetLDAPGroupname adds the lDAPGroupname to the post ldap importgroup params +func (o *PostLdapImportgroupParams) SetLDAPGroupname(lDAPGroupname *models.LDApimportGroupObject) { + o.LDAPGroupname = lDAPGroupname +} + +// WriteToRequest writes these params to a swagger request +func (o *PostLdapImportgroupParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.LDAPGroupname != nil { + if err := r.SetBodyParam(o.LDAPGroupname); err != nil { + return err + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/dcos/iam/client/ldap/post_ldap_importgroup_responses.go b/dcos/iam/client/ldap/post_ldap_importgroup_responses.go new file mode 100644 index 0000000..8f0ee2b --- /dev/null +++ b/dcos/iam/client/ldap/post_ldap_importgroup_responses.go @@ -0,0 +1,84 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package ldap + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + + "github.com/go-openapi/runtime" + + strfmt "github.com/go-openapi/strfmt" +) + +// PostLdapImportgroupReader is a Reader for the PostLdapImportgroup structure. +type PostLdapImportgroupReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PostLdapImportgroupReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + + case 201: + result := NewPostLdapImportgroupCreated() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + + case 400: + result := NewPostLdapImportgroupBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + + default: + return nil, runtime.NewAPIError("unknown error", response, response.Code()) + } +} + +// NewPostLdapImportgroupCreated creates a PostLdapImportgroupCreated with default headers values +func NewPostLdapImportgroupCreated() *PostLdapImportgroupCreated { + return &PostLdapImportgroupCreated{} +} + +/*PostLdapImportgroupCreated handles this case with default header values. + +Success. +*/ +type PostLdapImportgroupCreated struct { +} + +func (o *PostLdapImportgroupCreated) Error() string { + return fmt.Sprintf("[POST /ldap/importgroup][%d] postLdapImportgroupCreated ", 201) +} + +func (o *PostLdapImportgroupCreated) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewPostLdapImportgroupBadRequest creates a PostLdapImportgroupBadRequest with default headers values +func NewPostLdapImportgroupBadRequest() *PostLdapImportgroupBadRequest { + return &PostLdapImportgroupBadRequest{} +} + +/*PostLdapImportgroupBadRequest handles this case with default header values. + +Various errors. If no directory back-end has been configured yet, the custom error code `ERR_LDAP_CONFIG_NOT_AVAILABLE` is set in the response. If there was no LDAP search result or an error occured during the search process, one of the custom error codes `ERR_LDAP_IMPORT_GROUP_NOT_FOUND` and `ERR_LDAP_IMPORT_SEARCH_FAILED` is set in the response, and a description is provided to report the problem specifics. +*/ +type PostLdapImportgroupBadRequest struct { +} + +func (o *PostLdapImportgroupBadRequest) Error() string { + return fmt.Sprintf("[POST /ldap/importgroup][%d] postLdapImportgroupBadRequest ", 400) +} + +func (o *PostLdapImportgroupBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/dcos/iam/client/ldap/post_ldap_importuser_parameters.go b/dcos/iam/client/ldap/post_ldap_importuser_parameters.go new file mode 100644 index 0000000..b13cc64 --- /dev/null +++ b/dcos/iam/client/ldap/post_ldap_importuser_parameters.go @@ -0,0 +1,139 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package ldap + +// 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" + + strfmt "github.com/go-openapi/strfmt" + + models "github.com/dcos/client-go/dcos/iam/models" +) + +// NewPostLdapImportuserParams creates a new PostLdapImportuserParams object +// with the default values initialized. +func NewPostLdapImportuserParams() *PostLdapImportuserParams { + var () + return &PostLdapImportuserParams{ + + timeout: cr.DefaultTimeout, + } +} + +// NewPostLdapImportuserParamsWithTimeout creates a new PostLdapImportuserParams object +// with the default values initialized, and the ability to set a timeout on a request +func NewPostLdapImportuserParamsWithTimeout(timeout time.Duration) *PostLdapImportuserParams { + var () + return &PostLdapImportuserParams{ + + timeout: timeout, + } +} + +// NewPostLdapImportuserParamsWithContext creates a new PostLdapImportuserParams object +// with the default values initialized, and the ability to set a context for a request +func NewPostLdapImportuserParamsWithContext(ctx context.Context) *PostLdapImportuserParams { + var () + return &PostLdapImportuserParams{ + + Context: ctx, + } +} + +// NewPostLdapImportuserParamsWithHTTPClient creates a new PostLdapImportuserParams object +// with the default values initialized, and the ability to set a custom HTTPClient for a request +func NewPostLdapImportuserParamsWithHTTPClient(client *http.Client) *PostLdapImportuserParams { + var () + return &PostLdapImportuserParams{ + HTTPClient: client, + } +} + +/*PostLdapImportuserParams contains all the parameters to send to the API endpoint +for the post ldap importuser operation typically these are written to a http.Request +*/ +type PostLdapImportuserParams struct { + + /*LDAPUsername + A JSON object specifying the username (read: "login" or "user ID") of the user that should be imported. That string is equivalent to the `uid` the user is supposed to log in with after successful import. The exact meaning of this string depends on the configured LDAP authentication method. + + */ + LDAPUsername *models.LDApimportUserObject + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithTimeout adds the timeout to the post ldap importuser params +func (o *PostLdapImportuserParams) WithTimeout(timeout time.Duration) *PostLdapImportuserParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the post ldap importuser params +func (o *PostLdapImportuserParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the post ldap importuser params +func (o *PostLdapImportuserParams) WithContext(ctx context.Context) *PostLdapImportuserParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the post ldap importuser params +func (o *PostLdapImportuserParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the post ldap importuser params +func (o *PostLdapImportuserParams) WithHTTPClient(client *http.Client) *PostLdapImportuserParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the post ldap importuser params +func (o *PostLdapImportuserParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithLDAPUsername adds the lDAPUsername to the post ldap importuser params +func (o *PostLdapImportuserParams) WithLDAPUsername(lDAPUsername *models.LDApimportUserObject) *PostLdapImportuserParams { + o.SetLDAPUsername(lDAPUsername) + return o +} + +// SetLDAPUsername adds the lDAPUsername to the post ldap importuser params +func (o *PostLdapImportuserParams) SetLDAPUsername(lDAPUsername *models.LDApimportUserObject) { + o.LDAPUsername = lDAPUsername +} + +// WriteToRequest writes these params to a swagger request +func (o *PostLdapImportuserParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.LDAPUsername != nil { + if err := r.SetBodyParam(o.LDAPUsername); err != nil { + return err + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/dcos/iam/client/ldap/post_ldap_importuser_responses.go b/dcos/iam/client/ldap/post_ldap_importuser_responses.go new file mode 100644 index 0000000..5b04924 --- /dev/null +++ b/dcos/iam/client/ldap/post_ldap_importuser_responses.go @@ -0,0 +1,84 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package ldap + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + + "github.com/go-openapi/runtime" + + strfmt "github.com/go-openapi/strfmt" +) + +// PostLdapImportuserReader is a Reader for the PostLdapImportuser structure. +type PostLdapImportuserReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PostLdapImportuserReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + + case 201: + result := NewPostLdapImportuserCreated() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + + case 400: + result := NewPostLdapImportuserBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + + default: + return nil, runtime.NewAPIError("unknown error", response, response.Code()) + } +} + +// NewPostLdapImportuserCreated creates a PostLdapImportuserCreated with default headers values +func NewPostLdapImportuserCreated() *PostLdapImportuserCreated { + return &PostLdapImportuserCreated{} +} + +/*PostLdapImportuserCreated handles this case with default header values. + +Success. +*/ +type PostLdapImportuserCreated struct { +} + +func (o *PostLdapImportuserCreated) Error() string { + return fmt.Sprintf("[POST /ldap/importuser][%d] postLdapImportuserCreated ", 201) +} + +func (o *PostLdapImportuserCreated) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewPostLdapImportuserBadRequest creates a PostLdapImportuserBadRequest with default headers values +func NewPostLdapImportuserBadRequest() *PostLdapImportuserBadRequest { + return &PostLdapImportuserBadRequest{} +} + +/*PostLdapImportuserBadRequest handles this case with default header values. + +Various errors. If no directory back-end has been configured yet, the custom error code `ERR_LDAP_CONFIG_NOT_AVAILABLE` is set in the response. If there was no LDAP search result or an error occured during the search process, one of the custom error codes `ERR_LDAP_IMPORT_USER_NOT_FOUND` and `ERR_LDAP_IMPORT_SEARCH_FAILED` is set in the response, and a description is provided to report the problem specifics. +*/ +type PostLdapImportuserBadRequest struct { +} + +func (o *PostLdapImportuserBadRequest) Error() string { + return fmt.Sprintf("[POST /ldap/importuser][%d] postLdapImportuserBadRequest ", 400) +} + +func (o *PostLdapImportuserBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/dcos/iam/client/ldap/put_ldap_config_parameters.go b/dcos/iam/client/ldap/put_ldap_config_parameters.go new file mode 100644 index 0000000..9db9dc7 --- /dev/null +++ b/dcos/iam/client/ldap/put_ldap_config_parameters.go @@ -0,0 +1,139 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package ldap + +// 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" + + strfmt "github.com/go-openapi/strfmt" + + models "github.com/dcos/client-go/dcos/iam/models" +) + +// NewPutLdapConfigParams creates a new PutLdapConfigParams object +// with the default values initialized. +func NewPutLdapConfigParams() *PutLdapConfigParams { + var () + return &PutLdapConfigParams{ + + timeout: cr.DefaultTimeout, + } +} + +// NewPutLdapConfigParamsWithTimeout creates a new PutLdapConfigParams object +// with the default values initialized, and the ability to set a timeout on a request +func NewPutLdapConfigParamsWithTimeout(timeout time.Duration) *PutLdapConfigParams { + var () + return &PutLdapConfigParams{ + + timeout: timeout, + } +} + +// NewPutLdapConfigParamsWithContext creates a new PutLdapConfigParams object +// with the default values initialized, and the ability to set a context for a request +func NewPutLdapConfigParamsWithContext(ctx context.Context) *PutLdapConfigParams { + var () + return &PutLdapConfigParams{ + + Context: ctx, + } +} + +// NewPutLdapConfigParamsWithHTTPClient creates a new PutLdapConfigParams object +// with the default values initialized, and the ability to set a custom HTTPClient for a request +func NewPutLdapConfigParamsWithHTTPClient(client *http.Client) *PutLdapConfigParams { + var () + return &PutLdapConfigParams{ + HTTPClient: client, + } +} + +/*PutLdapConfigParams contains all the parameters to send to the API endpoint +for the put ldap config operation typically these are written to a http.Request +*/ +type PutLdapConfigParams struct { + + /*LDAPConfiguration + JSON object containing the LDAP configuration details. + + */ + LDAPConfiguration *models.LDAPConfiguration + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithTimeout adds the timeout to the put ldap config params +func (o *PutLdapConfigParams) WithTimeout(timeout time.Duration) *PutLdapConfigParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the put ldap config params +func (o *PutLdapConfigParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the put ldap config params +func (o *PutLdapConfigParams) WithContext(ctx context.Context) *PutLdapConfigParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the put ldap config params +func (o *PutLdapConfigParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the put ldap config params +func (o *PutLdapConfigParams) WithHTTPClient(client *http.Client) *PutLdapConfigParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the put ldap config params +func (o *PutLdapConfigParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithLDAPConfiguration adds the lDAPConfiguration to the put ldap config params +func (o *PutLdapConfigParams) WithLDAPConfiguration(lDAPConfiguration *models.LDAPConfiguration) *PutLdapConfigParams { + o.SetLDAPConfiguration(lDAPConfiguration) + return o +} + +// SetLDAPConfiguration adds the lDAPConfiguration to the put ldap config params +func (o *PutLdapConfigParams) SetLDAPConfiguration(lDAPConfiguration *models.LDAPConfiguration) { + o.LDAPConfiguration = lDAPConfiguration +} + +// WriteToRequest writes these params to a swagger request +func (o *PutLdapConfigParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.LDAPConfiguration != nil { + if err := r.SetBodyParam(o.LDAPConfiguration); err != nil { + return err + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/dcos/iam/client/ldap/put_ldap_config_responses.go b/dcos/iam/client/ldap/put_ldap_config_responses.go new file mode 100644 index 0000000..4eca598 --- /dev/null +++ b/dcos/iam/client/ldap/put_ldap_config_responses.go @@ -0,0 +1,84 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package ldap + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + + "github.com/go-openapi/runtime" + + strfmt "github.com/go-openapi/strfmt" +) + +// PutLdapConfigReader is a Reader for the PutLdapConfig structure. +type PutLdapConfigReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PutLdapConfigReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + + case 200: + result := NewPutLdapConfigOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + + case 400: + result := NewPutLdapConfigBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + + default: + return nil, runtime.NewAPIError("unknown error", response, response.Code()) + } +} + +// NewPutLdapConfigOK creates a PutLdapConfigOK with default headers values +func NewPutLdapConfigOK() *PutLdapConfigOK { + return &PutLdapConfigOK{} +} + +/*PutLdapConfigOK handles this case with default header values. + +Configuration has been persisted. Basic validation tests passed, but the directory service was not contacted. You're encouraged to now perform a basic feature check against the directory back-end with the newly set configuration by using the the config test endpoint. +*/ +type PutLdapConfigOK struct { +} + +func (o *PutLdapConfigOK) Error() string { + return fmt.Sprintf("[PUT /ldap/config][%d] putLdapConfigOK ", 200) +} + +func (o *PutLdapConfigOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewPutLdapConfigBadRequest creates a PutLdapConfigBadRequest with default headers values +func NewPutLdapConfigBadRequest() *PutLdapConfigBadRequest { + return &PutLdapConfigBadRequest{} +} + +/*PutLdapConfigBadRequest handles this case with default header values. + +Various errors. If the configuration object itself is invalid, the custom error code `ERR_LDAP_CONFIG_INVALID` is set in the response and a description sheds light onto the problem specifics. +*/ +type PutLdapConfigBadRequest struct { +} + +func (o *PutLdapConfigBadRequest) Error() string { + return fmt.Sprintf("[PUT /ldap/config][%d] putLdapConfigBadRequest ", 400) +} + +func (o *PutLdapConfigBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/dcos/iam/client/login/get_auth_login_parameters.go b/dcos/iam/client/login/get_auth_login_parameters.go new file mode 100644 index 0000000..040a319 --- /dev/null +++ b/dcos/iam/client/login/get_auth_login_parameters.go @@ -0,0 +1,147 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package login + +// 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" + + strfmt "github.com/go-openapi/strfmt" +) + +// NewGetAuthLoginParams creates a new GetAuthLoginParams object +// with the default values initialized. +func NewGetAuthLoginParams() *GetAuthLoginParams { + var () + return &GetAuthLoginParams{ + + timeout: cr.DefaultTimeout, + } +} + +// NewGetAuthLoginParamsWithTimeout creates a new GetAuthLoginParams object +// with the default values initialized, and the ability to set a timeout on a request +func NewGetAuthLoginParamsWithTimeout(timeout time.Duration) *GetAuthLoginParams { + var () + return &GetAuthLoginParams{ + + timeout: timeout, + } +} + +// NewGetAuthLoginParamsWithContext creates a new GetAuthLoginParams object +// with the default values initialized, and the ability to set a context for a request +func NewGetAuthLoginParamsWithContext(ctx context.Context) *GetAuthLoginParams { + var () + return &GetAuthLoginParams{ + + Context: ctx, + } +} + +// NewGetAuthLoginParamsWithHTTPClient creates a new GetAuthLoginParams object +// with the default values initialized, and the ability to set a custom HTTPClient for a request +func NewGetAuthLoginParamsWithHTTPClient(client *http.Client) *GetAuthLoginParams { + var () + return &GetAuthLoginParams{ + HTTPClient: client, + } +} + +/*GetAuthLoginParams contains all the parameters to send to the API endpoint +for the get auth login operation typically these are written to a http.Request +*/ +type GetAuthLoginParams struct { + + /*OidcProvider + OIDC provider ID + + */ + OidcProvider *string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithTimeout adds the timeout to the get auth login params +func (o *GetAuthLoginParams) WithTimeout(timeout time.Duration) *GetAuthLoginParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the get auth login params +func (o *GetAuthLoginParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the get auth login params +func (o *GetAuthLoginParams) WithContext(ctx context.Context) *GetAuthLoginParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the get auth login params +func (o *GetAuthLoginParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the get auth login params +func (o *GetAuthLoginParams) WithHTTPClient(client *http.Client) *GetAuthLoginParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the get auth login params +func (o *GetAuthLoginParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithOidcProvider adds the oidcProvider to the get auth login params +func (o *GetAuthLoginParams) WithOidcProvider(oidcProvider *string) *GetAuthLoginParams { + o.SetOidcProvider(oidcProvider) + return o +} + +// SetOidcProvider adds the oidcProvider to the get auth login params +func (o *GetAuthLoginParams) SetOidcProvider(oidcProvider *string) { + o.OidcProvider = oidcProvider +} + +// WriteToRequest writes these params to a swagger request +func (o *GetAuthLoginParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.OidcProvider != nil { + + // query param oidc-provider + var qrOidcProvider string + if o.OidcProvider != nil { + qrOidcProvider = *o.OidcProvider + } + qOidcProvider := qrOidcProvider + if qOidcProvider != "" { + if err := r.SetQueryParam("oidc-provider", qOidcProvider); err != nil { + return err + } + } + + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/dcos/iam/client/login/get_auth_login_responses.go b/dcos/iam/client/login/get_auth_login_responses.go new file mode 100644 index 0000000..b2003da --- /dev/null +++ b/dcos/iam/client/login/get_auth_login_responses.go @@ -0,0 +1,56 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package login + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + + "github.com/go-openapi/runtime" + + strfmt "github.com/go-openapi/strfmt" +) + +// GetAuthLoginReader is a Reader for the GetAuthLogin structure. +type GetAuthLoginReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *GetAuthLoginReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + + case 200: + result := NewGetAuthLoginOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + + default: + return nil, runtime.NewAPIError("unknown error", response, response.Code()) + } +} + +// NewGetAuthLoginOK creates a GetAuthLoginOK with default headers values +func NewGetAuthLoginOK() *GetAuthLoginOK { + return &GetAuthLoginOK{} +} + +/*GetAuthLoginOK handles this case with default header values. + +Redirect to the identity provider. +*/ +type GetAuthLoginOK struct { +} + +func (o *GetAuthLoginOK) Error() string { + return fmt.Sprintf("[GET /auth/login][%d] getAuthLoginOK ", 200) +} + +func (o *GetAuthLoginOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/dcos/iam/client/login/login_client.go b/dcos/iam/client/login/login_client.go new file mode 100644 index 0000000..450c7d0 --- /dev/null +++ b/dcos/iam/client/login/login_client.go @@ -0,0 +1,90 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package login + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "github.com/go-openapi/runtime" + + strfmt "github.com/go-openapi/strfmt" +) + +// New creates a new login API client. +func New(transport runtime.ClientTransport, formats strfmt.Registry) *Client { + return &Client{transport: transport, formats: formats} +} + +/* +Client for login API +*/ +type Client struct { + transport runtime.ClientTransport + formats strfmt.Registry +} + +/* +GetAuthLogin logs in using an external identity provider + +Log in using an external identity provider (via e.g. OpenID Connect), as specified via query parameter. This request initiates a single sign-on flow. +*/ +func (a *Client) GetAuthLogin(params *GetAuthLoginParams) (*GetAuthLoginOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewGetAuthLoginParams() + } + + result, err := a.transport.Submit(&runtime.ClientOperation{ + ID: "GetAuthLogin", + Method: "GET", + PathPattern: "/auth/login", + ProducesMediaTypes: []string{""}, + ConsumesMediaTypes: []string{""}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &GetAuthLoginReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + }) + if err != nil { + return nil, err + } + return result.(*GetAuthLoginOK), nil + +} + +/* +PostAuthLogin logs in obtain a d c o s authentication token + +Exchange user credentials (regular user account: uid and password; service user account: uid and service login token) for a DC/OS authentication token. The resulting DC/OS authentication token is an RFC 7519 JSON Web Token (JWT) of type RS256. It has a limited lifetime which depends on the IAM configuration (only, i.e. the lifetime cannot be chosen as part of the login HTTP request). The DC/OS authentication token can be verified out-of-band using a standards-compliant RS256 JWT verification procedure based on the long-lived public key material presented by the IAM's /auth/jwks endpoint, and by requiring the two claims `exp` and `uid` to be present. +*/ +func (a *Client) PostAuthLogin(params *PostAuthLoginParams) (*PostAuthLoginOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPostAuthLoginParams() + } + + result, err := a.transport.Submit(&runtime.ClientOperation{ + ID: "PostAuthLogin", + Method: "POST", + PathPattern: "/auth/login", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &PostAuthLoginReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + }) + if err != nil { + return nil, err + } + return result.(*PostAuthLoginOK), nil + +} + +// SetTransport changes the transport on the client +func (a *Client) SetTransport(transport runtime.ClientTransport) { + a.transport = transport +} diff --git a/dcos/iam/client/login/post_auth_login_parameters.go b/dcos/iam/client/login/post_auth_login_parameters.go new file mode 100644 index 0000000..e8753e6 --- /dev/null +++ b/dcos/iam/client/login/post_auth_login_parameters.go @@ -0,0 +1,139 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package login + +// 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" + + strfmt "github.com/go-openapi/strfmt" + + models "github.com/dcos/client-go/dcos/iam/models" +) + +// NewPostAuthLoginParams creates a new PostAuthLoginParams object +// with the default values initialized. +func NewPostAuthLoginParams() *PostAuthLoginParams { + var () + return &PostAuthLoginParams{ + + timeout: cr.DefaultTimeout, + } +} + +// NewPostAuthLoginParamsWithTimeout creates a new PostAuthLoginParams object +// with the default values initialized, and the ability to set a timeout on a request +func NewPostAuthLoginParamsWithTimeout(timeout time.Duration) *PostAuthLoginParams { + var () + return &PostAuthLoginParams{ + + timeout: timeout, + } +} + +// NewPostAuthLoginParamsWithContext creates a new PostAuthLoginParams object +// with the default values initialized, and the ability to set a context for a request +func NewPostAuthLoginParamsWithContext(ctx context.Context) *PostAuthLoginParams { + var () + return &PostAuthLoginParams{ + + Context: ctx, + } +} + +// NewPostAuthLoginParamsWithHTTPClient creates a new PostAuthLoginParams object +// with the default values initialized, and the ability to set a custom HTTPClient for a request +func NewPostAuthLoginParamsWithHTTPClient(client *http.Client) *PostAuthLoginParams { + var () + return &PostAuthLoginParams{ + HTTPClient: client, + } +} + +/*PostAuthLoginParams contains all the parameters to send to the API endpoint +for the post auth login operation typically these are written to a http.Request +*/ +type PostAuthLoginParams struct { + + /*LoginObject + uid & password or uid & service login token. + + */ + LoginObject *models.LoginObject + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithTimeout adds the timeout to the post auth login params +func (o *PostAuthLoginParams) WithTimeout(timeout time.Duration) *PostAuthLoginParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the post auth login params +func (o *PostAuthLoginParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the post auth login params +func (o *PostAuthLoginParams) WithContext(ctx context.Context) *PostAuthLoginParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the post auth login params +func (o *PostAuthLoginParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the post auth login params +func (o *PostAuthLoginParams) WithHTTPClient(client *http.Client) *PostAuthLoginParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the post auth login params +func (o *PostAuthLoginParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithLoginObject adds the loginObject to the post auth login params +func (o *PostAuthLoginParams) WithLoginObject(loginObject *models.LoginObject) *PostAuthLoginParams { + o.SetLoginObject(loginObject) + return o +} + +// SetLoginObject adds the loginObject to the post auth login params +func (o *PostAuthLoginParams) SetLoginObject(loginObject *models.LoginObject) { + o.LoginObject = loginObject +} + +// WriteToRequest writes these params to a swagger request +func (o *PostAuthLoginParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.LoginObject != nil { + if err := r.SetBodyParam(o.LoginObject); err != nil { + return err + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/dcos/iam/client/login/post_auth_login_responses.go b/dcos/iam/client/login/post_auth_login_responses.go new file mode 100644 index 0000000..492d8e5 --- /dev/null +++ b/dcos/iam/client/login/post_auth_login_responses.go @@ -0,0 +1,102 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package login + +// 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" + + strfmt "github.com/go-openapi/strfmt" + + models "github.com/dcos/client-go/dcos/iam/models" +) + +// PostAuthLoginReader is a Reader for the PostAuthLogin structure. +type PostAuthLoginReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PostAuthLoginReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + + case 200: + result := NewPostAuthLoginOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + + case 401: + result := NewPostAuthLoginUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + + default: + return nil, runtime.NewAPIError("unknown error", response, response.Code()) + } +} + +// NewPostAuthLoginOK creates a PostAuthLoginOK with default headers values +func NewPostAuthLoginOK() *PostAuthLoginOK { + return &PostAuthLoginOK{} +} + +/*PostAuthLoginOK handles this case with default header values. + +Login successful. The response body contains a JSON object providing the authentication token. +*/ +type PostAuthLoginOK struct { + /*A cookie containing the auth token (implementation detail for browser support, should not be of interest to general API consumers). + */ + SetCookie string + + Payload *models.AuthToken +} + +func (o *PostAuthLoginOK) Error() string { + return fmt.Sprintf("[POST /auth/login][%d] postAuthLoginOK %+v", 200, o.Payload) +} + +func (o *PostAuthLoginOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + // response header Set-Cookie + o.SetCookie = response.GetHeader("Set-Cookie") + + o.Payload = new(models.AuthToken) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewPostAuthLoginUnauthorized creates a PostAuthLoginUnauthorized with default headers values +func NewPostAuthLoginUnauthorized() *PostAuthLoginUnauthorized { + return &PostAuthLoginUnauthorized{} +} + +/*PostAuthLoginUnauthorized handles this case with default header values. + +Login failed. +*/ +type PostAuthLoginUnauthorized struct { +} + +func (o *PostAuthLoginUnauthorized) Error() string { + return fmt.Sprintf("[POST /auth/login][%d] postAuthLoginUnauthorized ", 401) +} + +func (o *PostAuthLoginUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/dcos/iam/client/oidc/delete_auth_oidc_providers_provider_id_parameters.go b/dcos/iam/client/oidc/delete_auth_oidc_providers_provider_id_parameters.go new file mode 100644 index 0000000..5ba40a4 --- /dev/null +++ b/dcos/iam/client/oidc/delete_auth_oidc_providers_provider_id_parameters.go @@ -0,0 +1,136 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package oidc + +// 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" + + strfmt "github.com/go-openapi/strfmt" +) + +// NewDeleteAuthOidcProvidersProviderIDParams creates a new DeleteAuthOidcProvidersProviderIDParams object +// with the default values initialized. +func NewDeleteAuthOidcProvidersProviderIDParams() *DeleteAuthOidcProvidersProviderIDParams { + var () + return &DeleteAuthOidcProvidersProviderIDParams{ + + timeout: cr.DefaultTimeout, + } +} + +// NewDeleteAuthOidcProvidersProviderIDParamsWithTimeout creates a new DeleteAuthOidcProvidersProviderIDParams object +// with the default values initialized, and the ability to set a timeout on a request +func NewDeleteAuthOidcProvidersProviderIDParamsWithTimeout(timeout time.Duration) *DeleteAuthOidcProvidersProviderIDParams { + var () + return &DeleteAuthOidcProvidersProviderIDParams{ + + timeout: timeout, + } +} + +// NewDeleteAuthOidcProvidersProviderIDParamsWithContext creates a new DeleteAuthOidcProvidersProviderIDParams object +// with the default values initialized, and the ability to set a context for a request +func NewDeleteAuthOidcProvidersProviderIDParamsWithContext(ctx context.Context) *DeleteAuthOidcProvidersProviderIDParams { + var () + return &DeleteAuthOidcProvidersProviderIDParams{ + + Context: ctx, + } +} + +// NewDeleteAuthOidcProvidersProviderIDParamsWithHTTPClient creates a new DeleteAuthOidcProvidersProviderIDParams object +// with the default values initialized, and the ability to set a custom HTTPClient for a request +func NewDeleteAuthOidcProvidersProviderIDParamsWithHTTPClient(client *http.Client) *DeleteAuthOidcProvidersProviderIDParams { + var () + return &DeleteAuthOidcProvidersProviderIDParams{ + HTTPClient: client, + } +} + +/*DeleteAuthOidcProvidersProviderIDParams contains all the parameters to send to the API endpoint +for the delete auth oidc providers provider ID operation typically these are written to a http.Request +*/ +type DeleteAuthOidcProvidersProviderIDParams struct { + + /*ProviderID + The ID of the OIDC provider to delete. + + */ + ProviderID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithTimeout adds the timeout to the delete auth oidc providers provider ID params +func (o *DeleteAuthOidcProvidersProviderIDParams) WithTimeout(timeout time.Duration) *DeleteAuthOidcProvidersProviderIDParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the delete auth oidc providers provider ID params +func (o *DeleteAuthOidcProvidersProviderIDParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the delete auth oidc providers provider ID params +func (o *DeleteAuthOidcProvidersProviderIDParams) WithContext(ctx context.Context) *DeleteAuthOidcProvidersProviderIDParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the delete auth oidc providers provider ID params +func (o *DeleteAuthOidcProvidersProviderIDParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the delete auth oidc providers provider ID params +func (o *DeleteAuthOidcProvidersProviderIDParams) WithHTTPClient(client *http.Client) *DeleteAuthOidcProvidersProviderIDParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the delete auth oidc providers provider ID params +func (o *DeleteAuthOidcProvidersProviderIDParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithProviderID adds the providerID to the delete auth oidc providers provider ID params +func (o *DeleteAuthOidcProvidersProviderIDParams) WithProviderID(providerID string) *DeleteAuthOidcProvidersProviderIDParams { + o.SetProviderID(providerID) + return o +} + +// SetProviderID adds the providerId to the delete auth oidc providers provider ID params +func (o *DeleteAuthOidcProvidersProviderIDParams) SetProviderID(providerID string) { + o.ProviderID = providerID +} + +// WriteToRequest writes these params to a swagger request +func (o *DeleteAuthOidcProvidersProviderIDParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param provider-id + if err := r.SetPathParam("provider-id", o.ProviderID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/dcos/iam/client/oidc/delete_auth_oidc_providers_provider_id_responses.go b/dcos/iam/client/oidc/delete_auth_oidc_providers_provider_id_responses.go new file mode 100644 index 0000000..2d7a9b5 --- /dev/null +++ b/dcos/iam/client/oidc/delete_auth_oidc_providers_provider_id_responses.go @@ -0,0 +1,56 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package oidc + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + + "github.com/go-openapi/runtime" + + strfmt "github.com/go-openapi/strfmt" +) + +// DeleteAuthOidcProvidersProviderIDReader is a Reader for the DeleteAuthOidcProvidersProviderID structure. +type DeleteAuthOidcProvidersProviderIDReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *DeleteAuthOidcProvidersProviderIDReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + + case 204: + result := NewDeleteAuthOidcProvidersProviderIDNoContent() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + + default: + return nil, runtime.NewAPIError("unknown error", response, response.Code()) + } +} + +// NewDeleteAuthOidcProvidersProviderIDNoContent creates a DeleteAuthOidcProvidersProviderIDNoContent with default headers values +func NewDeleteAuthOidcProvidersProviderIDNoContent() *DeleteAuthOidcProvidersProviderIDNoContent { + return &DeleteAuthOidcProvidersProviderIDNoContent{} +} + +/*DeleteAuthOidcProvidersProviderIDNoContent handles this case with default header values. + +Success. +*/ +type DeleteAuthOidcProvidersProviderIDNoContent struct { +} + +func (o *DeleteAuthOidcProvidersProviderIDNoContent) Error() string { + return fmt.Sprintf("[DELETE /auth/oidc/providers/{provider-id}][%d] deleteAuthOidcProvidersProviderIdNoContent ", 204) +} + +func (o *DeleteAuthOidcProvidersProviderIDNoContent) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/dcos/iam/client/oidc/get_auth_oidc_callback_parameters.go b/dcos/iam/client/oidc/get_auth_oidc_callback_parameters.go new file mode 100644 index 0000000..8b64772 --- /dev/null +++ b/dcos/iam/client/oidc/get_auth_oidc_callback_parameters.go @@ -0,0 +1,113 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package oidc + +// 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" + + strfmt "github.com/go-openapi/strfmt" +) + +// NewGetAuthOidcCallbackParams creates a new GetAuthOidcCallbackParams object +// with the default values initialized. +func NewGetAuthOidcCallbackParams() *GetAuthOidcCallbackParams { + + return &GetAuthOidcCallbackParams{ + + timeout: cr.DefaultTimeout, + } +} + +// NewGetAuthOidcCallbackParamsWithTimeout creates a new GetAuthOidcCallbackParams object +// with the default values initialized, and the ability to set a timeout on a request +func NewGetAuthOidcCallbackParamsWithTimeout(timeout time.Duration) *GetAuthOidcCallbackParams { + + return &GetAuthOidcCallbackParams{ + + timeout: timeout, + } +} + +// NewGetAuthOidcCallbackParamsWithContext creates a new GetAuthOidcCallbackParams object +// with the default values initialized, and the ability to set a context for a request +func NewGetAuthOidcCallbackParamsWithContext(ctx context.Context) *GetAuthOidcCallbackParams { + + return &GetAuthOidcCallbackParams{ + + Context: ctx, + } +} + +// NewGetAuthOidcCallbackParamsWithHTTPClient creates a new GetAuthOidcCallbackParams object +// with the default values initialized, and the ability to set a custom HTTPClient for a request +func NewGetAuthOidcCallbackParamsWithHTTPClient(client *http.Client) *GetAuthOidcCallbackParams { + + return &GetAuthOidcCallbackParams{ + HTTPClient: client, + } +} + +/*GetAuthOidcCallbackParams contains all the parameters to send to the API endpoint +for the get auth oidc callback operation typically these are written to a http.Request +*/ +type GetAuthOidcCallbackParams struct { + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithTimeout adds the timeout to the get auth oidc callback params +func (o *GetAuthOidcCallbackParams) WithTimeout(timeout time.Duration) *GetAuthOidcCallbackParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the get auth oidc callback params +func (o *GetAuthOidcCallbackParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the get auth oidc callback params +func (o *GetAuthOidcCallbackParams) WithContext(ctx context.Context) *GetAuthOidcCallbackParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the get auth oidc callback params +func (o *GetAuthOidcCallbackParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the get auth oidc callback params +func (o *GetAuthOidcCallbackParams) WithHTTPClient(client *http.Client) *GetAuthOidcCallbackParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the get auth oidc callback params +func (o *GetAuthOidcCallbackParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WriteToRequest writes these params to a swagger request +func (o *GetAuthOidcCallbackParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/dcos/iam/client/oidc/get_auth_oidc_callback_responses.go b/dcos/iam/client/oidc/get_auth_oidc_callback_responses.go new file mode 100644 index 0000000..b81976e --- /dev/null +++ b/dcos/iam/client/oidc/get_auth_oidc_callback_responses.go @@ -0,0 +1,84 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package oidc + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + + "github.com/go-openapi/runtime" + + strfmt "github.com/go-openapi/strfmt" +) + +// GetAuthOidcCallbackReader is a Reader for the GetAuthOidcCallback structure. +type GetAuthOidcCallbackReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *GetAuthOidcCallbackReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + + case 302: + result := NewGetAuthOidcCallbackFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + + case 401: + result := NewGetAuthOidcCallbackUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + + default: + return nil, runtime.NewAPIError("unknown error", response, response.Code()) + } +} + +// NewGetAuthOidcCallbackFound creates a GetAuthOidcCallbackFound with default headers values +func NewGetAuthOidcCallbackFound() *GetAuthOidcCallbackFound { + return &GetAuthOidcCallbackFound{} +} + +/*GetAuthOidcCallbackFound handles this case with default header values. + +OIDC authentication flow successful. +*/ +type GetAuthOidcCallbackFound struct { +} + +func (o *GetAuthOidcCallbackFound) Error() string { + return fmt.Sprintf("[GET /auth/oidc/callback][%d] getAuthOidcCallbackFound ", 302) +} + +func (o *GetAuthOidcCallbackFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewGetAuthOidcCallbackUnauthorized creates a GetAuthOidcCallbackUnauthorized with default headers values +func NewGetAuthOidcCallbackUnauthorized() *GetAuthOidcCallbackUnauthorized { + return &GetAuthOidcCallbackUnauthorized{} +} + +/*GetAuthOidcCallbackUnauthorized handles this case with default header values. + +Problem in authentication flow. +*/ +type GetAuthOidcCallbackUnauthorized struct { +} + +func (o *GetAuthOidcCallbackUnauthorized) Error() string { + return fmt.Sprintf("[GET /auth/oidc/callback][%d] getAuthOidcCallbackUnauthorized ", 401) +} + +func (o *GetAuthOidcCallbackUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/dcos/iam/client/oidc/get_auth_oidc_providers_parameters.go b/dcos/iam/client/oidc/get_auth_oidc_providers_parameters.go new file mode 100644 index 0000000..6243590 --- /dev/null +++ b/dcos/iam/client/oidc/get_auth_oidc_providers_parameters.go @@ -0,0 +1,113 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package oidc + +// 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" + + strfmt "github.com/go-openapi/strfmt" +) + +// NewGetAuthOidcProvidersParams creates a new GetAuthOidcProvidersParams object +// with the default values initialized. +func NewGetAuthOidcProvidersParams() *GetAuthOidcProvidersParams { + + return &GetAuthOidcProvidersParams{ + + timeout: cr.DefaultTimeout, + } +} + +// NewGetAuthOidcProvidersParamsWithTimeout creates a new GetAuthOidcProvidersParams object +// with the default values initialized, and the ability to set a timeout on a request +func NewGetAuthOidcProvidersParamsWithTimeout(timeout time.Duration) *GetAuthOidcProvidersParams { + + return &GetAuthOidcProvidersParams{ + + timeout: timeout, + } +} + +// NewGetAuthOidcProvidersParamsWithContext creates a new GetAuthOidcProvidersParams object +// with the default values initialized, and the ability to set a context for a request +func NewGetAuthOidcProvidersParamsWithContext(ctx context.Context) *GetAuthOidcProvidersParams { + + return &GetAuthOidcProvidersParams{ + + Context: ctx, + } +} + +// NewGetAuthOidcProvidersParamsWithHTTPClient creates a new GetAuthOidcProvidersParams object +// with the default values initialized, and the ability to set a custom HTTPClient for a request +func NewGetAuthOidcProvidersParamsWithHTTPClient(client *http.Client) *GetAuthOidcProvidersParams { + + return &GetAuthOidcProvidersParams{ + HTTPClient: client, + } +} + +/*GetAuthOidcProvidersParams contains all the parameters to send to the API endpoint +for the get auth oidc providers operation typically these are written to a http.Request +*/ +type GetAuthOidcProvidersParams struct { + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithTimeout adds the timeout to the get auth oidc providers params +func (o *GetAuthOidcProvidersParams) WithTimeout(timeout time.Duration) *GetAuthOidcProvidersParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the get auth oidc providers params +func (o *GetAuthOidcProvidersParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the get auth oidc providers params +func (o *GetAuthOidcProvidersParams) WithContext(ctx context.Context) *GetAuthOidcProvidersParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the get auth oidc providers params +func (o *GetAuthOidcProvidersParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the get auth oidc providers params +func (o *GetAuthOidcProvidersParams) WithHTTPClient(client *http.Client) *GetAuthOidcProvidersParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the get auth oidc providers params +func (o *GetAuthOidcProvidersParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WriteToRequest writes these params to a swagger request +func (o *GetAuthOidcProvidersParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/dcos/iam/client/oidc/get_auth_oidc_providers_provider_id_parameters.go b/dcos/iam/client/oidc/get_auth_oidc_providers_provider_id_parameters.go new file mode 100644 index 0000000..2c8452b --- /dev/null +++ b/dcos/iam/client/oidc/get_auth_oidc_providers_provider_id_parameters.go @@ -0,0 +1,136 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package oidc + +// 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" + + strfmt "github.com/go-openapi/strfmt" +) + +// NewGetAuthOidcProvidersProviderIDParams creates a new GetAuthOidcProvidersProviderIDParams object +// with the default values initialized. +func NewGetAuthOidcProvidersProviderIDParams() *GetAuthOidcProvidersProviderIDParams { + var () + return &GetAuthOidcProvidersProviderIDParams{ + + timeout: cr.DefaultTimeout, + } +} + +// NewGetAuthOidcProvidersProviderIDParamsWithTimeout creates a new GetAuthOidcProvidersProviderIDParams object +// with the default values initialized, and the ability to set a timeout on a request +func NewGetAuthOidcProvidersProviderIDParamsWithTimeout(timeout time.Duration) *GetAuthOidcProvidersProviderIDParams { + var () + return &GetAuthOidcProvidersProviderIDParams{ + + timeout: timeout, + } +} + +// NewGetAuthOidcProvidersProviderIDParamsWithContext creates a new GetAuthOidcProvidersProviderIDParams object +// with the default values initialized, and the ability to set a context for a request +func NewGetAuthOidcProvidersProviderIDParamsWithContext(ctx context.Context) *GetAuthOidcProvidersProviderIDParams { + var () + return &GetAuthOidcProvidersProviderIDParams{ + + Context: ctx, + } +} + +// NewGetAuthOidcProvidersProviderIDParamsWithHTTPClient creates a new GetAuthOidcProvidersProviderIDParams object +// with the default values initialized, and the ability to set a custom HTTPClient for a request +func NewGetAuthOidcProvidersProviderIDParamsWithHTTPClient(client *http.Client) *GetAuthOidcProvidersProviderIDParams { + var () + return &GetAuthOidcProvidersProviderIDParams{ + HTTPClient: client, + } +} + +/*GetAuthOidcProvidersProviderIDParams contains all the parameters to send to the API endpoint +for the get auth oidc providers provider ID operation typically these are written to a http.Request +*/ +type GetAuthOidcProvidersProviderIDParams struct { + + /*ProviderID + The ID of the OIDC provider to retrieve the config for. + + */ + ProviderID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithTimeout adds the timeout to the get auth oidc providers provider ID params +func (o *GetAuthOidcProvidersProviderIDParams) WithTimeout(timeout time.Duration) *GetAuthOidcProvidersProviderIDParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the get auth oidc providers provider ID params +func (o *GetAuthOidcProvidersProviderIDParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the get auth oidc providers provider ID params +func (o *GetAuthOidcProvidersProviderIDParams) WithContext(ctx context.Context) *GetAuthOidcProvidersProviderIDParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the get auth oidc providers provider ID params +func (o *GetAuthOidcProvidersProviderIDParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the get auth oidc providers provider ID params +func (o *GetAuthOidcProvidersProviderIDParams) WithHTTPClient(client *http.Client) *GetAuthOidcProvidersProviderIDParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the get auth oidc providers provider ID params +func (o *GetAuthOidcProvidersProviderIDParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithProviderID adds the providerID to the get auth oidc providers provider ID params +func (o *GetAuthOidcProvidersProviderIDParams) WithProviderID(providerID string) *GetAuthOidcProvidersProviderIDParams { + o.SetProviderID(providerID) + return o +} + +// SetProviderID adds the providerId to the get auth oidc providers provider ID params +func (o *GetAuthOidcProvidersProviderIDParams) SetProviderID(providerID string) { + o.ProviderID = providerID +} + +// WriteToRequest writes these params to a swagger request +func (o *GetAuthOidcProvidersProviderIDParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param provider-id + if err := r.SetPathParam("provider-id", o.ProviderID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/dcos/iam/client/oidc/get_auth_oidc_providers_provider_id_responses.go b/dcos/iam/client/oidc/get_auth_oidc_providers_provider_id_responses.go new file mode 100644 index 0000000..fc31cd6 --- /dev/null +++ b/dcos/iam/client/oidc/get_auth_oidc_providers_provider_id_responses.go @@ -0,0 +1,67 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package oidc + +// 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" + + strfmt "github.com/go-openapi/strfmt" + + models "github.com/dcos/client-go/dcos/iam/models" +) + +// GetAuthOidcProvidersProviderIDReader is a Reader for the GetAuthOidcProvidersProviderID structure. +type GetAuthOidcProvidersProviderIDReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *GetAuthOidcProvidersProviderIDReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + + case 200: + result := NewGetAuthOidcProvidersProviderIDOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + + default: + return nil, runtime.NewAPIError("unknown error", response, response.Code()) + } +} + +// NewGetAuthOidcProvidersProviderIDOK creates a GetAuthOidcProvidersProviderIDOK with default headers values +func NewGetAuthOidcProvidersProviderIDOK() *GetAuthOidcProvidersProviderIDOK { + return &GetAuthOidcProvidersProviderIDOK{} +} + +/*GetAuthOidcProvidersProviderIDOK handles this case with default header values. + +Success. +*/ +type GetAuthOidcProvidersProviderIDOK struct { + Payload *models.OIDCProviderConfig +} + +func (o *GetAuthOidcProvidersProviderIDOK) Error() string { + return fmt.Sprintf("[GET /auth/oidc/providers/{provider-id}][%d] getAuthOidcProvidersProviderIdOK %+v", 200, o.Payload) +} + +func (o *GetAuthOidcProvidersProviderIDOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.OIDCProviderConfig) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/dcos/iam/client/oidc/get_auth_oidc_providers_responses.go b/dcos/iam/client/oidc/get_auth_oidc_providers_responses.go new file mode 100644 index 0000000..04486d2 --- /dev/null +++ b/dcos/iam/client/oidc/get_auth_oidc_providers_responses.go @@ -0,0 +1,56 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package oidc + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + + "github.com/go-openapi/runtime" + + strfmt "github.com/go-openapi/strfmt" +) + +// GetAuthOidcProvidersReader is a Reader for the GetAuthOidcProviders structure. +type GetAuthOidcProvidersReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *GetAuthOidcProvidersReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + + case 200: + result := NewGetAuthOidcProvidersOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + + default: + return nil, runtime.NewAPIError("unknown error", response, response.Code()) + } +} + +// NewGetAuthOidcProvidersOK creates a GetAuthOidcProvidersOK with default headers values +func NewGetAuthOidcProvidersOK() *GetAuthOidcProvidersOK { + return &GetAuthOidcProvidersOK{} +} + +/*GetAuthOidcProvidersOK handles this case with default header values. + +Success. +*/ +type GetAuthOidcProvidersOK struct { +} + +func (o *GetAuthOidcProvidersOK) Error() string { + return fmt.Sprintf("[GET /auth/oidc/providers][%d] getAuthOidcProvidersOK ", 200) +} + +func (o *GetAuthOidcProvidersOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/dcos/iam/client/oidc/oidc_client.go b/dcos/iam/client/oidc/oidc_client.go new file mode 100644 index 0000000..9a5629a --- /dev/null +++ b/dcos/iam/client/oidc/oidc_client.go @@ -0,0 +1,210 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package oidc + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "github.com/go-openapi/runtime" + + strfmt "github.com/go-openapi/strfmt" +) + +// New creates a new oidc API client. +func New(transport runtime.ClientTransport, formats strfmt.Registry) *Client { + return &Client{transport: transport, formats: formats} +} + +/* +Client for oidc API +*/ +type Client struct { + transport runtime.ClientTransport + formats strfmt.Registry +} + +/* +DeleteAuthOidcProvidersProviderID deletes provider + +Delete provider (disables authentication with that provider). +*/ +func (a *Client) DeleteAuthOidcProvidersProviderID(params *DeleteAuthOidcProvidersProviderIDParams) (*DeleteAuthOidcProvidersProviderIDNoContent, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewDeleteAuthOidcProvidersProviderIDParams() + } + + result, err := a.transport.Submit(&runtime.ClientOperation{ + ID: "DeleteAuthOidcProvidersProviderID", + Method: "DELETE", + PathPattern: "/auth/oidc/providers/{provider-id}", + ProducesMediaTypes: []string{""}, + ConsumesMediaTypes: []string{""}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &DeleteAuthOidcProvidersProviderIDReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + }) + if err != nil { + return nil, err + } + return result.(*DeleteAuthOidcProvidersProviderIDNoContent), nil + +} + +/* +GetAuthOidcCallback opens ID connect callback URL + +After successfully logging in to an OpenID Connect identity provider, the end-user is being redirected back to the IAM via this callback URL. API consumers are not required to explicitly interact with this endpoint. This URL usually needs to be handed over to an OpenID Connect provider (often called "redirect" or "callback" URL). +*/ +func (a *Client) GetAuthOidcCallback(params *GetAuthOidcCallbackParams) error { + // TODO: Validate the params before sending + if params == nil { + params = NewGetAuthOidcCallbackParams() + } + + _, err := a.transport.Submit(&runtime.ClientOperation{ + ID: "GetAuthOidcCallback", + Method: "GET", + PathPattern: "/auth/oidc/callback", + ProducesMediaTypes: []string{""}, + ConsumesMediaTypes: []string{""}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &GetAuthOidcCallbackReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + }) + if err != nil { + return err + } + return nil + +} + +/* +GetAuthOidcProviders gets an overview for the configured o ID c providers + +Get an overview for the configured OIDC providers. The response contains a JSON object, with each key being an OIDC provider ID, and each value being the corresponding provider description string. This endpoint does not expose sensitive provider configuration details. +*/ +func (a *Client) GetAuthOidcProviders(params *GetAuthOidcProvidersParams) (*GetAuthOidcProvidersOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewGetAuthOidcProvidersParams() + } + + result, err := a.transport.Submit(&runtime.ClientOperation{ + ID: "GetAuthOidcProviders", + Method: "GET", + PathPattern: "/auth/oidc/providers", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{""}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &GetAuthOidcProvidersReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + }) + if err != nil { + return nil, err + } + return result.(*GetAuthOidcProvidersOK), nil + +} + +/* +GetAuthOidcProvidersProviderID gets configuration for a specific provider + +Get configuration for a specific provider. +*/ +func (a *Client) GetAuthOidcProvidersProviderID(params *GetAuthOidcProvidersProviderIDParams) (*GetAuthOidcProvidersProviderIDOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewGetAuthOidcProvidersProviderIDParams() + } + + result, err := a.transport.Submit(&runtime.ClientOperation{ + ID: "GetAuthOidcProvidersProviderID", + Method: "GET", + PathPattern: "/auth/oidc/providers/{provider-id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{""}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &GetAuthOidcProvidersProviderIDReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + }) + if err != nil { + return nil, err + } + return result.(*GetAuthOidcProvidersProviderIDOK), nil + +} + +/* +PatchAuthOidcProvidersProviderID updates o ID c provider config + +Update config for existing OIDC provider. +*/ +func (a *Client) PatchAuthOidcProvidersProviderID(params *PatchAuthOidcProvidersProviderIDParams) (*PatchAuthOidcProvidersProviderIDNoContent, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPatchAuthOidcProvidersProviderIDParams() + } + + result, err := a.transport.Submit(&runtime.ClientOperation{ + ID: "PatchAuthOidcProvidersProviderID", + Method: "PATCH", + PathPattern: "/auth/oidc/providers/{provider-id}", + ProducesMediaTypes: []string{""}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &PatchAuthOidcProvidersProviderIDReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + }) + if err != nil { + return nil, err + } + return result.(*PatchAuthOidcProvidersProviderIDNoContent), nil + +} + +/* +PutAuthOidcProvidersProviderID configures a new o ID c provider + +Set up OIDC provider with the ID as specified in the URL, and with the config as specified via JSON in the request body. +*/ +func (a *Client) PutAuthOidcProvidersProviderID(params *PutAuthOidcProvidersProviderIDParams) (*PutAuthOidcProvidersProviderIDCreated, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPutAuthOidcProvidersProviderIDParams() + } + + result, err := a.transport.Submit(&runtime.ClientOperation{ + ID: "PutAuthOidcProvidersProviderID", + Method: "PUT", + PathPattern: "/auth/oidc/providers/{provider-id}", + ProducesMediaTypes: []string{""}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &PutAuthOidcProvidersProviderIDReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + }) + if err != nil { + return nil, err + } + return result.(*PutAuthOidcProvidersProviderIDCreated), nil + +} + +// SetTransport changes the transport on the client +func (a *Client) SetTransport(transport runtime.ClientTransport) { + a.transport = transport +} diff --git a/dcos/iam/client/oidc/patch_auth_oidc_providers_provider_id_parameters.go b/dcos/iam/client/oidc/patch_auth_oidc_providers_provider_id_parameters.go new file mode 100644 index 0000000..e687e99 --- /dev/null +++ b/dcos/iam/client/oidc/patch_auth_oidc_providers_provider_id_parameters.go @@ -0,0 +1,160 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package oidc + +// 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" + + strfmt "github.com/go-openapi/strfmt" + + models "github.com/dcos/client-go/dcos/iam/models" +) + +// NewPatchAuthOidcProvidersProviderIDParams creates a new PatchAuthOidcProvidersProviderIDParams object +// with the default values initialized. +func NewPatchAuthOidcProvidersProviderIDParams() *PatchAuthOidcProvidersProviderIDParams { + var () + return &PatchAuthOidcProvidersProviderIDParams{ + + timeout: cr.DefaultTimeout, + } +} + +// NewPatchAuthOidcProvidersProviderIDParamsWithTimeout creates a new PatchAuthOidcProvidersProviderIDParams object +// with the default values initialized, and the ability to set a timeout on a request +func NewPatchAuthOidcProvidersProviderIDParamsWithTimeout(timeout time.Duration) *PatchAuthOidcProvidersProviderIDParams { + var () + return &PatchAuthOidcProvidersProviderIDParams{ + + timeout: timeout, + } +} + +// NewPatchAuthOidcProvidersProviderIDParamsWithContext creates a new PatchAuthOidcProvidersProviderIDParams object +// with the default values initialized, and the ability to set a context for a request +func NewPatchAuthOidcProvidersProviderIDParamsWithContext(ctx context.Context) *PatchAuthOidcProvidersProviderIDParams { + var () + return &PatchAuthOidcProvidersProviderIDParams{ + + Context: ctx, + } +} + +// NewPatchAuthOidcProvidersProviderIDParamsWithHTTPClient creates a new PatchAuthOidcProvidersProviderIDParams object +// with the default values initialized, and the ability to set a custom HTTPClient for a request +func NewPatchAuthOidcProvidersProviderIDParamsWithHTTPClient(client *http.Client) *PatchAuthOidcProvidersProviderIDParams { + var () + return &PatchAuthOidcProvidersProviderIDParams{ + HTTPClient: client, + } +} + +/*PatchAuthOidcProvidersProviderIDParams contains all the parameters to send to the API endpoint +for the patch auth oidc providers provider ID operation typically these are written to a http.Request +*/ +type PatchAuthOidcProvidersProviderIDParams struct { + + /*ProviderConfigObject + Provider config JSON object + + */ + ProviderConfigObject *models.OIDCProviderConfig + /*ProviderID + The ID of the provider to modify. + + */ + ProviderID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithTimeout adds the timeout to the patch auth oidc providers provider ID params +func (o *PatchAuthOidcProvidersProviderIDParams) WithTimeout(timeout time.Duration) *PatchAuthOidcProvidersProviderIDParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the patch auth oidc providers provider ID params +func (o *PatchAuthOidcProvidersProviderIDParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the patch auth oidc providers provider ID params +func (o *PatchAuthOidcProvidersProviderIDParams) WithContext(ctx context.Context) *PatchAuthOidcProvidersProviderIDParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the patch auth oidc providers provider ID params +func (o *PatchAuthOidcProvidersProviderIDParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the patch auth oidc providers provider ID params +func (o *PatchAuthOidcProvidersProviderIDParams) WithHTTPClient(client *http.Client) *PatchAuthOidcProvidersProviderIDParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the patch auth oidc providers provider ID params +func (o *PatchAuthOidcProvidersProviderIDParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithProviderConfigObject adds the providerConfigObject to the patch auth oidc providers provider ID params +func (o *PatchAuthOidcProvidersProviderIDParams) WithProviderConfigObject(providerConfigObject *models.OIDCProviderConfig) *PatchAuthOidcProvidersProviderIDParams { + o.SetProviderConfigObject(providerConfigObject) + return o +} + +// SetProviderConfigObject adds the providerConfigObject to the patch auth oidc providers provider ID params +func (o *PatchAuthOidcProvidersProviderIDParams) SetProviderConfigObject(providerConfigObject *models.OIDCProviderConfig) { + o.ProviderConfigObject = providerConfigObject +} + +// WithProviderID adds the providerID to the patch auth oidc providers provider ID params +func (o *PatchAuthOidcProvidersProviderIDParams) WithProviderID(providerID string) *PatchAuthOidcProvidersProviderIDParams { + o.SetProviderID(providerID) + return o +} + +// SetProviderID adds the providerId to the patch auth oidc providers provider ID params +func (o *PatchAuthOidcProvidersProviderIDParams) SetProviderID(providerID string) { + o.ProviderID = providerID +} + +// WriteToRequest writes these params to a swagger request +func (o *PatchAuthOidcProvidersProviderIDParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.ProviderConfigObject != nil { + if err := r.SetBodyParam(o.ProviderConfigObject); err != nil { + return err + } + } + + // path param provider-id + if err := r.SetPathParam("provider-id", o.ProviderID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/dcos/iam/client/oidc/patch_auth_oidc_providers_provider_id_responses.go b/dcos/iam/client/oidc/patch_auth_oidc_providers_provider_id_responses.go new file mode 100644 index 0000000..02d0cce --- /dev/null +++ b/dcos/iam/client/oidc/patch_auth_oidc_providers_provider_id_responses.go @@ -0,0 +1,84 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package oidc + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + + "github.com/go-openapi/runtime" + + strfmt "github.com/go-openapi/strfmt" +) + +// PatchAuthOidcProvidersProviderIDReader is a Reader for the PatchAuthOidcProvidersProviderID structure. +type PatchAuthOidcProvidersProviderIDReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PatchAuthOidcProvidersProviderIDReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + + case 204: + result := NewPatchAuthOidcProvidersProviderIDNoContent() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + + case 400: + result := NewPatchAuthOidcProvidersProviderIDBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + + default: + return nil, runtime.NewAPIError("unknown error", response, response.Code()) + } +} + +// NewPatchAuthOidcProvidersProviderIDNoContent creates a PatchAuthOidcProvidersProviderIDNoContent with default headers values +func NewPatchAuthOidcProvidersProviderIDNoContent() *PatchAuthOidcProvidersProviderIDNoContent { + return &PatchAuthOidcProvidersProviderIDNoContent{} +} + +/*PatchAuthOidcProvidersProviderIDNoContent handles this case with default header values. + +Update applied. +*/ +type PatchAuthOidcProvidersProviderIDNoContent struct { +} + +func (o *PatchAuthOidcProvidersProviderIDNoContent) Error() string { + return fmt.Sprintf("[PATCH /auth/oidc/providers/{provider-id}][%d] patchAuthOidcProvidersProviderIdNoContent ", 204) +} + +func (o *PatchAuthOidcProvidersProviderIDNoContent) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewPatchAuthOidcProvidersProviderIDBadRequest creates a PatchAuthOidcProvidersProviderIDBadRequest with default headers values +func NewPatchAuthOidcProvidersProviderIDBadRequest() *PatchAuthOidcProvidersProviderIDBadRequest { + return &PatchAuthOidcProvidersProviderIDBadRequest{} +} + +/*PatchAuthOidcProvidersProviderIDBadRequest handles this case with default header values. + +Various errors (e.g. provider not yet configured). +*/ +type PatchAuthOidcProvidersProviderIDBadRequest struct { +} + +func (o *PatchAuthOidcProvidersProviderIDBadRequest) Error() string { + return fmt.Sprintf("[PATCH /auth/oidc/providers/{provider-id}][%d] patchAuthOidcProvidersProviderIdBadRequest ", 400) +} + +func (o *PatchAuthOidcProvidersProviderIDBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/dcos/iam/client/oidc/put_auth_oidc_providers_provider_id_parameters.go b/dcos/iam/client/oidc/put_auth_oidc_providers_provider_id_parameters.go new file mode 100644 index 0000000..75542cd --- /dev/null +++ b/dcos/iam/client/oidc/put_auth_oidc_providers_provider_id_parameters.go @@ -0,0 +1,160 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package oidc + +// 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" + + strfmt "github.com/go-openapi/strfmt" + + models "github.com/dcos/client-go/dcos/iam/models" +) + +// NewPutAuthOidcProvidersProviderIDParams creates a new PutAuthOidcProvidersProviderIDParams object +// with the default values initialized. +func NewPutAuthOidcProvidersProviderIDParams() *PutAuthOidcProvidersProviderIDParams { + var () + return &PutAuthOidcProvidersProviderIDParams{ + + timeout: cr.DefaultTimeout, + } +} + +// NewPutAuthOidcProvidersProviderIDParamsWithTimeout creates a new PutAuthOidcProvidersProviderIDParams object +// with the default values initialized, and the ability to set a timeout on a request +func NewPutAuthOidcProvidersProviderIDParamsWithTimeout(timeout time.Duration) *PutAuthOidcProvidersProviderIDParams { + var () + return &PutAuthOidcProvidersProviderIDParams{ + + timeout: timeout, + } +} + +// NewPutAuthOidcProvidersProviderIDParamsWithContext creates a new PutAuthOidcProvidersProviderIDParams object +// with the default values initialized, and the ability to set a context for a request +func NewPutAuthOidcProvidersProviderIDParamsWithContext(ctx context.Context) *PutAuthOidcProvidersProviderIDParams { + var () + return &PutAuthOidcProvidersProviderIDParams{ + + Context: ctx, + } +} + +// NewPutAuthOidcProvidersProviderIDParamsWithHTTPClient creates a new PutAuthOidcProvidersProviderIDParams object +// with the default values initialized, and the ability to set a custom HTTPClient for a request +func NewPutAuthOidcProvidersProviderIDParamsWithHTTPClient(client *http.Client) *PutAuthOidcProvidersProviderIDParams { + var () + return &PutAuthOidcProvidersProviderIDParams{ + HTTPClient: client, + } +} + +/*PutAuthOidcProvidersProviderIDParams contains all the parameters to send to the API endpoint +for the put auth oidc providers provider ID operation typically these are written to a http.Request +*/ +type PutAuthOidcProvidersProviderIDParams struct { + + /*ProviderConfigObject + Provider config JSON object + + */ + ProviderConfigObject *models.OIDCProviderConfig + /*ProviderID + The ID of the provider to create. + + */ + ProviderID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithTimeout adds the timeout to the put auth oidc providers provider ID params +func (o *PutAuthOidcProvidersProviderIDParams) WithTimeout(timeout time.Duration) *PutAuthOidcProvidersProviderIDParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the put auth oidc providers provider ID params +func (o *PutAuthOidcProvidersProviderIDParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the put auth oidc providers provider ID params +func (o *PutAuthOidcProvidersProviderIDParams) WithContext(ctx context.Context) *PutAuthOidcProvidersProviderIDParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the put auth oidc providers provider ID params +func (o *PutAuthOidcProvidersProviderIDParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the put auth oidc providers provider ID params +func (o *PutAuthOidcProvidersProviderIDParams) WithHTTPClient(client *http.Client) *PutAuthOidcProvidersProviderIDParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the put auth oidc providers provider ID params +func (o *PutAuthOidcProvidersProviderIDParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithProviderConfigObject adds the providerConfigObject to the put auth oidc providers provider ID params +func (o *PutAuthOidcProvidersProviderIDParams) WithProviderConfigObject(providerConfigObject *models.OIDCProviderConfig) *PutAuthOidcProvidersProviderIDParams { + o.SetProviderConfigObject(providerConfigObject) + return o +} + +// SetProviderConfigObject adds the providerConfigObject to the put auth oidc providers provider ID params +func (o *PutAuthOidcProvidersProviderIDParams) SetProviderConfigObject(providerConfigObject *models.OIDCProviderConfig) { + o.ProviderConfigObject = providerConfigObject +} + +// WithProviderID adds the providerID to the put auth oidc providers provider ID params +func (o *PutAuthOidcProvidersProviderIDParams) WithProviderID(providerID string) *PutAuthOidcProvidersProviderIDParams { + o.SetProviderID(providerID) + return o +} + +// SetProviderID adds the providerId to the put auth oidc providers provider ID params +func (o *PutAuthOidcProvidersProviderIDParams) SetProviderID(providerID string) { + o.ProviderID = providerID +} + +// WriteToRequest writes these params to a swagger request +func (o *PutAuthOidcProvidersProviderIDParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.ProviderConfigObject != nil { + if err := r.SetBodyParam(o.ProviderConfigObject); err != nil { + return err + } + } + + // path param provider-id + if err := r.SetPathParam("provider-id", o.ProviderID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/dcos/iam/client/oidc/put_auth_oidc_providers_provider_id_responses.go b/dcos/iam/client/oidc/put_auth_oidc_providers_provider_id_responses.go new file mode 100644 index 0000000..ddb5dbf --- /dev/null +++ b/dcos/iam/client/oidc/put_auth_oidc_providers_provider_id_responses.go @@ -0,0 +1,84 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package oidc + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + + "github.com/go-openapi/runtime" + + strfmt "github.com/go-openapi/strfmt" +) + +// PutAuthOidcProvidersProviderIDReader is a Reader for the PutAuthOidcProvidersProviderID structure. +type PutAuthOidcProvidersProviderIDReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PutAuthOidcProvidersProviderIDReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + + case 201: + result := NewPutAuthOidcProvidersProviderIDCreated() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + + case 409: + result := NewPutAuthOidcProvidersProviderIDConflict() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + + default: + return nil, runtime.NewAPIError("unknown error", response, response.Code()) + } +} + +// NewPutAuthOidcProvidersProviderIDCreated creates a PutAuthOidcProvidersProviderIDCreated with default headers values +func NewPutAuthOidcProvidersProviderIDCreated() *PutAuthOidcProvidersProviderIDCreated { + return &PutAuthOidcProvidersProviderIDCreated{} +} + +/*PutAuthOidcProvidersProviderIDCreated handles this case with default header values. + +Provider created. +*/ +type PutAuthOidcProvidersProviderIDCreated struct { +} + +func (o *PutAuthOidcProvidersProviderIDCreated) Error() string { + return fmt.Sprintf("[PUT /auth/oidc/providers/{provider-id}][%d] putAuthOidcProvidersProviderIdCreated ", 201) +} + +func (o *PutAuthOidcProvidersProviderIDCreated) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewPutAuthOidcProvidersProviderIDConflict creates a PutAuthOidcProvidersProviderIDConflict with default headers values +func NewPutAuthOidcProvidersProviderIDConflict() *PutAuthOidcProvidersProviderIDConflict { + return &PutAuthOidcProvidersProviderIDConflict{} +} + +/*PutAuthOidcProvidersProviderIDConflict handles this case with default header values. + +Provider already exists. +*/ +type PutAuthOidcProvidersProviderIDConflict struct { +} + +func (o *PutAuthOidcProvidersProviderIDConflict) Error() string { + return fmt.Sprintf("[PUT /auth/oidc/providers/{provider-id}][%d] putAuthOidcProvidersProviderIdConflict ", 409) +} + +func (o *PutAuthOidcProvidersProviderIDConflict) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/dcos/iam/client/operations/get_auth_jwks_parameters.go b/dcos/iam/client/operations/get_auth_jwks_parameters.go new file mode 100644 index 0000000..be1f110 --- /dev/null +++ b/dcos/iam/client/operations/get_auth_jwks_parameters.go @@ -0,0 +1,113 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package operations + +// 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" + + strfmt "github.com/go-openapi/strfmt" +) + +// NewGetAuthJwksParams creates a new GetAuthJwksParams object +// with the default values initialized. +func NewGetAuthJwksParams() *GetAuthJwksParams { + + return &GetAuthJwksParams{ + + timeout: cr.DefaultTimeout, + } +} + +// NewGetAuthJwksParamsWithTimeout creates a new GetAuthJwksParams object +// with the default values initialized, and the ability to set a timeout on a request +func NewGetAuthJwksParamsWithTimeout(timeout time.Duration) *GetAuthJwksParams { + + return &GetAuthJwksParams{ + + timeout: timeout, + } +} + +// NewGetAuthJwksParamsWithContext creates a new GetAuthJwksParams object +// with the default values initialized, and the ability to set a context for a request +func NewGetAuthJwksParamsWithContext(ctx context.Context) *GetAuthJwksParams { + + return &GetAuthJwksParams{ + + Context: ctx, + } +} + +// NewGetAuthJwksParamsWithHTTPClient creates a new GetAuthJwksParams object +// with the default values initialized, and the ability to set a custom HTTPClient for a request +func NewGetAuthJwksParamsWithHTTPClient(client *http.Client) *GetAuthJwksParams { + + return &GetAuthJwksParams{ + HTTPClient: client, + } +} + +/*GetAuthJwksParams contains all the parameters to send to the API endpoint +for the get auth jwks operation typically these are written to a http.Request +*/ +type GetAuthJwksParams struct { + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithTimeout adds the timeout to the get auth jwks params +func (o *GetAuthJwksParams) WithTimeout(timeout time.Duration) *GetAuthJwksParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the get auth jwks params +func (o *GetAuthJwksParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the get auth jwks params +func (o *GetAuthJwksParams) WithContext(ctx context.Context) *GetAuthJwksParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the get auth jwks params +func (o *GetAuthJwksParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the get auth jwks params +func (o *GetAuthJwksParams) WithHTTPClient(client *http.Client) *GetAuthJwksParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the get auth jwks params +func (o *GetAuthJwksParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WriteToRequest writes these params to a swagger request +func (o *GetAuthJwksParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/dcos/iam/client/operations/get_auth_jwks_responses.go b/dcos/iam/client/operations/get_auth_jwks_responses.go new file mode 100644 index 0000000..5b123ed --- /dev/null +++ b/dcos/iam/client/operations/get_auth_jwks_responses.go @@ -0,0 +1,56 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package operations + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + + "github.com/go-openapi/runtime" + + strfmt "github.com/go-openapi/strfmt" +) + +// GetAuthJwksReader is a Reader for the GetAuthJwks structure. +type GetAuthJwksReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *GetAuthJwksReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + + case 200: + result := NewGetAuthJwksOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + + default: + return nil, runtime.NewAPIError("unknown error", response, response.Code()) + } +} + +// NewGetAuthJwksOK creates a GetAuthJwksOK with default headers values +func NewGetAuthJwksOK() *GetAuthJwksOK { + return &GetAuthJwksOK{} +} + +/*GetAuthJwksOK handles this case with default header values. + +The response body contains a JSON Web Key Set document. +*/ +type GetAuthJwksOK struct { +} + +func (o *GetAuthJwksOK) Error() string { + return fmt.Sprintf("[GET /auth/jwks][%d] getAuthJwksOK ", 200) +} + +func (o *GetAuthJwksOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/dcos/iam/client/operations/operations_client.go b/dcos/iam/client/operations/operations_client.go new file mode 100644 index 0000000..28d29b3 --- /dev/null +++ b/dcos/iam/client/operations/operations_client.go @@ -0,0 +1,60 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package operations + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "github.com/go-openapi/runtime" + + strfmt "github.com/go-openapi/strfmt" +) + +// New creates a new operations API client. +func New(transport runtime.ClientTransport, formats strfmt.Registry) *Client { + return &Client{transport: transport, formats: formats} +} + +/* +Client for operations API +*/ +type Client struct { + transport runtime.ClientTransport + formats strfmt.Registry +} + +/* +GetAuthJwks gets the i a m s JSON web key set j w k s according to r f cs 7517 7518 + +This endpoint provides the IAM's JSON Web Key Set (JWKS), exposing public key details required for the process of DC/OS authentication token verification: the public key material can be used for verifying authentication tokens signed by the IAM's private key. The DC/OS authentication token is a JSON Web Token (JWT) of type RS256, and is required to have the two claims `exp` and `uid`. For interpretation of the data provided by the JWKS endpoint see https://tools.ietf.org/html/rfc7517 and https://tools.ietf.org/html/rfc7518. +*/ +func (a *Client) GetAuthJwks(params *GetAuthJwksParams) (*GetAuthJwksOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewGetAuthJwksParams() + } + + result, err := a.transport.Submit(&runtime.ClientOperation{ + ID: "GetAuthJwks", + Method: "GET", + PathPattern: "/auth/jwks", + ProducesMediaTypes: []string{""}, + ConsumesMediaTypes: []string{""}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &GetAuthJwksReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + }) + if err != nil { + return nil, err + } + return result.(*GetAuthJwksOK), nil + +} + +// SetTransport changes the transport on the client +func (a *Client) SetTransport(transport runtime.ClientTransport) { + a.transport = transport +} diff --git a/dcos/iam/client/permissions/delete_acls_rid_groups_gid_action_parameters.go b/dcos/iam/client/permissions/delete_acls_rid_groups_gid_action_parameters.go new file mode 100644 index 0000000..2cd346c --- /dev/null +++ b/dcos/iam/client/permissions/delete_acls_rid_groups_gid_action_parameters.go @@ -0,0 +1,178 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package permissions + +// 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" + + strfmt "github.com/go-openapi/strfmt" +) + +// NewDeleteAclsRidGroupsGidActionParams creates a new DeleteAclsRidGroupsGidActionParams object +// with the default values initialized. +func NewDeleteAclsRidGroupsGidActionParams() *DeleteAclsRidGroupsGidActionParams { + var () + return &DeleteAclsRidGroupsGidActionParams{ + + timeout: cr.DefaultTimeout, + } +} + +// NewDeleteAclsRidGroupsGidActionParamsWithTimeout creates a new DeleteAclsRidGroupsGidActionParams object +// with the default values initialized, and the ability to set a timeout on a request +func NewDeleteAclsRidGroupsGidActionParamsWithTimeout(timeout time.Duration) *DeleteAclsRidGroupsGidActionParams { + var () + return &DeleteAclsRidGroupsGidActionParams{ + + timeout: timeout, + } +} + +// NewDeleteAclsRidGroupsGidActionParamsWithContext creates a new DeleteAclsRidGroupsGidActionParams object +// with the default values initialized, and the ability to set a context for a request +func NewDeleteAclsRidGroupsGidActionParamsWithContext(ctx context.Context) *DeleteAclsRidGroupsGidActionParams { + var () + return &DeleteAclsRidGroupsGidActionParams{ + + Context: ctx, + } +} + +// NewDeleteAclsRidGroupsGidActionParamsWithHTTPClient creates a new DeleteAclsRidGroupsGidActionParams object +// with the default values initialized, and the ability to set a custom HTTPClient for a request +func NewDeleteAclsRidGroupsGidActionParamsWithHTTPClient(client *http.Client) *DeleteAclsRidGroupsGidActionParams { + var () + return &DeleteAclsRidGroupsGidActionParams{ + HTTPClient: client, + } +} + +/*DeleteAclsRidGroupsGidActionParams contains all the parameters to send to the API endpoint +for the delete acls rid groups gid action operation typically these are written to a http.Request +*/ +type DeleteAclsRidGroupsGidActionParams struct { + + /*Action + action name + + */ + Action string + /*Gid + group ID. + + */ + Gid string + /*Rid + resource ID. + + */ + Rid string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithTimeout adds the timeout to the delete acls rid groups gid action params +func (o *DeleteAclsRidGroupsGidActionParams) WithTimeout(timeout time.Duration) *DeleteAclsRidGroupsGidActionParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the delete acls rid groups gid action params +func (o *DeleteAclsRidGroupsGidActionParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the delete acls rid groups gid action params +func (o *DeleteAclsRidGroupsGidActionParams) WithContext(ctx context.Context) *DeleteAclsRidGroupsGidActionParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the delete acls rid groups gid action params +func (o *DeleteAclsRidGroupsGidActionParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the delete acls rid groups gid action params +func (o *DeleteAclsRidGroupsGidActionParams) WithHTTPClient(client *http.Client) *DeleteAclsRidGroupsGidActionParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the delete acls rid groups gid action params +func (o *DeleteAclsRidGroupsGidActionParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithAction adds the action to the delete acls rid groups gid action params +func (o *DeleteAclsRidGroupsGidActionParams) WithAction(action string) *DeleteAclsRidGroupsGidActionParams { + o.SetAction(action) + return o +} + +// SetAction adds the action to the delete acls rid groups gid action params +func (o *DeleteAclsRidGroupsGidActionParams) SetAction(action string) { + o.Action = action +} + +// WithGid adds the gid to the delete acls rid groups gid action params +func (o *DeleteAclsRidGroupsGidActionParams) WithGid(gid string) *DeleteAclsRidGroupsGidActionParams { + o.SetGid(gid) + return o +} + +// SetGid adds the gid to the delete acls rid groups gid action params +func (o *DeleteAclsRidGroupsGidActionParams) SetGid(gid string) { + o.Gid = gid +} + +// WithRid adds the rid to the delete acls rid groups gid action params +func (o *DeleteAclsRidGroupsGidActionParams) WithRid(rid string) *DeleteAclsRidGroupsGidActionParams { + o.SetRid(rid) + return o +} + +// SetRid adds the rid to the delete acls rid groups gid action params +func (o *DeleteAclsRidGroupsGidActionParams) SetRid(rid string) { + o.Rid = rid +} + +// WriteToRequest writes these params to a swagger request +func (o *DeleteAclsRidGroupsGidActionParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param action + if err := r.SetPathParam("action", o.Action); err != nil { + return err + } + + // path param gid + if err := r.SetPathParam("gid", o.Gid); err != nil { + return err + } + + // path param rid + if err := r.SetPathParam("rid", o.Rid); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/dcos/iam/client/permissions/delete_acls_rid_groups_gid_action_responses.go b/dcos/iam/client/permissions/delete_acls_rid_groups_gid_action_responses.go new file mode 100644 index 0000000..b544427 --- /dev/null +++ b/dcos/iam/client/permissions/delete_acls_rid_groups_gid_action_responses.go @@ -0,0 +1,56 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package permissions + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + + "github.com/go-openapi/runtime" + + strfmt "github.com/go-openapi/strfmt" +) + +// DeleteAclsRidGroupsGidActionReader is a Reader for the DeleteAclsRidGroupsGidAction structure. +type DeleteAclsRidGroupsGidActionReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *DeleteAclsRidGroupsGidActionReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + + case 204: + result := NewDeleteAclsRidGroupsGidActionNoContent() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + + default: + return nil, runtime.NewAPIError("unknown error", response, response.Code()) + } +} + +// NewDeleteAclsRidGroupsGidActionNoContent creates a DeleteAclsRidGroupsGidActionNoContent with default headers values +func NewDeleteAclsRidGroupsGidActionNoContent() *DeleteAclsRidGroupsGidActionNoContent { + return &DeleteAclsRidGroupsGidActionNoContent{} +} + +/*DeleteAclsRidGroupsGidActionNoContent handles this case with default header values. + +Success. +*/ +type DeleteAclsRidGroupsGidActionNoContent struct { +} + +func (o *DeleteAclsRidGroupsGidActionNoContent) Error() string { + return fmt.Sprintf("[DELETE /acls/{rid}/groups/{gid}/{action}][%d] deleteAclsRidGroupsGidActionNoContent ", 204) +} + +func (o *DeleteAclsRidGroupsGidActionNoContent) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/dcos/iam/client/permissions/delete_acls_rid_groups_gid_parameters.go b/dcos/iam/client/permissions/delete_acls_rid_groups_gid_parameters.go new file mode 100644 index 0000000..616d36b --- /dev/null +++ b/dcos/iam/client/permissions/delete_acls_rid_groups_gid_parameters.go @@ -0,0 +1,157 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package permissions + +// 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" + + strfmt "github.com/go-openapi/strfmt" +) + +// NewDeleteAclsRidGroupsGidParams creates a new DeleteAclsRidGroupsGidParams object +// with the default values initialized. +func NewDeleteAclsRidGroupsGidParams() *DeleteAclsRidGroupsGidParams { + var () + return &DeleteAclsRidGroupsGidParams{ + + timeout: cr.DefaultTimeout, + } +} + +// NewDeleteAclsRidGroupsGidParamsWithTimeout creates a new DeleteAclsRidGroupsGidParams object +// with the default values initialized, and the ability to set a timeout on a request +func NewDeleteAclsRidGroupsGidParamsWithTimeout(timeout time.Duration) *DeleteAclsRidGroupsGidParams { + var () + return &DeleteAclsRidGroupsGidParams{ + + timeout: timeout, + } +} + +// NewDeleteAclsRidGroupsGidParamsWithContext creates a new DeleteAclsRidGroupsGidParams object +// with the default values initialized, and the ability to set a context for a request +func NewDeleteAclsRidGroupsGidParamsWithContext(ctx context.Context) *DeleteAclsRidGroupsGidParams { + var () + return &DeleteAclsRidGroupsGidParams{ + + Context: ctx, + } +} + +// NewDeleteAclsRidGroupsGidParamsWithHTTPClient creates a new DeleteAclsRidGroupsGidParams object +// with the default values initialized, and the ability to set a custom HTTPClient for a request +func NewDeleteAclsRidGroupsGidParamsWithHTTPClient(client *http.Client) *DeleteAclsRidGroupsGidParams { + var () + return &DeleteAclsRidGroupsGidParams{ + HTTPClient: client, + } +} + +/*DeleteAclsRidGroupsGidParams contains all the parameters to send to the API endpoint +for the delete acls rid groups gid operation typically these are written to a http.Request +*/ +type DeleteAclsRidGroupsGidParams struct { + + /*Gid + group ID. + + */ + Gid string + /*Rid + resource ID. + + */ + Rid string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithTimeout adds the timeout to the delete acls rid groups gid params +func (o *DeleteAclsRidGroupsGidParams) WithTimeout(timeout time.Duration) *DeleteAclsRidGroupsGidParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the delete acls rid groups gid params +func (o *DeleteAclsRidGroupsGidParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the delete acls rid groups gid params +func (o *DeleteAclsRidGroupsGidParams) WithContext(ctx context.Context) *DeleteAclsRidGroupsGidParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the delete acls rid groups gid params +func (o *DeleteAclsRidGroupsGidParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the delete acls rid groups gid params +func (o *DeleteAclsRidGroupsGidParams) WithHTTPClient(client *http.Client) *DeleteAclsRidGroupsGidParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the delete acls rid groups gid params +func (o *DeleteAclsRidGroupsGidParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithGid adds the gid to the delete acls rid groups gid params +func (o *DeleteAclsRidGroupsGidParams) WithGid(gid string) *DeleteAclsRidGroupsGidParams { + o.SetGid(gid) + return o +} + +// SetGid adds the gid to the delete acls rid groups gid params +func (o *DeleteAclsRidGroupsGidParams) SetGid(gid string) { + o.Gid = gid +} + +// WithRid adds the rid to the delete acls rid groups gid params +func (o *DeleteAclsRidGroupsGidParams) WithRid(rid string) *DeleteAclsRidGroupsGidParams { + o.SetRid(rid) + return o +} + +// SetRid adds the rid to the delete acls rid groups gid params +func (o *DeleteAclsRidGroupsGidParams) SetRid(rid string) { + o.Rid = rid +} + +// WriteToRequest writes these params to a swagger request +func (o *DeleteAclsRidGroupsGidParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param gid + if err := r.SetPathParam("gid", o.Gid); err != nil { + return err + } + + // path param rid + if err := r.SetPathParam("rid", o.Rid); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/dcos/iam/client/permissions/delete_acls_rid_groups_gid_responses.go b/dcos/iam/client/permissions/delete_acls_rid_groups_gid_responses.go new file mode 100644 index 0000000..088a00c --- /dev/null +++ b/dcos/iam/client/permissions/delete_acls_rid_groups_gid_responses.go @@ -0,0 +1,56 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package permissions + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + + "github.com/go-openapi/runtime" + + strfmt "github.com/go-openapi/strfmt" +) + +// DeleteAclsRidGroupsGidReader is a Reader for the DeleteAclsRidGroupsGid structure. +type DeleteAclsRidGroupsGidReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *DeleteAclsRidGroupsGidReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + + case 204: + result := NewDeleteAclsRidGroupsGidNoContent() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + + default: + return nil, runtime.NewAPIError("unknown error", response, response.Code()) + } +} + +// NewDeleteAclsRidGroupsGidNoContent creates a DeleteAclsRidGroupsGidNoContent with default headers values +func NewDeleteAclsRidGroupsGidNoContent() *DeleteAclsRidGroupsGidNoContent { + return &DeleteAclsRidGroupsGidNoContent{} +} + +/*DeleteAclsRidGroupsGidNoContent handles this case with default header values. + +Success. +*/ +type DeleteAclsRidGroupsGidNoContent struct { +} + +func (o *DeleteAclsRidGroupsGidNoContent) Error() string { + return fmt.Sprintf("[DELETE /acls/{rid}/groups/{gid}][%d] deleteAclsRidGroupsGidNoContent ", 204) +} + +func (o *DeleteAclsRidGroupsGidNoContent) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/dcos/iam/client/permissions/delete_acls_rid_parameters.go b/dcos/iam/client/permissions/delete_acls_rid_parameters.go new file mode 100644 index 0000000..3f3e217 --- /dev/null +++ b/dcos/iam/client/permissions/delete_acls_rid_parameters.go @@ -0,0 +1,136 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package permissions + +// 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" + + strfmt "github.com/go-openapi/strfmt" +) + +// NewDeleteAclsRidParams creates a new DeleteAclsRidParams object +// with the default values initialized. +func NewDeleteAclsRidParams() *DeleteAclsRidParams { + var () + return &DeleteAclsRidParams{ + + timeout: cr.DefaultTimeout, + } +} + +// NewDeleteAclsRidParamsWithTimeout creates a new DeleteAclsRidParams object +// with the default values initialized, and the ability to set a timeout on a request +func NewDeleteAclsRidParamsWithTimeout(timeout time.Duration) *DeleteAclsRidParams { + var () + return &DeleteAclsRidParams{ + + timeout: timeout, + } +} + +// NewDeleteAclsRidParamsWithContext creates a new DeleteAclsRidParams object +// with the default values initialized, and the ability to set a context for a request +func NewDeleteAclsRidParamsWithContext(ctx context.Context) *DeleteAclsRidParams { + var () + return &DeleteAclsRidParams{ + + Context: ctx, + } +} + +// NewDeleteAclsRidParamsWithHTTPClient creates a new DeleteAclsRidParams object +// with the default values initialized, and the ability to set a custom HTTPClient for a request +func NewDeleteAclsRidParamsWithHTTPClient(client *http.Client) *DeleteAclsRidParams { + var () + return &DeleteAclsRidParams{ + HTTPClient: client, + } +} + +/*DeleteAclsRidParams contains all the parameters to send to the API endpoint +for the delete acls rid operation typically these are written to a http.Request +*/ +type DeleteAclsRidParams struct { + + /*Rid + The ID of resource for which the ACL should be deleted. + + */ + Rid string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithTimeout adds the timeout to the delete acls rid params +func (o *DeleteAclsRidParams) WithTimeout(timeout time.Duration) *DeleteAclsRidParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the delete acls rid params +func (o *DeleteAclsRidParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the delete acls rid params +func (o *DeleteAclsRidParams) WithContext(ctx context.Context) *DeleteAclsRidParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the delete acls rid params +func (o *DeleteAclsRidParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the delete acls rid params +func (o *DeleteAclsRidParams) WithHTTPClient(client *http.Client) *DeleteAclsRidParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the delete acls rid params +func (o *DeleteAclsRidParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithRid adds the rid to the delete acls rid params +func (o *DeleteAclsRidParams) WithRid(rid string) *DeleteAclsRidParams { + o.SetRid(rid) + return o +} + +// SetRid adds the rid to the delete acls rid params +func (o *DeleteAclsRidParams) SetRid(rid string) { + o.Rid = rid +} + +// WriteToRequest writes these params to a swagger request +func (o *DeleteAclsRidParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param rid + if err := r.SetPathParam("rid", o.Rid); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/dcos/iam/client/permissions/delete_acls_rid_responses.go b/dcos/iam/client/permissions/delete_acls_rid_responses.go new file mode 100644 index 0000000..c155653 --- /dev/null +++ b/dcos/iam/client/permissions/delete_acls_rid_responses.go @@ -0,0 +1,84 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package permissions + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + + "github.com/go-openapi/runtime" + + strfmt "github.com/go-openapi/strfmt" +) + +// DeleteAclsRidReader is a Reader for the DeleteAclsRid structure. +type DeleteAclsRidReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *DeleteAclsRidReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + + case 204: + result := NewDeleteAclsRidNoContent() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + + case 404: + result := NewDeleteAclsRidNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + + default: + return nil, runtime.NewAPIError("unknown error", response, response.Code()) + } +} + +// NewDeleteAclsRidNoContent creates a DeleteAclsRidNoContent with default headers values +func NewDeleteAclsRidNoContent() *DeleteAclsRidNoContent { + return &DeleteAclsRidNoContent{} +} + +/*DeleteAclsRidNoContent handles this case with default header values. + +Success. +*/ +type DeleteAclsRidNoContent struct { +} + +func (o *DeleteAclsRidNoContent) Error() string { + return fmt.Sprintf("[DELETE /acls/{rid}][%d] deleteAclsRidNoContent ", 204) +} + +func (o *DeleteAclsRidNoContent) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewDeleteAclsRidNotFound creates a DeleteAclsRidNotFound with default headers values +func NewDeleteAclsRidNotFound() *DeleteAclsRidNotFound { + return &DeleteAclsRidNotFound{} +} + +/*DeleteAclsRidNotFound handles this case with default header values. + +ACL not found. +*/ +type DeleteAclsRidNotFound struct { +} + +func (o *DeleteAclsRidNotFound) Error() string { + return fmt.Sprintf("[DELETE /acls/{rid}][%d] deleteAclsRidNotFound ", 404) +} + +func (o *DeleteAclsRidNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/dcos/iam/client/permissions/delete_acls_rid_users_uid_action_parameters.go b/dcos/iam/client/permissions/delete_acls_rid_users_uid_action_parameters.go new file mode 100644 index 0000000..acdd611 --- /dev/null +++ b/dcos/iam/client/permissions/delete_acls_rid_users_uid_action_parameters.go @@ -0,0 +1,178 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package permissions + +// 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" + + strfmt "github.com/go-openapi/strfmt" +) + +// NewDeleteAclsRidUsersUIDActionParams creates a new DeleteAclsRidUsersUIDActionParams object +// with the default values initialized. +func NewDeleteAclsRidUsersUIDActionParams() *DeleteAclsRidUsersUIDActionParams { + var () + return &DeleteAclsRidUsersUIDActionParams{ + + timeout: cr.DefaultTimeout, + } +} + +// NewDeleteAclsRidUsersUIDActionParamsWithTimeout creates a new DeleteAclsRidUsersUIDActionParams object +// with the default values initialized, and the ability to set a timeout on a request +func NewDeleteAclsRidUsersUIDActionParamsWithTimeout(timeout time.Duration) *DeleteAclsRidUsersUIDActionParams { + var () + return &DeleteAclsRidUsersUIDActionParams{ + + timeout: timeout, + } +} + +// NewDeleteAclsRidUsersUIDActionParamsWithContext creates a new DeleteAclsRidUsersUIDActionParams object +// with the default values initialized, and the ability to set a context for a request +func NewDeleteAclsRidUsersUIDActionParamsWithContext(ctx context.Context) *DeleteAclsRidUsersUIDActionParams { + var () + return &DeleteAclsRidUsersUIDActionParams{ + + Context: ctx, + } +} + +// NewDeleteAclsRidUsersUIDActionParamsWithHTTPClient creates a new DeleteAclsRidUsersUIDActionParams object +// with the default values initialized, and the ability to set a custom HTTPClient for a request +func NewDeleteAclsRidUsersUIDActionParamsWithHTTPClient(client *http.Client) *DeleteAclsRidUsersUIDActionParams { + var () + return &DeleteAclsRidUsersUIDActionParams{ + HTTPClient: client, + } +} + +/*DeleteAclsRidUsersUIDActionParams contains all the parameters to send to the API endpoint +for the delete acls rid users UID action operation typically these are written to a http.Request +*/ +type DeleteAclsRidUsersUIDActionParams struct { + + /*Action + action name + + */ + Action string + /*Rid + resource ID. + + */ + Rid string + /*UID + account ID. + + */ + UID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithTimeout adds the timeout to the delete acls rid users UID action params +func (o *DeleteAclsRidUsersUIDActionParams) WithTimeout(timeout time.Duration) *DeleteAclsRidUsersUIDActionParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the delete acls rid users UID action params +func (o *DeleteAclsRidUsersUIDActionParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the delete acls rid users UID action params +func (o *DeleteAclsRidUsersUIDActionParams) WithContext(ctx context.Context) *DeleteAclsRidUsersUIDActionParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the delete acls rid users UID action params +func (o *DeleteAclsRidUsersUIDActionParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the delete acls rid users UID action params +func (o *DeleteAclsRidUsersUIDActionParams) WithHTTPClient(client *http.Client) *DeleteAclsRidUsersUIDActionParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the delete acls rid users UID action params +func (o *DeleteAclsRidUsersUIDActionParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithAction adds the action to the delete acls rid users UID action params +func (o *DeleteAclsRidUsersUIDActionParams) WithAction(action string) *DeleteAclsRidUsersUIDActionParams { + o.SetAction(action) + return o +} + +// SetAction adds the action to the delete acls rid users UID action params +func (o *DeleteAclsRidUsersUIDActionParams) SetAction(action string) { + o.Action = action +} + +// WithRid adds the rid to the delete acls rid users UID action params +func (o *DeleteAclsRidUsersUIDActionParams) WithRid(rid string) *DeleteAclsRidUsersUIDActionParams { + o.SetRid(rid) + return o +} + +// SetRid adds the rid to the delete acls rid users UID action params +func (o *DeleteAclsRidUsersUIDActionParams) SetRid(rid string) { + o.Rid = rid +} + +// WithUID adds the uid to the delete acls rid users UID action params +func (o *DeleteAclsRidUsersUIDActionParams) WithUID(uid string) *DeleteAclsRidUsersUIDActionParams { + o.SetUID(uid) + return o +} + +// SetUID adds the uid to the delete acls rid users UID action params +func (o *DeleteAclsRidUsersUIDActionParams) SetUID(uid string) { + o.UID = uid +} + +// WriteToRequest writes these params to a swagger request +func (o *DeleteAclsRidUsersUIDActionParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param action + if err := r.SetPathParam("action", o.Action); err != nil { + return err + } + + // path param rid + if err := r.SetPathParam("rid", o.Rid); err != nil { + return err + } + + // path param uid + if err := r.SetPathParam("uid", o.UID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/dcos/iam/client/permissions/delete_acls_rid_users_uid_action_responses.go b/dcos/iam/client/permissions/delete_acls_rid_users_uid_action_responses.go new file mode 100644 index 0000000..949eaed --- /dev/null +++ b/dcos/iam/client/permissions/delete_acls_rid_users_uid_action_responses.go @@ -0,0 +1,56 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package permissions + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + + "github.com/go-openapi/runtime" + + strfmt "github.com/go-openapi/strfmt" +) + +// DeleteAclsRidUsersUIDActionReader is a Reader for the DeleteAclsRidUsersUIDAction structure. +type DeleteAclsRidUsersUIDActionReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *DeleteAclsRidUsersUIDActionReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + + case 204: + result := NewDeleteAclsRidUsersUIDActionNoContent() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + + default: + return nil, runtime.NewAPIError("unknown error", response, response.Code()) + } +} + +// NewDeleteAclsRidUsersUIDActionNoContent creates a DeleteAclsRidUsersUIDActionNoContent with default headers values +func NewDeleteAclsRidUsersUIDActionNoContent() *DeleteAclsRidUsersUIDActionNoContent { + return &DeleteAclsRidUsersUIDActionNoContent{} +} + +/*DeleteAclsRidUsersUIDActionNoContent handles this case with default header values. + +Success. +*/ +type DeleteAclsRidUsersUIDActionNoContent struct { +} + +func (o *DeleteAclsRidUsersUIDActionNoContent) Error() string { + return fmt.Sprintf("[DELETE /acls/{rid}/users/{uid}/{action}][%d] deleteAclsRidUsersUidActionNoContent ", 204) +} + +func (o *DeleteAclsRidUsersUIDActionNoContent) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/dcos/iam/client/permissions/delete_acls_rid_users_uid_parameters.go b/dcos/iam/client/permissions/delete_acls_rid_users_uid_parameters.go new file mode 100644 index 0000000..f535235 --- /dev/null +++ b/dcos/iam/client/permissions/delete_acls_rid_users_uid_parameters.go @@ -0,0 +1,157 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package permissions + +// 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" + + strfmt "github.com/go-openapi/strfmt" +) + +// NewDeleteAclsRidUsersUIDParams creates a new DeleteAclsRidUsersUIDParams object +// with the default values initialized. +func NewDeleteAclsRidUsersUIDParams() *DeleteAclsRidUsersUIDParams { + var () + return &DeleteAclsRidUsersUIDParams{ + + timeout: cr.DefaultTimeout, + } +} + +// NewDeleteAclsRidUsersUIDParamsWithTimeout creates a new DeleteAclsRidUsersUIDParams object +// with the default values initialized, and the ability to set a timeout on a request +func NewDeleteAclsRidUsersUIDParamsWithTimeout(timeout time.Duration) *DeleteAclsRidUsersUIDParams { + var () + return &DeleteAclsRidUsersUIDParams{ + + timeout: timeout, + } +} + +// NewDeleteAclsRidUsersUIDParamsWithContext creates a new DeleteAclsRidUsersUIDParams object +// with the default values initialized, and the ability to set a context for a request +func NewDeleteAclsRidUsersUIDParamsWithContext(ctx context.Context) *DeleteAclsRidUsersUIDParams { + var () + return &DeleteAclsRidUsersUIDParams{ + + Context: ctx, + } +} + +// NewDeleteAclsRidUsersUIDParamsWithHTTPClient creates a new DeleteAclsRidUsersUIDParams object +// with the default values initialized, and the ability to set a custom HTTPClient for a request +func NewDeleteAclsRidUsersUIDParamsWithHTTPClient(client *http.Client) *DeleteAclsRidUsersUIDParams { + var () + return &DeleteAclsRidUsersUIDParams{ + HTTPClient: client, + } +} + +/*DeleteAclsRidUsersUIDParams contains all the parameters to send to the API endpoint +for the delete acls rid users UID operation typically these are written to a http.Request +*/ +type DeleteAclsRidUsersUIDParams struct { + + /*Rid + resource ID. + + */ + Rid string + /*UID + account ID. + + */ + UID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithTimeout adds the timeout to the delete acls rid users UID params +func (o *DeleteAclsRidUsersUIDParams) WithTimeout(timeout time.Duration) *DeleteAclsRidUsersUIDParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the delete acls rid users UID params +func (o *DeleteAclsRidUsersUIDParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the delete acls rid users UID params +func (o *DeleteAclsRidUsersUIDParams) WithContext(ctx context.Context) *DeleteAclsRidUsersUIDParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the delete acls rid users UID params +func (o *DeleteAclsRidUsersUIDParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the delete acls rid users UID params +func (o *DeleteAclsRidUsersUIDParams) WithHTTPClient(client *http.Client) *DeleteAclsRidUsersUIDParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the delete acls rid users UID params +func (o *DeleteAclsRidUsersUIDParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithRid adds the rid to the delete acls rid users UID params +func (o *DeleteAclsRidUsersUIDParams) WithRid(rid string) *DeleteAclsRidUsersUIDParams { + o.SetRid(rid) + return o +} + +// SetRid adds the rid to the delete acls rid users UID params +func (o *DeleteAclsRidUsersUIDParams) SetRid(rid string) { + o.Rid = rid +} + +// WithUID adds the uid to the delete acls rid users UID params +func (o *DeleteAclsRidUsersUIDParams) WithUID(uid string) *DeleteAclsRidUsersUIDParams { + o.SetUID(uid) + return o +} + +// SetUID adds the uid to the delete acls rid users UID params +func (o *DeleteAclsRidUsersUIDParams) SetUID(uid string) { + o.UID = uid +} + +// WriteToRequest writes these params to a swagger request +func (o *DeleteAclsRidUsersUIDParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param rid + if err := r.SetPathParam("rid", o.Rid); err != nil { + return err + } + + // path param uid + if err := r.SetPathParam("uid", o.UID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/dcos/iam/client/permissions/delete_acls_rid_users_uid_responses.go b/dcos/iam/client/permissions/delete_acls_rid_users_uid_responses.go new file mode 100644 index 0000000..669a5a1 --- /dev/null +++ b/dcos/iam/client/permissions/delete_acls_rid_users_uid_responses.go @@ -0,0 +1,56 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package permissions + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + + "github.com/go-openapi/runtime" + + strfmt "github.com/go-openapi/strfmt" +) + +// DeleteAclsRidUsersUIDReader is a Reader for the DeleteAclsRidUsersUID structure. +type DeleteAclsRidUsersUIDReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *DeleteAclsRidUsersUIDReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + + case 204: + result := NewDeleteAclsRidUsersUIDNoContent() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + + default: + return nil, runtime.NewAPIError("unknown error", response, response.Code()) + } +} + +// NewDeleteAclsRidUsersUIDNoContent creates a DeleteAclsRidUsersUIDNoContent with default headers values +func NewDeleteAclsRidUsersUIDNoContent() *DeleteAclsRidUsersUIDNoContent { + return &DeleteAclsRidUsersUIDNoContent{} +} + +/*DeleteAclsRidUsersUIDNoContent handles this case with default header values. + +Success. +*/ +type DeleteAclsRidUsersUIDNoContent struct { +} + +func (o *DeleteAclsRidUsersUIDNoContent) Error() string { + return fmt.Sprintf("[DELETE /acls/{rid}/users/{uid}][%d] deleteAclsRidUsersUidNoContent ", 204) +} + +func (o *DeleteAclsRidUsersUIDNoContent) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/dcos/iam/client/permissions/get_acls_parameters.go b/dcos/iam/client/permissions/get_acls_parameters.go new file mode 100644 index 0000000..a045370 --- /dev/null +++ b/dcos/iam/client/permissions/get_acls_parameters.go @@ -0,0 +1,113 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package permissions + +// 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" + + strfmt "github.com/go-openapi/strfmt" +) + +// NewGetAclsParams creates a new GetAclsParams object +// with the default values initialized. +func NewGetAclsParams() *GetAclsParams { + + return &GetAclsParams{ + + timeout: cr.DefaultTimeout, + } +} + +// NewGetAclsParamsWithTimeout creates a new GetAclsParams object +// with the default values initialized, and the ability to set a timeout on a request +func NewGetAclsParamsWithTimeout(timeout time.Duration) *GetAclsParams { + + return &GetAclsParams{ + + timeout: timeout, + } +} + +// NewGetAclsParamsWithContext creates a new GetAclsParams object +// with the default values initialized, and the ability to set a context for a request +func NewGetAclsParamsWithContext(ctx context.Context) *GetAclsParams { + + return &GetAclsParams{ + + Context: ctx, + } +} + +// NewGetAclsParamsWithHTTPClient creates a new GetAclsParams object +// with the default values initialized, and the ability to set a custom HTTPClient for a request +func NewGetAclsParamsWithHTTPClient(client *http.Client) *GetAclsParams { + + return &GetAclsParams{ + HTTPClient: client, + } +} + +/*GetAclsParams contains all the parameters to send to the API endpoint +for the get acls operation typically these are written to a http.Request +*/ +type GetAclsParams struct { + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithTimeout adds the timeout to the get acls params +func (o *GetAclsParams) WithTimeout(timeout time.Duration) *GetAclsParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the get acls params +func (o *GetAclsParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the get acls params +func (o *GetAclsParams) WithContext(ctx context.Context) *GetAclsParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the get acls params +func (o *GetAclsParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the get acls params +func (o *GetAclsParams) WithHTTPClient(client *http.Client) *GetAclsParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the get acls params +func (o *GetAclsParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WriteToRequest writes these params to a swagger request +func (o *GetAclsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/dcos/iam/client/permissions/get_acls_responses.go b/dcos/iam/client/permissions/get_acls_responses.go new file mode 100644 index 0000000..2f4597a --- /dev/null +++ b/dcos/iam/client/permissions/get_acls_responses.go @@ -0,0 +1,136 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package permissions + +// 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" + "strconv" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + "github.com/go-openapi/swag" + + strfmt "github.com/go-openapi/strfmt" + + models "github.com/dcos/client-go/dcos/iam/models" +) + +// GetAclsReader is a Reader for the GetAcls structure. +type GetAclsReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *GetAclsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + + case 200: + result := NewGetAclsOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + + default: + return nil, runtime.NewAPIError("unknown error", response, response.Code()) + } +} + +// NewGetAclsOK creates a GetAclsOK with default headers values +func NewGetAclsOK() *GetAclsOK { + return &GetAclsOK{} +} + +/*GetAclsOK handles this case with default header values. + +Success +*/ +type GetAclsOK struct { + Payload *GetAclsOKBody +} + +func (o *GetAclsOK) Error() string { + return fmt.Sprintf("[GET /acls][%d] getAclsOK %+v", 200, o.Payload) +} + +func (o *GetAclsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(GetAclsOKBody) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +/*GetAclsOKBody get acls o k body +swagger:model GetAclsOKBody +*/ +type GetAclsOKBody struct { + + // array + Array []*models.ACL `json:"array"` +} + +// Validate validates this get acls o k body +func (o *GetAclsOKBody) Validate(formats strfmt.Registry) error { + var res []error + + if err := o.validateArray(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (o *GetAclsOKBody) validateArray(formats strfmt.Registry) error { + + if swag.IsZero(o.Array) { // not required + return nil + } + + for i := 0; i < len(o.Array); i++ { + if swag.IsZero(o.Array[i]) { // not required + continue + } + + if o.Array[i] != nil { + if err := o.Array[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("getAclsOK" + "." + "array" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// MarshalBinary interface implementation +func (o *GetAclsOKBody) MarshalBinary() ([]byte, error) { + if o == nil { + return nil, nil + } + return swag.WriteJSON(o) +} + +// UnmarshalBinary interface implementation +func (o *GetAclsOKBody) UnmarshalBinary(b []byte) error { + var res GetAclsOKBody + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *o = res + return nil +} diff --git a/dcos/iam/client/permissions/get_acls_rid_groups_gid_action_parameters.go b/dcos/iam/client/permissions/get_acls_rid_groups_gid_action_parameters.go new file mode 100644 index 0000000..eb58eb3 --- /dev/null +++ b/dcos/iam/client/permissions/get_acls_rid_groups_gid_action_parameters.go @@ -0,0 +1,178 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package permissions + +// 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" + + strfmt "github.com/go-openapi/strfmt" +) + +// NewGetAclsRidGroupsGidActionParams creates a new GetAclsRidGroupsGidActionParams object +// with the default values initialized. +func NewGetAclsRidGroupsGidActionParams() *GetAclsRidGroupsGidActionParams { + var () + return &GetAclsRidGroupsGidActionParams{ + + timeout: cr.DefaultTimeout, + } +} + +// NewGetAclsRidGroupsGidActionParamsWithTimeout creates a new GetAclsRidGroupsGidActionParams object +// with the default values initialized, and the ability to set a timeout on a request +func NewGetAclsRidGroupsGidActionParamsWithTimeout(timeout time.Duration) *GetAclsRidGroupsGidActionParams { + var () + return &GetAclsRidGroupsGidActionParams{ + + timeout: timeout, + } +} + +// NewGetAclsRidGroupsGidActionParamsWithContext creates a new GetAclsRidGroupsGidActionParams object +// with the default values initialized, and the ability to set a context for a request +func NewGetAclsRidGroupsGidActionParamsWithContext(ctx context.Context) *GetAclsRidGroupsGidActionParams { + var () + return &GetAclsRidGroupsGidActionParams{ + + Context: ctx, + } +} + +// NewGetAclsRidGroupsGidActionParamsWithHTTPClient creates a new GetAclsRidGroupsGidActionParams object +// with the default values initialized, and the ability to set a custom HTTPClient for a request +func NewGetAclsRidGroupsGidActionParamsWithHTTPClient(client *http.Client) *GetAclsRidGroupsGidActionParams { + var () + return &GetAclsRidGroupsGidActionParams{ + HTTPClient: client, + } +} + +/*GetAclsRidGroupsGidActionParams contains all the parameters to send to the API endpoint +for the get acls rid groups gid action operation typically these are written to a http.Request +*/ +type GetAclsRidGroupsGidActionParams struct { + + /*Action + action name + + */ + Action string + /*Gid + group ID + + */ + Gid string + /*Rid + resource ID + + */ + Rid string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithTimeout adds the timeout to the get acls rid groups gid action params +func (o *GetAclsRidGroupsGidActionParams) WithTimeout(timeout time.Duration) *GetAclsRidGroupsGidActionParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the get acls rid groups gid action params +func (o *GetAclsRidGroupsGidActionParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the get acls rid groups gid action params +func (o *GetAclsRidGroupsGidActionParams) WithContext(ctx context.Context) *GetAclsRidGroupsGidActionParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the get acls rid groups gid action params +func (o *GetAclsRidGroupsGidActionParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the get acls rid groups gid action params +func (o *GetAclsRidGroupsGidActionParams) WithHTTPClient(client *http.Client) *GetAclsRidGroupsGidActionParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the get acls rid groups gid action params +func (o *GetAclsRidGroupsGidActionParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithAction adds the action to the get acls rid groups gid action params +func (o *GetAclsRidGroupsGidActionParams) WithAction(action string) *GetAclsRidGroupsGidActionParams { + o.SetAction(action) + return o +} + +// SetAction adds the action to the get acls rid groups gid action params +func (o *GetAclsRidGroupsGidActionParams) SetAction(action string) { + o.Action = action +} + +// WithGid adds the gid to the get acls rid groups gid action params +func (o *GetAclsRidGroupsGidActionParams) WithGid(gid string) *GetAclsRidGroupsGidActionParams { + o.SetGid(gid) + return o +} + +// SetGid adds the gid to the get acls rid groups gid action params +func (o *GetAclsRidGroupsGidActionParams) SetGid(gid string) { + o.Gid = gid +} + +// WithRid adds the rid to the get acls rid groups gid action params +func (o *GetAclsRidGroupsGidActionParams) WithRid(rid string) *GetAclsRidGroupsGidActionParams { + o.SetRid(rid) + return o +} + +// SetRid adds the rid to the get acls rid groups gid action params +func (o *GetAclsRidGroupsGidActionParams) SetRid(rid string) { + o.Rid = rid +} + +// WriteToRequest writes these params to a swagger request +func (o *GetAclsRidGroupsGidActionParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param action + if err := r.SetPathParam("action", o.Action); err != nil { + return err + } + + // path param gid + if err := r.SetPathParam("gid", o.Gid); err != nil { + return err + } + + // path param rid + if err := r.SetPathParam("rid", o.Rid); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/dcos/iam/client/permissions/get_acls_rid_groups_gid_action_responses.go b/dcos/iam/client/permissions/get_acls_rid_groups_gid_action_responses.go new file mode 100644 index 0000000..2490b11 --- /dev/null +++ b/dcos/iam/client/permissions/get_acls_rid_groups_gid_action_responses.go @@ -0,0 +1,67 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package permissions + +// 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" + + strfmt "github.com/go-openapi/strfmt" + + models "github.com/dcos/client-go/dcos/iam/models" +) + +// GetAclsRidGroupsGidActionReader is a Reader for the GetAclsRidGroupsGidAction structure. +type GetAclsRidGroupsGidActionReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *GetAclsRidGroupsGidActionReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + + case 200: + result := NewGetAclsRidGroupsGidActionOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + + default: + return nil, runtime.NewAPIError("unknown error", response, response.Code()) + } +} + +// NewGetAclsRidGroupsGidActionOK creates a GetAclsRidGroupsGidActionOK with default headers values +func NewGetAclsRidGroupsGidActionOK() *GetAclsRidGroupsGidActionOK { + return &GetAclsRidGroupsGidActionOK{} +} + +/*GetAclsRidGroupsGidActionOK handles this case with default header values. + +Boolean answer in JSON response body. +*/ +type GetAclsRidGroupsGidActionOK struct { + Payload *models.ActionAllowed +} + +func (o *GetAclsRidGroupsGidActionOK) Error() string { + return fmt.Sprintf("[GET /acls/{rid}/groups/{gid}/{action}][%d] getAclsRidGroupsGidActionOK %+v", 200, o.Payload) +} + +func (o *GetAclsRidGroupsGidActionOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.ActionAllowed) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/dcos/iam/client/permissions/get_acls_rid_groups_gid_parameters.go b/dcos/iam/client/permissions/get_acls_rid_groups_gid_parameters.go new file mode 100644 index 0000000..3fd0891 --- /dev/null +++ b/dcos/iam/client/permissions/get_acls_rid_groups_gid_parameters.go @@ -0,0 +1,157 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package permissions + +// 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" + + strfmt "github.com/go-openapi/strfmt" +) + +// NewGetAclsRidGroupsGidParams creates a new GetAclsRidGroupsGidParams object +// with the default values initialized. +func NewGetAclsRidGroupsGidParams() *GetAclsRidGroupsGidParams { + var () + return &GetAclsRidGroupsGidParams{ + + timeout: cr.DefaultTimeout, + } +} + +// NewGetAclsRidGroupsGidParamsWithTimeout creates a new GetAclsRidGroupsGidParams object +// with the default values initialized, and the ability to set a timeout on a request +func NewGetAclsRidGroupsGidParamsWithTimeout(timeout time.Duration) *GetAclsRidGroupsGidParams { + var () + return &GetAclsRidGroupsGidParams{ + + timeout: timeout, + } +} + +// NewGetAclsRidGroupsGidParamsWithContext creates a new GetAclsRidGroupsGidParams object +// with the default values initialized, and the ability to set a context for a request +func NewGetAclsRidGroupsGidParamsWithContext(ctx context.Context) *GetAclsRidGroupsGidParams { + var () + return &GetAclsRidGroupsGidParams{ + + Context: ctx, + } +} + +// NewGetAclsRidGroupsGidParamsWithHTTPClient creates a new GetAclsRidGroupsGidParams object +// with the default values initialized, and the ability to set a custom HTTPClient for a request +func NewGetAclsRidGroupsGidParamsWithHTTPClient(client *http.Client) *GetAclsRidGroupsGidParams { + var () + return &GetAclsRidGroupsGidParams{ + HTTPClient: client, + } +} + +/*GetAclsRidGroupsGidParams contains all the parameters to send to the API endpoint +for the get acls rid groups gid operation typically these are written to a http.Request +*/ +type GetAclsRidGroupsGidParams struct { + + /*Gid + group ID + + */ + Gid string + /*Rid + resource ID + + */ + Rid string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithTimeout adds the timeout to the get acls rid groups gid params +func (o *GetAclsRidGroupsGidParams) WithTimeout(timeout time.Duration) *GetAclsRidGroupsGidParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the get acls rid groups gid params +func (o *GetAclsRidGroupsGidParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the get acls rid groups gid params +func (o *GetAclsRidGroupsGidParams) WithContext(ctx context.Context) *GetAclsRidGroupsGidParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the get acls rid groups gid params +func (o *GetAclsRidGroupsGidParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the get acls rid groups gid params +func (o *GetAclsRidGroupsGidParams) WithHTTPClient(client *http.Client) *GetAclsRidGroupsGidParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the get acls rid groups gid params +func (o *GetAclsRidGroupsGidParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithGid adds the gid to the get acls rid groups gid params +func (o *GetAclsRidGroupsGidParams) WithGid(gid string) *GetAclsRidGroupsGidParams { + o.SetGid(gid) + return o +} + +// SetGid adds the gid to the get acls rid groups gid params +func (o *GetAclsRidGroupsGidParams) SetGid(gid string) { + o.Gid = gid +} + +// WithRid adds the rid to the get acls rid groups gid params +func (o *GetAclsRidGroupsGidParams) WithRid(rid string) *GetAclsRidGroupsGidParams { + o.SetRid(rid) + return o +} + +// SetRid adds the rid to the get acls rid groups gid params +func (o *GetAclsRidGroupsGidParams) SetRid(rid string) { + o.Rid = rid +} + +// WriteToRequest writes these params to a swagger request +func (o *GetAclsRidGroupsGidParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param gid + if err := r.SetPathParam("gid", o.Gid); err != nil { + return err + } + + // path param rid + if err := r.SetPathParam("rid", o.Rid); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/dcos/iam/client/permissions/get_acls_rid_groups_gid_responses.go b/dcos/iam/client/permissions/get_acls_rid_groups_gid_responses.go new file mode 100644 index 0000000..4f403ff --- /dev/null +++ b/dcos/iam/client/permissions/get_acls_rid_groups_gid_responses.go @@ -0,0 +1,136 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package permissions + +// 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" + "strconv" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + "github.com/go-openapi/swag" + + strfmt "github.com/go-openapi/strfmt" + + models "github.com/dcos/client-go/dcos/iam/models" +) + +// GetAclsRidGroupsGidReader is a Reader for the GetAclsRidGroupsGid structure. +type GetAclsRidGroupsGidReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *GetAclsRidGroupsGidReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + + case 200: + result := NewGetAclsRidGroupsGidOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + + default: + return nil, runtime.NewAPIError("unknown error", response, response.Code()) + } +} + +// NewGetAclsRidGroupsGidOK creates a GetAclsRidGroupsGidOK with default headers values +func NewGetAclsRidGroupsGidOK() *GetAclsRidGroupsGidOK { + return &GetAclsRidGroupsGidOK{} +} + +/*GetAclsRidGroupsGidOK handles this case with default header values. + +Success. +*/ +type GetAclsRidGroupsGidOK struct { + Payload *GetAclsRidGroupsGidOKBody +} + +func (o *GetAclsRidGroupsGidOK) Error() string { + return fmt.Sprintf("[GET /acls/{rid}/groups/{gid}][%d] getAclsRidGroupsGidOK %+v", 200, o.Payload) +} + +func (o *GetAclsRidGroupsGidOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(GetAclsRidGroupsGidOKBody) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +/*GetAclsRidGroupsGidOKBody get acls rid groups gid o k body +swagger:model GetAclsRidGroupsGidOKBody +*/ +type GetAclsRidGroupsGidOKBody struct { + + // array + Array []*models.Action `json:"array"` +} + +// Validate validates this get acls rid groups gid o k body +func (o *GetAclsRidGroupsGidOKBody) Validate(formats strfmt.Registry) error { + var res []error + + if err := o.validateArray(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (o *GetAclsRidGroupsGidOKBody) validateArray(formats strfmt.Registry) error { + + if swag.IsZero(o.Array) { // not required + return nil + } + + for i := 0; i < len(o.Array); i++ { + if swag.IsZero(o.Array[i]) { // not required + continue + } + + if o.Array[i] != nil { + if err := o.Array[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("getAclsRidGroupsGidOK" + "." + "array" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// MarshalBinary interface implementation +func (o *GetAclsRidGroupsGidOKBody) MarshalBinary() ([]byte, error) { + if o == nil { + return nil, nil + } + return swag.WriteJSON(o) +} + +// UnmarshalBinary interface implementation +func (o *GetAclsRidGroupsGidOKBody) UnmarshalBinary(b []byte) error { + var res GetAclsRidGroupsGidOKBody + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *o = res + return nil +} diff --git a/dcos/iam/client/permissions/get_acls_rid_parameters.go b/dcos/iam/client/permissions/get_acls_rid_parameters.go new file mode 100644 index 0000000..e83ca83 --- /dev/null +++ b/dcos/iam/client/permissions/get_acls_rid_parameters.go @@ -0,0 +1,136 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package permissions + +// 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" + + strfmt "github.com/go-openapi/strfmt" +) + +// NewGetAclsRidParams creates a new GetAclsRidParams object +// with the default values initialized. +func NewGetAclsRidParams() *GetAclsRidParams { + var () + return &GetAclsRidParams{ + + timeout: cr.DefaultTimeout, + } +} + +// NewGetAclsRidParamsWithTimeout creates a new GetAclsRidParams object +// with the default values initialized, and the ability to set a timeout on a request +func NewGetAclsRidParamsWithTimeout(timeout time.Duration) *GetAclsRidParams { + var () + return &GetAclsRidParams{ + + timeout: timeout, + } +} + +// NewGetAclsRidParamsWithContext creates a new GetAclsRidParams object +// with the default values initialized, and the ability to set a context for a request +func NewGetAclsRidParamsWithContext(ctx context.Context) *GetAclsRidParams { + var () + return &GetAclsRidParams{ + + Context: ctx, + } +} + +// NewGetAclsRidParamsWithHTTPClient creates a new GetAclsRidParams object +// with the default values initialized, and the ability to set a custom HTTPClient for a request +func NewGetAclsRidParamsWithHTTPClient(client *http.Client) *GetAclsRidParams { + var () + return &GetAclsRidParams{ + HTTPClient: client, + } +} + +/*GetAclsRidParams contains all the parameters to send to the API endpoint +for the get acls rid operation typically these are written to a http.Request +*/ +type GetAclsRidParams struct { + + /*Rid + The ID of the resource to retrieve the ACL for. + + */ + Rid string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithTimeout adds the timeout to the get acls rid params +func (o *GetAclsRidParams) WithTimeout(timeout time.Duration) *GetAclsRidParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the get acls rid params +func (o *GetAclsRidParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the get acls rid params +func (o *GetAclsRidParams) WithContext(ctx context.Context) *GetAclsRidParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the get acls rid params +func (o *GetAclsRidParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the get acls rid params +func (o *GetAclsRidParams) WithHTTPClient(client *http.Client) *GetAclsRidParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the get acls rid params +func (o *GetAclsRidParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithRid adds the rid to the get acls rid params +func (o *GetAclsRidParams) WithRid(rid string) *GetAclsRidParams { + o.SetRid(rid) + return o +} + +// SetRid adds the rid to the get acls rid params +func (o *GetAclsRidParams) SetRid(rid string) { + o.Rid = rid +} + +// WriteToRequest writes these params to a swagger request +func (o *GetAclsRidParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param rid + if err := r.SetPathParam("rid", o.Rid); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/dcos/iam/client/permissions/get_acls_rid_permissions_parameters.go b/dcos/iam/client/permissions/get_acls_rid_permissions_parameters.go new file mode 100644 index 0000000..6215659 --- /dev/null +++ b/dcos/iam/client/permissions/get_acls_rid_permissions_parameters.go @@ -0,0 +1,136 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package permissions + +// 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" + + strfmt "github.com/go-openapi/strfmt" +) + +// NewGetAclsRidPermissionsParams creates a new GetAclsRidPermissionsParams object +// with the default values initialized. +func NewGetAclsRidPermissionsParams() *GetAclsRidPermissionsParams { + var () + return &GetAclsRidPermissionsParams{ + + timeout: cr.DefaultTimeout, + } +} + +// NewGetAclsRidPermissionsParamsWithTimeout creates a new GetAclsRidPermissionsParams object +// with the default values initialized, and the ability to set a timeout on a request +func NewGetAclsRidPermissionsParamsWithTimeout(timeout time.Duration) *GetAclsRidPermissionsParams { + var () + return &GetAclsRidPermissionsParams{ + + timeout: timeout, + } +} + +// NewGetAclsRidPermissionsParamsWithContext creates a new GetAclsRidPermissionsParams object +// with the default values initialized, and the ability to set a context for a request +func NewGetAclsRidPermissionsParamsWithContext(ctx context.Context) *GetAclsRidPermissionsParams { + var () + return &GetAclsRidPermissionsParams{ + + Context: ctx, + } +} + +// NewGetAclsRidPermissionsParamsWithHTTPClient creates a new GetAclsRidPermissionsParams object +// with the default values initialized, and the ability to set a custom HTTPClient for a request +func NewGetAclsRidPermissionsParamsWithHTTPClient(client *http.Client) *GetAclsRidPermissionsParams { + var () + return &GetAclsRidPermissionsParams{ + HTTPClient: client, + } +} + +/*GetAclsRidPermissionsParams contains all the parameters to send to the API endpoint +for the get acls rid permissions operation typically these are written to a http.Request +*/ +type GetAclsRidPermissionsParams struct { + + /*Rid + resource ID + + */ + Rid string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithTimeout adds the timeout to the get acls rid permissions params +func (o *GetAclsRidPermissionsParams) WithTimeout(timeout time.Duration) *GetAclsRidPermissionsParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the get acls rid permissions params +func (o *GetAclsRidPermissionsParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the get acls rid permissions params +func (o *GetAclsRidPermissionsParams) WithContext(ctx context.Context) *GetAclsRidPermissionsParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the get acls rid permissions params +func (o *GetAclsRidPermissionsParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the get acls rid permissions params +func (o *GetAclsRidPermissionsParams) WithHTTPClient(client *http.Client) *GetAclsRidPermissionsParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the get acls rid permissions params +func (o *GetAclsRidPermissionsParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithRid adds the rid to the get acls rid permissions params +func (o *GetAclsRidPermissionsParams) WithRid(rid string) *GetAclsRidPermissionsParams { + o.SetRid(rid) + return o +} + +// SetRid adds the rid to the get acls rid permissions params +func (o *GetAclsRidPermissionsParams) SetRid(rid string) { + o.Rid = rid +} + +// WriteToRequest writes these params to a swagger request +func (o *GetAclsRidPermissionsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param rid + if err := r.SetPathParam("rid", o.Rid); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/dcos/iam/client/permissions/get_acls_rid_permissions_responses.go b/dcos/iam/client/permissions/get_acls_rid_permissions_responses.go new file mode 100644 index 0000000..79a93a0 --- /dev/null +++ b/dcos/iam/client/permissions/get_acls_rid_permissions_responses.go @@ -0,0 +1,67 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package permissions + +// 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" + + strfmt "github.com/go-openapi/strfmt" + + models "github.com/dcos/client-go/dcos/iam/models" +) + +// GetAclsRidPermissionsReader is a Reader for the GetAclsRidPermissions structure. +type GetAclsRidPermissionsReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *GetAclsRidPermissionsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + + case 200: + result := NewGetAclsRidPermissionsOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + + default: + return nil, runtime.NewAPIError("unknown error", response, response.Code()) + } +} + +// NewGetAclsRidPermissionsOK creates a GetAclsRidPermissionsOK with default headers values +func NewGetAclsRidPermissionsOK() *GetAclsRidPermissionsOK { + return &GetAclsRidPermissionsOK{} +} + +/*GetAclsRidPermissionsOK handles this case with default header values. + +Success. +*/ +type GetAclsRidPermissionsOK struct { + Payload *models.ACLPermissions +} + +func (o *GetAclsRidPermissionsOK) Error() string { + return fmt.Sprintf("[GET /acls/{rid}/permissions][%d] getAclsRidPermissionsOK %+v", 200, o.Payload) +} + +func (o *GetAclsRidPermissionsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.ACLPermissions) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/dcos/iam/client/permissions/get_acls_rid_responses.go b/dcos/iam/client/permissions/get_acls_rid_responses.go new file mode 100644 index 0000000..7f2a5f9 --- /dev/null +++ b/dcos/iam/client/permissions/get_acls_rid_responses.go @@ -0,0 +1,67 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package permissions + +// 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" + + strfmt "github.com/go-openapi/strfmt" + + models "github.com/dcos/client-go/dcos/iam/models" +) + +// GetAclsRidReader is a Reader for the GetAclsRid structure. +type GetAclsRidReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *GetAclsRidReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + + case 200: + result := NewGetAclsRidOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + + default: + return nil, runtime.NewAPIError("unknown error", response, response.Code()) + } +} + +// NewGetAclsRidOK creates a GetAclsRidOK with default headers values +func NewGetAclsRidOK() *GetAclsRidOK { + return &GetAclsRidOK{} +} + +/*GetAclsRidOK handles this case with default header values. + +Success. +*/ +type GetAclsRidOK struct { + Payload *models.ACL +} + +func (o *GetAclsRidOK) Error() string { + return fmt.Sprintf("[GET /acls/{rid}][%d] getAclsRidOK %+v", 200, o.Payload) +} + +func (o *GetAclsRidOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.ACL) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/dcos/iam/client/permissions/get_acls_rid_users_uid_action_parameters.go b/dcos/iam/client/permissions/get_acls_rid_users_uid_action_parameters.go new file mode 100644 index 0000000..e9b1a61 --- /dev/null +++ b/dcos/iam/client/permissions/get_acls_rid_users_uid_action_parameters.go @@ -0,0 +1,178 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package permissions + +// 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" + + strfmt "github.com/go-openapi/strfmt" +) + +// NewGetAclsRidUsersUIDActionParams creates a new GetAclsRidUsersUIDActionParams object +// with the default values initialized. +func NewGetAclsRidUsersUIDActionParams() *GetAclsRidUsersUIDActionParams { + var () + return &GetAclsRidUsersUIDActionParams{ + + timeout: cr.DefaultTimeout, + } +} + +// NewGetAclsRidUsersUIDActionParamsWithTimeout creates a new GetAclsRidUsersUIDActionParams object +// with the default values initialized, and the ability to set a timeout on a request +func NewGetAclsRidUsersUIDActionParamsWithTimeout(timeout time.Duration) *GetAclsRidUsersUIDActionParams { + var () + return &GetAclsRidUsersUIDActionParams{ + + timeout: timeout, + } +} + +// NewGetAclsRidUsersUIDActionParamsWithContext creates a new GetAclsRidUsersUIDActionParams object +// with the default values initialized, and the ability to set a context for a request +func NewGetAclsRidUsersUIDActionParamsWithContext(ctx context.Context) *GetAclsRidUsersUIDActionParams { + var () + return &GetAclsRidUsersUIDActionParams{ + + Context: ctx, + } +} + +// NewGetAclsRidUsersUIDActionParamsWithHTTPClient creates a new GetAclsRidUsersUIDActionParams object +// with the default values initialized, and the ability to set a custom HTTPClient for a request +func NewGetAclsRidUsersUIDActionParamsWithHTTPClient(client *http.Client) *GetAclsRidUsersUIDActionParams { + var () + return &GetAclsRidUsersUIDActionParams{ + HTTPClient: client, + } +} + +/*GetAclsRidUsersUIDActionParams contains all the parameters to send to the API endpoint +for the get acls rid users UID action operation typically these are written to a http.Request +*/ +type GetAclsRidUsersUIDActionParams struct { + + /*Action + action name + + */ + Action string + /*Rid + resource ID + + */ + Rid string + /*UID + account ID + + */ + UID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithTimeout adds the timeout to the get acls rid users UID action params +func (o *GetAclsRidUsersUIDActionParams) WithTimeout(timeout time.Duration) *GetAclsRidUsersUIDActionParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the get acls rid users UID action params +func (o *GetAclsRidUsersUIDActionParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the get acls rid users UID action params +func (o *GetAclsRidUsersUIDActionParams) WithContext(ctx context.Context) *GetAclsRidUsersUIDActionParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the get acls rid users UID action params +func (o *GetAclsRidUsersUIDActionParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the get acls rid users UID action params +func (o *GetAclsRidUsersUIDActionParams) WithHTTPClient(client *http.Client) *GetAclsRidUsersUIDActionParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the get acls rid users UID action params +func (o *GetAclsRidUsersUIDActionParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithAction adds the action to the get acls rid users UID action params +func (o *GetAclsRidUsersUIDActionParams) WithAction(action string) *GetAclsRidUsersUIDActionParams { + o.SetAction(action) + return o +} + +// SetAction adds the action to the get acls rid users UID action params +func (o *GetAclsRidUsersUIDActionParams) SetAction(action string) { + o.Action = action +} + +// WithRid adds the rid to the get acls rid users UID action params +func (o *GetAclsRidUsersUIDActionParams) WithRid(rid string) *GetAclsRidUsersUIDActionParams { + o.SetRid(rid) + return o +} + +// SetRid adds the rid to the get acls rid users UID action params +func (o *GetAclsRidUsersUIDActionParams) SetRid(rid string) { + o.Rid = rid +} + +// WithUID adds the uid to the get acls rid users UID action params +func (o *GetAclsRidUsersUIDActionParams) WithUID(uid string) *GetAclsRidUsersUIDActionParams { + o.SetUID(uid) + return o +} + +// SetUID adds the uid to the get acls rid users UID action params +func (o *GetAclsRidUsersUIDActionParams) SetUID(uid string) { + o.UID = uid +} + +// WriteToRequest writes these params to a swagger request +func (o *GetAclsRidUsersUIDActionParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param action + if err := r.SetPathParam("action", o.Action); err != nil { + return err + } + + // path param rid + if err := r.SetPathParam("rid", o.Rid); err != nil { + return err + } + + // path param uid + if err := r.SetPathParam("uid", o.UID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/dcos/iam/client/permissions/get_acls_rid_users_uid_action_responses.go b/dcos/iam/client/permissions/get_acls_rid_users_uid_action_responses.go new file mode 100644 index 0000000..0ae226f --- /dev/null +++ b/dcos/iam/client/permissions/get_acls_rid_users_uid_action_responses.go @@ -0,0 +1,67 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package permissions + +// 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" + + strfmt "github.com/go-openapi/strfmt" + + models "github.com/dcos/client-go/dcos/iam/models" +) + +// GetAclsRidUsersUIDActionReader is a Reader for the GetAclsRidUsersUIDAction structure. +type GetAclsRidUsersUIDActionReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *GetAclsRidUsersUIDActionReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + + case 200: + result := NewGetAclsRidUsersUIDActionOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + + default: + return nil, runtime.NewAPIError("unknown error", response, response.Code()) + } +} + +// NewGetAclsRidUsersUIDActionOK creates a GetAclsRidUsersUIDActionOK with default headers values +func NewGetAclsRidUsersUIDActionOK() *GetAclsRidUsersUIDActionOK { + return &GetAclsRidUsersUIDActionOK{} +} + +/*GetAclsRidUsersUIDActionOK handles this case with default header values. + +Boolean answer in JSON response body. +*/ +type GetAclsRidUsersUIDActionOK struct { + Payload *models.ActionAllowed +} + +func (o *GetAclsRidUsersUIDActionOK) Error() string { + return fmt.Sprintf("[GET /acls/{rid}/users/{uid}/{action}][%d] getAclsRidUsersUidActionOK %+v", 200, o.Payload) +} + +func (o *GetAclsRidUsersUIDActionOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.ActionAllowed) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/dcos/iam/client/permissions/get_acls_rid_users_uid_parameters.go b/dcos/iam/client/permissions/get_acls_rid_users_uid_parameters.go new file mode 100644 index 0000000..44adf65 --- /dev/null +++ b/dcos/iam/client/permissions/get_acls_rid_users_uid_parameters.go @@ -0,0 +1,157 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package permissions + +// 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" + + strfmt "github.com/go-openapi/strfmt" +) + +// NewGetAclsRidUsersUIDParams creates a new GetAclsRidUsersUIDParams object +// with the default values initialized. +func NewGetAclsRidUsersUIDParams() *GetAclsRidUsersUIDParams { + var () + return &GetAclsRidUsersUIDParams{ + + timeout: cr.DefaultTimeout, + } +} + +// NewGetAclsRidUsersUIDParamsWithTimeout creates a new GetAclsRidUsersUIDParams object +// with the default values initialized, and the ability to set a timeout on a request +func NewGetAclsRidUsersUIDParamsWithTimeout(timeout time.Duration) *GetAclsRidUsersUIDParams { + var () + return &GetAclsRidUsersUIDParams{ + + timeout: timeout, + } +} + +// NewGetAclsRidUsersUIDParamsWithContext creates a new GetAclsRidUsersUIDParams object +// with the default values initialized, and the ability to set a context for a request +func NewGetAclsRidUsersUIDParamsWithContext(ctx context.Context) *GetAclsRidUsersUIDParams { + var () + return &GetAclsRidUsersUIDParams{ + + Context: ctx, + } +} + +// NewGetAclsRidUsersUIDParamsWithHTTPClient creates a new GetAclsRidUsersUIDParams object +// with the default values initialized, and the ability to set a custom HTTPClient for a request +func NewGetAclsRidUsersUIDParamsWithHTTPClient(client *http.Client) *GetAclsRidUsersUIDParams { + var () + return &GetAclsRidUsersUIDParams{ + HTTPClient: client, + } +} + +/*GetAclsRidUsersUIDParams contains all the parameters to send to the API endpoint +for the get acls rid users UID operation typically these are written to a http.Request +*/ +type GetAclsRidUsersUIDParams struct { + + /*Rid + resource ID + + */ + Rid string + /*UID + account ID + + */ + UID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithTimeout adds the timeout to the get acls rid users UID params +func (o *GetAclsRidUsersUIDParams) WithTimeout(timeout time.Duration) *GetAclsRidUsersUIDParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the get acls rid users UID params +func (o *GetAclsRidUsersUIDParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the get acls rid users UID params +func (o *GetAclsRidUsersUIDParams) WithContext(ctx context.Context) *GetAclsRidUsersUIDParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the get acls rid users UID params +func (o *GetAclsRidUsersUIDParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the get acls rid users UID params +func (o *GetAclsRidUsersUIDParams) WithHTTPClient(client *http.Client) *GetAclsRidUsersUIDParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the get acls rid users UID params +func (o *GetAclsRidUsersUIDParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithRid adds the rid to the get acls rid users UID params +func (o *GetAclsRidUsersUIDParams) WithRid(rid string) *GetAclsRidUsersUIDParams { + o.SetRid(rid) + return o +} + +// SetRid adds the rid to the get acls rid users UID params +func (o *GetAclsRidUsersUIDParams) SetRid(rid string) { + o.Rid = rid +} + +// WithUID adds the uid to the get acls rid users UID params +func (o *GetAclsRidUsersUIDParams) WithUID(uid string) *GetAclsRidUsersUIDParams { + o.SetUID(uid) + return o +} + +// SetUID adds the uid to the get acls rid users UID params +func (o *GetAclsRidUsersUIDParams) SetUID(uid string) { + o.UID = uid +} + +// WriteToRequest writes these params to a swagger request +func (o *GetAclsRidUsersUIDParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param rid + if err := r.SetPathParam("rid", o.Rid); err != nil { + return err + } + + // path param uid + if err := r.SetPathParam("uid", o.UID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/dcos/iam/client/permissions/get_acls_rid_users_uid_responses.go b/dcos/iam/client/permissions/get_acls_rid_users_uid_responses.go new file mode 100644 index 0000000..6dbc381 --- /dev/null +++ b/dcos/iam/client/permissions/get_acls_rid_users_uid_responses.go @@ -0,0 +1,136 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package permissions + +// 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" + "strconv" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + "github.com/go-openapi/swag" + + strfmt "github.com/go-openapi/strfmt" + + models "github.com/dcos/client-go/dcos/iam/models" +) + +// GetAclsRidUsersUIDReader is a Reader for the GetAclsRidUsersUID structure. +type GetAclsRidUsersUIDReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *GetAclsRidUsersUIDReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + + case 200: + result := NewGetAclsRidUsersUIDOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + + default: + return nil, runtime.NewAPIError("unknown error", response, response.Code()) + } +} + +// NewGetAclsRidUsersUIDOK creates a GetAclsRidUsersUIDOK with default headers values +func NewGetAclsRidUsersUIDOK() *GetAclsRidUsersUIDOK { + return &GetAclsRidUsersUIDOK{} +} + +/*GetAclsRidUsersUIDOK handles this case with default header values. + +Success. +*/ +type GetAclsRidUsersUIDOK struct { + Payload *GetAclsRidUsersUIDOKBody +} + +func (o *GetAclsRidUsersUIDOK) Error() string { + return fmt.Sprintf("[GET /acls/{rid}/users/{uid}][%d] getAclsRidUsersUidOK %+v", 200, o.Payload) +} + +func (o *GetAclsRidUsersUIDOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(GetAclsRidUsersUIDOKBody) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +/*GetAclsRidUsersUIDOKBody get acls rid users UID o k body +swagger:model GetAclsRidUsersUIDOKBody +*/ +type GetAclsRidUsersUIDOKBody struct { + + // array + Array []*models.Action `json:"array"` +} + +// Validate validates this get acls rid users UID o k body +func (o *GetAclsRidUsersUIDOKBody) Validate(formats strfmt.Registry) error { + var res []error + + if err := o.validateArray(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (o *GetAclsRidUsersUIDOKBody) validateArray(formats strfmt.Registry) error { + + if swag.IsZero(o.Array) { // not required + return nil + } + + for i := 0; i < len(o.Array); i++ { + if swag.IsZero(o.Array[i]) { // not required + continue + } + + if o.Array[i] != nil { + if err := o.Array[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("getAclsRidUsersUidOK" + "." + "array" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// MarshalBinary interface implementation +func (o *GetAclsRidUsersUIDOKBody) MarshalBinary() ([]byte, error) { + if o == nil { + return nil, nil + } + return swag.WriteJSON(o) +} + +// UnmarshalBinary interface implementation +func (o *GetAclsRidUsersUIDOKBody) UnmarshalBinary(b []byte) error { + var res GetAclsRidUsersUIDOKBody + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *o = res + return nil +} diff --git a/dcos/iam/client/permissions/patch_acls_rid_parameters.go b/dcos/iam/client/permissions/patch_acls_rid_parameters.go new file mode 100644 index 0000000..9caad0e --- /dev/null +++ b/dcos/iam/client/permissions/patch_acls_rid_parameters.go @@ -0,0 +1,160 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package permissions + +// 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" + + strfmt "github.com/go-openapi/strfmt" + + models "github.com/dcos/client-go/dcos/iam/models" +) + +// NewPatchAclsRidParams creates a new PatchAclsRidParams object +// with the default values initialized. +func NewPatchAclsRidParams() *PatchAclsRidParams { + var () + return &PatchAclsRidParams{ + + timeout: cr.DefaultTimeout, + } +} + +// NewPatchAclsRidParamsWithTimeout creates a new PatchAclsRidParams object +// with the default values initialized, and the ability to set a timeout on a request +func NewPatchAclsRidParamsWithTimeout(timeout time.Duration) *PatchAclsRidParams { + var () + return &PatchAclsRidParams{ + + timeout: timeout, + } +} + +// NewPatchAclsRidParamsWithContext creates a new PatchAclsRidParams object +// with the default values initialized, and the ability to set a context for a request +func NewPatchAclsRidParamsWithContext(ctx context.Context) *PatchAclsRidParams { + var () + return &PatchAclsRidParams{ + + Context: ctx, + } +} + +// NewPatchAclsRidParamsWithHTTPClient creates a new PatchAclsRidParams object +// with the default values initialized, and the ability to set a custom HTTPClient for a request +func NewPatchAclsRidParamsWithHTTPClient(client *http.Client) *PatchAclsRidParams { + var () + return &PatchAclsRidParams{ + HTTPClient: client, + } +} + +/*PatchAclsRidParams contains all the parameters to send to the API endpoint +for the patch acls rid operation typically these are written to a http.Request +*/ +type PatchAclsRidParams struct { + + /*ACLUpdateObject + New ACL. + + */ + ACLUpdateObject *models.ACLUpdate + /*Rid + The ID of the resource for which the ACL should be created. + + */ + Rid string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithTimeout adds the timeout to the patch acls rid params +func (o *PatchAclsRidParams) WithTimeout(timeout time.Duration) *PatchAclsRidParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the patch acls rid params +func (o *PatchAclsRidParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the patch acls rid params +func (o *PatchAclsRidParams) WithContext(ctx context.Context) *PatchAclsRidParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the patch acls rid params +func (o *PatchAclsRidParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the patch acls rid params +func (o *PatchAclsRidParams) WithHTTPClient(client *http.Client) *PatchAclsRidParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the patch acls rid params +func (o *PatchAclsRidParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithACLUpdateObject adds the aCLUpdateObject to the patch acls rid params +func (o *PatchAclsRidParams) WithACLUpdateObject(aCLUpdateObject *models.ACLUpdate) *PatchAclsRidParams { + o.SetACLUpdateObject(aCLUpdateObject) + return o +} + +// SetACLUpdateObject adds the aclUpdateObject to the patch acls rid params +func (o *PatchAclsRidParams) SetACLUpdateObject(aCLUpdateObject *models.ACLUpdate) { + o.ACLUpdateObject = aCLUpdateObject +} + +// WithRid adds the rid to the patch acls rid params +func (o *PatchAclsRidParams) WithRid(rid string) *PatchAclsRidParams { + o.SetRid(rid) + return o +} + +// SetRid adds the rid to the patch acls rid params +func (o *PatchAclsRidParams) SetRid(rid string) { + o.Rid = rid +} + +// WriteToRequest writes these params to a swagger request +func (o *PatchAclsRidParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.ACLUpdateObject != nil { + if err := r.SetBodyParam(o.ACLUpdateObject); err != nil { + return err + } + } + + // path param rid + if err := r.SetPathParam("rid", o.Rid); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/dcos/iam/client/permissions/patch_acls_rid_responses.go b/dcos/iam/client/permissions/patch_acls_rid_responses.go new file mode 100644 index 0000000..1b8644d --- /dev/null +++ b/dcos/iam/client/permissions/patch_acls_rid_responses.go @@ -0,0 +1,56 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package permissions + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + + "github.com/go-openapi/runtime" + + strfmt "github.com/go-openapi/strfmt" +) + +// PatchAclsRidReader is a Reader for the PatchAclsRid structure. +type PatchAclsRidReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PatchAclsRidReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + + case 204: + result := NewPatchAclsRidNoContent() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + + default: + return nil, runtime.NewAPIError("unknown error", response, response.Code()) + } +} + +// NewPatchAclsRidNoContent creates a PatchAclsRidNoContent with default headers values +func NewPatchAclsRidNoContent() *PatchAclsRidNoContent { + return &PatchAclsRidNoContent{} +} + +/*PatchAclsRidNoContent handles this case with default header values. + +Success. +*/ +type PatchAclsRidNoContent struct { +} + +func (o *PatchAclsRidNoContent) Error() string { + return fmt.Sprintf("[PATCH /acls/{rid}][%d] patchAclsRidNoContent ", 204) +} + +func (o *PatchAclsRidNoContent) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/dcos/iam/client/permissions/permissions_client.go b/dcos/iam/client/permissions/permissions_client.go new file mode 100644 index 0000000..4a56fc3 --- /dev/null +++ b/dcos/iam/client/permissions/permissions_client.go @@ -0,0 +1,510 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package permissions + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "github.com/go-openapi/runtime" + + strfmt "github.com/go-openapi/strfmt" +) + +// New creates a new permissions API client. +func New(transport runtime.ClientTransport, formats strfmt.Registry) *Client { + return &Client{transport: transport, formats: formats} +} + +/* +Client for permissions API +*/ +type Client struct { + transport runtime.ClientTransport + formats strfmt.Registry +} + +/* +DeleteAclsRid deletes ACL for a certain resource + +Delete ACL of resource with ID `rid`. +*/ +func (a *Client) DeleteAclsRid(params *DeleteAclsRidParams) (*DeleteAclsRidNoContent, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewDeleteAclsRidParams() + } + + result, err := a.transport.Submit(&runtime.ClientOperation{ + ID: "DeleteAclsRid", + Method: "DELETE", + PathPattern: "/acls/{rid}", + ProducesMediaTypes: []string{""}, + ConsumesMediaTypes: []string{""}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &DeleteAclsRidReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + }) + if err != nil { + return nil, err + } + return result.(*DeleteAclsRidNoContent), nil + +} + +/* +DeleteAclsRidGroupsGid forbids all actions of given group to given resource + +Forbid all actions of given group to given resource. +*/ +func (a *Client) DeleteAclsRidGroupsGid(params *DeleteAclsRidGroupsGidParams) (*DeleteAclsRidGroupsGidNoContent, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewDeleteAclsRidGroupsGidParams() + } + + result, err := a.transport.Submit(&runtime.ClientOperation{ + ID: "DeleteAclsRidGroupsGid", + Method: "DELETE", + PathPattern: "/acls/{rid}/groups/{gid}", + ProducesMediaTypes: []string{""}, + ConsumesMediaTypes: []string{""}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &DeleteAclsRidGroupsGidReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + }) + if err != nil { + return nil, err + } + return result.(*DeleteAclsRidGroupsGidNoContent), nil + +} + +/* +DeleteAclsRidGroupsGidAction forbids single action for given resource and group + +Forbid single action for given resource and group. +*/ +func (a *Client) DeleteAclsRidGroupsGidAction(params *DeleteAclsRidGroupsGidActionParams) (*DeleteAclsRidGroupsGidActionNoContent, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewDeleteAclsRidGroupsGidActionParams() + } + + result, err := a.transport.Submit(&runtime.ClientOperation{ + ID: "DeleteAclsRidGroupsGidAction", + Method: "DELETE", + PathPattern: "/acls/{rid}/groups/{gid}/{action}", + ProducesMediaTypes: []string{""}, + ConsumesMediaTypes: []string{""}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &DeleteAclsRidGroupsGidActionReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + }) + if err != nil { + return nil, err + } + return result.(*DeleteAclsRidGroupsGidActionNoContent), nil + +} + +/* +DeleteAclsRidUsersUID forbids all actions of given account to given resource + +Forbid all actions of given account to given resource. +*/ +func (a *Client) DeleteAclsRidUsersUID(params *DeleteAclsRidUsersUIDParams) (*DeleteAclsRidUsersUIDNoContent, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewDeleteAclsRidUsersUIDParams() + } + + result, err := a.transport.Submit(&runtime.ClientOperation{ + ID: "DeleteAclsRidUsersUID", + Method: "DELETE", + PathPattern: "/acls/{rid}/users/{uid}", + ProducesMediaTypes: []string{""}, + ConsumesMediaTypes: []string{""}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &DeleteAclsRidUsersUIDReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + }) + if err != nil { + return nil, err + } + return result.(*DeleteAclsRidUsersUIDNoContent), nil + +} + +/* +DeleteAclsRidUsersUIDAction forbids single action for given account and resource + +Forbid single action for given account and resource. +*/ +func (a *Client) DeleteAclsRidUsersUIDAction(params *DeleteAclsRidUsersUIDActionParams) (*DeleteAclsRidUsersUIDActionNoContent, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewDeleteAclsRidUsersUIDActionParams() + } + + result, err := a.transport.Submit(&runtime.ClientOperation{ + ID: "DeleteAclsRidUsersUIDAction", + Method: "DELETE", + PathPattern: "/acls/{rid}/users/{uid}/{action}", + ProducesMediaTypes: []string{""}, + ConsumesMediaTypes: []string{""}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &DeleteAclsRidUsersUIDActionReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + }) + if err != nil { + return nil, err + } + return result.(*DeleteAclsRidUsersUIDActionNoContent), nil + +} + +/* +GetAcls retrieves all ACL objects + +Get array of `ACL` objects. +*/ +func (a *Client) GetAcls(params *GetAclsParams) (*GetAclsOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewGetAclsParams() + } + + result, err := a.transport.Submit(&runtime.ClientOperation{ + ID: "GetAcls", + Method: "GET", + PathPattern: "/acls", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{""}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &GetAclsReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + }) + if err != nil { + return nil, err + } + return result.(*GetAclsOK), nil + +} + +/* +GetAclsRid retrieves ACL for a certain resource + +Retrieve single `ACL` object, for a specific resource. +*/ +func (a *Client) GetAclsRid(params *GetAclsRidParams) (*GetAclsRidOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewGetAclsRidParams() + } + + result, err := a.transport.Submit(&runtime.ClientOperation{ + ID: "GetAclsRid", + Method: "GET", + PathPattern: "/acls/{rid}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{""}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &GetAclsRidReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + }) + if err != nil { + return nil, err + } + return result.(*GetAclsRidOK), nil + +} + +/* +GetAclsRidGroupsGid gets allowed actions for given resource and group + +Get allowed actions for given resource and group. +*/ +func (a *Client) GetAclsRidGroupsGid(params *GetAclsRidGroupsGidParams) (*GetAclsRidGroupsGidOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewGetAclsRidGroupsGidParams() + } + + result, err := a.transport.Submit(&runtime.ClientOperation{ + ID: "GetAclsRidGroupsGid", + Method: "GET", + PathPattern: "/acls/{rid}/groups/{gid}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{""}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &GetAclsRidGroupsGidReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + }) + if err != nil { + return nil, err + } + return result.(*GetAclsRidGroupsGidOK), nil + +} + +/* +GetAclsRidGroupsGidAction queries whether action is allowed or not + +Query whether action is allowed or not. +*/ +func (a *Client) GetAclsRidGroupsGidAction(params *GetAclsRidGroupsGidActionParams) (*GetAclsRidGroupsGidActionOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewGetAclsRidGroupsGidActionParams() + } + + result, err := a.transport.Submit(&runtime.ClientOperation{ + ID: "GetAclsRidGroupsGidAction", + Method: "GET", + PathPattern: "/acls/{rid}/groups/{gid}/{action}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{""}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &GetAclsRidGroupsGidActionReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + }) + if err != nil { + return nil, err + } + return result.(*GetAclsRidGroupsGidActionOK), nil + +} + +/* +GetAclsRidPermissions retrieves all permissions for resource + +Retrieve all permissions that are set for a specific resource. +*/ +func (a *Client) GetAclsRidPermissions(params *GetAclsRidPermissionsParams) (*GetAclsRidPermissionsOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewGetAclsRidPermissionsParams() + } + + result, err := a.transport.Submit(&runtime.ClientOperation{ + ID: "GetAclsRidPermissions", + Method: "GET", + PathPattern: "/acls/{rid}/permissions", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{""}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &GetAclsRidPermissionsReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + }) + if err != nil { + return nil, err + } + return result.(*GetAclsRidPermissionsOK), nil + +} + +/* +GetAclsRidUsersUID gets allowed actions for given resource and user + +Get allowed actions for given resource and user. +*/ +func (a *Client) GetAclsRidUsersUID(params *GetAclsRidUsersUIDParams) (*GetAclsRidUsersUIDOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewGetAclsRidUsersUIDParams() + } + + result, err := a.transport.Submit(&runtime.ClientOperation{ + ID: "GetAclsRidUsersUID", + Method: "GET", + PathPattern: "/acls/{rid}/users/{uid}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{""}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &GetAclsRidUsersUIDReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + }) + if err != nil { + return nil, err + } + return result.(*GetAclsRidUsersUIDOK), nil + +} + +/* +GetAclsRidUsersUIDAction queries whether action is allowed or not + +Query whether action is allowed or not. +*/ +func (a *Client) GetAclsRidUsersUIDAction(params *GetAclsRidUsersUIDActionParams) (*GetAclsRidUsersUIDActionOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewGetAclsRidUsersUIDActionParams() + } + + result, err := a.transport.Submit(&runtime.ClientOperation{ + ID: "GetAclsRidUsersUIDAction", + Method: "GET", + PathPattern: "/acls/{rid}/users/{uid}/{action}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{""}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &GetAclsRidUsersUIDActionReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + }) + if err != nil { + return nil, err + } + return result.(*GetAclsRidUsersUIDActionOK), nil + +} + +/* +PatchAclsRid updates ACL for a certain resource + +Update ACL for resource with ID `rid`. +*/ +func (a *Client) PatchAclsRid(params *PatchAclsRidParams) (*PatchAclsRidNoContent, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPatchAclsRidParams() + } + + result, err := a.transport.Submit(&runtime.ClientOperation{ + ID: "PatchAclsRid", + Method: "PATCH", + PathPattern: "/acls/{rid}", + ProducesMediaTypes: []string{""}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &PatchAclsRidReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + }) + if err != nil { + return nil, err + } + return result.(*PatchAclsRidNoContent), nil + +} + +/* +PutAclsRid creates ACL for a certain resource + +Create new ACL for resource with ID `rid` (description in body, no permissions by default). +*/ +func (a *Client) PutAclsRid(params *PutAclsRidParams) (*PutAclsRidCreated, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPutAclsRidParams() + } + + result, err := a.transport.Submit(&runtime.ClientOperation{ + ID: "PutAclsRid", + Method: "PUT", + PathPattern: "/acls/{rid}", + ProducesMediaTypes: []string{""}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &PutAclsRidReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + }) + if err != nil { + return nil, err + } + return result.(*PutAclsRidCreated), nil + +} + +/* +PutAclsRidGroupsGidAction permits single action for given resource and group + +Permit single action for given resource and group. +*/ +func (a *Client) PutAclsRidGroupsGidAction(params *PutAclsRidGroupsGidActionParams) (*PutAclsRidGroupsGidActionNoContent, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPutAclsRidGroupsGidActionParams() + } + + result, err := a.transport.Submit(&runtime.ClientOperation{ + ID: "PutAclsRidGroupsGidAction", + Method: "PUT", + PathPattern: "/acls/{rid}/groups/{gid}/{action}", + ProducesMediaTypes: []string{""}, + ConsumesMediaTypes: []string{""}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &PutAclsRidGroupsGidActionReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + }) + if err != nil { + return nil, err + } + return result.(*PutAclsRidGroupsGidActionNoContent), nil + +} + +/* +PutAclsRidUsersUIDAction permits single action for given account and resource + +Permit single action for given account and resource. +*/ +func (a *Client) PutAclsRidUsersUIDAction(params *PutAclsRidUsersUIDActionParams) (*PutAclsRidUsersUIDActionNoContent, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPutAclsRidUsersUIDActionParams() + } + + result, err := a.transport.Submit(&runtime.ClientOperation{ + ID: "PutAclsRidUsersUIDAction", + Method: "PUT", + PathPattern: "/acls/{rid}/users/{uid}/{action}", + ProducesMediaTypes: []string{""}, + ConsumesMediaTypes: []string{""}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &PutAclsRidUsersUIDActionReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + }) + if err != nil { + return nil, err + } + return result.(*PutAclsRidUsersUIDActionNoContent), nil + +} + +// SetTransport changes the transport on the client +func (a *Client) SetTransport(transport runtime.ClientTransport) { + a.transport = transport +} diff --git a/dcos/iam/client/permissions/put_acls_rid_groups_gid_action_parameters.go b/dcos/iam/client/permissions/put_acls_rid_groups_gid_action_parameters.go new file mode 100644 index 0000000..b4c06d4 --- /dev/null +++ b/dcos/iam/client/permissions/put_acls_rid_groups_gid_action_parameters.go @@ -0,0 +1,178 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package permissions + +// 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" + + strfmt "github.com/go-openapi/strfmt" +) + +// NewPutAclsRidGroupsGidActionParams creates a new PutAclsRidGroupsGidActionParams object +// with the default values initialized. +func NewPutAclsRidGroupsGidActionParams() *PutAclsRidGroupsGidActionParams { + var () + return &PutAclsRidGroupsGidActionParams{ + + timeout: cr.DefaultTimeout, + } +} + +// NewPutAclsRidGroupsGidActionParamsWithTimeout creates a new PutAclsRidGroupsGidActionParams object +// with the default values initialized, and the ability to set a timeout on a request +func NewPutAclsRidGroupsGidActionParamsWithTimeout(timeout time.Duration) *PutAclsRidGroupsGidActionParams { + var () + return &PutAclsRidGroupsGidActionParams{ + + timeout: timeout, + } +} + +// NewPutAclsRidGroupsGidActionParamsWithContext creates a new PutAclsRidGroupsGidActionParams object +// with the default values initialized, and the ability to set a context for a request +func NewPutAclsRidGroupsGidActionParamsWithContext(ctx context.Context) *PutAclsRidGroupsGidActionParams { + var () + return &PutAclsRidGroupsGidActionParams{ + + Context: ctx, + } +} + +// NewPutAclsRidGroupsGidActionParamsWithHTTPClient creates a new PutAclsRidGroupsGidActionParams object +// with the default values initialized, and the ability to set a custom HTTPClient for a request +func NewPutAclsRidGroupsGidActionParamsWithHTTPClient(client *http.Client) *PutAclsRidGroupsGidActionParams { + var () + return &PutAclsRidGroupsGidActionParams{ + HTTPClient: client, + } +} + +/*PutAclsRidGroupsGidActionParams contains all the parameters to send to the API endpoint +for the put acls rid groups gid action operation typically these are written to a http.Request +*/ +type PutAclsRidGroupsGidActionParams struct { + + /*Action + action name + + */ + Action string + /*Gid + group ID. + + */ + Gid string + /*Rid + resource ID. + + */ + Rid string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithTimeout adds the timeout to the put acls rid groups gid action params +func (o *PutAclsRidGroupsGidActionParams) WithTimeout(timeout time.Duration) *PutAclsRidGroupsGidActionParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the put acls rid groups gid action params +func (o *PutAclsRidGroupsGidActionParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the put acls rid groups gid action params +func (o *PutAclsRidGroupsGidActionParams) WithContext(ctx context.Context) *PutAclsRidGroupsGidActionParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the put acls rid groups gid action params +func (o *PutAclsRidGroupsGidActionParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the put acls rid groups gid action params +func (o *PutAclsRidGroupsGidActionParams) WithHTTPClient(client *http.Client) *PutAclsRidGroupsGidActionParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the put acls rid groups gid action params +func (o *PutAclsRidGroupsGidActionParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithAction adds the action to the put acls rid groups gid action params +func (o *PutAclsRidGroupsGidActionParams) WithAction(action string) *PutAclsRidGroupsGidActionParams { + o.SetAction(action) + return o +} + +// SetAction adds the action to the put acls rid groups gid action params +func (o *PutAclsRidGroupsGidActionParams) SetAction(action string) { + o.Action = action +} + +// WithGid adds the gid to the put acls rid groups gid action params +func (o *PutAclsRidGroupsGidActionParams) WithGid(gid string) *PutAclsRidGroupsGidActionParams { + o.SetGid(gid) + return o +} + +// SetGid adds the gid to the put acls rid groups gid action params +func (o *PutAclsRidGroupsGidActionParams) SetGid(gid string) { + o.Gid = gid +} + +// WithRid adds the rid to the put acls rid groups gid action params +func (o *PutAclsRidGroupsGidActionParams) WithRid(rid string) *PutAclsRidGroupsGidActionParams { + o.SetRid(rid) + return o +} + +// SetRid adds the rid to the put acls rid groups gid action params +func (o *PutAclsRidGroupsGidActionParams) SetRid(rid string) { + o.Rid = rid +} + +// WriteToRequest writes these params to a swagger request +func (o *PutAclsRidGroupsGidActionParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param action + if err := r.SetPathParam("action", o.Action); err != nil { + return err + } + + // path param gid + if err := r.SetPathParam("gid", o.Gid); err != nil { + return err + } + + // path param rid + if err := r.SetPathParam("rid", o.Rid); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/dcos/iam/client/permissions/put_acls_rid_groups_gid_action_responses.go b/dcos/iam/client/permissions/put_acls_rid_groups_gid_action_responses.go new file mode 100644 index 0000000..fd2c38a --- /dev/null +++ b/dcos/iam/client/permissions/put_acls_rid_groups_gid_action_responses.go @@ -0,0 +1,56 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package permissions + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + + "github.com/go-openapi/runtime" + + strfmt "github.com/go-openapi/strfmt" +) + +// PutAclsRidGroupsGidActionReader is a Reader for the PutAclsRidGroupsGidAction structure. +type PutAclsRidGroupsGidActionReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PutAclsRidGroupsGidActionReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + + case 204: + result := NewPutAclsRidGroupsGidActionNoContent() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + + default: + return nil, runtime.NewAPIError("unknown error", response, response.Code()) + } +} + +// NewPutAclsRidGroupsGidActionNoContent creates a PutAclsRidGroupsGidActionNoContent with default headers values +func NewPutAclsRidGroupsGidActionNoContent() *PutAclsRidGroupsGidActionNoContent { + return &PutAclsRidGroupsGidActionNoContent{} +} + +/*PutAclsRidGroupsGidActionNoContent handles this case with default header values. + +Success. +*/ +type PutAclsRidGroupsGidActionNoContent struct { +} + +func (o *PutAclsRidGroupsGidActionNoContent) Error() string { + return fmt.Sprintf("[PUT /acls/{rid}/groups/{gid}/{action}][%d] putAclsRidGroupsGidActionNoContent ", 204) +} + +func (o *PutAclsRidGroupsGidActionNoContent) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/dcos/iam/client/permissions/put_acls_rid_parameters.go b/dcos/iam/client/permissions/put_acls_rid_parameters.go new file mode 100644 index 0000000..0bc4188 --- /dev/null +++ b/dcos/iam/client/permissions/put_acls_rid_parameters.go @@ -0,0 +1,157 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package permissions + +// 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" + + strfmt "github.com/go-openapi/strfmt" + + models "github.com/dcos/client-go/dcos/iam/models" +) + +// NewPutAclsRidParams creates a new PutAclsRidParams object +// with the default values initialized. +func NewPutAclsRidParams() *PutAclsRidParams { + var () + return &PutAclsRidParams{ + + timeout: cr.DefaultTimeout, + } +} + +// NewPutAclsRidParamsWithTimeout creates a new PutAclsRidParams object +// with the default values initialized, and the ability to set a timeout on a request +func NewPutAclsRidParamsWithTimeout(timeout time.Duration) *PutAclsRidParams { + var () + return &PutAclsRidParams{ + + timeout: timeout, + } +} + +// NewPutAclsRidParamsWithContext creates a new PutAclsRidParams object +// with the default values initialized, and the ability to set a context for a request +func NewPutAclsRidParamsWithContext(ctx context.Context) *PutAclsRidParams { + var () + return &PutAclsRidParams{ + + Context: ctx, + } +} + +// NewPutAclsRidParamsWithHTTPClient creates a new PutAclsRidParams object +// with the default values initialized, and the ability to set a custom HTTPClient for a request +func NewPutAclsRidParamsWithHTTPClient(client *http.Client) *PutAclsRidParams { + var () + return &PutAclsRidParams{ + HTTPClient: client, + } +} + +/*PutAclsRidParams contains all the parameters to send to the API endpoint +for the put acls rid operation typically these are written to a http.Request +*/ +type PutAclsRidParams struct { + + /*ACL*/ + ACL *models.ACLCreate + /*Rid + The ID of the resource for which the ACL should be created. + + */ + Rid string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithTimeout adds the timeout to the put acls rid params +func (o *PutAclsRidParams) WithTimeout(timeout time.Duration) *PutAclsRidParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the put acls rid params +func (o *PutAclsRidParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the put acls rid params +func (o *PutAclsRidParams) WithContext(ctx context.Context) *PutAclsRidParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the put acls rid params +func (o *PutAclsRidParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the put acls rid params +func (o *PutAclsRidParams) WithHTTPClient(client *http.Client) *PutAclsRidParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the put acls rid params +func (o *PutAclsRidParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithACL adds the acl to the put acls rid params +func (o *PutAclsRidParams) WithACL(acl *models.ACLCreate) *PutAclsRidParams { + o.SetACL(acl) + return o +} + +// SetACL adds the acl to the put acls rid params +func (o *PutAclsRidParams) SetACL(acl *models.ACLCreate) { + o.ACL = acl +} + +// WithRid adds the rid to the put acls rid params +func (o *PutAclsRidParams) WithRid(rid string) *PutAclsRidParams { + o.SetRid(rid) + return o +} + +// SetRid adds the rid to the put acls rid params +func (o *PutAclsRidParams) SetRid(rid string) { + o.Rid = rid +} + +// WriteToRequest writes these params to a swagger request +func (o *PutAclsRidParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.ACL != nil { + if err := r.SetBodyParam(o.ACL); err != nil { + return err + } + } + + // path param rid + if err := r.SetPathParam("rid", o.Rid); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/dcos/iam/client/permissions/put_acls_rid_responses.go b/dcos/iam/client/permissions/put_acls_rid_responses.go new file mode 100644 index 0000000..e752fab --- /dev/null +++ b/dcos/iam/client/permissions/put_acls_rid_responses.go @@ -0,0 +1,84 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package permissions + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + + "github.com/go-openapi/runtime" + + strfmt "github.com/go-openapi/strfmt" +) + +// PutAclsRidReader is a Reader for the PutAclsRid structure. +type PutAclsRidReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PutAclsRidReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + + case 201: + result := NewPutAclsRidCreated() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + + case 409: + result := NewPutAclsRidConflict() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + + default: + return nil, runtime.NewAPIError("unknown error", response, response.Code()) + } +} + +// NewPutAclsRidCreated creates a PutAclsRidCreated with default headers values +func NewPutAclsRidCreated() *PutAclsRidCreated { + return &PutAclsRidCreated{} +} + +/*PutAclsRidCreated handles this case with default header values. + +ACL created. +*/ +type PutAclsRidCreated struct { +} + +func (o *PutAclsRidCreated) Error() string { + return fmt.Sprintf("[PUT /acls/{rid}][%d] putAclsRidCreated ", 201) +} + +func (o *PutAclsRidCreated) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewPutAclsRidConflict creates a PutAclsRidConflict with default headers values +func NewPutAclsRidConflict() *PutAclsRidConflict { + return &PutAclsRidConflict{} +} + +/*PutAclsRidConflict handles this case with default header values. + +Already exists (this resource already has an ACL set). +*/ +type PutAclsRidConflict struct { +} + +func (o *PutAclsRidConflict) Error() string { + return fmt.Sprintf("[PUT /acls/{rid}][%d] putAclsRidConflict ", 409) +} + +func (o *PutAclsRidConflict) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/dcos/iam/client/permissions/put_acls_rid_users_uid_action_parameters.go b/dcos/iam/client/permissions/put_acls_rid_users_uid_action_parameters.go new file mode 100644 index 0000000..4b56e48 --- /dev/null +++ b/dcos/iam/client/permissions/put_acls_rid_users_uid_action_parameters.go @@ -0,0 +1,178 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package permissions + +// 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" + + strfmt "github.com/go-openapi/strfmt" +) + +// NewPutAclsRidUsersUIDActionParams creates a new PutAclsRidUsersUIDActionParams object +// with the default values initialized. +func NewPutAclsRidUsersUIDActionParams() *PutAclsRidUsersUIDActionParams { + var () + return &PutAclsRidUsersUIDActionParams{ + + timeout: cr.DefaultTimeout, + } +} + +// NewPutAclsRidUsersUIDActionParamsWithTimeout creates a new PutAclsRidUsersUIDActionParams object +// with the default values initialized, and the ability to set a timeout on a request +func NewPutAclsRidUsersUIDActionParamsWithTimeout(timeout time.Duration) *PutAclsRidUsersUIDActionParams { + var () + return &PutAclsRidUsersUIDActionParams{ + + timeout: timeout, + } +} + +// NewPutAclsRidUsersUIDActionParamsWithContext creates a new PutAclsRidUsersUIDActionParams object +// with the default values initialized, and the ability to set a context for a request +func NewPutAclsRidUsersUIDActionParamsWithContext(ctx context.Context) *PutAclsRidUsersUIDActionParams { + var () + return &PutAclsRidUsersUIDActionParams{ + + Context: ctx, + } +} + +// NewPutAclsRidUsersUIDActionParamsWithHTTPClient creates a new PutAclsRidUsersUIDActionParams object +// with the default values initialized, and the ability to set a custom HTTPClient for a request +func NewPutAclsRidUsersUIDActionParamsWithHTTPClient(client *http.Client) *PutAclsRidUsersUIDActionParams { + var () + return &PutAclsRidUsersUIDActionParams{ + HTTPClient: client, + } +} + +/*PutAclsRidUsersUIDActionParams contains all the parameters to send to the API endpoint +for the put acls rid users UID action operation typically these are written to a http.Request +*/ +type PutAclsRidUsersUIDActionParams struct { + + /*Action + action name + + */ + Action string + /*Rid + resource ID. + + */ + Rid string + /*UID + account ID. + + */ + UID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithTimeout adds the timeout to the put acls rid users UID action params +func (o *PutAclsRidUsersUIDActionParams) WithTimeout(timeout time.Duration) *PutAclsRidUsersUIDActionParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the put acls rid users UID action params +func (o *PutAclsRidUsersUIDActionParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the put acls rid users UID action params +func (o *PutAclsRidUsersUIDActionParams) WithContext(ctx context.Context) *PutAclsRidUsersUIDActionParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the put acls rid users UID action params +func (o *PutAclsRidUsersUIDActionParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the put acls rid users UID action params +func (o *PutAclsRidUsersUIDActionParams) WithHTTPClient(client *http.Client) *PutAclsRidUsersUIDActionParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the put acls rid users UID action params +func (o *PutAclsRidUsersUIDActionParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithAction adds the action to the put acls rid users UID action params +func (o *PutAclsRidUsersUIDActionParams) WithAction(action string) *PutAclsRidUsersUIDActionParams { + o.SetAction(action) + return o +} + +// SetAction adds the action to the put acls rid users UID action params +func (o *PutAclsRidUsersUIDActionParams) SetAction(action string) { + o.Action = action +} + +// WithRid adds the rid to the put acls rid users UID action params +func (o *PutAclsRidUsersUIDActionParams) WithRid(rid string) *PutAclsRidUsersUIDActionParams { + o.SetRid(rid) + return o +} + +// SetRid adds the rid to the put acls rid users UID action params +func (o *PutAclsRidUsersUIDActionParams) SetRid(rid string) { + o.Rid = rid +} + +// WithUID adds the uid to the put acls rid users UID action params +func (o *PutAclsRidUsersUIDActionParams) WithUID(uid string) *PutAclsRidUsersUIDActionParams { + o.SetUID(uid) + return o +} + +// SetUID adds the uid to the put acls rid users UID action params +func (o *PutAclsRidUsersUIDActionParams) SetUID(uid string) { + o.UID = uid +} + +// WriteToRequest writes these params to a swagger request +func (o *PutAclsRidUsersUIDActionParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param action + if err := r.SetPathParam("action", o.Action); err != nil { + return err + } + + // path param rid + if err := r.SetPathParam("rid", o.Rid); err != nil { + return err + } + + // path param uid + if err := r.SetPathParam("uid", o.UID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/dcos/iam/client/permissions/put_acls_rid_users_uid_action_responses.go b/dcos/iam/client/permissions/put_acls_rid_users_uid_action_responses.go new file mode 100644 index 0000000..ea7562c --- /dev/null +++ b/dcos/iam/client/permissions/put_acls_rid_users_uid_action_responses.go @@ -0,0 +1,84 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package permissions + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + + "github.com/go-openapi/runtime" + + strfmt "github.com/go-openapi/strfmt" +) + +// PutAclsRidUsersUIDActionReader is a Reader for the PutAclsRidUsersUIDAction structure. +type PutAclsRidUsersUIDActionReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PutAclsRidUsersUIDActionReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + + case 204: + result := NewPutAclsRidUsersUIDActionNoContent() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + + case 409: + result := NewPutAclsRidUsersUIDActionConflict() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + + default: + return nil, runtime.NewAPIError("unknown error", response, response.Code()) + } +} + +// NewPutAclsRidUsersUIDActionNoContent creates a PutAclsRidUsersUIDActionNoContent with default headers values +func NewPutAclsRidUsersUIDActionNoContent() *PutAclsRidUsersUIDActionNoContent { + return &PutAclsRidUsersUIDActionNoContent{} +} + +/*PutAclsRidUsersUIDActionNoContent handles this case with default header values. + +Success. +*/ +type PutAclsRidUsersUIDActionNoContent struct { +} + +func (o *PutAclsRidUsersUIDActionNoContent) Error() string { + return fmt.Sprintf("[PUT /acls/{rid}/users/{uid}/{action}][%d] putAclsRidUsersUidActionNoContent ", 204) +} + +func (o *PutAclsRidUsersUIDActionNoContent) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewPutAclsRidUsersUIDActionConflict creates a PutAclsRidUsersUIDActionConflict with default headers values +func NewPutAclsRidUsersUIDActionConflict() *PutAclsRidUsersUIDActionConflict { + return &PutAclsRidUsersUIDActionConflict{} +} + +/*PutAclsRidUsersUIDActionConflict handles this case with default header values. + +Already exists (this account already has this action). +*/ +type PutAclsRidUsersUIDActionConflict struct { +} + +func (o *PutAclsRidUsersUIDActionConflict) Error() string { + return fmt.Sprintf("[PUT /acls/{rid}/users/{uid}/{action}][%d] putAclsRidUsersUidActionConflict ", 409) +} + +func (o *PutAclsRidUsersUIDActionConflict) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/dcos/iam/client/saml/delete_auth_saml_providers_provider_id_parameters.go b/dcos/iam/client/saml/delete_auth_saml_providers_provider_id_parameters.go new file mode 100644 index 0000000..362c06c --- /dev/null +++ b/dcos/iam/client/saml/delete_auth_saml_providers_provider_id_parameters.go @@ -0,0 +1,136 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package saml + +// 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" + + strfmt "github.com/go-openapi/strfmt" +) + +// NewDeleteAuthSamlProvidersProviderIDParams creates a new DeleteAuthSamlProvidersProviderIDParams object +// with the default values initialized. +func NewDeleteAuthSamlProvidersProviderIDParams() *DeleteAuthSamlProvidersProviderIDParams { + var () + return &DeleteAuthSamlProvidersProviderIDParams{ + + timeout: cr.DefaultTimeout, + } +} + +// NewDeleteAuthSamlProvidersProviderIDParamsWithTimeout creates a new DeleteAuthSamlProvidersProviderIDParams object +// with the default values initialized, and the ability to set a timeout on a request +func NewDeleteAuthSamlProvidersProviderIDParamsWithTimeout(timeout time.Duration) *DeleteAuthSamlProvidersProviderIDParams { + var () + return &DeleteAuthSamlProvidersProviderIDParams{ + + timeout: timeout, + } +} + +// NewDeleteAuthSamlProvidersProviderIDParamsWithContext creates a new DeleteAuthSamlProvidersProviderIDParams object +// with the default values initialized, and the ability to set a context for a request +func NewDeleteAuthSamlProvidersProviderIDParamsWithContext(ctx context.Context) *DeleteAuthSamlProvidersProviderIDParams { + var () + return &DeleteAuthSamlProvidersProviderIDParams{ + + Context: ctx, + } +} + +// NewDeleteAuthSamlProvidersProviderIDParamsWithHTTPClient creates a new DeleteAuthSamlProvidersProviderIDParams object +// with the default values initialized, and the ability to set a custom HTTPClient for a request +func NewDeleteAuthSamlProvidersProviderIDParamsWithHTTPClient(client *http.Client) *DeleteAuthSamlProvidersProviderIDParams { + var () + return &DeleteAuthSamlProvidersProviderIDParams{ + HTTPClient: client, + } +} + +/*DeleteAuthSamlProvidersProviderIDParams contains all the parameters to send to the API endpoint +for the delete auth saml providers provider ID operation typically these are written to a http.Request +*/ +type DeleteAuthSamlProvidersProviderIDParams struct { + + /*ProviderID + The ID of the SAML provider to delete. + + */ + ProviderID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithTimeout adds the timeout to the delete auth saml providers provider ID params +func (o *DeleteAuthSamlProvidersProviderIDParams) WithTimeout(timeout time.Duration) *DeleteAuthSamlProvidersProviderIDParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the delete auth saml providers provider ID params +func (o *DeleteAuthSamlProvidersProviderIDParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the delete auth saml providers provider ID params +func (o *DeleteAuthSamlProvidersProviderIDParams) WithContext(ctx context.Context) *DeleteAuthSamlProvidersProviderIDParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the delete auth saml providers provider ID params +func (o *DeleteAuthSamlProvidersProviderIDParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the delete auth saml providers provider ID params +func (o *DeleteAuthSamlProvidersProviderIDParams) WithHTTPClient(client *http.Client) *DeleteAuthSamlProvidersProviderIDParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the delete auth saml providers provider ID params +func (o *DeleteAuthSamlProvidersProviderIDParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithProviderID adds the providerID to the delete auth saml providers provider ID params +func (o *DeleteAuthSamlProvidersProviderIDParams) WithProviderID(providerID string) *DeleteAuthSamlProvidersProviderIDParams { + o.SetProviderID(providerID) + return o +} + +// SetProviderID adds the providerId to the delete auth saml providers provider ID params +func (o *DeleteAuthSamlProvidersProviderIDParams) SetProviderID(providerID string) { + o.ProviderID = providerID +} + +// WriteToRequest writes these params to a swagger request +func (o *DeleteAuthSamlProvidersProviderIDParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param provider-id + if err := r.SetPathParam("provider-id", o.ProviderID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/dcos/iam/client/saml/delete_auth_saml_providers_provider_id_responses.go b/dcos/iam/client/saml/delete_auth_saml_providers_provider_id_responses.go new file mode 100644 index 0000000..ac93fcc --- /dev/null +++ b/dcos/iam/client/saml/delete_auth_saml_providers_provider_id_responses.go @@ -0,0 +1,56 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package saml + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + + "github.com/go-openapi/runtime" + + strfmt "github.com/go-openapi/strfmt" +) + +// DeleteAuthSamlProvidersProviderIDReader is a Reader for the DeleteAuthSamlProvidersProviderID structure. +type DeleteAuthSamlProvidersProviderIDReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *DeleteAuthSamlProvidersProviderIDReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + + case 204: + result := NewDeleteAuthSamlProvidersProviderIDNoContent() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + + default: + return nil, runtime.NewAPIError("unknown error", response, response.Code()) + } +} + +// NewDeleteAuthSamlProvidersProviderIDNoContent creates a DeleteAuthSamlProvidersProviderIDNoContent with default headers values +func NewDeleteAuthSamlProvidersProviderIDNoContent() *DeleteAuthSamlProvidersProviderIDNoContent { + return &DeleteAuthSamlProvidersProviderIDNoContent{} +} + +/*DeleteAuthSamlProvidersProviderIDNoContent handles this case with default header values. + +Success. +*/ +type DeleteAuthSamlProvidersProviderIDNoContent struct { +} + +func (o *DeleteAuthSamlProvidersProviderIDNoContent) Error() string { + return fmt.Sprintf("[DELETE /auth/saml/providers/{provider-id}][%d] deleteAuthSamlProvidersProviderIdNoContent ", 204) +} + +func (o *DeleteAuthSamlProvidersProviderIDNoContent) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/dcos/iam/client/saml/get_auth_saml_providers_parameters.go b/dcos/iam/client/saml/get_auth_saml_providers_parameters.go new file mode 100644 index 0000000..dba3788 --- /dev/null +++ b/dcos/iam/client/saml/get_auth_saml_providers_parameters.go @@ -0,0 +1,113 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package saml + +// 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" + + strfmt "github.com/go-openapi/strfmt" +) + +// NewGetAuthSamlProvidersParams creates a new GetAuthSamlProvidersParams object +// with the default values initialized. +func NewGetAuthSamlProvidersParams() *GetAuthSamlProvidersParams { + + return &GetAuthSamlProvidersParams{ + + timeout: cr.DefaultTimeout, + } +} + +// NewGetAuthSamlProvidersParamsWithTimeout creates a new GetAuthSamlProvidersParams object +// with the default values initialized, and the ability to set a timeout on a request +func NewGetAuthSamlProvidersParamsWithTimeout(timeout time.Duration) *GetAuthSamlProvidersParams { + + return &GetAuthSamlProvidersParams{ + + timeout: timeout, + } +} + +// NewGetAuthSamlProvidersParamsWithContext creates a new GetAuthSamlProvidersParams object +// with the default values initialized, and the ability to set a context for a request +func NewGetAuthSamlProvidersParamsWithContext(ctx context.Context) *GetAuthSamlProvidersParams { + + return &GetAuthSamlProvidersParams{ + + Context: ctx, + } +} + +// NewGetAuthSamlProvidersParamsWithHTTPClient creates a new GetAuthSamlProvidersParams object +// with the default values initialized, and the ability to set a custom HTTPClient for a request +func NewGetAuthSamlProvidersParamsWithHTTPClient(client *http.Client) *GetAuthSamlProvidersParams { + + return &GetAuthSamlProvidersParams{ + HTTPClient: client, + } +} + +/*GetAuthSamlProvidersParams contains all the parameters to send to the API endpoint +for the get auth saml providers operation typically these are written to a http.Request +*/ +type GetAuthSamlProvidersParams struct { + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithTimeout adds the timeout to the get auth saml providers params +func (o *GetAuthSamlProvidersParams) WithTimeout(timeout time.Duration) *GetAuthSamlProvidersParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the get auth saml providers params +func (o *GetAuthSamlProvidersParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the get auth saml providers params +func (o *GetAuthSamlProvidersParams) WithContext(ctx context.Context) *GetAuthSamlProvidersParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the get auth saml providers params +func (o *GetAuthSamlProvidersParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the get auth saml providers params +func (o *GetAuthSamlProvidersParams) WithHTTPClient(client *http.Client) *GetAuthSamlProvidersParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the get auth saml providers params +func (o *GetAuthSamlProvidersParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WriteToRequest writes these params to a swagger request +func (o *GetAuthSamlProvidersParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/dcos/iam/client/saml/get_auth_saml_providers_provider_id_acs_callback_url_parameters.go b/dcos/iam/client/saml/get_auth_saml_providers_provider_id_acs_callback_url_parameters.go new file mode 100644 index 0000000..3b27e01 --- /dev/null +++ b/dcos/iam/client/saml/get_auth_saml_providers_provider_id_acs_callback_url_parameters.go @@ -0,0 +1,136 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package saml + +// 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" + + strfmt "github.com/go-openapi/strfmt" +) + +// NewGetAuthSamlProvidersProviderIDAcsCallbackURLParams creates a new GetAuthSamlProvidersProviderIDAcsCallbackURLParams object +// with the default values initialized. +func NewGetAuthSamlProvidersProviderIDAcsCallbackURLParams() *GetAuthSamlProvidersProviderIDAcsCallbackURLParams { + var () + return &GetAuthSamlProvidersProviderIDAcsCallbackURLParams{ + + timeout: cr.DefaultTimeout, + } +} + +// NewGetAuthSamlProvidersProviderIDAcsCallbackURLParamsWithTimeout creates a new GetAuthSamlProvidersProviderIDAcsCallbackURLParams object +// with the default values initialized, and the ability to set a timeout on a request +func NewGetAuthSamlProvidersProviderIDAcsCallbackURLParamsWithTimeout(timeout time.Duration) *GetAuthSamlProvidersProviderIDAcsCallbackURLParams { + var () + return &GetAuthSamlProvidersProviderIDAcsCallbackURLParams{ + + timeout: timeout, + } +} + +// NewGetAuthSamlProvidersProviderIDAcsCallbackURLParamsWithContext creates a new GetAuthSamlProvidersProviderIDAcsCallbackURLParams object +// with the default values initialized, and the ability to set a context for a request +func NewGetAuthSamlProvidersProviderIDAcsCallbackURLParamsWithContext(ctx context.Context) *GetAuthSamlProvidersProviderIDAcsCallbackURLParams { + var () + return &GetAuthSamlProvidersProviderIDAcsCallbackURLParams{ + + Context: ctx, + } +} + +// NewGetAuthSamlProvidersProviderIDAcsCallbackURLParamsWithHTTPClient creates a new GetAuthSamlProvidersProviderIDAcsCallbackURLParams object +// with the default values initialized, and the ability to set a custom HTTPClient for a request +func NewGetAuthSamlProvidersProviderIDAcsCallbackURLParamsWithHTTPClient(client *http.Client) *GetAuthSamlProvidersProviderIDAcsCallbackURLParams { + var () + return &GetAuthSamlProvidersProviderIDAcsCallbackURLParams{ + HTTPClient: client, + } +} + +/*GetAuthSamlProvidersProviderIDAcsCallbackURLParams contains all the parameters to send to the API endpoint +for the get auth saml providers provider ID acs callback URL operation typically these are written to a http.Request +*/ +type GetAuthSamlProvidersProviderIDAcsCallbackURLParams struct { + + /*ProviderID + The ID of the SAML provider to retrieve the ACS callback URL for. + + */ + ProviderID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithTimeout adds the timeout to the get auth saml providers provider ID acs callback URL params +func (o *GetAuthSamlProvidersProviderIDAcsCallbackURLParams) WithTimeout(timeout time.Duration) *GetAuthSamlProvidersProviderIDAcsCallbackURLParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the get auth saml providers provider ID acs callback URL params +func (o *GetAuthSamlProvidersProviderIDAcsCallbackURLParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the get auth saml providers provider ID acs callback URL params +func (o *GetAuthSamlProvidersProviderIDAcsCallbackURLParams) WithContext(ctx context.Context) *GetAuthSamlProvidersProviderIDAcsCallbackURLParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the get auth saml providers provider ID acs callback URL params +func (o *GetAuthSamlProvidersProviderIDAcsCallbackURLParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the get auth saml providers provider ID acs callback URL params +func (o *GetAuthSamlProvidersProviderIDAcsCallbackURLParams) WithHTTPClient(client *http.Client) *GetAuthSamlProvidersProviderIDAcsCallbackURLParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the get auth saml providers provider ID acs callback URL params +func (o *GetAuthSamlProvidersProviderIDAcsCallbackURLParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithProviderID adds the providerID to the get auth saml providers provider ID acs callback URL params +func (o *GetAuthSamlProvidersProviderIDAcsCallbackURLParams) WithProviderID(providerID string) *GetAuthSamlProvidersProviderIDAcsCallbackURLParams { + o.SetProviderID(providerID) + return o +} + +// SetProviderID adds the providerId to the get auth saml providers provider ID acs callback URL params +func (o *GetAuthSamlProvidersProviderIDAcsCallbackURLParams) SetProviderID(providerID string) { + o.ProviderID = providerID +} + +// WriteToRequest writes these params to a swagger request +func (o *GetAuthSamlProvidersProviderIDAcsCallbackURLParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param provider-id + if err := r.SetPathParam("provider-id", o.ProviderID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/dcos/iam/client/saml/get_auth_saml_providers_provider_id_acs_callback_url_responses.go b/dcos/iam/client/saml/get_auth_saml_providers_provider_id_acs_callback_url_responses.go new file mode 100644 index 0000000..853df38 --- /dev/null +++ b/dcos/iam/client/saml/get_auth_saml_providers_provider_id_acs_callback_url_responses.go @@ -0,0 +1,67 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package saml + +// 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" + + strfmt "github.com/go-openapi/strfmt" + + models "github.com/dcos/client-go/dcos/iam/models" +) + +// GetAuthSamlProvidersProviderIDAcsCallbackURLReader is a Reader for the GetAuthSamlProvidersProviderIDAcsCallbackURL structure. +type GetAuthSamlProvidersProviderIDAcsCallbackURLReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *GetAuthSamlProvidersProviderIDAcsCallbackURLReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + + case 200: + result := NewGetAuthSamlProvidersProviderIDAcsCallbackURLOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + + default: + return nil, runtime.NewAPIError("unknown error", response, response.Code()) + } +} + +// NewGetAuthSamlProvidersProviderIDAcsCallbackURLOK creates a GetAuthSamlProvidersProviderIDAcsCallbackURLOK with default headers values +func NewGetAuthSamlProvidersProviderIDAcsCallbackURLOK() *GetAuthSamlProvidersProviderIDAcsCallbackURLOK { + return &GetAuthSamlProvidersProviderIDAcsCallbackURLOK{} +} + +/*GetAuthSamlProvidersProviderIDAcsCallbackURLOK handles this case with default header values. + +The response body contains a JSON object declaring the callback URL +*/ +type GetAuthSamlProvidersProviderIDAcsCallbackURLOK struct { + Payload *models.SAMLACSCallbackURLObject +} + +func (o *GetAuthSamlProvidersProviderIDAcsCallbackURLOK) Error() string { + return fmt.Sprintf("[GET /auth/saml/providers/{provider-id}/acs-callback-url][%d] getAuthSamlProvidersProviderIdAcsCallbackUrlOK %+v", 200, o.Payload) +} + +func (o *GetAuthSamlProvidersProviderIDAcsCallbackURLOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.SAMLACSCallbackURLObject) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/dcos/iam/client/saml/get_auth_saml_providers_provider_id_parameters.go b/dcos/iam/client/saml/get_auth_saml_providers_provider_id_parameters.go new file mode 100644 index 0000000..33f9009 --- /dev/null +++ b/dcos/iam/client/saml/get_auth_saml_providers_provider_id_parameters.go @@ -0,0 +1,136 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package saml + +// 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" + + strfmt "github.com/go-openapi/strfmt" +) + +// NewGetAuthSamlProvidersProviderIDParams creates a new GetAuthSamlProvidersProviderIDParams object +// with the default values initialized. +func NewGetAuthSamlProvidersProviderIDParams() *GetAuthSamlProvidersProviderIDParams { + var () + return &GetAuthSamlProvidersProviderIDParams{ + + timeout: cr.DefaultTimeout, + } +} + +// NewGetAuthSamlProvidersProviderIDParamsWithTimeout creates a new GetAuthSamlProvidersProviderIDParams object +// with the default values initialized, and the ability to set a timeout on a request +func NewGetAuthSamlProvidersProviderIDParamsWithTimeout(timeout time.Duration) *GetAuthSamlProvidersProviderIDParams { + var () + return &GetAuthSamlProvidersProviderIDParams{ + + timeout: timeout, + } +} + +// NewGetAuthSamlProvidersProviderIDParamsWithContext creates a new GetAuthSamlProvidersProviderIDParams object +// with the default values initialized, and the ability to set a context for a request +func NewGetAuthSamlProvidersProviderIDParamsWithContext(ctx context.Context) *GetAuthSamlProvidersProviderIDParams { + var () + return &GetAuthSamlProvidersProviderIDParams{ + + Context: ctx, + } +} + +// NewGetAuthSamlProvidersProviderIDParamsWithHTTPClient creates a new GetAuthSamlProvidersProviderIDParams object +// with the default values initialized, and the ability to set a custom HTTPClient for a request +func NewGetAuthSamlProvidersProviderIDParamsWithHTTPClient(client *http.Client) *GetAuthSamlProvidersProviderIDParams { + var () + return &GetAuthSamlProvidersProviderIDParams{ + HTTPClient: client, + } +} + +/*GetAuthSamlProvidersProviderIDParams contains all the parameters to send to the API endpoint +for the get auth saml providers provider ID operation typically these are written to a http.Request +*/ +type GetAuthSamlProvidersProviderIDParams struct { + + /*ProviderID + The ID of the SAML provider to retrieve the config for. + + */ + ProviderID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithTimeout adds the timeout to the get auth saml providers provider ID params +func (o *GetAuthSamlProvidersProviderIDParams) WithTimeout(timeout time.Duration) *GetAuthSamlProvidersProviderIDParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the get auth saml providers provider ID params +func (o *GetAuthSamlProvidersProviderIDParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the get auth saml providers provider ID params +func (o *GetAuthSamlProvidersProviderIDParams) WithContext(ctx context.Context) *GetAuthSamlProvidersProviderIDParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the get auth saml providers provider ID params +func (o *GetAuthSamlProvidersProviderIDParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the get auth saml providers provider ID params +func (o *GetAuthSamlProvidersProviderIDParams) WithHTTPClient(client *http.Client) *GetAuthSamlProvidersProviderIDParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the get auth saml providers provider ID params +func (o *GetAuthSamlProvidersProviderIDParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithProviderID adds the providerID to the get auth saml providers provider ID params +func (o *GetAuthSamlProvidersProviderIDParams) WithProviderID(providerID string) *GetAuthSamlProvidersProviderIDParams { + o.SetProviderID(providerID) + return o +} + +// SetProviderID adds the providerId to the get auth saml providers provider ID params +func (o *GetAuthSamlProvidersProviderIDParams) SetProviderID(providerID string) { + o.ProviderID = providerID +} + +// WriteToRequest writes these params to a swagger request +func (o *GetAuthSamlProvidersProviderIDParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param provider-id + if err := r.SetPathParam("provider-id", o.ProviderID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/dcos/iam/client/saml/get_auth_saml_providers_provider_id_responses.go b/dcos/iam/client/saml/get_auth_saml_providers_provider_id_responses.go new file mode 100644 index 0000000..ee2cc6b --- /dev/null +++ b/dcos/iam/client/saml/get_auth_saml_providers_provider_id_responses.go @@ -0,0 +1,67 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package saml + +// 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" + + strfmt "github.com/go-openapi/strfmt" + + models "github.com/dcos/client-go/dcos/iam/models" +) + +// GetAuthSamlProvidersProviderIDReader is a Reader for the GetAuthSamlProvidersProviderID structure. +type GetAuthSamlProvidersProviderIDReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *GetAuthSamlProvidersProviderIDReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + + case 200: + result := NewGetAuthSamlProvidersProviderIDOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + + default: + return nil, runtime.NewAPIError("unknown error", response, response.Code()) + } +} + +// NewGetAuthSamlProvidersProviderIDOK creates a GetAuthSamlProvidersProviderIDOK with default headers values +func NewGetAuthSamlProvidersProviderIDOK() *GetAuthSamlProvidersProviderIDOK { + return &GetAuthSamlProvidersProviderIDOK{} +} + +/*GetAuthSamlProvidersProviderIDOK handles this case with default header values. + +Success. +*/ +type GetAuthSamlProvidersProviderIDOK struct { + Payload *models.SAMLProviderConfig +} + +func (o *GetAuthSamlProvidersProviderIDOK) Error() string { + return fmt.Sprintf("[GET /auth/saml/providers/{provider-id}][%d] getAuthSamlProvidersProviderIdOK %+v", 200, o.Payload) +} + +func (o *GetAuthSamlProvidersProviderIDOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.SAMLProviderConfig) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/dcos/iam/client/saml/get_auth_saml_providers_provider_id_sp_metadata_parameters.go b/dcos/iam/client/saml/get_auth_saml_providers_provider_id_sp_metadata_parameters.go new file mode 100644 index 0000000..a1a9551 --- /dev/null +++ b/dcos/iam/client/saml/get_auth_saml_providers_provider_id_sp_metadata_parameters.go @@ -0,0 +1,136 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package saml + +// 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" + + strfmt "github.com/go-openapi/strfmt" +) + +// NewGetAuthSamlProvidersProviderIDSpMetadataParams creates a new GetAuthSamlProvidersProviderIDSpMetadataParams object +// with the default values initialized. +func NewGetAuthSamlProvidersProviderIDSpMetadataParams() *GetAuthSamlProvidersProviderIDSpMetadataParams { + var () + return &GetAuthSamlProvidersProviderIDSpMetadataParams{ + + timeout: cr.DefaultTimeout, + } +} + +// NewGetAuthSamlProvidersProviderIDSpMetadataParamsWithTimeout creates a new GetAuthSamlProvidersProviderIDSpMetadataParams object +// with the default values initialized, and the ability to set a timeout on a request +func NewGetAuthSamlProvidersProviderIDSpMetadataParamsWithTimeout(timeout time.Duration) *GetAuthSamlProvidersProviderIDSpMetadataParams { + var () + return &GetAuthSamlProvidersProviderIDSpMetadataParams{ + + timeout: timeout, + } +} + +// NewGetAuthSamlProvidersProviderIDSpMetadataParamsWithContext creates a new GetAuthSamlProvidersProviderIDSpMetadataParams object +// with the default values initialized, and the ability to set a context for a request +func NewGetAuthSamlProvidersProviderIDSpMetadataParamsWithContext(ctx context.Context) *GetAuthSamlProvidersProviderIDSpMetadataParams { + var () + return &GetAuthSamlProvidersProviderIDSpMetadataParams{ + + Context: ctx, + } +} + +// NewGetAuthSamlProvidersProviderIDSpMetadataParamsWithHTTPClient creates a new GetAuthSamlProvidersProviderIDSpMetadataParams object +// with the default values initialized, and the ability to set a custom HTTPClient for a request +func NewGetAuthSamlProvidersProviderIDSpMetadataParamsWithHTTPClient(client *http.Client) *GetAuthSamlProvidersProviderIDSpMetadataParams { + var () + return &GetAuthSamlProvidersProviderIDSpMetadataParams{ + HTTPClient: client, + } +} + +/*GetAuthSamlProvidersProviderIDSpMetadataParams contains all the parameters to send to the API endpoint +for the get auth saml providers provider ID sp metadata operation typically these are written to a http.Request +*/ +type GetAuthSamlProvidersProviderIDSpMetadataParams struct { + + /*ProviderID + The ID of the SAML provider to retrieve the metadata for. + + */ + ProviderID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithTimeout adds the timeout to the get auth saml providers provider ID sp metadata params +func (o *GetAuthSamlProvidersProviderIDSpMetadataParams) WithTimeout(timeout time.Duration) *GetAuthSamlProvidersProviderIDSpMetadataParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the get auth saml providers provider ID sp metadata params +func (o *GetAuthSamlProvidersProviderIDSpMetadataParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the get auth saml providers provider ID sp metadata params +func (o *GetAuthSamlProvidersProviderIDSpMetadataParams) WithContext(ctx context.Context) *GetAuthSamlProvidersProviderIDSpMetadataParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the get auth saml providers provider ID sp metadata params +func (o *GetAuthSamlProvidersProviderIDSpMetadataParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the get auth saml providers provider ID sp metadata params +func (o *GetAuthSamlProvidersProviderIDSpMetadataParams) WithHTTPClient(client *http.Client) *GetAuthSamlProvidersProviderIDSpMetadataParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the get auth saml providers provider ID sp metadata params +func (o *GetAuthSamlProvidersProviderIDSpMetadataParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithProviderID adds the providerID to the get auth saml providers provider ID sp metadata params +func (o *GetAuthSamlProvidersProviderIDSpMetadataParams) WithProviderID(providerID string) *GetAuthSamlProvidersProviderIDSpMetadataParams { + o.SetProviderID(providerID) + return o +} + +// SetProviderID adds the providerId to the get auth saml providers provider ID sp metadata params +func (o *GetAuthSamlProvidersProviderIDSpMetadataParams) SetProviderID(providerID string) { + o.ProviderID = providerID +} + +// WriteToRequest writes these params to a swagger request +func (o *GetAuthSamlProvidersProviderIDSpMetadataParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param provider-id + if err := r.SetPathParam("provider-id", o.ProviderID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/dcos/iam/client/saml/get_auth_saml_providers_provider_id_sp_metadata_responses.go b/dcos/iam/client/saml/get_auth_saml_providers_provider_id_sp_metadata_responses.go new file mode 100644 index 0000000..ab30132 --- /dev/null +++ b/dcos/iam/client/saml/get_auth_saml_providers_provider_id_sp_metadata_responses.go @@ -0,0 +1,56 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package saml + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + + "github.com/go-openapi/runtime" + + strfmt "github.com/go-openapi/strfmt" +) + +// GetAuthSamlProvidersProviderIDSpMetadataReader is a Reader for the GetAuthSamlProvidersProviderIDSpMetadata structure. +type GetAuthSamlProvidersProviderIDSpMetadataReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *GetAuthSamlProvidersProviderIDSpMetadataReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + + case 200: + result := NewGetAuthSamlProvidersProviderIDSpMetadataOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + + default: + return nil, runtime.NewAPIError("unknown error", response, response.Code()) + } +} + +// NewGetAuthSamlProvidersProviderIDSpMetadataOK creates a GetAuthSamlProvidersProviderIDSpMetadataOK with default headers values +func NewGetAuthSamlProvidersProviderIDSpMetadataOK() *GetAuthSamlProvidersProviderIDSpMetadataOK { + return &GetAuthSamlProvidersProviderIDSpMetadataOK{} +} + +/*GetAuthSamlProvidersProviderIDSpMetadataOK handles this case with default header values. + +The response body contains the metadata in UTF-8 encoding, setting the Content-Type to `application/samlmetadata+xml`. +*/ +type GetAuthSamlProvidersProviderIDSpMetadataOK struct { +} + +func (o *GetAuthSamlProvidersProviderIDSpMetadataOK) Error() string { + return fmt.Sprintf("[GET /auth/saml/providers/{provider-id}/sp-metadata][%d] getAuthSamlProvidersProviderIdSpMetadataOK ", 200) +} + +func (o *GetAuthSamlProvidersProviderIDSpMetadataOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/dcos/iam/client/saml/get_auth_saml_providers_responses.go b/dcos/iam/client/saml/get_auth_saml_providers_responses.go new file mode 100644 index 0000000..5b5da68 --- /dev/null +++ b/dcos/iam/client/saml/get_auth_saml_providers_responses.go @@ -0,0 +1,56 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package saml + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + + "github.com/go-openapi/runtime" + + strfmt "github.com/go-openapi/strfmt" +) + +// GetAuthSamlProvidersReader is a Reader for the GetAuthSamlProviders structure. +type GetAuthSamlProvidersReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *GetAuthSamlProvidersReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + + case 200: + result := NewGetAuthSamlProvidersOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + + default: + return nil, runtime.NewAPIError("unknown error", response, response.Code()) + } +} + +// NewGetAuthSamlProvidersOK creates a GetAuthSamlProvidersOK with default headers values +func NewGetAuthSamlProvidersOK() *GetAuthSamlProvidersOK { + return &GetAuthSamlProvidersOK{} +} + +/*GetAuthSamlProvidersOK handles this case with default header values. + +Success. +*/ +type GetAuthSamlProvidersOK struct { +} + +func (o *GetAuthSamlProvidersOK) Error() string { + return fmt.Sprintf("[GET /auth/saml/providers][%d] getAuthSamlProvidersOK ", 200) +} + +func (o *GetAuthSamlProvidersOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/dcos/iam/client/saml/patch_auth_saml_providers_provider_id_parameters.go b/dcos/iam/client/saml/patch_auth_saml_providers_provider_id_parameters.go new file mode 100644 index 0000000..92f72f2 --- /dev/null +++ b/dcos/iam/client/saml/patch_auth_saml_providers_provider_id_parameters.go @@ -0,0 +1,160 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package saml + +// 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" + + strfmt "github.com/go-openapi/strfmt" + + models "github.com/dcos/client-go/dcos/iam/models" +) + +// NewPatchAuthSamlProvidersProviderIDParams creates a new PatchAuthSamlProvidersProviderIDParams object +// with the default values initialized. +func NewPatchAuthSamlProvidersProviderIDParams() *PatchAuthSamlProvidersProviderIDParams { + var () + return &PatchAuthSamlProvidersProviderIDParams{ + + timeout: cr.DefaultTimeout, + } +} + +// NewPatchAuthSamlProvidersProviderIDParamsWithTimeout creates a new PatchAuthSamlProvidersProviderIDParams object +// with the default values initialized, and the ability to set a timeout on a request +func NewPatchAuthSamlProvidersProviderIDParamsWithTimeout(timeout time.Duration) *PatchAuthSamlProvidersProviderIDParams { + var () + return &PatchAuthSamlProvidersProviderIDParams{ + + timeout: timeout, + } +} + +// NewPatchAuthSamlProvidersProviderIDParamsWithContext creates a new PatchAuthSamlProvidersProviderIDParams object +// with the default values initialized, and the ability to set a context for a request +func NewPatchAuthSamlProvidersProviderIDParamsWithContext(ctx context.Context) *PatchAuthSamlProvidersProviderIDParams { + var () + return &PatchAuthSamlProvidersProviderIDParams{ + + Context: ctx, + } +} + +// NewPatchAuthSamlProvidersProviderIDParamsWithHTTPClient creates a new PatchAuthSamlProvidersProviderIDParams object +// with the default values initialized, and the ability to set a custom HTTPClient for a request +func NewPatchAuthSamlProvidersProviderIDParamsWithHTTPClient(client *http.Client) *PatchAuthSamlProvidersProviderIDParams { + var () + return &PatchAuthSamlProvidersProviderIDParams{ + HTTPClient: client, + } +} + +/*PatchAuthSamlProvidersProviderIDParams contains all the parameters to send to the API endpoint +for the patch auth saml providers provider ID operation typically these are written to a http.Request +*/ +type PatchAuthSamlProvidersProviderIDParams struct { + + /*ProviderConfigObject + Provider config JSON object + + */ + ProviderConfigObject *models.SAMLProviderConfig + /*ProviderID + The ID of the provider to modify. + + */ + ProviderID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithTimeout adds the timeout to the patch auth saml providers provider ID params +func (o *PatchAuthSamlProvidersProviderIDParams) WithTimeout(timeout time.Duration) *PatchAuthSamlProvidersProviderIDParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the patch auth saml providers provider ID params +func (o *PatchAuthSamlProvidersProviderIDParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the patch auth saml providers provider ID params +func (o *PatchAuthSamlProvidersProviderIDParams) WithContext(ctx context.Context) *PatchAuthSamlProvidersProviderIDParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the patch auth saml providers provider ID params +func (o *PatchAuthSamlProvidersProviderIDParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the patch auth saml providers provider ID params +func (o *PatchAuthSamlProvidersProviderIDParams) WithHTTPClient(client *http.Client) *PatchAuthSamlProvidersProviderIDParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the patch auth saml providers provider ID params +func (o *PatchAuthSamlProvidersProviderIDParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithProviderConfigObject adds the providerConfigObject to the patch auth saml providers provider ID params +func (o *PatchAuthSamlProvidersProviderIDParams) WithProviderConfigObject(providerConfigObject *models.SAMLProviderConfig) *PatchAuthSamlProvidersProviderIDParams { + o.SetProviderConfigObject(providerConfigObject) + return o +} + +// SetProviderConfigObject adds the providerConfigObject to the patch auth saml providers provider ID params +func (o *PatchAuthSamlProvidersProviderIDParams) SetProviderConfigObject(providerConfigObject *models.SAMLProviderConfig) { + o.ProviderConfigObject = providerConfigObject +} + +// WithProviderID adds the providerID to the patch auth saml providers provider ID params +func (o *PatchAuthSamlProvidersProviderIDParams) WithProviderID(providerID string) *PatchAuthSamlProvidersProviderIDParams { + o.SetProviderID(providerID) + return o +} + +// SetProviderID adds the providerId to the patch auth saml providers provider ID params +func (o *PatchAuthSamlProvidersProviderIDParams) SetProviderID(providerID string) { + o.ProviderID = providerID +} + +// WriteToRequest writes these params to a swagger request +func (o *PatchAuthSamlProvidersProviderIDParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.ProviderConfigObject != nil { + if err := r.SetBodyParam(o.ProviderConfigObject); err != nil { + return err + } + } + + // path param provider-id + if err := r.SetPathParam("provider-id", o.ProviderID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/dcos/iam/client/saml/patch_auth_saml_providers_provider_id_responses.go b/dcos/iam/client/saml/patch_auth_saml_providers_provider_id_responses.go new file mode 100644 index 0000000..5f25be9 --- /dev/null +++ b/dcos/iam/client/saml/patch_auth_saml_providers_provider_id_responses.go @@ -0,0 +1,84 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package saml + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + + "github.com/go-openapi/runtime" + + strfmt "github.com/go-openapi/strfmt" +) + +// PatchAuthSamlProvidersProviderIDReader is a Reader for the PatchAuthSamlProvidersProviderID structure. +type PatchAuthSamlProvidersProviderIDReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PatchAuthSamlProvidersProviderIDReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + + case 204: + result := NewPatchAuthSamlProvidersProviderIDNoContent() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + + case 400: + result := NewPatchAuthSamlProvidersProviderIDBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + + default: + return nil, runtime.NewAPIError("unknown error", response, response.Code()) + } +} + +// NewPatchAuthSamlProvidersProviderIDNoContent creates a PatchAuthSamlProvidersProviderIDNoContent with default headers values +func NewPatchAuthSamlProvidersProviderIDNoContent() *PatchAuthSamlProvidersProviderIDNoContent { + return &PatchAuthSamlProvidersProviderIDNoContent{} +} + +/*PatchAuthSamlProvidersProviderIDNoContent handles this case with default header values. + +Update applied. +*/ +type PatchAuthSamlProvidersProviderIDNoContent struct { +} + +func (o *PatchAuthSamlProvidersProviderIDNoContent) Error() string { + return fmt.Sprintf("[PATCH /auth/saml/providers/{provider-id}][%d] patchAuthSamlProvidersProviderIdNoContent ", 204) +} + +func (o *PatchAuthSamlProvidersProviderIDNoContent) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewPatchAuthSamlProvidersProviderIDBadRequest creates a PatchAuthSamlProvidersProviderIDBadRequest with default headers values +func NewPatchAuthSamlProvidersProviderIDBadRequest() *PatchAuthSamlProvidersProviderIDBadRequest { + return &PatchAuthSamlProvidersProviderIDBadRequest{} +} + +/*PatchAuthSamlProvidersProviderIDBadRequest handles this case with default header values. + +Various errors (e.g. provider not yet configured). +*/ +type PatchAuthSamlProvidersProviderIDBadRequest struct { +} + +func (o *PatchAuthSamlProvidersProviderIDBadRequest) Error() string { + return fmt.Sprintf("[PATCH /auth/saml/providers/{provider-id}][%d] patchAuthSamlProvidersProviderIdBadRequest ", 400) +} + +func (o *PatchAuthSamlProvidersProviderIDBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/dcos/iam/client/saml/post_auth_saml_providers_provider_id_acs_callback_parameters.go b/dcos/iam/client/saml/post_auth_saml_providers_provider_id_acs_callback_parameters.go new file mode 100644 index 0000000..add4578 --- /dev/null +++ b/dcos/iam/client/saml/post_auth_saml_providers_provider_id_acs_callback_parameters.go @@ -0,0 +1,136 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package saml + +// 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" + + strfmt "github.com/go-openapi/strfmt" +) + +// NewPostAuthSamlProvidersProviderIDAcsCallbackParams creates a new PostAuthSamlProvidersProviderIDAcsCallbackParams object +// with the default values initialized. +func NewPostAuthSamlProvidersProviderIDAcsCallbackParams() *PostAuthSamlProvidersProviderIDAcsCallbackParams { + var () + return &PostAuthSamlProvidersProviderIDAcsCallbackParams{ + + timeout: cr.DefaultTimeout, + } +} + +// NewPostAuthSamlProvidersProviderIDAcsCallbackParamsWithTimeout creates a new PostAuthSamlProvidersProviderIDAcsCallbackParams object +// with the default values initialized, and the ability to set a timeout on a request +func NewPostAuthSamlProvidersProviderIDAcsCallbackParamsWithTimeout(timeout time.Duration) *PostAuthSamlProvidersProviderIDAcsCallbackParams { + var () + return &PostAuthSamlProvidersProviderIDAcsCallbackParams{ + + timeout: timeout, + } +} + +// NewPostAuthSamlProvidersProviderIDAcsCallbackParamsWithContext creates a new PostAuthSamlProvidersProviderIDAcsCallbackParams object +// with the default values initialized, and the ability to set a context for a request +func NewPostAuthSamlProvidersProviderIDAcsCallbackParamsWithContext(ctx context.Context) *PostAuthSamlProvidersProviderIDAcsCallbackParams { + var () + return &PostAuthSamlProvidersProviderIDAcsCallbackParams{ + + Context: ctx, + } +} + +// NewPostAuthSamlProvidersProviderIDAcsCallbackParamsWithHTTPClient creates a new PostAuthSamlProvidersProviderIDAcsCallbackParams object +// with the default values initialized, and the ability to set a custom HTTPClient for a request +func NewPostAuthSamlProvidersProviderIDAcsCallbackParamsWithHTTPClient(client *http.Client) *PostAuthSamlProvidersProviderIDAcsCallbackParams { + var () + return &PostAuthSamlProvidersProviderIDAcsCallbackParams{ + HTTPClient: client, + } +} + +/*PostAuthSamlProvidersProviderIDAcsCallbackParams contains all the parameters to send to the API endpoint +for the post auth saml providers provider ID acs callback operation typically these are written to a http.Request +*/ +type PostAuthSamlProvidersProviderIDAcsCallbackParams struct { + + /*ProviderID + The ID of the provider the authentication response is meant for. + + */ + ProviderID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithTimeout adds the timeout to the post auth saml providers provider ID acs callback params +func (o *PostAuthSamlProvidersProviderIDAcsCallbackParams) WithTimeout(timeout time.Duration) *PostAuthSamlProvidersProviderIDAcsCallbackParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the post auth saml providers provider ID acs callback params +func (o *PostAuthSamlProvidersProviderIDAcsCallbackParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the post auth saml providers provider ID acs callback params +func (o *PostAuthSamlProvidersProviderIDAcsCallbackParams) WithContext(ctx context.Context) *PostAuthSamlProvidersProviderIDAcsCallbackParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the post auth saml providers provider ID acs callback params +func (o *PostAuthSamlProvidersProviderIDAcsCallbackParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the post auth saml providers provider ID acs callback params +func (o *PostAuthSamlProvidersProviderIDAcsCallbackParams) WithHTTPClient(client *http.Client) *PostAuthSamlProvidersProviderIDAcsCallbackParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the post auth saml providers provider ID acs callback params +func (o *PostAuthSamlProvidersProviderIDAcsCallbackParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithProviderID adds the providerID to the post auth saml providers provider ID acs callback params +func (o *PostAuthSamlProvidersProviderIDAcsCallbackParams) WithProviderID(providerID string) *PostAuthSamlProvidersProviderIDAcsCallbackParams { + o.SetProviderID(providerID) + return o +} + +// SetProviderID adds the providerId to the post auth saml providers provider ID acs callback params +func (o *PostAuthSamlProvidersProviderIDAcsCallbackParams) SetProviderID(providerID string) { + o.ProviderID = providerID +} + +// WriteToRequest writes these params to a swagger request +func (o *PostAuthSamlProvidersProviderIDAcsCallbackParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param provider-id + if err := r.SetPathParam("provider-id", o.ProviderID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/dcos/iam/client/saml/post_auth_saml_providers_provider_id_acs_callback_responses.go b/dcos/iam/client/saml/post_auth_saml_providers_provider_id_acs_callback_responses.go new file mode 100644 index 0000000..81df739 --- /dev/null +++ b/dcos/iam/client/saml/post_auth_saml_providers_provider_id_acs_callback_responses.go @@ -0,0 +1,84 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package saml + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + + "github.com/go-openapi/runtime" + + strfmt "github.com/go-openapi/strfmt" +) + +// PostAuthSamlProvidersProviderIDAcsCallbackReader is a Reader for the PostAuthSamlProvidersProviderIDAcsCallback structure. +type PostAuthSamlProvidersProviderIDAcsCallbackReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PostAuthSamlProvidersProviderIDAcsCallbackReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + + case 302: + result := NewPostAuthSamlProvidersProviderIDAcsCallbackFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + + case 401: + result := NewPostAuthSamlProvidersProviderIDAcsCallbackUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + + default: + return nil, runtime.NewAPIError("unknown error", response, response.Code()) + } +} + +// NewPostAuthSamlProvidersProviderIDAcsCallbackFound creates a PostAuthSamlProvidersProviderIDAcsCallbackFound with default headers values +func NewPostAuthSamlProvidersProviderIDAcsCallbackFound() *PostAuthSamlProvidersProviderIDAcsCallbackFound { + return &PostAuthSamlProvidersProviderIDAcsCallbackFound{} +} + +/*PostAuthSamlProvidersProviderIDAcsCallbackFound handles this case with default header values. + +SAML authentication flow successful. +*/ +type PostAuthSamlProvidersProviderIDAcsCallbackFound struct { +} + +func (o *PostAuthSamlProvidersProviderIDAcsCallbackFound) Error() string { + return fmt.Sprintf("[POST /auth/saml/providers/{provider-id}/acs-callback][%d] postAuthSamlProvidersProviderIdAcsCallbackFound ", 302) +} + +func (o *PostAuthSamlProvidersProviderIDAcsCallbackFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewPostAuthSamlProvidersProviderIDAcsCallbackUnauthorized creates a PostAuthSamlProvidersProviderIDAcsCallbackUnauthorized with default headers values +func NewPostAuthSamlProvidersProviderIDAcsCallbackUnauthorized() *PostAuthSamlProvidersProviderIDAcsCallbackUnauthorized { + return &PostAuthSamlProvidersProviderIDAcsCallbackUnauthorized{} +} + +/*PostAuthSamlProvidersProviderIDAcsCallbackUnauthorized handles this case with default header values. + +Problem in authentication flow. +*/ +type PostAuthSamlProvidersProviderIDAcsCallbackUnauthorized struct { +} + +func (o *PostAuthSamlProvidersProviderIDAcsCallbackUnauthorized) Error() string { + return fmt.Sprintf("[POST /auth/saml/providers/{provider-id}/acs-callback][%d] postAuthSamlProvidersProviderIdAcsCallbackUnauthorized ", 401) +} + +func (o *PostAuthSamlProvidersProviderIDAcsCallbackUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/dcos/iam/client/saml/put_auth_saml_providers_provider_id_parameters.go b/dcos/iam/client/saml/put_auth_saml_providers_provider_id_parameters.go new file mode 100644 index 0000000..ea32b0c --- /dev/null +++ b/dcos/iam/client/saml/put_auth_saml_providers_provider_id_parameters.go @@ -0,0 +1,160 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package saml + +// 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" + + strfmt "github.com/go-openapi/strfmt" + + models "github.com/dcos/client-go/dcos/iam/models" +) + +// NewPutAuthSamlProvidersProviderIDParams creates a new PutAuthSamlProvidersProviderIDParams object +// with the default values initialized. +func NewPutAuthSamlProvidersProviderIDParams() *PutAuthSamlProvidersProviderIDParams { + var () + return &PutAuthSamlProvidersProviderIDParams{ + + timeout: cr.DefaultTimeout, + } +} + +// NewPutAuthSamlProvidersProviderIDParamsWithTimeout creates a new PutAuthSamlProvidersProviderIDParams object +// with the default values initialized, and the ability to set a timeout on a request +func NewPutAuthSamlProvidersProviderIDParamsWithTimeout(timeout time.Duration) *PutAuthSamlProvidersProviderIDParams { + var () + return &PutAuthSamlProvidersProviderIDParams{ + + timeout: timeout, + } +} + +// NewPutAuthSamlProvidersProviderIDParamsWithContext creates a new PutAuthSamlProvidersProviderIDParams object +// with the default values initialized, and the ability to set a context for a request +func NewPutAuthSamlProvidersProviderIDParamsWithContext(ctx context.Context) *PutAuthSamlProvidersProviderIDParams { + var () + return &PutAuthSamlProvidersProviderIDParams{ + + Context: ctx, + } +} + +// NewPutAuthSamlProvidersProviderIDParamsWithHTTPClient creates a new PutAuthSamlProvidersProviderIDParams object +// with the default values initialized, and the ability to set a custom HTTPClient for a request +func NewPutAuthSamlProvidersProviderIDParamsWithHTTPClient(client *http.Client) *PutAuthSamlProvidersProviderIDParams { + var () + return &PutAuthSamlProvidersProviderIDParams{ + HTTPClient: client, + } +} + +/*PutAuthSamlProvidersProviderIDParams contains all the parameters to send to the API endpoint +for the put auth saml providers provider ID operation typically these are written to a http.Request +*/ +type PutAuthSamlProvidersProviderIDParams struct { + + /*ProviderConfigObject + Provider config JSON object + + */ + ProviderConfigObject *models.SAMLProviderConfig + /*ProviderID + The ID of the provider to create. + + */ + ProviderID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithTimeout adds the timeout to the put auth saml providers provider ID params +func (o *PutAuthSamlProvidersProviderIDParams) WithTimeout(timeout time.Duration) *PutAuthSamlProvidersProviderIDParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the put auth saml providers provider ID params +func (o *PutAuthSamlProvidersProviderIDParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the put auth saml providers provider ID params +func (o *PutAuthSamlProvidersProviderIDParams) WithContext(ctx context.Context) *PutAuthSamlProvidersProviderIDParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the put auth saml providers provider ID params +func (o *PutAuthSamlProvidersProviderIDParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the put auth saml providers provider ID params +func (o *PutAuthSamlProvidersProviderIDParams) WithHTTPClient(client *http.Client) *PutAuthSamlProvidersProviderIDParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the put auth saml providers provider ID params +func (o *PutAuthSamlProvidersProviderIDParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithProviderConfigObject adds the providerConfigObject to the put auth saml providers provider ID params +func (o *PutAuthSamlProvidersProviderIDParams) WithProviderConfigObject(providerConfigObject *models.SAMLProviderConfig) *PutAuthSamlProvidersProviderIDParams { + o.SetProviderConfigObject(providerConfigObject) + return o +} + +// SetProviderConfigObject adds the providerConfigObject to the put auth saml providers provider ID params +func (o *PutAuthSamlProvidersProviderIDParams) SetProviderConfigObject(providerConfigObject *models.SAMLProviderConfig) { + o.ProviderConfigObject = providerConfigObject +} + +// WithProviderID adds the providerID to the put auth saml providers provider ID params +func (o *PutAuthSamlProvidersProviderIDParams) WithProviderID(providerID string) *PutAuthSamlProvidersProviderIDParams { + o.SetProviderID(providerID) + return o +} + +// SetProviderID adds the providerId to the put auth saml providers provider ID params +func (o *PutAuthSamlProvidersProviderIDParams) SetProviderID(providerID string) { + o.ProviderID = providerID +} + +// WriteToRequest writes these params to a swagger request +func (o *PutAuthSamlProvidersProviderIDParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.ProviderConfigObject != nil { + if err := r.SetBodyParam(o.ProviderConfigObject); err != nil { + return err + } + } + + // path param provider-id + if err := r.SetPathParam("provider-id", o.ProviderID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/dcos/iam/client/saml/put_auth_saml_providers_provider_id_responses.go b/dcos/iam/client/saml/put_auth_saml_providers_provider_id_responses.go new file mode 100644 index 0000000..19ef118 --- /dev/null +++ b/dcos/iam/client/saml/put_auth_saml_providers_provider_id_responses.go @@ -0,0 +1,84 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package saml + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + + "github.com/go-openapi/runtime" + + strfmt "github.com/go-openapi/strfmt" +) + +// PutAuthSamlProvidersProviderIDReader is a Reader for the PutAuthSamlProvidersProviderID structure. +type PutAuthSamlProvidersProviderIDReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PutAuthSamlProvidersProviderIDReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + + case 201: + result := NewPutAuthSamlProvidersProviderIDCreated() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + + case 409: + result := NewPutAuthSamlProvidersProviderIDConflict() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + + default: + return nil, runtime.NewAPIError("unknown error", response, response.Code()) + } +} + +// NewPutAuthSamlProvidersProviderIDCreated creates a PutAuthSamlProvidersProviderIDCreated with default headers values +func NewPutAuthSamlProvidersProviderIDCreated() *PutAuthSamlProvidersProviderIDCreated { + return &PutAuthSamlProvidersProviderIDCreated{} +} + +/*PutAuthSamlProvidersProviderIDCreated handles this case with default header values. + +Provider created. +*/ +type PutAuthSamlProvidersProviderIDCreated struct { +} + +func (o *PutAuthSamlProvidersProviderIDCreated) Error() string { + return fmt.Sprintf("[PUT /auth/saml/providers/{provider-id}][%d] putAuthSamlProvidersProviderIdCreated ", 201) +} + +func (o *PutAuthSamlProvidersProviderIDCreated) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewPutAuthSamlProvidersProviderIDConflict creates a PutAuthSamlProvidersProviderIDConflict with default headers values +func NewPutAuthSamlProvidersProviderIDConflict() *PutAuthSamlProvidersProviderIDConflict { + return &PutAuthSamlProvidersProviderIDConflict{} +} + +/*PutAuthSamlProvidersProviderIDConflict handles this case with default header values. + +Provider already exists. +*/ +type PutAuthSamlProvidersProviderIDConflict struct { +} + +func (o *PutAuthSamlProvidersProviderIDConflict) Error() string { + return fmt.Sprintf("[PUT /auth/saml/providers/{provider-id}][%d] putAuthSamlProvidersProviderIdConflict ", 409) +} + +func (o *PutAuthSamlProvidersProviderIDConflict) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/dcos/iam/client/saml/saml_client.go b/dcos/iam/client/saml/saml_client.go new file mode 100644 index 0000000..4e5b1ce --- /dev/null +++ b/dcos/iam/client/saml/saml_client.go @@ -0,0 +1,270 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package saml + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "github.com/go-openapi/runtime" + + strfmt "github.com/go-openapi/strfmt" +) + +// New creates a new saml API client. +func New(transport runtime.ClientTransport, formats strfmt.Registry) *Client { + return &Client{transport: transport, formats: formats} +} + +/* +Client for saml API +*/ +type Client struct { + transport runtime.ClientTransport + formats strfmt.Registry +} + +/* +DeleteAuthSamlProvidersProviderID deletes provider + +Delete provider (disables authentication with that provider). +*/ +func (a *Client) DeleteAuthSamlProvidersProviderID(params *DeleteAuthSamlProvidersProviderIDParams) (*DeleteAuthSamlProvidersProviderIDNoContent, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewDeleteAuthSamlProvidersProviderIDParams() + } + + result, err := a.transport.Submit(&runtime.ClientOperation{ + ID: "DeleteAuthSamlProvidersProviderID", + Method: "DELETE", + PathPattern: "/auth/saml/providers/{provider-id}", + ProducesMediaTypes: []string{""}, + ConsumesMediaTypes: []string{""}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &DeleteAuthSamlProvidersProviderIDReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + }) + if err != nil { + return nil, err + } + return result.(*DeleteAuthSamlProvidersProviderIDNoContent), nil + +} + +/* +GetAuthSamlProviders gets an overview for the configured s a m l 2 0 providers + +Get an overview for the configured SAML 2.0 providers. The response contains a JSON object, with each key being a SAML provider ID, and each value being the corresponding provider description string. This endpoint does not expose sensitive provider configuration details. +*/ +func (a *Client) GetAuthSamlProviders(params *GetAuthSamlProvidersParams) (*GetAuthSamlProvidersOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewGetAuthSamlProvidersParams() + } + + result, err := a.transport.Submit(&runtime.ClientOperation{ + ID: "GetAuthSamlProviders", + Method: "GET", + PathPattern: "/auth/saml/providers", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{""}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &GetAuthSamlProvidersReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + }) + if err != nil { + return nil, err + } + return result.(*GetAuthSamlProvidersOK), nil + +} + +/* +GetAuthSamlProvidersProviderID gets configuration for a specific s a m l provider + +Get configuration for a specific SAML provider. +*/ +func (a *Client) GetAuthSamlProvidersProviderID(params *GetAuthSamlProvidersProviderIDParams) (*GetAuthSamlProvidersProviderIDOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewGetAuthSamlProvidersProviderIDParams() + } + + result, err := a.transport.Submit(&runtime.ClientOperation{ + ID: "GetAuthSamlProvidersProviderID", + Method: "GET", + PathPattern: "/auth/saml/providers/{provider-id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{""}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &GetAuthSamlProvidersProviderIDReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + }) + if err != nil { + return nil, err + } + return result.(*GetAuthSamlProvidersProviderIDOK), nil + +} + +/* +GetAuthSamlProvidersProviderIDAcsCallbackURL gets the authentication callback URL for this s p + +The IAM acts as SAML service provider (SP). A SAML identity provider (IdP) usually requires to be configured with the Assertion Consumer Service (ACS) callback URL of the SP (which is where the IdP makes the end-user submit the authentication response). +*/ +func (a *Client) GetAuthSamlProvidersProviderIDAcsCallbackURL(params *GetAuthSamlProvidersProviderIDAcsCallbackURLParams) (*GetAuthSamlProvidersProviderIDAcsCallbackURLOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewGetAuthSamlProvidersProviderIDAcsCallbackURLParams() + } + + result, err := a.transport.Submit(&runtime.ClientOperation{ + ID: "GetAuthSamlProvidersProviderIDAcsCallbackURL", + Method: "GET", + PathPattern: "/auth/saml/providers/{provider-id}/acs-callback-url", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{""}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &GetAuthSamlProvidersProviderIDAcsCallbackURLReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + }) + if err != nil { + return nil, err + } + return result.(*GetAuthSamlProvidersProviderIDAcsCallbackURLOK), nil + +} + +/* +GetAuthSamlProvidersProviderIDSpMetadata gets s p metadata XML + +The IAM acts as SAML service provider (SP). This endpoint provides the SP metadata as an XML document. Certain identity providers (IdPs) may want to directly consume this document. +*/ +func (a *Client) GetAuthSamlProvidersProviderIDSpMetadata(params *GetAuthSamlProvidersProviderIDSpMetadataParams) (*GetAuthSamlProvidersProviderIDSpMetadataOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewGetAuthSamlProvidersProviderIDSpMetadataParams() + } + + result, err := a.transport.Submit(&runtime.ClientOperation{ + ID: "GetAuthSamlProvidersProviderIDSpMetadata", + Method: "GET", + PathPattern: "/auth/saml/providers/{provider-id}/sp-metadata", + ProducesMediaTypes: []string{"application/samlmetadata+xml"}, + ConsumesMediaTypes: []string{""}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &GetAuthSamlProvidersProviderIDSpMetadataReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + }) + if err != nil { + return nil, err + } + return result.(*GetAuthSamlProvidersProviderIDSpMetadataOK), nil + +} + +/* +PatchAuthSamlProvidersProviderID updates s a m l provider config + +Update config for existing SAML provider. +*/ +func (a *Client) PatchAuthSamlProvidersProviderID(params *PatchAuthSamlProvidersProviderIDParams) (*PatchAuthSamlProvidersProviderIDNoContent, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPatchAuthSamlProvidersProviderIDParams() + } + + result, err := a.transport.Submit(&runtime.ClientOperation{ + ID: "PatchAuthSamlProvidersProviderID", + Method: "PATCH", + PathPattern: "/auth/saml/providers/{provider-id}", + ProducesMediaTypes: []string{""}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &PatchAuthSamlProvidersProviderIDReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + }) + if err != nil { + return nil, err + } + return result.(*PatchAuthSamlProvidersProviderIDNoContent), nil + +} + +/* +PostAuthSamlProvidersProviderIDAcsCallback thes s p a c s callback endpoint + +The IAM acts as SAML service provider (SP). As part of the authentication flow, a SAML identity provider (IdP) makes the end-user submit an authentication response to this endpoint. +*/ +func (a *Client) PostAuthSamlProvidersProviderIDAcsCallback(params *PostAuthSamlProvidersProviderIDAcsCallbackParams) error { + // TODO: Validate the params before sending + if params == nil { + params = NewPostAuthSamlProvidersProviderIDAcsCallbackParams() + } + + _, err := a.transport.Submit(&runtime.ClientOperation{ + ID: "PostAuthSamlProvidersProviderIDAcsCallback", + Method: "POST", + PathPattern: "/auth/saml/providers/{provider-id}/acs-callback", + ProducesMediaTypes: []string{""}, + ConsumesMediaTypes: []string{""}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &PostAuthSamlProvidersProviderIDAcsCallbackReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + }) + if err != nil { + return err + } + return nil + +} + +/* +PutAuthSamlProvidersProviderID configures a new s a m l provider + +Set up a SAML provider with the ID as specified in the URL, and with the config as given by the JSON document in the request body. +*/ +func (a *Client) PutAuthSamlProvidersProviderID(params *PutAuthSamlProvidersProviderIDParams) (*PutAuthSamlProvidersProviderIDCreated, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPutAuthSamlProvidersProviderIDParams() + } + + result, err := a.transport.Submit(&runtime.ClientOperation{ + ID: "PutAuthSamlProvidersProviderID", + Method: "PUT", + PathPattern: "/auth/saml/providers/{provider-id}", + ProducesMediaTypes: []string{""}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &PutAuthSamlProvidersProviderIDReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + }) + if err != nil { + return nil, err + } + return result.(*PutAuthSamlProvidersProviderIDCreated), nil + +} + +// SetTransport changes the transport on the client +func (a *Client) SetTransport(transport runtime.ClientTransport) { + a.transport = transport +} diff --git a/dcos/iam/client/users/delete_users_uid_parameters.go b/dcos/iam/client/users/delete_users_uid_parameters.go new file mode 100644 index 0000000..13edb9a --- /dev/null +++ b/dcos/iam/client/users/delete_users_uid_parameters.go @@ -0,0 +1,136 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package users + +// 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" + + strfmt "github.com/go-openapi/strfmt" +) + +// NewDeleteUsersUIDParams creates a new DeleteUsersUIDParams object +// with the default values initialized. +func NewDeleteUsersUIDParams() *DeleteUsersUIDParams { + var () + return &DeleteUsersUIDParams{ + + timeout: cr.DefaultTimeout, + } +} + +// NewDeleteUsersUIDParamsWithTimeout creates a new DeleteUsersUIDParams object +// with the default values initialized, and the ability to set a timeout on a request +func NewDeleteUsersUIDParamsWithTimeout(timeout time.Duration) *DeleteUsersUIDParams { + var () + return &DeleteUsersUIDParams{ + + timeout: timeout, + } +} + +// NewDeleteUsersUIDParamsWithContext creates a new DeleteUsersUIDParams object +// with the default values initialized, and the ability to set a context for a request +func NewDeleteUsersUIDParamsWithContext(ctx context.Context) *DeleteUsersUIDParams { + var () + return &DeleteUsersUIDParams{ + + Context: ctx, + } +} + +// NewDeleteUsersUIDParamsWithHTTPClient creates a new DeleteUsersUIDParams object +// with the default values initialized, and the ability to set a custom HTTPClient for a request +func NewDeleteUsersUIDParamsWithHTTPClient(client *http.Client) *DeleteUsersUIDParams { + var () + return &DeleteUsersUIDParams{ + HTTPClient: client, + } +} + +/*DeleteUsersUIDParams contains all the parameters to send to the API endpoint +for the delete users UID operation typically these are written to a http.Request +*/ +type DeleteUsersUIDParams struct { + + /*UID + The ID of the user account to delete. + + */ + UID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithTimeout adds the timeout to the delete users UID params +func (o *DeleteUsersUIDParams) WithTimeout(timeout time.Duration) *DeleteUsersUIDParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the delete users UID params +func (o *DeleteUsersUIDParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the delete users UID params +func (o *DeleteUsersUIDParams) WithContext(ctx context.Context) *DeleteUsersUIDParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the delete users UID params +func (o *DeleteUsersUIDParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the delete users UID params +func (o *DeleteUsersUIDParams) WithHTTPClient(client *http.Client) *DeleteUsersUIDParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the delete users UID params +func (o *DeleteUsersUIDParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithUID adds the uid to the delete users UID params +func (o *DeleteUsersUIDParams) WithUID(uid string) *DeleteUsersUIDParams { + o.SetUID(uid) + return o +} + +// SetUID adds the uid to the delete users UID params +func (o *DeleteUsersUIDParams) SetUID(uid string) { + o.UID = uid +} + +// WriteToRequest writes these params to a swagger request +func (o *DeleteUsersUIDParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param uid + if err := r.SetPathParam("uid", o.UID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/dcos/iam/client/users/delete_users_uid_responses.go b/dcos/iam/client/users/delete_users_uid_responses.go new file mode 100644 index 0000000..ab74750 --- /dev/null +++ b/dcos/iam/client/users/delete_users_uid_responses.go @@ -0,0 +1,112 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package users + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + + "github.com/go-openapi/runtime" + + strfmt "github.com/go-openapi/strfmt" +) + +// DeleteUsersUIDReader is a Reader for the DeleteUsersUID structure. +type DeleteUsersUIDReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *DeleteUsersUIDReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + + case 204: + result := NewDeleteUsersUIDNoContent() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + + case 400: + result := NewDeleteUsersUIDBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + + case 404: + result := NewDeleteUsersUIDNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + + default: + return nil, runtime.NewAPIError("unknown error", response, response.Code()) + } +} + +// NewDeleteUsersUIDNoContent creates a DeleteUsersUIDNoContent with default headers values +func NewDeleteUsersUIDNoContent() *DeleteUsersUIDNoContent { + return &DeleteUsersUIDNoContent{} +} + +/*DeleteUsersUIDNoContent handles this case with default header values. + +Success. +*/ +type DeleteUsersUIDNoContent struct { +} + +func (o *DeleteUsersUIDNoContent) Error() string { + return fmt.Sprintf("[DELETE /users/{uid}][%d] deleteUsersUidNoContent ", 204) +} + +func (o *DeleteUsersUIDNoContent) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewDeleteUsersUIDBadRequest creates a DeleteUsersUIDBadRequest with default headers values +func NewDeleteUsersUIDBadRequest() *DeleteUsersUIDBadRequest { + return &DeleteUsersUIDBadRequest{} +} + +/*DeleteUsersUIDBadRequest handles this case with default header values. + +Bad request. +*/ +type DeleteUsersUIDBadRequest struct { +} + +func (o *DeleteUsersUIDBadRequest) Error() string { + return fmt.Sprintf("[DELETE /users/{uid}][%d] deleteUsersUidBadRequest ", 400) +} + +func (o *DeleteUsersUIDBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewDeleteUsersUIDNotFound creates a DeleteUsersUIDNotFound with default headers values +func NewDeleteUsersUIDNotFound() *DeleteUsersUIDNotFound { + return &DeleteUsersUIDNotFound{} +} + +/*DeleteUsersUIDNotFound handles this case with default header values. + +User account not found. +*/ +type DeleteUsersUIDNotFound struct { +} + +func (o *DeleteUsersUIDNotFound) Error() string { + return fmt.Sprintf("[DELETE /users/{uid}][%d] deleteUsersUidNotFound ", 404) +} + +func (o *DeleteUsersUIDNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/dcos/iam/client/users/get_users_parameters.go b/dcos/iam/client/users/get_users_parameters.go new file mode 100644 index 0000000..6efdd39 --- /dev/null +++ b/dcos/iam/client/users/get_users_parameters.go @@ -0,0 +1,147 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package users + +// 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" + + strfmt "github.com/go-openapi/strfmt" +) + +// NewGetUsersParams creates a new GetUsersParams object +// with the default values initialized. +func NewGetUsersParams() *GetUsersParams { + var () + return &GetUsersParams{ + + timeout: cr.DefaultTimeout, + } +} + +// NewGetUsersParamsWithTimeout creates a new GetUsersParams object +// with the default values initialized, and the ability to set a timeout on a request +func NewGetUsersParamsWithTimeout(timeout time.Duration) *GetUsersParams { + var () + return &GetUsersParams{ + + timeout: timeout, + } +} + +// NewGetUsersParamsWithContext creates a new GetUsersParams object +// with the default values initialized, and the ability to set a context for a request +func NewGetUsersParamsWithContext(ctx context.Context) *GetUsersParams { + var () + return &GetUsersParams{ + + Context: ctx, + } +} + +// NewGetUsersParamsWithHTTPClient creates a new GetUsersParams object +// with the default values initialized, and the ability to set a custom HTTPClient for a request +func NewGetUsersParamsWithHTTPClient(client *http.Client) *GetUsersParams { + var () + return &GetUsersParams{ + HTTPClient: client, + } +} + +/*GetUsersParams contains all the parameters to send to the API endpoint +for the get users operation typically these are written to a http.Request +*/ +type GetUsersParams struct { + + /*Type + If set to `service`, list only service user accounts. If unset, default to only listing regular user accounts. + + */ + Type *string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithTimeout adds the timeout to the get users params +func (o *GetUsersParams) WithTimeout(timeout time.Duration) *GetUsersParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the get users params +func (o *GetUsersParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the get users params +func (o *GetUsersParams) WithContext(ctx context.Context) *GetUsersParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the get users params +func (o *GetUsersParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the get users params +func (o *GetUsersParams) WithHTTPClient(client *http.Client) *GetUsersParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the get users params +func (o *GetUsersParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithType adds the typeVar to the get users params +func (o *GetUsersParams) WithType(typeVar *string) *GetUsersParams { + o.SetType(typeVar) + return o +} + +// SetType adds the type to the get users params +func (o *GetUsersParams) SetType(typeVar *string) { + o.Type = typeVar +} + +// WriteToRequest writes these params to a swagger request +func (o *GetUsersParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.Type != nil { + + // query param type + var qrType string + if o.Type != nil { + qrType = *o.Type + } + qType := qrType + if qType != "" { + if err := r.SetQueryParam("type", qType); err != nil { + return err + } + } + + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/dcos/iam/client/users/get_users_responses.go b/dcos/iam/client/users/get_users_responses.go new file mode 100644 index 0000000..8d2f251 --- /dev/null +++ b/dcos/iam/client/users/get_users_responses.go @@ -0,0 +1,136 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package users + +// 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" + "strconv" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + "github.com/go-openapi/swag" + + strfmt "github.com/go-openapi/strfmt" + + models "github.com/dcos/client-go/dcos/iam/models" +) + +// GetUsersReader is a Reader for the GetUsers structure. +type GetUsersReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *GetUsersReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + + case 200: + result := NewGetUsersOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + + default: + return nil, runtime.NewAPIError("unknown error", response, response.Code()) + } +} + +// NewGetUsersOK creates a GetUsersOK with default headers values +func NewGetUsersOK() *GetUsersOK { + return &GetUsersOK{} +} + +/*GetUsersOK handles this case with default header values. + +Success. +*/ +type GetUsersOK struct { + Payload *GetUsersOKBody +} + +func (o *GetUsersOK) Error() string { + return fmt.Sprintf("[GET /users][%d] getUsersOK %+v", 200, o.Payload) +} + +func (o *GetUsersOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(GetUsersOKBody) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +/*GetUsersOKBody get users o k body +swagger:model GetUsersOKBody +*/ +type GetUsersOKBody struct { + + // array + Array []*models.User `json:"array"` +} + +// Validate validates this get users o k body +func (o *GetUsersOKBody) Validate(formats strfmt.Registry) error { + var res []error + + if err := o.validateArray(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (o *GetUsersOKBody) validateArray(formats strfmt.Registry) error { + + if swag.IsZero(o.Array) { // not required + return nil + } + + for i := 0; i < len(o.Array); i++ { + if swag.IsZero(o.Array[i]) { // not required + continue + } + + if o.Array[i] != nil { + if err := o.Array[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("getUsersOK" + "." + "array" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// MarshalBinary interface implementation +func (o *GetUsersOKBody) MarshalBinary() ([]byte, error) { + if o == nil { + return nil, nil + } + return swag.WriteJSON(o) +} + +// UnmarshalBinary interface implementation +func (o *GetUsersOKBody) UnmarshalBinary(b []byte) error { + var res GetUsersOKBody + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *o = res + return nil +} diff --git a/dcos/iam/client/users/get_users_uid_groups_parameters.go b/dcos/iam/client/users/get_users_uid_groups_parameters.go new file mode 100644 index 0000000..78bf621 --- /dev/null +++ b/dcos/iam/client/users/get_users_uid_groups_parameters.go @@ -0,0 +1,136 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package users + +// 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" + + strfmt "github.com/go-openapi/strfmt" +) + +// NewGetUsersUIDGroupsParams creates a new GetUsersUIDGroupsParams object +// with the default values initialized. +func NewGetUsersUIDGroupsParams() *GetUsersUIDGroupsParams { + var () + return &GetUsersUIDGroupsParams{ + + timeout: cr.DefaultTimeout, + } +} + +// NewGetUsersUIDGroupsParamsWithTimeout creates a new GetUsersUIDGroupsParams object +// with the default values initialized, and the ability to set a timeout on a request +func NewGetUsersUIDGroupsParamsWithTimeout(timeout time.Duration) *GetUsersUIDGroupsParams { + var () + return &GetUsersUIDGroupsParams{ + + timeout: timeout, + } +} + +// NewGetUsersUIDGroupsParamsWithContext creates a new GetUsersUIDGroupsParams object +// with the default values initialized, and the ability to set a context for a request +func NewGetUsersUIDGroupsParamsWithContext(ctx context.Context) *GetUsersUIDGroupsParams { + var () + return &GetUsersUIDGroupsParams{ + + Context: ctx, + } +} + +// NewGetUsersUIDGroupsParamsWithHTTPClient creates a new GetUsersUIDGroupsParams object +// with the default values initialized, and the ability to set a custom HTTPClient for a request +func NewGetUsersUIDGroupsParamsWithHTTPClient(client *http.Client) *GetUsersUIDGroupsParams { + var () + return &GetUsersUIDGroupsParams{ + HTTPClient: client, + } +} + +/*GetUsersUIDGroupsParams contains all the parameters to send to the API endpoint +for the get users UID groups operation typically these are written to a http.Request +*/ +type GetUsersUIDGroupsParams struct { + + /*UID + The ID of the user. + + */ + UID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithTimeout adds the timeout to the get users UID groups params +func (o *GetUsersUIDGroupsParams) WithTimeout(timeout time.Duration) *GetUsersUIDGroupsParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the get users UID groups params +func (o *GetUsersUIDGroupsParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the get users UID groups params +func (o *GetUsersUIDGroupsParams) WithContext(ctx context.Context) *GetUsersUIDGroupsParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the get users UID groups params +func (o *GetUsersUIDGroupsParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the get users UID groups params +func (o *GetUsersUIDGroupsParams) WithHTTPClient(client *http.Client) *GetUsersUIDGroupsParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the get users UID groups params +func (o *GetUsersUIDGroupsParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithUID adds the uid to the get users UID groups params +func (o *GetUsersUIDGroupsParams) WithUID(uid string) *GetUsersUIDGroupsParams { + o.SetUID(uid) + return o +} + +// SetUID adds the uid to the get users UID groups params +func (o *GetUsersUIDGroupsParams) SetUID(uid string) { + o.UID = uid +} + +// WriteToRequest writes these params to a swagger request +func (o *GetUsersUIDGroupsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param uid + if err := r.SetPathParam("uid", o.UID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/dcos/iam/client/users/get_users_uid_groups_responses.go b/dcos/iam/client/users/get_users_uid_groups_responses.go new file mode 100644 index 0000000..a48a483 --- /dev/null +++ b/dcos/iam/client/users/get_users_uid_groups_responses.go @@ -0,0 +1,67 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package users + +// 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" + + strfmt "github.com/go-openapi/strfmt" + + models "github.com/dcos/client-go/dcos/iam/models" +) + +// GetUsersUIDGroupsReader is a Reader for the GetUsersUIDGroups structure. +type GetUsersUIDGroupsReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *GetUsersUIDGroupsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + + case 200: + result := NewGetUsersUIDGroupsOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + + default: + return nil, runtime.NewAPIError("unknown error", response, response.Code()) + } +} + +// NewGetUsersUIDGroupsOK creates a GetUsersUIDGroupsOK with default headers values +func NewGetUsersUIDGroupsOK() *GetUsersUIDGroupsOK { + return &GetUsersUIDGroupsOK{} +} + +/*GetUsersUIDGroupsOK handles this case with default header values. + +Success. +*/ +type GetUsersUIDGroupsOK struct { + Payload *models.UserGroups +} + +func (o *GetUsersUIDGroupsOK) Error() string { + return fmt.Sprintf("[GET /users/{uid}/groups][%d] getUsersUidGroupsOK %+v", 200, o.Payload) +} + +func (o *GetUsersUIDGroupsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.UserGroups) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/dcos/iam/client/users/get_users_uid_parameters.go b/dcos/iam/client/users/get_users_uid_parameters.go new file mode 100644 index 0000000..1ebe067 --- /dev/null +++ b/dcos/iam/client/users/get_users_uid_parameters.go @@ -0,0 +1,136 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package users + +// 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" + + strfmt "github.com/go-openapi/strfmt" +) + +// NewGetUsersUIDParams creates a new GetUsersUIDParams object +// with the default values initialized. +func NewGetUsersUIDParams() *GetUsersUIDParams { + var () + return &GetUsersUIDParams{ + + timeout: cr.DefaultTimeout, + } +} + +// NewGetUsersUIDParamsWithTimeout creates a new GetUsersUIDParams object +// with the default values initialized, and the ability to set a timeout on a request +func NewGetUsersUIDParamsWithTimeout(timeout time.Duration) *GetUsersUIDParams { + var () + return &GetUsersUIDParams{ + + timeout: timeout, + } +} + +// NewGetUsersUIDParamsWithContext creates a new GetUsersUIDParams object +// with the default values initialized, and the ability to set a context for a request +func NewGetUsersUIDParamsWithContext(ctx context.Context) *GetUsersUIDParams { + var () + return &GetUsersUIDParams{ + + Context: ctx, + } +} + +// NewGetUsersUIDParamsWithHTTPClient creates a new GetUsersUIDParams object +// with the default values initialized, and the ability to set a custom HTTPClient for a request +func NewGetUsersUIDParamsWithHTTPClient(client *http.Client) *GetUsersUIDParams { + var () + return &GetUsersUIDParams{ + HTTPClient: client, + } +} + +/*GetUsersUIDParams contains all the parameters to send to the API endpoint +for the get users UID operation typically these are written to a http.Request +*/ +type GetUsersUIDParams struct { + + /*UID + The ID of the user object to retrieve. + + */ + UID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithTimeout adds the timeout to the get users UID params +func (o *GetUsersUIDParams) WithTimeout(timeout time.Duration) *GetUsersUIDParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the get users UID params +func (o *GetUsersUIDParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the get users UID params +func (o *GetUsersUIDParams) WithContext(ctx context.Context) *GetUsersUIDParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the get users UID params +func (o *GetUsersUIDParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the get users UID params +func (o *GetUsersUIDParams) WithHTTPClient(client *http.Client) *GetUsersUIDParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the get users UID params +func (o *GetUsersUIDParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithUID adds the uid to the get users UID params +func (o *GetUsersUIDParams) WithUID(uid string) *GetUsersUIDParams { + o.SetUID(uid) + return o +} + +// SetUID adds the uid to the get users UID params +func (o *GetUsersUIDParams) SetUID(uid string) { + o.UID = uid +} + +// WriteToRequest writes these params to a swagger request +func (o *GetUsersUIDParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param uid + if err := r.SetPathParam("uid", o.UID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/dcos/iam/client/users/get_users_uid_permissions_parameters.go b/dcos/iam/client/users/get_users_uid_permissions_parameters.go new file mode 100644 index 0000000..3bcb43a --- /dev/null +++ b/dcos/iam/client/users/get_users_uid_permissions_parameters.go @@ -0,0 +1,136 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package users + +// 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" + + strfmt "github.com/go-openapi/strfmt" +) + +// NewGetUsersUIDPermissionsParams creates a new GetUsersUIDPermissionsParams object +// with the default values initialized. +func NewGetUsersUIDPermissionsParams() *GetUsersUIDPermissionsParams { + var () + return &GetUsersUIDPermissionsParams{ + + timeout: cr.DefaultTimeout, + } +} + +// NewGetUsersUIDPermissionsParamsWithTimeout creates a new GetUsersUIDPermissionsParams object +// with the default values initialized, and the ability to set a timeout on a request +func NewGetUsersUIDPermissionsParamsWithTimeout(timeout time.Duration) *GetUsersUIDPermissionsParams { + var () + return &GetUsersUIDPermissionsParams{ + + timeout: timeout, + } +} + +// NewGetUsersUIDPermissionsParamsWithContext creates a new GetUsersUIDPermissionsParams object +// with the default values initialized, and the ability to set a context for a request +func NewGetUsersUIDPermissionsParamsWithContext(ctx context.Context) *GetUsersUIDPermissionsParams { + var () + return &GetUsersUIDPermissionsParams{ + + Context: ctx, + } +} + +// NewGetUsersUIDPermissionsParamsWithHTTPClient creates a new GetUsersUIDPermissionsParams object +// with the default values initialized, and the ability to set a custom HTTPClient for a request +func NewGetUsersUIDPermissionsParamsWithHTTPClient(client *http.Client) *GetUsersUIDPermissionsParams { + var () + return &GetUsersUIDPermissionsParams{ + HTTPClient: client, + } +} + +/*GetUsersUIDPermissionsParams contains all the parameters to send to the API endpoint +for the get users UID permissions operation typically these are written to a http.Request +*/ +type GetUsersUIDPermissionsParams struct { + + /*UID + The id of the user. + + */ + UID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithTimeout adds the timeout to the get users UID permissions params +func (o *GetUsersUIDPermissionsParams) WithTimeout(timeout time.Duration) *GetUsersUIDPermissionsParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the get users UID permissions params +func (o *GetUsersUIDPermissionsParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the get users UID permissions params +func (o *GetUsersUIDPermissionsParams) WithContext(ctx context.Context) *GetUsersUIDPermissionsParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the get users UID permissions params +func (o *GetUsersUIDPermissionsParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the get users UID permissions params +func (o *GetUsersUIDPermissionsParams) WithHTTPClient(client *http.Client) *GetUsersUIDPermissionsParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the get users UID permissions params +func (o *GetUsersUIDPermissionsParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithUID adds the uid to the get users UID permissions params +func (o *GetUsersUIDPermissionsParams) WithUID(uid string) *GetUsersUIDPermissionsParams { + o.SetUID(uid) + return o +} + +// SetUID adds the uid to the get users UID permissions params +func (o *GetUsersUIDPermissionsParams) SetUID(uid string) { + o.UID = uid +} + +// WriteToRequest writes these params to a swagger request +func (o *GetUsersUIDPermissionsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param uid + if err := r.SetPathParam("uid", o.UID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/dcos/iam/client/users/get_users_uid_permissions_responses.go b/dcos/iam/client/users/get_users_uid_permissions_responses.go new file mode 100644 index 0000000..a8b5d7d --- /dev/null +++ b/dcos/iam/client/users/get_users_uid_permissions_responses.go @@ -0,0 +1,67 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package users + +// 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" + + strfmt "github.com/go-openapi/strfmt" + + models "github.com/dcos/client-go/dcos/iam/models" +) + +// GetUsersUIDPermissionsReader is a Reader for the GetUsersUIDPermissions structure. +type GetUsersUIDPermissionsReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *GetUsersUIDPermissionsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + + case 200: + result := NewGetUsersUIDPermissionsOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + + default: + return nil, runtime.NewAPIError("unknown error", response, response.Code()) + } +} + +// NewGetUsersUIDPermissionsOK creates a GetUsersUIDPermissionsOK with default headers values +func NewGetUsersUIDPermissionsOK() *GetUsersUIDPermissionsOK { + return &GetUsersUIDPermissionsOK{} +} + +/*GetUsersUIDPermissionsOK handles this case with default header values. + +Success. +*/ +type GetUsersUIDPermissionsOK struct { + Payload *models.UserPermissions +} + +func (o *GetUsersUIDPermissionsOK) Error() string { + return fmt.Sprintf("[GET /users/{uid}/permissions][%d] getUsersUidPermissionsOK %+v", 200, o.Payload) +} + +func (o *GetUsersUIDPermissionsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.UserPermissions) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/dcos/iam/client/users/get_users_uid_responses.go b/dcos/iam/client/users/get_users_uid_responses.go new file mode 100644 index 0000000..5454f80 --- /dev/null +++ b/dcos/iam/client/users/get_users_uid_responses.go @@ -0,0 +1,67 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package users + +// 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" + + strfmt "github.com/go-openapi/strfmt" + + models "github.com/dcos/client-go/dcos/iam/models" +) + +// GetUsersUIDReader is a Reader for the GetUsersUID structure. +type GetUsersUIDReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *GetUsersUIDReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + + case 200: + result := NewGetUsersUIDOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + + default: + return nil, runtime.NewAPIError("unknown error", response, response.Code()) + } +} + +// NewGetUsersUIDOK creates a GetUsersUIDOK with default headers values +func NewGetUsersUIDOK() *GetUsersUIDOK { + return &GetUsersUIDOK{} +} + +/*GetUsersUIDOK handles this case with default header values. + +Success. +*/ +type GetUsersUIDOK struct { + Payload *models.User +} + +func (o *GetUsersUIDOK) Error() string { + return fmt.Sprintf("[GET /users/{uid}][%d] getUsersUidOK %+v", 200, o.Payload) +} + +func (o *GetUsersUIDOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.User) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/dcos/iam/client/users/patch_users_uid_parameters.go b/dcos/iam/client/users/patch_users_uid_parameters.go new file mode 100644 index 0000000..f4820a2 --- /dev/null +++ b/dcos/iam/client/users/patch_users_uid_parameters.go @@ -0,0 +1,160 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package users + +// 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" + + strfmt "github.com/go-openapi/strfmt" + + models "github.com/dcos/client-go/dcos/iam/models" +) + +// NewPatchUsersUIDParams creates a new PatchUsersUIDParams object +// with the default values initialized. +func NewPatchUsersUIDParams() *PatchUsersUIDParams { + var () + return &PatchUsersUIDParams{ + + timeout: cr.DefaultTimeout, + } +} + +// NewPatchUsersUIDParamsWithTimeout creates a new PatchUsersUIDParams object +// with the default values initialized, and the ability to set a timeout on a request +func NewPatchUsersUIDParamsWithTimeout(timeout time.Duration) *PatchUsersUIDParams { + var () + return &PatchUsersUIDParams{ + + timeout: timeout, + } +} + +// NewPatchUsersUIDParamsWithContext creates a new PatchUsersUIDParams object +// with the default values initialized, and the ability to set a context for a request +func NewPatchUsersUIDParamsWithContext(ctx context.Context) *PatchUsersUIDParams { + var () + return &PatchUsersUIDParams{ + + Context: ctx, + } +} + +// NewPatchUsersUIDParamsWithHTTPClient creates a new PatchUsersUIDParams object +// with the default values initialized, and the ability to set a custom HTTPClient for a request +func NewPatchUsersUIDParamsWithHTTPClient(client *http.Client) *PatchUsersUIDParams { + var () + return &PatchUsersUIDParams{ + HTTPClient: client, + } +} + +/*PatchUsersUIDParams contains all the parameters to send to the API endpoint +for the patch users UID operation typically these are written to a http.Request +*/ +type PatchUsersUIDParams struct { + + /*UserUpdateObject + Password/description. + + */ + UserUpdateObject *models.UserUpdate + /*UID + The ID of the user account to modify. + + */ + UID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithTimeout adds the timeout to the patch users UID params +func (o *PatchUsersUIDParams) WithTimeout(timeout time.Duration) *PatchUsersUIDParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the patch users UID params +func (o *PatchUsersUIDParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the patch users UID params +func (o *PatchUsersUIDParams) WithContext(ctx context.Context) *PatchUsersUIDParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the patch users UID params +func (o *PatchUsersUIDParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the patch users UID params +func (o *PatchUsersUIDParams) WithHTTPClient(client *http.Client) *PatchUsersUIDParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the patch users UID params +func (o *PatchUsersUIDParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithUserUpdateObject adds the userUpdateObject to the patch users UID params +func (o *PatchUsersUIDParams) WithUserUpdateObject(userUpdateObject *models.UserUpdate) *PatchUsersUIDParams { + o.SetUserUpdateObject(userUpdateObject) + return o +} + +// SetUserUpdateObject adds the userUpdateObject to the patch users UID params +func (o *PatchUsersUIDParams) SetUserUpdateObject(userUpdateObject *models.UserUpdate) { + o.UserUpdateObject = userUpdateObject +} + +// WithUID adds the uid to the patch users UID params +func (o *PatchUsersUIDParams) WithUID(uid string) *PatchUsersUIDParams { + o.SetUID(uid) + return o +} + +// SetUID adds the uid to the patch users UID params +func (o *PatchUsersUIDParams) SetUID(uid string) { + o.UID = uid +} + +// WriteToRequest writes these params to a swagger request +func (o *PatchUsersUIDParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.UserUpdateObject != nil { + if err := r.SetBodyParam(o.UserUpdateObject); err != nil { + return err + } + } + + // path param uid + if err := r.SetPathParam("uid", o.UID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/dcos/iam/client/users/patch_users_uid_responses.go b/dcos/iam/client/users/patch_users_uid_responses.go new file mode 100644 index 0000000..9623815 --- /dev/null +++ b/dcos/iam/client/users/patch_users_uid_responses.go @@ -0,0 +1,84 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package users + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + + "github.com/go-openapi/runtime" + + strfmt "github.com/go-openapi/strfmt" +) + +// PatchUsersUIDReader is a Reader for the PatchUsersUID structure. +type PatchUsersUIDReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PatchUsersUIDReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + + case 204: + result := NewPatchUsersUIDNoContent() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + + case 501: + result := NewPatchUsersUIDNotImplemented() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + + default: + return nil, runtime.NewAPIError("unknown error", response, response.Code()) + } +} + +// NewPatchUsersUIDNoContent creates a PatchUsersUIDNoContent with default headers values +func NewPatchUsersUIDNoContent() *PatchUsersUIDNoContent { + return &PatchUsersUIDNoContent{} +} + +/*PatchUsersUIDNoContent handles this case with default header values. + +Update applied. +*/ +type PatchUsersUIDNoContent struct { +} + +func (o *PatchUsersUIDNoContent) Error() string { + return fmt.Sprintf("[PATCH /users/{uid}][%d] patchUsersUidNoContent ", 204) +} + +func (o *PatchUsersUIDNoContent) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewPatchUsersUIDNotImplemented creates a PatchUsersUIDNotImplemented with default headers values +func NewPatchUsersUIDNotImplemented() *PatchUsersUIDNotImplemented { + return &PatchUsersUIDNotImplemented{} +} + +/*PatchUsersUIDNotImplemented handles this case with default header values. + +Not implemented for service user accounts. +*/ +type PatchUsersUIDNotImplemented struct { +} + +func (o *PatchUsersUIDNotImplemented) Error() string { + return fmt.Sprintf("[PATCH /users/{uid}][%d] patchUsersUidNotImplemented ", 501) +} + +func (o *PatchUsersUIDNotImplemented) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/dcos/iam/client/users/put_users_uid_parameters.go b/dcos/iam/client/users/put_users_uid_parameters.go new file mode 100644 index 0000000..6ec3933 --- /dev/null +++ b/dcos/iam/client/users/put_users_uid_parameters.go @@ -0,0 +1,160 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package users + +// 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" + + strfmt "github.com/go-openapi/strfmt" + + models "github.com/dcos/client-go/dcos/iam/models" +) + +// NewPutUsersUIDParams creates a new PutUsersUIDParams object +// with the default values initialized. +func NewPutUsersUIDParams() *PutUsersUIDParams { + var () + return &PutUsersUIDParams{ + + timeout: cr.DefaultTimeout, + } +} + +// NewPutUsersUIDParamsWithTimeout creates a new PutUsersUIDParams object +// with the default values initialized, and the ability to set a timeout on a request +func NewPutUsersUIDParamsWithTimeout(timeout time.Duration) *PutUsersUIDParams { + var () + return &PutUsersUIDParams{ + + timeout: timeout, + } +} + +// NewPutUsersUIDParamsWithContext creates a new PutUsersUIDParams object +// with the default values initialized, and the ability to set a context for a request +func NewPutUsersUIDParamsWithContext(ctx context.Context) *PutUsersUIDParams { + var () + return &PutUsersUIDParams{ + + Context: ctx, + } +} + +// NewPutUsersUIDParamsWithHTTPClient creates a new PutUsersUIDParams object +// with the default values initialized, and the ability to set a custom HTTPClient for a request +func NewPutUsersUIDParamsWithHTTPClient(client *http.Client) *PutUsersUIDParams { + var () + return &PutUsersUIDParams{ + HTTPClient: client, + } +} + +/*PutUsersUIDParams contains all the parameters to send to the API endpoint +for the put users UID operation typically these are written to a http.Request +*/ +type PutUsersUIDParams struct { + + /*UserCreationObject + Password/description. + + */ + UserCreationObject *models.UserCreate + /*UID + The ID of the user account to create. + + */ + UID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithTimeout adds the timeout to the put users UID params +func (o *PutUsersUIDParams) WithTimeout(timeout time.Duration) *PutUsersUIDParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the put users UID params +func (o *PutUsersUIDParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the put users UID params +func (o *PutUsersUIDParams) WithContext(ctx context.Context) *PutUsersUIDParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the put users UID params +func (o *PutUsersUIDParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the put users UID params +func (o *PutUsersUIDParams) WithHTTPClient(client *http.Client) *PutUsersUIDParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the put users UID params +func (o *PutUsersUIDParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithUserCreationObject adds the userCreationObject to the put users UID params +func (o *PutUsersUIDParams) WithUserCreationObject(userCreationObject *models.UserCreate) *PutUsersUIDParams { + o.SetUserCreationObject(userCreationObject) + return o +} + +// SetUserCreationObject adds the userCreationObject to the put users UID params +func (o *PutUsersUIDParams) SetUserCreationObject(userCreationObject *models.UserCreate) { + o.UserCreationObject = userCreationObject +} + +// WithUID adds the uid to the put users UID params +func (o *PutUsersUIDParams) WithUID(uid string) *PutUsersUIDParams { + o.SetUID(uid) + return o +} + +// SetUID adds the uid to the put users UID params +func (o *PutUsersUIDParams) SetUID(uid string) { + o.UID = uid +} + +// WriteToRequest writes these params to a swagger request +func (o *PutUsersUIDParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.UserCreationObject != nil { + if err := r.SetBodyParam(o.UserCreationObject); err != nil { + return err + } + } + + // path param uid + if err := r.SetPathParam("uid", o.UID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/dcos/iam/client/users/put_users_uid_responses.go b/dcos/iam/client/users/put_users_uid_responses.go new file mode 100644 index 0000000..97482e4 --- /dev/null +++ b/dcos/iam/client/users/put_users_uid_responses.go @@ -0,0 +1,84 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package users + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + + "github.com/go-openapi/runtime" + + strfmt "github.com/go-openapi/strfmt" +) + +// PutUsersUIDReader is a Reader for the PutUsersUID structure. +type PutUsersUIDReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PutUsersUIDReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + + case 201: + result := NewPutUsersUIDCreated() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + + case 409: + result := NewPutUsersUIDConflict() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + + default: + return nil, runtime.NewAPIError("unknown error", response, response.Code()) + } +} + +// NewPutUsersUIDCreated creates a PutUsersUIDCreated with default headers values +func NewPutUsersUIDCreated() *PutUsersUIDCreated { + return &PutUsersUIDCreated{} +} + +/*PutUsersUIDCreated handles this case with default header values. + +User created. +*/ +type PutUsersUIDCreated struct { +} + +func (o *PutUsersUIDCreated) Error() string { + return fmt.Sprintf("[PUT /users/{uid}][%d] putUsersUidCreated ", 201) +} + +func (o *PutUsersUIDCreated) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewPutUsersUIDConflict creates a PutUsersUIDConflict with default headers values +func NewPutUsersUIDConflict() *PutUsersUIDConflict { + return &PutUsersUIDConflict{} +} + +/*PutUsersUIDConflict handles this case with default header values. + +User already exists. +*/ +type PutUsersUIDConflict struct { +} + +func (o *PutUsersUIDConflict) Error() string { + return fmt.Sprintf("[PUT /users/{uid}][%d] putUsersUidConflict ", 409) +} + +func (o *PutUsersUIDConflict) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/dcos/iam/client/users/users_client.go b/dcos/iam/client/users/users_client.go new file mode 100644 index 0000000..9843ff1 --- /dev/null +++ b/dcos/iam/client/users/users_client.go @@ -0,0 +1,240 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package users + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "github.com/go-openapi/runtime" + + strfmt "github.com/go-openapi/strfmt" +) + +// New creates a new users API client. +func New(transport runtime.ClientTransport, formats strfmt.Registry) *Client { + return &Client{transport: transport, formats: formats} +} + +/* +Client for users API +*/ +type Client struct { + transport runtime.ClientTransport + formats strfmt.Registry +} + +/* +DeleteUsersUID deletes account + +Delete account. +*/ +func (a *Client) DeleteUsersUID(params *DeleteUsersUIDParams) (*DeleteUsersUIDNoContent, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewDeleteUsersUIDParams() + } + + result, err := a.transport.Submit(&runtime.ClientOperation{ + ID: "DeleteUsersUID", + Method: "DELETE", + PathPattern: "/users/{uid}", + ProducesMediaTypes: []string{""}, + ConsumesMediaTypes: []string{""}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &DeleteUsersUIDReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + }) + if err != nil { + return nil, err + } + return result.(*DeleteUsersUIDNoContent), nil + +} + +/* +GetUsers retrieves all regular user accounts or service user accounts + +Retrieve `User` objects. By default the list consists of regular user accounts, only. Alternatively, service user accounts may be requested instead. +*/ +func (a *Client) GetUsers(params *GetUsersParams) (*GetUsersOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewGetUsersParams() + } + + result, err := a.transport.Submit(&runtime.ClientOperation{ + ID: "GetUsers", + Method: "GET", + PathPattern: "/users", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{""}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &GetUsersReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + }) + if err != nil { + return nil, err + } + return result.(*GetUsersOK), nil + +} + +/* +GetUsersUID gets single user object + +Get specific `User` object. +*/ +func (a *Client) GetUsersUID(params *GetUsersUIDParams) (*GetUsersUIDOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewGetUsersUIDParams() + } + + result, err := a.transport.Submit(&runtime.ClientOperation{ + ID: "GetUsersUID", + Method: "GET", + PathPattern: "/users/{uid}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{""}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &GetUsersUIDReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + }) + if err != nil { + return nil, err + } + return result.(*GetUsersUIDOK), nil + +} + +/* +GetUsersUIDGroups retrieves groups the user is member of + +Retrieve groups the user is member of. +*/ +func (a *Client) GetUsersUIDGroups(params *GetUsersUIDGroupsParams) (*GetUsersUIDGroupsOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewGetUsersUIDGroupsParams() + } + + result, err := a.transport.Submit(&runtime.ClientOperation{ + ID: "GetUsersUIDGroups", + Method: "GET", + PathPattern: "/users/{uid}/groups", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{""}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &GetUsersUIDGroupsReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + }) + if err != nil { + return nil, err + } + return result.(*GetUsersUIDGroupsOK), nil + +} + +/* +GetUsersUIDPermissions retrieves permissions an account has + +Retrieve the permissions for this account with direct permissions distinguished from those that are obtained through group membership. +*/ +func (a *Client) GetUsersUIDPermissions(params *GetUsersUIDPermissionsParams) (*GetUsersUIDPermissionsOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewGetUsersUIDPermissionsParams() + } + + result, err := a.transport.Submit(&runtime.ClientOperation{ + ID: "GetUsersUIDPermissions", + Method: "GET", + PathPattern: "/users/{uid}/permissions", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{""}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &GetUsersUIDPermissionsReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + }) + if err != nil { + return nil, err + } + return result.(*GetUsersUIDPermissionsOK), nil + +} + +/* +PatchUsersUID updates user account + +Update existing user account (meta data and/or password). +*/ +func (a *Client) PatchUsersUID(params *PatchUsersUIDParams) (*PatchUsersUIDNoContent, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPatchUsersUIDParams() + } + + result, err := a.transport.Submit(&runtime.ClientOperation{ + ID: "PatchUsersUID", + Method: "PATCH", + PathPattern: "/users/{uid}", + ProducesMediaTypes: []string{""}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &PatchUsersUIDReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + }) + if err != nil { + return nil, err + } + return result.(*PatchUsersUIDNoContent), nil + +} + +/* +PutUsersUID creates user account + +Create user (uid in url, details incl. credentials in body). +*/ +func (a *Client) PutUsersUID(params *PutUsersUIDParams) (*PutUsersUIDCreated, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPutUsersUIDParams() + } + + result, err := a.transport.Submit(&runtime.ClientOperation{ + ID: "PutUsersUID", + Method: "PUT", + PathPattern: "/users/{uid}", + ProducesMediaTypes: []string{""}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &PutUsersUIDReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + }) + if err != nil { + return nil, err + } + return result.(*PutUsersUIDCreated), nil + +} + +// SetTransport changes the transport on the client +func (a *Client) SetTransport(transport runtime.ClientTransport) { + a.transport = transport +} diff --git a/dcos/iam/models/acl.go b/dcos/iam/models/acl.go new file mode 100644 index 0000000..62348f8 --- /dev/null +++ b/dcos/iam/models/acl.go @@ -0,0 +1,98 @@ +// 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 ( + strfmt "github.com/go-openapi/strfmt" + + "github.com/go-openapi/errors" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// ACL ACL +// swagger:model ACL +type ACL struct { + + // description + // Required: true + Description *string `json:"description"` + + // rid + // Required: true + Rid *string `json:"rid"` + + // url + // Required: true + URL *string `json:"url"` +} + +// Validate validates this ACL +func (m *ACL) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateDescription(formats); err != nil { + res = append(res, err) + } + + if err := m.validateRid(formats); err != nil { + res = append(res, err) + } + + if err := m.validateURL(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *ACL) validateDescription(formats strfmt.Registry) error { + + if err := validate.Required("description", "body", m.Description); err != nil { + return err + } + + return nil +} + +func (m *ACL) validateRid(formats strfmt.Registry) error { + + if err := validate.Required("rid", "body", m.Rid); err != nil { + return err + } + + return nil +} + +func (m *ACL) validateURL(formats strfmt.Registry) error { + + if err := validate.Required("url", "body", m.URL); err != nil { + return err + } + + return nil +} + +// MarshalBinary interface implementation +func (m *ACL) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *ACL) UnmarshalBinary(b []byte) error { + var res ACL + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/dcos/iam/models/acl_create.go b/dcos/iam/models/acl_create.go new file mode 100644 index 0000000..f16c8ea --- /dev/null +++ b/dcos/iam/models/acl_create.go @@ -0,0 +1,64 @@ +// 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 ( + strfmt "github.com/go-openapi/strfmt" + + "github.com/go-openapi/errors" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// ACLCreate ACL create +// swagger:model ACLCreate +type ACLCreate struct { + + // description + // Required: true + Description *string `json:"description"` +} + +// Validate validates this ACL create +func (m *ACLCreate) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateDescription(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *ACLCreate) validateDescription(formats strfmt.Registry) error { + + if err := validate.Required("description", "body", m.Description); err != nil { + return err + } + + return nil +} + +// MarshalBinary interface implementation +func (m *ACLCreate) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *ACLCreate) UnmarshalBinary(b []byte) error { + var res ACLCreate + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/dcos/iam/models/acl_permissions.go b/dcos/iam/models/acl_permissions.go new file mode 100644 index 0000000..914d3cf --- /dev/null +++ b/dcos/iam/models/acl_permissions.go @@ -0,0 +1,313 @@ +// 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 ( + "strconv" + + strfmt "github.com/go-openapi/strfmt" + + "github.com/go-openapi/errors" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// ACLPermissions ACL permissions +// swagger:model ACLPermissions +type ACLPermissions struct { + + // groups + Groups []*ACLPermissionsGroupsItems0 `json:"groups"` + + // users + Users []*ACLPermissionsUsersItems0 `json:"users"` +} + +// Validate validates this ACL permissions +func (m *ACLPermissions) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateGroups(formats); err != nil { + res = append(res, err) + } + + if err := m.validateUsers(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *ACLPermissions) validateGroups(formats strfmt.Registry) error { + + if swag.IsZero(m.Groups) { // not required + return nil + } + + for i := 0; i < len(m.Groups); i++ { + if swag.IsZero(m.Groups[i]) { // not required + continue + } + + if m.Groups[i] != nil { + if err := m.Groups[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("groups" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *ACLPermissions) validateUsers(formats strfmt.Registry) error { + + if swag.IsZero(m.Users) { // not required + return nil + } + + for i := 0; i < len(m.Users); i++ { + if swag.IsZero(m.Users[i]) { // not required + continue + } + + if m.Users[i] != nil { + if err := m.Users[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("users" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// MarshalBinary interface implementation +func (m *ACLPermissions) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *ACLPermissions) UnmarshalBinary(b []byte) error { + var res ACLPermissions + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} + +// ACLPermissionsGroupsItems0 ACL permissions groups items0 +// swagger:model ACLPermissionsGroupsItems0 +type ACLPermissionsGroupsItems0 struct { + + // actions + // Required: true + Actions []*Action `json:"actions"` + + // gid + // Required: true + Gid *string `json:"gid"` + + // groupurl + // Required: true + Groupurl *string `json:"groupurl"` +} + +// Validate validates this ACL permissions groups items0 +func (m *ACLPermissionsGroupsItems0) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateActions(formats); err != nil { + res = append(res, err) + } + + if err := m.validateGid(formats); err != nil { + res = append(res, err) + } + + if err := m.validateGroupurl(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *ACLPermissionsGroupsItems0) validateActions(formats strfmt.Registry) error { + + if err := validate.Required("actions", "body", m.Actions); err != nil { + return err + } + + for i := 0; i < len(m.Actions); i++ { + if swag.IsZero(m.Actions[i]) { // not required + continue + } + + if m.Actions[i] != nil { + if err := m.Actions[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("actions" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *ACLPermissionsGroupsItems0) validateGid(formats strfmt.Registry) error { + + if err := validate.Required("gid", "body", m.Gid); err != nil { + return err + } + + return nil +} + +func (m *ACLPermissionsGroupsItems0) validateGroupurl(formats strfmt.Registry) error { + + if err := validate.Required("groupurl", "body", m.Groupurl); err != nil { + return err + } + + return nil +} + +// MarshalBinary interface implementation +func (m *ACLPermissionsGroupsItems0) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *ACLPermissionsGroupsItems0) UnmarshalBinary(b []byte) error { + var res ACLPermissionsGroupsItems0 + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} + +// ACLPermissionsUsersItems0 ACL permissions users items0 +// swagger:model ACLPermissionsUsersItems0 +type ACLPermissionsUsersItems0 struct { + + // actions + // Required: true + Actions []*Action `json:"actions"` + + // uid + // Required: true + UID *string `json:"uid"` + + // userurl + // Required: true + Userurl *string `json:"userurl"` +} + +// Validate validates this ACL permissions users items0 +func (m *ACLPermissionsUsersItems0) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateActions(formats); err != nil { + res = append(res, err) + } + + if err := m.validateUID(formats); err != nil { + res = append(res, err) + } + + if err := m.validateUserurl(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *ACLPermissionsUsersItems0) validateActions(formats strfmt.Registry) error { + + if err := validate.Required("actions", "body", m.Actions); err != nil { + return err + } + + for i := 0; i < len(m.Actions); i++ { + if swag.IsZero(m.Actions[i]) { // not required + continue + } + + if m.Actions[i] != nil { + if err := m.Actions[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("actions" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *ACLPermissionsUsersItems0) validateUID(formats strfmt.Registry) error { + + if err := validate.Required("uid", "body", m.UID); err != nil { + return err + } + + return nil +} + +func (m *ACLPermissionsUsersItems0) validateUserurl(formats strfmt.Registry) error { + + if err := validate.Required("userurl", "body", m.Userurl); err != nil { + return err + } + + return nil +} + +// MarshalBinary interface implementation +func (m *ACLPermissionsUsersItems0) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *ACLPermissionsUsersItems0) UnmarshalBinary(b []byte) error { + var res ACLPermissionsUsersItems0 + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/dcos/iam/models/acl_update.go b/dcos/iam/models/acl_update.go new file mode 100644 index 0000000..1a5b44b --- /dev/null +++ b/dcos/iam/models/acl_update.go @@ -0,0 +1,64 @@ +// 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 ( + strfmt "github.com/go-openapi/strfmt" + + "github.com/go-openapi/errors" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// ACLUpdate ACL update +// swagger:model ACLUpdate +type ACLUpdate struct { + + // description + // Required: true + Description *string `json:"description"` +} + +// Validate validates this ACL update +func (m *ACLUpdate) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateDescription(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *ACLUpdate) validateDescription(formats strfmt.Registry) error { + + if err := validate.Required("description", "body", m.Description); err != nil { + return err + } + + return nil +} + +// MarshalBinary interface implementation +func (m *ACLUpdate) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *ACLUpdate) UnmarshalBinary(b []byte) error { + var res ACLUpdate + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/dcos/iam/models/action.go b/dcos/iam/models/action.go new file mode 100644 index 0000000..11bd244 --- /dev/null +++ b/dcos/iam/models/action.go @@ -0,0 +1,81 @@ +// 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 ( + strfmt "github.com/go-openapi/strfmt" + + "github.com/go-openapi/errors" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// Action action +// swagger:model Action +type Action struct { + + // name + // Required: true + Name *string `json:"name"` + + // url + // Required: true + URL *string `json:"url"` +} + +// Validate validates this action +func (m *Action) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateName(formats); err != nil { + res = append(res, err) + } + + if err := m.validateURL(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Action) validateName(formats strfmt.Registry) error { + + if err := validate.Required("name", "body", m.Name); err != nil { + return err + } + + return nil +} + +func (m *Action) validateURL(formats strfmt.Registry) error { + + if err := validate.Required("url", "body", m.URL); err != nil { + return err + } + + return nil +} + +// MarshalBinary interface implementation +func (m *Action) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *Action) UnmarshalBinary(b []byte) error { + var res Action + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/dcos/iam/models/action_allowed.go b/dcos/iam/models/action_allowed.go new file mode 100644 index 0000000..e2f4c10 --- /dev/null +++ b/dcos/iam/models/action_allowed.go @@ -0,0 +1,64 @@ +// 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 ( + strfmt "github.com/go-openapi/strfmt" + + "github.com/go-openapi/errors" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// ActionAllowed action allowed +// swagger:model ActionAllowed +type ActionAllowed struct { + + // allowed + // Required: true + Allowed *bool `json:"allowed"` +} + +// Validate validates this action allowed +func (m *ActionAllowed) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateAllowed(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *ActionAllowed) validateAllowed(formats strfmt.Registry) error { + + if err := validate.Required("allowed", "body", m.Allowed); err != nil { + return err + } + + return nil +} + +// MarshalBinary interface implementation +func (m *ActionAllowed) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *ActionAllowed) UnmarshalBinary(b []byte) error { + var res ActionAllowed + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/dcos/iam/models/auth_token.go b/dcos/iam/models/auth_token.go new file mode 100644 index 0000000..5496e82 --- /dev/null +++ b/dcos/iam/models/auth_token.go @@ -0,0 +1,64 @@ +// 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 ( + strfmt "github.com/go-openapi/strfmt" + + "github.com/go-openapi/errors" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// AuthToken auth token +// swagger:model AuthToken +type AuthToken struct { + + // token + // Required: true + Token *string `json:"token"` +} + +// Validate validates this auth token +func (m *AuthToken) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateToken(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *AuthToken) validateToken(formats strfmt.Registry) error { + + if err := validate.Required("token", "body", m.Token); err != nil { + return err + } + + return nil +} + +// MarshalBinary interface implementation +func (m *AuthToken) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *AuthToken) UnmarshalBinary(b []byte) error { + var res AuthToken + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/dcos/iam/models/group.go b/dcos/iam/models/group.go new file mode 100644 index 0000000..b4f48cf --- /dev/null +++ b/dcos/iam/models/group.go @@ -0,0 +1,115 @@ +// 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 ( + strfmt "github.com/go-openapi/strfmt" + + "github.com/go-openapi/errors" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// Group group +// swagger:model Group +type Group struct { + + // description + // Required: true + Description *string `json:"description"` + + // gid + // Required: true + Gid *string `json:"gid"` + + // provider type + // Required: true + ProviderType *string `json:"provider_type"` + + // url + // Required: true + URL *string `json:"url"` +} + +// Validate validates this group +func (m *Group) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateDescription(formats); err != nil { + res = append(res, err) + } + + if err := m.validateGid(formats); err != nil { + res = append(res, err) + } + + if err := m.validateProviderType(formats); err != nil { + res = append(res, err) + } + + if err := m.validateURL(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Group) validateDescription(formats strfmt.Registry) error { + + if err := validate.Required("description", "body", m.Description); err != nil { + return err + } + + return nil +} + +func (m *Group) validateGid(formats strfmt.Registry) error { + + if err := validate.Required("gid", "body", m.Gid); err != nil { + return err + } + + return nil +} + +func (m *Group) validateProviderType(formats strfmt.Registry) error { + + if err := validate.Required("provider_type", "body", m.ProviderType); err != nil { + return err + } + + return nil +} + +func (m *Group) validateURL(formats strfmt.Registry) error { + + if err := validate.Required("url", "body", m.URL); err != nil { + return err + } + + return nil +} + +// MarshalBinary interface implementation +func (m *Group) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *Group) UnmarshalBinary(b []byte) error { + var res Group + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/dcos/iam/models/group_create.go b/dcos/iam/models/group_create.go new file mode 100644 index 0000000..793f61c --- /dev/null +++ b/dcos/iam/models/group_create.go @@ -0,0 +1,67 @@ +// 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 ( + strfmt "github.com/go-openapi/strfmt" + + "github.com/go-openapi/errors" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// GroupCreate group create +// swagger:model GroupCreate +type GroupCreate struct { + + // description + // Required: true + Description *string `json:"description"` + + // provider type + ProviderType string `json:"provider_type,omitempty"` +} + +// Validate validates this group create +func (m *GroupCreate) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateDescription(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *GroupCreate) validateDescription(formats strfmt.Registry) error { + + if err := validate.Required("description", "body", m.Description); err != nil { + return err + } + + return nil +} + +// MarshalBinary interface implementation +func (m *GroupCreate) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *GroupCreate) UnmarshalBinary(b []byte) error { + var res GroupCreate + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/dcos/iam/models/group_permissions.go b/dcos/iam/models/group_permissions.go new file mode 100644 index 0000000..233a0d8 --- /dev/null +++ b/dcos/iam/models/group_permissions.go @@ -0,0 +1,198 @@ +// 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 ( + "strconv" + + strfmt "github.com/go-openapi/strfmt" + + "github.com/go-openapi/errors" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// GroupPermissions group permissions +// swagger:model GroupPermissions +type GroupPermissions struct { + + // array + Array []*GroupPermissionsArrayItems0 `json:"array"` +} + +// Validate validates this group permissions +func (m *GroupPermissions) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateArray(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *GroupPermissions) validateArray(formats strfmt.Registry) error { + + if swag.IsZero(m.Array) { // not required + return nil + } + + for i := 0; i < len(m.Array); i++ { + if swag.IsZero(m.Array[i]) { // not required + continue + } + + if m.Array[i] != nil { + if err := m.Array[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("array" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// MarshalBinary interface implementation +func (m *GroupPermissions) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *GroupPermissions) UnmarshalBinary(b []byte) error { + var res GroupPermissions + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} + +// GroupPermissionsArrayItems0 group permissions array items0 +// swagger:model GroupPermissionsArrayItems0 +type GroupPermissionsArrayItems0 struct { + + // aclurl + // Required: true + Aclurl *string `json:"aclurl"` + + // actions + // Required: true + Actions []*Action `json:"actions"` + + // description + // Required: true + Description *string `json:"description"` + + // rid + // Required: true + Rid *string `json:"rid"` +} + +// Validate validates this group permissions array items0 +func (m *GroupPermissionsArrayItems0) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateAclurl(formats); err != nil { + res = append(res, err) + } + + if err := m.validateActions(formats); err != nil { + res = append(res, err) + } + + if err := m.validateDescription(formats); err != nil { + res = append(res, err) + } + + if err := m.validateRid(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *GroupPermissionsArrayItems0) validateAclurl(formats strfmt.Registry) error { + + if err := validate.Required("aclurl", "body", m.Aclurl); err != nil { + return err + } + + return nil +} + +func (m *GroupPermissionsArrayItems0) validateActions(formats strfmt.Registry) error { + + if err := validate.Required("actions", "body", m.Actions); err != nil { + return err + } + + for i := 0; i < len(m.Actions); i++ { + if swag.IsZero(m.Actions[i]) { // not required + continue + } + + if m.Actions[i] != nil { + if err := m.Actions[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("actions" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *GroupPermissionsArrayItems0) validateDescription(formats strfmt.Registry) error { + + if err := validate.Required("description", "body", m.Description); err != nil { + return err + } + + return nil +} + +func (m *GroupPermissionsArrayItems0) validateRid(formats strfmt.Registry) error { + + if err := validate.Required("rid", "body", m.Rid); err != nil { + return err + } + + return nil +} + +// MarshalBinary interface implementation +func (m *GroupPermissionsArrayItems0) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *GroupPermissionsArrayItems0) UnmarshalBinary(b []byte) error { + var res GroupPermissionsArrayItems0 + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/dcos/iam/models/group_update.go b/dcos/iam/models/group_update.go new file mode 100644 index 0000000..1e3bacf --- /dev/null +++ b/dcos/iam/models/group_update.go @@ -0,0 +1,64 @@ +// 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 ( + strfmt "github.com/go-openapi/strfmt" + + "github.com/go-openapi/errors" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// GroupUpdate group update +// swagger:model GroupUpdate +type GroupUpdate struct { + + // description + // Required: true + Description *string `json:"description"` +} + +// Validate validates this group update +func (m *GroupUpdate) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateDescription(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *GroupUpdate) validateDescription(formats strfmt.Registry) error { + + if err := validate.Required("description", "body", m.Description); err != nil { + return err + } + + return nil +} + +// MarshalBinary interface implementation +func (m *GroupUpdate) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *GroupUpdate) UnmarshalBinary(b []byte) error { + var res GroupUpdate + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/dcos/iam/models/group_users.go b/dcos/iam/models/group_users.go new file mode 100644 index 0000000..41cedb2 --- /dev/null +++ b/dcos/iam/models/group_users.go @@ -0,0 +1,157 @@ +// 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 ( + "strconv" + + strfmt "github.com/go-openapi/strfmt" + + "github.com/go-openapi/errors" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// GroupUsers group users +// swagger:model GroupUsers +type GroupUsers struct { + + // array + Array []*GroupUsersArrayItems0 `json:"array"` +} + +// Validate validates this group users +func (m *GroupUsers) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateArray(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *GroupUsers) validateArray(formats strfmt.Registry) error { + + if swag.IsZero(m.Array) { // not required + return nil + } + + for i := 0; i < len(m.Array); i++ { + if swag.IsZero(m.Array[i]) { // not required + continue + } + + if m.Array[i] != nil { + if err := m.Array[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("array" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// MarshalBinary interface implementation +func (m *GroupUsers) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *GroupUsers) UnmarshalBinary(b []byte) error { + var res GroupUsers + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} + +// GroupUsersArrayItems0 group users array items0 +// swagger:model GroupUsersArrayItems0 +type GroupUsersArrayItems0 struct { + + // membershipurl + // Required: true + Membershipurl *string `json:"membershipurl"` + + // user + // Required: true + User *User `json:"user"` +} + +// Validate validates this group users array items0 +func (m *GroupUsersArrayItems0) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateMembershipurl(formats); err != nil { + res = append(res, err) + } + + if err := m.validateUser(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *GroupUsersArrayItems0) validateMembershipurl(formats strfmt.Registry) error { + + if err := validate.Required("membershipurl", "body", m.Membershipurl); err != nil { + return err + } + + return nil +} + +func (m *GroupUsersArrayItems0) validateUser(formats strfmt.Registry) error { + + if err := validate.Required("user", "body", m.User); err != nil { + return err + } + + if m.User != nil { + if err := m.User.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("user") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *GroupUsersArrayItems0) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *GroupUsersArrayItems0) UnmarshalBinary(b []byte) error { + var res GroupUsersArrayItems0 + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/dcos/iam/models/l_d_a_p_configuration.go b/dcos/iam/models/l_d_a_p_configuration.go new file mode 100644 index 0000000..46a364d --- /dev/null +++ b/dcos/iam/models/l_d_a_p_configuration.go @@ -0,0 +1,180 @@ +// 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 ( + strfmt "github.com/go-openapi/strfmt" + + "github.com/go-openapi/errors" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// LDAPConfiguration l d a p configuration +// swagger:model LDAPConfiguration +type LDAPConfiguration struct { + + // ca certs + CaCerts string `json:"ca-certs,omitempty"` + + // client cert + ClientCert string `json:"client-cert,omitempty"` + + // dntemplate + Dntemplate string `json:"dntemplate,omitempty"` + + // enforce starttls + // Required: true + EnforceStarttls *bool `json:"enforce-starttls"` + + // group search + GroupSearch *LDAPGroupSearchConfig `json:"group-search,omitempty"` + + // host + // Required: true + Host *string `json:"host"` + + // lookup dn + LookupDn string `json:"lookup-dn,omitempty"` + + // lookup password + LookupPassword string `json:"lookup-password,omitempty"` + + // port + // Required: true + Port *int64 `json:"port"` + + // use ldaps + // Required: true + UseLdaps *bool `json:"use-ldaps"` + + // user search + UserSearch *LDAPUserSearchConfig `json:"user-search,omitempty"` +} + +// Validate validates this l d a p configuration +func (m *LDAPConfiguration) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateEnforceStarttls(formats); err != nil { + res = append(res, err) + } + + if err := m.validateGroupSearch(formats); err != nil { + res = append(res, err) + } + + if err := m.validateHost(formats); err != nil { + res = append(res, err) + } + + if err := m.validatePort(formats); err != nil { + res = append(res, err) + } + + if err := m.validateUseLdaps(formats); err != nil { + res = append(res, err) + } + + if err := m.validateUserSearch(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *LDAPConfiguration) validateEnforceStarttls(formats strfmt.Registry) error { + + if err := validate.Required("enforce-starttls", "body", m.EnforceStarttls); err != nil { + return err + } + + return nil +} + +func (m *LDAPConfiguration) validateGroupSearch(formats strfmt.Registry) error { + + if swag.IsZero(m.GroupSearch) { // not required + return nil + } + + if m.GroupSearch != nil { + if err := m.GroupSearch.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("group-search") + } + return err + } + } + + return nil +} + +func (m *LDAPConfiguration) validateHost(formats strfmt.Registry) error { + + if err := validate.Required("host", "body", m.Host); err != nil { + return err + } + + return nil +} + +func (m *LDAPConfiguration) validatePort(formats strfmt.Registry) error { + + if err := validate.Required("port", "body", m.Port); err != nil { + return err + } + + return nil +} + +func (m *LDAPConfiguration) validateUseLdaps(formats strfmt.Registry) error { + + if err := validate.Required("use-ldaps", "body", m.UseLdaps); err != nil { + return err + } + + return nil +} + +func (m *LDAPConfiguration) validateUserSearch(formats strfmt.Registry) error { + + if swag.IsZero(m.UserSearch) { // not required + return nil + } + + if m.UserSearch != nil { + if err := m.UserSearch.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("user-search") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *LDAPConfiguration) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *LDAPConfiguration) UnmarshalBinary(b []byte) error { + var res LDAPConfiguration + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/dcos/iam/models/l_d_a_p_group_search_config.go b/dcos/iam/models/l_d_a_p_group_search_config.go new file mode 100644 index 0000000..03c4e6c --- /dev/null +++ b/dcos/iam/models/l_d_a_p_group_search_config.go @@ -0,0 +1,84 @@ +// 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 ( + strfmt "github.com/go-openapi/strfmt" + + "github.com/go-openapi/errors" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// LDAPGroupSearchConfig l d a p group search config +// swagger:model LDAPGroupSearchConfig +type LDAPGroupSearchConfig struct { + + // member attributes + MemberAttributes []string `json:"member-attributes"` + + // search base + // Required: true + SearchBase *string `json:"search-base"` + + // search filter template + // Required: true + SearchFilterTemplate *string `json:"search-filter-template"` +} + +// Validate validates this l d a p group search config +func (m *LDAPGroupSearchConfig) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateSearchBase(formats); err != nil { + res = append(res, err) + } + + if err := m.validateSearchFilterTemplate(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *LDAPGroupSearchConfig) validateSearchBase(formats strfmt.Registry) error { + + if err := validate.Required("search-base", "body", m.SearchBase); err != nil { + return err + } + + return nil +} + +func (m *LDAPGroupSearchConfig) validateSearchFilterTemplate(formats strfmt.Registry) error { + + if err := validate.Required("search-filter-template", "body", m.SearchFilterTemplate); err != nil { + return err + } + + return nil +} + +// MarshalBinary interface implementation +func (m *LDAPGroupSearchConfig) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *LDAPGroupSearchConfig) UnmarshalBinary(b []byte) error { + var res LDAPGroupSearchConfig + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/dcos/iam/models/l_d_a_p_test_credentials.go b/dcos/iam/models/l_d_a_p_test_credentials.go new file mode 100644 index 0000000..efe8be1 --- /dev/null +++ b/dcos/iam/models/l_d_a_p_test_credentials.go @@ -0,0 +1,81 @@ +// 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 ( + strfmt "github.com/go-openapi/strfmt" + + "github.com/go-openapi/errors" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// LDAPTestCredentials l d a p test credentials +// swagger:model LDAPTestCredentials +type LDAPTestCredentials struct { + + // password + // Required: true + Password *string `json:"password"` + + // uid + // Required: true + UID *string `json:"uid"` +} + +// Validate validates this l d a p test credentials +func (m *LDAPTestCredentials) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validatePassword(formats); err != nil { + res = append(res, err) + } + + if err := m.validateUID(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *LDAPTestCredentials) validatePassword(formats strfmt.Registry) error { + + if err := validate.Required("password", "body", m.Password); err != nil { + return err + } + + return nil +} + +func (m *LDAPTestCredentials) validateUID(formats strfmt.Registry) error { + + if err := validate.Required("uid", "body", m.UID); err != nil { + return err + } + + return nil +} + +// MarshalBinary interface implementation +func (m *LDAPTestCredentials) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *LDAPTestCredentials) UnmarshalBinary(b []byte) error { + var res LDAPTestCredentials + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/dcos/iam/models/l_d_a_p_test_result_object.go b/dcos/iam/models/l_d_a_p_test_result_object.go new file mode 100644 index 0000000..29ab82e --- /dev/null +++ b/dcos/iam/models/l_d_a_p_test_result_object.go @@ -0,0 +1,81 @@ +// 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 ( + strfmt "github.com/go-openapi/strfmt" + + "github.com/go-openapi/errors" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// LDAPTestResultObject l d a p test result object +// swagger:model LDAPTestResultObject +type LDAPTestResultObject struct { + + // code + // Required: true + Code *string `json:"code"` + + // description + // Required: true + Description *string `json:"description"` +} + +// Validate validates this l d a p test result object +func (m *LDAPTestResultObject) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateCode(formats); err != nil { + res = append(res, err) + } + + if err := m.validateDescription(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *LDAPTestResultObject) validateCode(formats strfmt.Registry) error { + + if err := validate.Required("code", "body", m.Code); err != nil { + return err + } + + return nil +} + +func (m *LDAPTestResultObject) validateDescription(formats strfmt.Registry) error { + + if err := validate.Required("description", "body", m.Description); err != nil { + return err + } + + return nil +} + +// MarshalBinary interface implementation +func (m *LDAPTestResultObject) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *LDAPTestResultObject) UnmarshalBinary(b []byte) error { + var res LDAPTestResultObject + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/dcos/iam/models/l_d_a_p_user_search_config.go b/dcos/iam/models/l_d_a_p_user_search_config.go new file mode 100644 index 0000000..e75f4ed --- /dev/null +++ b/dcos/iam/models/l_d_a_p_user_search_config.go @@ -0,0 +1,81 @@ +// 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 ( + strfmt "github.com/go-openapi/strfmt" + + "github.com/go-openapi/errors" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// LDAPUserSearchConfig l d a p user search config +// swagger:model LDAPUserSearchConfig +type LDAPUserSearchConfig struct { + + // search base + // Required: true + SearchBase *string `json:"search-base"` + + // search filter template + // Required: true + SearchFilterTemplate *string `json:"search-filter-template"` +} + +// Validate validates this l d a p user search config +func (m *LDAPUserSearchConfig) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateSearchBase(formats); err != nil { + res = append(res, err) + } + + if err := m.validateSearchFilterTemplate(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *LDAPUserSearchConfig) validateSearchBase(formats strfmt.Registry) error { + + if err := validate.Required("search-base", "body", m.SearchBase); err != nil { + return err + } + + return nil +} + +func (m *LDAPUserSearchConfig) validateSearchFilterTemplate(formats strfmt.Registry) error { + + if err := validate.Required("search-filter-template", "body", m.SearchFilterTemplate); err != nil { + return err + } + + return nil +} + +// MarshalBinary interface implementation +func (m *LDAPUserSearchConfig) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *LDAPUserSearchConfig) UnmarshalBinary(b []byte) error { + var res LDAPUserSearchConfig + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/dcos/iam/models/l_d_apimport_group_object.go b/dcos/iam/models/l_d_apimport_group_object.go new file mode 100644 index 0000000..4eb8084 --- /dev/null +++ b/dcos/iam/models/l_d_apimport_group_object.go @@ -0,0 +1,64 @@ +// 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 ( + strfmt "github.com/go-openapi/strfmt" + + "github.com/go-openapi/errors" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// LDApimportGroupObject l d apimport group object +// swagger:model LDAPImportGroupObject +type LDApimportGroupObject struct { + + // groupname + // Required: true + Groupname *string `json:"groupname"` +} + +// Validate validates this l d apimport group object +func (m *LDApimportGroupObject) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateGroupname(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *LDApimportGroupObject) validateGroupname(formats strfmt.Registry) error { + + if err := validate.Required("groupname", "body", m.Groupname); err != nil { + return err + } + + return nil +} + +// MarshalBinary interface implementation +func (m *LDApimportGroupObject) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *LDApimportGroupObject) UnmarshalBinary(b []byte) error { + var res LDApimportGroupObject + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/dcos/iam/models/l_d_apimport_user_object.go b/dcos/iam/models/l_d_apimport_user_object.go new file mode 100644 index 0000000..b32b864 --- /dev/null +++ b/dcos/iam/models/l_d_apimport_user_object.go @@ -0,0 +1,64 @@ +// 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 ( + strfmt "github.com/go-openapi/strfmt" + + "github.com/go-openapi/errors" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// LDApimportUserObject l d apimport user object +// swagger:model LDAPImportUserObject +type LDApimportUserObject struct { + + // username + // Required: true + Username *string `json:"username"` +} + +// Validate validates this l d apimport user object +func (m *LDApimportUserObject) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateUsername(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *LDApimportUserObject) validateUsername(formats strfmt.Registry) error { + + if err := validate.Required("username", "body", m.Username); err != nil { + return err + } + + return nil +} + +// MarshalBinary interface implementation +func (m *LDApimportUserObject) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *LDApimportUserObject) UnmarshalBinary(b []byte) error { + var res LDApimportUserObject + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/dcos/iam/models/login_object.go b/dcos/iam/models/login_object.go new file mode 100644 index 0000000..6caab3a --- /dev/null +++ b/dcos/iam/models/login_object.go @@ -0,0 +1,49 @@ +// 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 ( + strfmt "github.com/go-openapi/strfmt" + + "github.com/go-openapi/swag" +) + +// LoginObject login object +// swagger:model LoginObject +type LoginObject struct { + + // password + Password string `json:"password,omitempty"` + + // token + Token string `json:"token,omitempty"` + + // uid + UID string `json:"uid,omitempty"` +} + +// Validate validates this login object +func (m *LoginObject) Validate(formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *LoginObject) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *LoginObject) UnmarshalBinary(b []byte) error { + var res LoginObject + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/dcos/iam/models/o_id_c_provider_config.go b/dcos/iam/models/o_id_c_provider_config.go new file mode 100644 index 0000000..5aadc0b --- /dev/null +++ b/dcos/iam/models/o_id_c_provider_config.go @@ -0,0 +1,138 @@ +// 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 ( + strfmt "github.com/go-openapi/strfmt" + + "github.com/go-openapi/errors" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// OIDCProviderConfig o ID c provider config +// swagger:model OIDCProviderConfig +type OIDCProviderConfig struct { + + // base url + // Required: true + BaseURL *string `json:"base_url"` + + // ca certs + CaCerts string `json:"ca_certs,omitempty"` + + // client id + // Required: true + ClientID *string `json:"client_id"` + + // client secret + // Required: true + ClientSecret *string `json:"client_secret"` + + // description + // Required: true + Description *string `json:"description"` + + // issuer + // Required: true + Issuer *string `json:"issuer"` + + // verify server certificate + VerifyServerCertificate bool `json:"verify_server_certificate,omitempty"` +} + +// Validate validates this o ID c provider config +func (m *OIDCProviderConfig) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateBaseURL(formats); err != nil { + res = append(res, err) + } + + if err := m.validateClientID(formats); err != nil { + res = append(res, err) + } + + if err := m.validateClientSecret(formats); err != nil { + res = append(res, err) + } + + if err := m.validateDescription(formats); err != nil { + res = append(res, err) + } + + if err := m.validateIssuer(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *OIDCProviderConfig) validateBaseURL(formats strfmt.Registry) error { + + if err := validate.Required("base_url", "body", m.BaseURL); err != nil { + return err + } + + return nil +} + +func (m *OIDCProviderConfig) validateClientID(formats strfmt.Registry) error { + + if err := validate.Required("client_id", "body", m.ClientID); err != nil { + return err + } + + return nil +} + +func (m *OIDCProviderConfig) validateClientSecret(formats strfmt.Registry) error { + + if err := validate.Required("client_secret", "body", m.ClientSecret); err != nil { + return err + } + + return nil +} + +func (m *OIDCProviderConfig) validateDescription(formats strfmt.Registry) error { + + if err := validate.Required("description", "body", m.Description); err != nil { + return err + } + + return nil +} + +func (m *OIDCProviderConfig) validateIssuer(formats strfmt.Registry) error { + + if err := validate.Required("issuer", "body", m.Issuer); err != nil { + return err + } + + return nil +} + +// MarshalBinary interface implementation +func (m *OIDCProviderConfig) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *OIDCProviderConfig) UnmarshalBinary(b []byte) error { + var res OIDCProviderConfig + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/dcos/iam/models/s_a_m_l_a_c_s_callback_url_object.go b/dcos/iam/models/s_a_m_l_a_c_s_callback_url_object.go new file mode 100644 index 0000000..a0b6f10 --- /dev/null +++ b/dcos/iam/models/s_a_m_l_a_c_s_callback_url_object.go @@ -0,0 +1,64 @@ +// 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 ( + strfmt "github.com/go-openapi/strfmt" + + "github.com/go-openapi/errors" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// SAMLACSCallbackURLObject s a m l a c s callback Url object +// swagger:model SAMLACSCallbackUrlObject +type SAMLACSCallbackURLObject struct { + + // acs callback url + // Required: true + AcsCallbackURL *string `json:"acs-callback-url"` +} + +// Validate validates this s a m l a c s callback Url object +func (m *SAMLACSCallbackURLObject) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateAcsCallbackURL(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *SAMLACSCallbackURLObject) validateAcsCallbackURL(formats strfmt.Registry) error { + + if err := validate.Required("acs-callback-url", "body", m.AcsCallbackURL); err != nil { + return err + } + + return nil +} + +// MarshalBinary interface implementation +func (m *SAMLACSCallbackURLObject) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *SAMLACSCallbackURLObject) UnmarshalBinary(b []byte) error { + var res SAMLACSCallbackURLObject + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/dcos/iam/models/s_a_m_l_provider_config.go b/dcos/iam/models/s_a_m_l_provider_config.go new file mode 100644 index 0000000..6d6bc91 --- /dev/null +++ b/dcos/iam/models/s_a_m_l_provider_config.go @@ -0,0 +1,98 @@ +// 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 ( + strfmt "github.com/go-openapi/strfmt" + + "github.com/go-openapi/errors" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// SAMLProviderConfig s a m l provider config +// swagger:model SAMLProviderConfig +type SAMLProviderConfig struct { + + // description + // Required: true + Description *string `json:"description"` + + // idp metadata + // Required: true + IdpMetadata *string `json:"idp_metadata"` + + // sp base url + // Required: true + SpBaseURL *string `json:"sp_base_url"` +} + +// Validate validates this s a m l provider config +func (m *SAMLProviderConfig) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateDescription(formats); err != nil { + res = append(res, err) + } + + if err := m.validateIdpMetadata(formats); err != nil { + res = append(res, err) + } + + if err := m.validateSpBaseURL(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *SAMLProviderConfig) validateDescription(formats strfmt.Registry) error { + + if err := validate.Required("description", "body", m.Description); err != nil { + return err + } + + return nil +} + +func (m *SAMLProviderConfig) validateIdpMetadata(formats strfmt.Registry) error { + + if err := validate.Required("idp_metadata", "body", m.IdpMetadata); err != nil { + return err + } + + return nil +} + +func (m *SAMLProviderConfig) validateSpBaseURL(formats strfmt.Registry) error { + + if err := validate.Required("sp_base_url", "body", m.SpBaseURL); err != nil { + return err + } + + return nil +} + +// MarshalBinary interface implementation +func (m *SAMLProviderConfig) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *SAMLProviderConfig) UnmarshalBinary(b []byte) error { + var res SAMLProviderConfig + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/dcos/iam/models/user.go b/dcos/iam/models/user.go new file mode 100644 index 0000000..f833ce9 --- /dev/null +++ b/dcos/iam/models/user.go @@ -0,0 +1,155 @@ +// 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 ( + strfmt "github.com/go-openapi/strfmt" + + "github.com/go-openapi/errors" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// User user +// swagger:model User +type User struct { + + // description + // Required: true + Description *string `json:"description"` + + // is remote + // Required: true + IsRemote *bool `json:"is_remote"` + + // is service + IsService bool `json:"is_service,omitempty"` + + // provider id + // Required: true + ProviderID *string `json:"provider_id"` + + // provider type + // Required: true + ProviderType *string `json:"provider_type"` + + // public key + PublicKey string `json:"public_key,omitempty"` + + // uid + // Required: true + UID *string `json:"uid"` + + // url + // Required: true + URL *string `json:"url"` +} + +// Validate validates this user +func (m *User) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateDescription(formats); err != nil { + res = append(res, err) + } + + if err := m.validateIsRemote(formats); err != nil { + res = append(res, err) + } + + if err := m.validateProviderID(formats); err != nil { + res = append(res, err) + } + + if err := m.validateProviderType(formats); err != nil { + res = append(res, err) + } + + if err := m.validateUID(formats); err != nil { + res = append(res, err) + } + + if err := m.validateURL(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *User) validateDescription(formats strfmt.Registry) error { + + if err := validate.Required("description", "body", m.Description); err != nil { + return err + } + + return nil +} + +func (m *User) validateIsRemote(formats strfmt.Registry) error { + + if err := validate.Required("is_remote", "body", m.IsRemote); err != nil { + return err + } + + return nil +} + +func (m *User) validateProviderID(formats strfmt.Registry) error { + + if err := validate.Required("provider_id", "body", m.ProviderID); err != nil { + return err + } + + return nil +} + +func (m *User) validateProviderType(formats strfmt.Registry) error { + + if err := validate.Required("provider_type", "body", m.ProviderType); err != nil { + return err + } + + return nil +} + +func (m *User) validateUID(formats strfmt.Registry) error { + + if err := validate.Required("uid", "body", m.UID); err != nil { + return err + } + + return nil +} + +func (m *User) validateURL(formats strfmt.Registry) error { + + if err := validate.Required("url", "body", m.URL); err != nil { + return err + } + + return nil +} + +// MarshalBinary interface implementation +func (m *User) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *User) UnmarshalBinary(b []byte) error { + var res User + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/dcos/iam/models/user_create.go b/dcos/iam/models/user_create.go new file mode 100644 index 0000000..c048d41 --- /dev/null +++ b/dcos/iam/models/user_create.go @@ -0,0 +1,61 @@ +// 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 ( + strfmt "github.com/go-openapi/strfmt" + + "github.com/go-openapi/swag" +) + +// UserCreate user create +// swagger:model UserCreate +type UserCreate struct { + + // cluster url + ClusterURL string `json:"cluster_url,omitempty"` + + // creator uid + CreatorUID string `json:"creator_uid,omitempty"` + + // description + Description string `json:"description,omitempty"` + + // password + Password string `json:"password,omitempty"` + + // provider id + ProviderID string `json:"provider_id,omitempty"` + + // provider type + ProviderType string `json:"provider_type,omitempty"` + + // public key + PublicKey string `json:"public_key,omitempty"` +} + +// Validate validates this user create +func (m *UserCreate) Validate(formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *UserCreate) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *UserCreate) UnmarshalBinary(b []byte) error { + var res UserCreate + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/dcos/iam/models/user_groups.go b/dcos/iam/models/user_groups.go new file mode 100644 index 0000000..82faf9c --- /dev/null +++ b/dcos/iam/models/user_groups.go @@ -0,0 +1,157 @@ +// 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 ( + "strconv" + + strfmt "github.com/go-openapi/strfmt" + + "github.com/go-openapi/errors" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// UserGroups user groups +// swagger:model UserGroups +type UserGroups struct { + + // array + Array []*UserGroupsArrayItems0 `json:"array"` +} + +// Validate validates this user groups +func (m *UserGroups) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateArray(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *UserGroups) validateArray(formats strfmt.Registry) error { + + if swag.IsZero(m.Array) { // not required + return nil + } + + for i := 0; i < len(m.Array); i++ { + if swag.IsZero(m.Array[i]) { // not required + continue + } + + if m.Array[i] != nil { + if err := m.Array[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("array" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// MarshalBinary interface implementation +func (m *UserGroups) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *UserGroups) UnmarshalBinary(b []byte) error { + var res UserGroups + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} + +// UserGroupsArrayItems0 user groups array items0 +// swagger:model UserGroupsArrayItems0 +type UserGroupsArrayItems0 struct { + + // group + // Required: true + Group *Group `json:"group"` + + // membershipurl + // Required: true + Membershipurl *string `json:"membershipurl"` +} + +// Validate validates this user groups array items0 +func (m *UserGroupsArrayItems0) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateGroup(formats); err != nil { + res = append(res, err) + } + + if err := m.validateMembershipurl(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *UserGroupsArrayItems0) validateGroup(formats strfmt.Registry) error { + + if err := validate.Required("group", "body", m.Group); err != nil { + return err + } + + if m.Group != nil { + if err := m.Group.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("group") + } + return err + } + } + + return nil +} + +func (m *UserGroupsArrayItems0) validateMembershipurl(formats strfmt.Registry) error { + + if err := validate.Required("membershipurl", "body", m.Membershipurl); err != nil { + return err + } + + return nil +} + +// MarshalBinary interface implementation +func (m *UserGroupsArrayItems0) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *UserGroupsArrayItems0) UnmarshalBinary(b []byte) error { + var res UserGroupsArrayItems0 + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/dcos/iam/models/user_permissions.go b/dcos/iam/models/user_permissions.go new file mode 100644 index 0000000..daa0b8b --- /dev/null +++ b/dcos/iam/models/user_permissions.go @@ -0,0 +1,381 @@ +// 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 ( + "strconv" + + strfmt "github.com/go-openapi/strfmt" + + "github.com/go-openapi/errors" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// UserPermissions user permissions +// swagger:model UserPermissions +type UserPermissions struct { + + // direct + Direct []*UserPermissionsDirectItems0 `json:"direct"` + + // groups + Groups []*UserPermissionsGroupsItems0 `json:"groups"` +} + +// Validate validates this user permissions +func (m *UserPermissions) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateDirect(formats); err != nil { + res = append(res, err) + } + + if err := m.validateGroups(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *UserPermissions) validateDirect(formats strfmt.Registry) error { + + if swag.IsZero(m.Direct) { // not required + return nil + } + + for i := 0; i < len(m.Direct); i++ { + if swag.IsZero(m.Direct[i]) { // not required + continue + } + + if m.Direct[i] != nil { + if err := m.Direct[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("direct" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *UserPermissions) validateGroups(formats strfmt.Registry) error { + + if swag.IsZero(m.Groups) { // not required + return nil + } + + for i := 0; i < len(m.Groups); i++ { + if swag.IsZero(m.Groups[i]) { // not required + continue + } + + if m.Groups[i] != nil { + if err := m.Groups[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("groups" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// MarshalBinary interface implementation +func (m *UserPermissions) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *UserPermissions) UnmarshalBinary(b []byte) error { + var res UserPermissions + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} + +// UserPermissionsDirectItems0 user permissions direct items0 +// swagger:model UserPermissionsDirectItems0 +type UserPermissionsDirectItems0 struct { + + // aclurl + // Required: true + Aclurl *string `json:"aclurl"` + + // actions + // Required: true + Actions []*Action `json:"actions"` + + // description + // Required: true + Description *string `json:"description"` + + // rid + // Required: true + Rid *string `json:"rid"` +} + +// Validate validates this user permissions direct items0 +func (m *UserPermissionsDirectItems0) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateAclurl(formats); err != nil { + res = append(res, err) + } + + if err := m.validateActions(formats); err != nil { + res = append(res, err) + } + + if err := m.validateDescription(formats); err != nil { + res = append(res, err) + } + + if err := m.validateRid(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *UserPermissionsDirectItems0) validateAclurl(formats strfmt.Registry) error { + + if err := validate.Required("aclurl", "body", m.Aclurl); err != nil { + return err + } + + return nil +} + +func (m *UserPermissionsDirectItems0) validateActions(formats strfmt.Registry) error { + + if err := validate.Required("actions", "body", m.Actions); err != nil { + return err + } + + for i := 0; i < len(m.Actions); i++ { + if swag.IsZero(m.Actions[i]) { // not required + continue + } + + if m.Actions[i] != nil { + if err := m.Actions[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("actions" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *UserPermissionsDirectItems0) validateDescription(formats strfmt.Registry) error { + + if err := validate.Required("description", "body", m.Description); err != nil { + return err + } + + return nil +} + +func (m *UserPermissionsDirectItems0) validateRid(formats strfmt.Registry) error { + + if err := validate.Required("rid", "body", m.Rid); err != nil { + return err + } + + return nil +} + +// MarshalBinary interface implementation +func (m *UserPermissionsDirectItems0) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *UserPermissionsDirectItems0) UnmarshalBinary(b []byte) error { + var res UserPermissionsDirectItems0 + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} + +// UserPermissionsGroupsItems0 user permissions groups items0 +// swagger:model UserPermissionsGroupsItems0 +type UserPermissionsGroupsItems0 struct { + + // aclurl + // Required: true + Aclurl *string `json:"aclurl"` + + // actions + // Required: true + Actions []*Action `json:"actions"` + + // description + // Required: true + Description *string `json:"description"` + + // gid + // Required: true + Gid *string `json:"gid"` + + // membershipurl + // Required: true + Membershipurl *string `json:"membershipurl"` + + // rid + // Required: true + Rid *string `json:"rid"` +} + +// Validate validates this user permissions groups items0 +func (m *UserPermissionsGroupsItems0) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateAclurl(formats); err != nil { + res = append(res, err) + } + + if err := m.validateActions(formats); err != nil { + res = append(res, err) + } + + if err := m.validateDescription(formats); err != nil { + res = append(res, err) + } + + if err := m.validateGid(formats); err != nil { + res = append(res, err) + } + + if err := m.validateMembershipurl(formats); err != nil { + res = append(res, err) + } + + if err := m.validateRid(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *UserPermissionsGroupsItems0) validateAclurl(formats strfmt.Registry) error { + + if err := validate.Required("aclurl", "body", m.Aclurl); err != nil { + return err + } + + return nil +} + +func (m *UserPermissionsGroupsItems0) validateActions(formats strfmt.Registry) error { + + if err := validate.Required("actions", "body", m.Actions); err != nil { + return err + } + + for i := 0; i < len(m.Actions); i++ { + if swag.IsZero(m.Actions[i]) { // not required + continue + } + + if m.Actions[i] != nil { + if err := m.Actions[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("actions" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *UserPermissionsGroupsItems0) validateDescription(formats strfmt.Registry) error { + + if err := validate.Required("description", "body", m.Description); err != nil { + return err + } + + return nil +} + +func (m *UserPermissionsGroupsItems0) validateGid(formats strfmt.Registry) error { + + if err := validate.Required("gid", "body", m.Gid); err != nil { + return err + } + + return nil +} + +func (m *UserPermissionsGroupsItems0) validateMembershipurl(formats strfmt.Registry) error { + + if err := validate.Required("membershipurl", "body", m.Membershipurl); err != nil { + return err + } + + return nil +} + +func (m *UserPermissionsGroupsItems0) validateRid(formats strfmt.Registry) error { + + if err := validate.Required("rid", "body", m.Rid); err != nil { + return err + } + + return nil +} + +// MarshalBinary interface implementation +func (m *UserPermissionsGroupsItems0) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *UserPermissionsGroupsItems0) UnmarshalBinary(b []byte) error { + var res UserPermissionsGroupsItems0 + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/dcos/iam/models/user_update.go b/dcos/iam/models/user_update.go new file mode 100644 index 0000000..0358d14 --- /dev/null +++ b/dcos/iam/models/user_update.go @@ -0,0 +1,46 @@ +// 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 ( + strfmt "github.com/go-openapi/strfmt" + + "github.com/go-openapi/swag" +) + +// UserUpdate user update +// swagger:model UserUpdate +type UserUpdate struct { + + // description + Description string `json:"description,omitempty"` + + // password + Password string `json:"password,omitempty"` +} + +// Validate validates this user update +func (m *UserUpdate) Validate(formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *UserUpdate) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *UserUpdate) UnmarshalBinary(b []byte) error { + var res UserUpdate + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/dcos/secrets/client/dcos_secrets_client.go b/dcos/secrets/client/dcos_secrets_client.go new file mode 100644 index 0000000..02c7acc --- /dev/null +++ b/dcos/secrets/client/dcos_secrets_client.go @@ -0,0 +1,117 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package client + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "github.com/go-openapi/runtime" + httptransport "github.com/go-openapi/runtime/client" + + strfmt "github.com/go-openapi/strfmt" + + "github.com/dcos/client-go/dcos/secrets/client/secrets" +) + +// Default DCOS secrets HTTP client. +var Default = NewHTTPClient(nil) + +const ( + // DefaultHost is the default Host + // found in Meta (info) section of spec file + DefaultHost string = "localhost" + // DefaultBasePath is the default BasePath + // found in Meta (info) section of spec file + DefaultBasePath string = "/secrets/v1" +) + +// DefaultSchemes are the default schemes found in Meta (info) section of spec file +var DefaultSchemes = []string{"https"} + +// NewHTTPClient creates a new DCOS secrets HTTP client. +func NewHTTPClient(formats strfmt.Registry) *DCOSSecrets { + return NewHTTPClientWithConfig(formats, nil) +} + +// NewHTTPClientWithConfig creates a new DCOS secrets HTTP client, +// using a customizable transport config. +func NewHTTPClientWithConfig(formats strfmt.Registry, cfg *TransportConfig) *DCOSSecrets { + // ensure nullable parameters have default + if cfg == nil { + cfg = DefaultTransportConfig() + } + + // create transport and client + transport := httptransport.New(cfg.Host, cfg.BasePath, cfg.Schemes) + return New(transport, formats) +} + +// New creates a new DCOS secrets client +func New(transport runtime.ClientTransport, formats strfmt.Registry) *DCOSSecrets { + // ensure nullable parameters have default + if formats == nil { + formats = strfmt.Default + } + + cli := new(DCOSSecrets) + cli.Transport = transport + + cli.Secrets = secrets.New(transport, formats) + + return cli +} + +// DefaultTransportConfig creates a TransportConfig with the +// default settings taken from the meta section of the spec file. +func DefaultTransportConfig() *TransportConfig { + return &TransportConfig{ + Host: DefaultHost, + BasePath: DefaultBasePath, + Schemes: DefaultSchemes, + } +} + +// TransportConfig contains the transport related info, +// found in the meta section of the spec file. +type TransportConfig struct { + Host string + BasePath string + Schemes []string +} + +// WithHost overrides the default host, +// provided by the meta section of the spec file. +func (cfg *TransportConfig) WithHost(host string) *TransportConfig { + cfg.Host = host + return cfg +} + +// WithBasePath overrides the default basePath, +// provided by the meta section of the spec file. +func (cfg *TransportConfig) WithBasePath(basePath string) *TransportConfig { + cfg.BasePath = basePath + return cfg +} + +// WithSchemes overrides the default schemes, +// provided by the meta section of the spec file. +func (cfg *TransportConfig) WithSchemes(schemes []string) *TransportConfig { + cfg.Schemes = schemes + return cfg +} + +// DCOSSecrets is a client for DCOS secrets +type DCOSSecrets struct { + Secrets *secrets.Client + + Transport runtime.ClientTransport +} + +// SetTransport changes the transport on the client and all its subresources +func (c *DCOSSecrets) SetTransport(transport runtime.ClientTransport) { + c.Transport = transport + + c.Secrets.SetTransport(transport) + +} diff --git a/dcos/secrets/client/secrets/delete_secret_store_path_to_secret_parameters.go b/dcos/secrets/client/secrets/delete_secret_store_path_to_secret_parameters.go new file mode 100644 index 0000000..682cc8c --- /dev/null +++ b/dcos/secrets/client/secrets/delete_secret_store_path_to_secret_parameters.go @@ -0,0 +1,157 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package secrets + +// 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" + + strfmt "github.com/go-openapi/strfmt" +) + +// NewDeleteSecretStorePathToSecretParams creates a new DeleteSecretStorePathToSecretParams object +// with the default values initialized. +func NewDeleteSecretStorePathToSecretParams() *DeleteSecretStorePathToSecretParams { + var () + return &DeleteSecretStorePathToSecretParams{ + + timeout: cr.DefaultTimeout, + } +} + +// NewDeleteSecretStorePathToSecretParamsWithTimeout creates a new DeleteSecretStorePathToSecretParams object +// with the default values initialized, and the ability to set a timeout on a request +func NewDeleteSecretStorePathToSecretParamsWithTimeout(timeout time.Duration) *DeleteSecretStorePathToSecretParams { + var () + return &DeleteSecretStorePathToSecretParams{ + + timeout: timeout, + } +} + +// NewDeleteSecretStorePathToSecretParamsWithContext creates a new DeleteSecretStorePathToSecretParams object +// with the default values initialized, and the ability to set a context for a request +func NewDeleteSecretStorePathToSecretParamsWithContext(ctx context.Context) *DeleteSecretStorePathToSecretParams { + var () + return &DeleteSecretStorePathToSecretParams{ + + Context: ctx, + } +} + +// NewDeleteSecretStorePathToSecretParamsWithHTTPClient creates a new DeleteSecretStorePathToSecretParams object +// with the default values initialized, and the ability to set a custom HTTPClient for a request +func NewDeleteSecretStorePathToSecretParamsWithHTTPClient(client *http.Client) *DeleteSecretStorePathToSecretParams { + var () + return &DeleteSecretStorePathToSecretParams{ + HTTPClient: client, + } +} + +/*DeleteSecretStorePathToSecretParams contains all the parameters to send to the API endpoint +for the delete secret store path to secret operation typically these are written to a http.Request +*/ +type DeleteSecretStorePathToSecretParams struct { + + /*PathToSecret + The path to the secret to delete. + + */ + PathToSecret string + /*Store + The backend to delete the secret from. + + */ + Store string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithTimeout adds the timeout to the delete secret store path to secret params +func (o *DeleteSecretStorePathToSecretParams) WithTimeout(timeout time.Duration) *DeleteSecretStorePathToSecretParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the delete secret store path to secret params +func (o *DeleteSecretStorePathToSecretParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the delete secret store path to secret params +func (o *DeleteSecretStorePathToSecretParams) WithContext(ctx context.Context) *DeleteSecretStorePathToSecretParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the delete secret store path to secret params +func (o *DeleteSecretStorePathToSecretParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the delete secret store path to secret params +func (o *DeleteSecretStorePathToSecretParams) WithHTTPClient(client *http.Client) *DeleteSecretStorePathToSecretParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the delete secret store path to secret params +func (o *DeleteSecretStorePathToSecretParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithPathToSecret adds the pathToSecret to the delete secret store path to secret params +func (o *DeleteSecretStorePathToSecretParams) WithPathToSecret(pathToSecret string) *DeleteSecretStorePathToSecretParams { + o.SetPathToSecret(pathToSecret) + return o +} + +// SetPathToSecret adds the pathToSecret to the delete secret store path to secret params +func (o *DeleteSecretStorePathToSecretParams) SetPathToSecret(pathToSecret string) { + o.PathToSecret = pathToSecret +} + +// WithStore adds the store to the delete secret store path to secret params +func (o *DeleteSecretStorePathToSecretParams) WithStore(store string) *DeleteSecretStorePathToSecretParams { + o.SetStore(store) + return o +} + +// SetStore adds the store to the delete secret store path to secret params +func (o *DeleteSecretStorePathToSecretParams) SetStore(store string) { + o.Store = store +} + +// WriteToRequest writes these params to a swagger request +func (o *DeleteSecretStorePathToSecretParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param path-to-secret + if err := r.SetPathParam("path-to-secret", o.PathToSecret); err != nil { + return err + } + + // path param store + if err := r.SetPathParam("store", o.Store); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/dcos/secrets/client/secrets/delete_secret_store_path_to_secret_responses.go b/dcos/secrets/client/secrets/delete_secret_store_path_to_secret_responses.go new file mode 100644 index 0000000..5707295 --- /dev/null +++ b/dcos/secrets/client/secrets/delete_secret_store_path_to_secret_responses.go @@ -0,0 +1,112 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package secrets + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + + "github.com/go-openapi/runtime" + + strfmt "github.com/go-openapi/strfmt" +) + +// DeleteSecretStorePathToSecretReader is a Reader for the DeleteSecretStorePathToSecret structure. +type DeleteSecretStorePathToSecretReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *DeleteSecretStorePathToSecretReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + + case 204: + result := NewDeleteSecretStorePathToSecretNoContent() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + + case 403: + result := NewDeleteSecretStorePathToSecretForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + + case 404: + result := NewDeleteSecretStorePathToSecretNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + + default: + return nil, runtime.NewAPIError("unknown error", response, response.Code()) + } +} + +// NewDeleteSecretStorePathToSecretNoContent creates a DeleteSecretStorePathToSecretNoContent with default headers values +func NewDeleteSecretStorePathToSecretNoContent() *DeleteSecretStorePathToSecretNoContent { + return &DeleteSecretStorePathToSecretNoContent{} +} + +/*DeleteSecretStorePathToSecretNoContent handles this case with default header values. + +Success. +*/ +type DeleteSecretStorePathToSecretNoContent struct { +} + +func (o *DeleteSecretStorePathToSecretNoContent) Error() string { + return fmt.Sprintf("[DELETE /secret/{store}/{path-to-secret}][%d] deleteSecretStorePathToSecretNoContent ", 204) +} + +func (o *DeleteSecretStorePathToSecretNoContent) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewDeleteSecretStorePathToSecretForbidden creates a DeleteSecretStorePathToSecretForbidden with default headers values +func NewDeleteSecretStorePathToSecretForbidden() *DeleteSecretStorePathToSecretForbidden { + return &DeleteSecretStorePathToSecretForbidden{} +} + +/*DeleteSecretStorePathToSecretForbidden handles this case with default header values. + +Forbidden. +*/ +type DeleteSecretStorePathToSecretForbidden struct { +} + +func (o *DeleteSecretStorePathToSecretForbidden) Error() string { + return fmt.Sprintf("[DELETE /secret/{store}/{path-to-secret}][%d] deleteSecretStorePathToSecretForbidden ", 403) +} + +func (o *DeleteSecretStorePathToSecretForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewDeleteSecretStorePathToSecretNotFound creates a DeleteSecretStorePathToSecretNotFound with default headers values +func NewDeleteSecretStorePathToSecretNotFound() *DeleteSecretStorePathToSecretNotFound { + return &DeleteSecretStorePathToSecretNotFound{} +} + +/*DeleteSecretStorePathToSecretNotFound handles this case with default header values. + +Secret not found. +*/ +type DeleteSecretStorePathToSecretNotFound struct { +} + +func (o *DeleteSecretStorePathToSecretNotFound) Error() string { + return fmt.Sprintf("[DELETE /secret/{store}/{path-to-secret}][%d] deleteSecretStorePathToSecretNotFound ", 404) +} + +func (o *DeleteSecretStorePathToSecretNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/dcos/secrets/client/secrets/get_secret_store_path_to_secret_parameters.go b/dcos/secrets/client/secrets/get_secret_store_path_to_secret_parameters.go new file mode 100644 index 0000000..75c56e2 --- /dev/null +++ b/dcos/secrets/client/secrets/get_secret_store_path_to_secret_parameters.go @@ -0,0 +1,190 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package secrets + +// 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" + + strfmt "github.com/go-openapi/strfmt" +) + +// NewGetSecretStorePathToSecretParams creates a new GetSecretStorePathToSecretParams object +// with the default values initialized. +func NewGetSecretStorePathToSecretParams() *GetSecretStorePathToSecretParams { + var () + return &GetSecretStorePathToSecretParams{ + + timeout: cr.DefaultTimeout, + } +} + +// NewGetSecretStorePathToSecretParamsWithTimeout creates a new GetSecretStorePathToSecretParams object +// with the default values initialized, and the ability to set a timeout on a request +func NewGetSecretStorePathToSecretParamsWithTimeout(timeout time.Duration) *GetSecretStorePathToSecretParams { + var () + return &GetSecretStorePathToSecretParams{ + + timeout: timeout, + } +} + +// NewGetSecretStorePathToSecretParamsWithContext creates a new GetSecretStorePathToSecretParams object +// with the default values initialized, and the ability to set a context for a request +func NewGetSecretStorePathToSecretParamsWithContext(ctx context.Context) *GetSecretStorePathToSecretParams { + var () + return &GetSecretStorePathToSecretParams{ + + Context: ctx, + } +} + +// NewGetSecretStorePathToSecretParamsWithHTTPClient creates a new GetSecretStorePathToSecretParams object +// with the default values initialized, and the ability to set a custom HTTPClient for a request +func NewGetSecretStorePathToSecretParamsWithHTTPClient(client *http.Client) *GetSecretStorePathToSecretParams { + var () + return &GetSecretStorePathToSecretParams{ + HTTPClient: client, + } +} + +/*GetSecretStorePathToSecretParams contains all the parameters to send to the API endpoint +for the get secret store path to secret operation typically these are written to a http.Request +*/ +type GetSecretStorePathToSecretParams struct { + + /*List + If set to true, list only secret keys. + + + */ + List *string + /*PathToSecret + The path to store the secret in. + + */ + PathToSecret string + /*Store + The backend store from which to get the secret. + + */ + Store string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithTimeout adds the timeout to the get secret store path to secret params +func (o *GetSecretStorePathToSecretParams) WithTimeout(timeout time.Duration) *GetSecretStorePathToSecretParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the get secret store path to secret params +func (o *GetSecretStorePathToSecretParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the get secret store path to secret params +func (o *GetSecretStorePathToSecretParams) WithContext(ctx context.Context) *GetSecretStorePathToSecretParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the get secret store path to secret params +func (o *GetSecretStorePathToSecretParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the get secret store path to secret params +func (o *GetSecretStorePathToSecretParams) WithHTTPClient(client *http.Client) *GetSecretStorePathToSecretParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the get secret store path to secret params +func (o *GetSecretStorePathToSecretParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithList adds the list to the get secret store path to secret params +func (o *GetSecretStorePathToSecretParams) WithList(list *string) *GetSecretStorePathToSecretParams { + o.SetList(list) + return o +} + +// SetList adds the list to the get secret store path to secret params +func (o *GetSecretStorePathToSecretParams) SetList(list *string) { + o.List = list +} + +// WithPathToSecret adds the pathToSecret to the get secret store path to secret params +func (o *GetSecretStorePathToSecretParams) WithPathToSecret(pathToSecret string) *GetSecretStorePathToSecretParams { + o.SetPathToSecret(pathToSecret) + return o +} + +// SetPathToSecret adds the pathToSecret to the get secret store path to secret params +func (o *GetSecretStorePathToSecretParams) SetPathToSecret(pathToSecret string) { + o.PathToSecret = pathToSecret +} + +// WithStore adds the store to the get secret store path to secret params +func (o *GetSecretStorePathToSecretParams) WithStore(store string) *GetSecretStorePathToSecretParams { + o.SetStore(store) + return o +} + +// SetStore adds the store to the get secret store path to secret params +func (o *GetSecretStorePathToSecretParams) SetStore(store string) { + o.Store = store +} + +// WriteToRequest writes these params to a swagger request +func (o *GetSecretStorePathToSecretParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.List != nil { + + // query param list + var qrList string + if o.List != nil { + qrList = *o.List + } + qList := qrList + if qList != "" { + if err := r.SetQueryParam("list", qList); err != nil { + return err + } + } + + } + + // path param path-to-secret + if err := r.SetPathParam("path-to-secret", o.PathToSecret); err != nil { + return err + } + + // path param store + if err := r.SetPathParam("store", o.Store); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/dcos/secrets/client/secrets/get_secret_store_path_to_secret_responses.go b/dcos/secrets/client/secrets/get_secret_store_path_to_secret_responses.go new file mode 100644 index 0000000..f79c367 --- /dev/null +++ b/dcos/secrets/client/secrets/get_secret_store_path_to_secret_responses.go @@ -0,0 +1,151 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package secrets + +// 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" + + strfmt "github.com/go-openapi/strfmt" + + models "github.com/dcos/client-go/dcos/secrets/models" +) + +// GetSecretStorePathToSecretReader is a Reader for the GetSecretStorePathToSecret structure. +type GetSecretStorePathToSecretReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *GetSecretStorePathToSecretReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + + case 200: + result := NewGetSecretStorePathToSecretOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + + case 400: + result := NewGetSecretStorePathToSecretBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + + case 403: + result := NewGetSecretStorePathToSecretForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + + case 404: + result := NewGetSecretStorePathToSecretNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + + default: + return nil, runtime.NewAPIError("unknown error", response, response.Code()) + } +} + +// NewGetSecretStorePathToSecretOK creates a GetSecretStorePathToSecretOK with default headers values +func NewGetSecretStorePathToSecretOK() *GetSecretStorePathToSecretOK { + return &GetSecretStorePathToSecretOK{} +} + +/*GetSecretStorePathToSecretOK handles this case with default header values. + +Response body contains secret authorized content. +*/ +type GetSecretStorePathToSecretOK struct { + Payload *models.Secret +} + +func (o *GetSecretStorePathToSecretOK) Error() string { + return fmt.Sprintf("[GET /secret/{store}/{path-to-secret}][%d] getSecretStorePathToSecretOK %+v", 200, o.Payload) +} + +func (o *GetSecretStorePathToSecretOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Secret) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewGetSecretStorePathToSecretBadRequest creates a GetSecretStorePathToSecretBadRequest with default headers values +func NewGetSecretStorePathToSecretBadRequest() *GetSecretStorePathToSecretBadRequest { + return &GetSecretStorePathToSecretBadRequest{} +} + +/*GetSecretStorePathToSecretBadRequest handles this case with default header values. + +Unsupported Accept header. +*/ +type GetSecretStorePathToSecretBadRequest struct { +} + +func (o *GetSecretStorePathToSecretBadRequest) Error() string { + return fmt.Sprintf("[GET /secret/{store}/{path-to-secret}][%d] getSecretStorePathToSecretBadRequest ", 400) +} + +func (o *GetSecretStorePathToSecretBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewGetSecretStorePathToSecretForbidden creates a GetSecretStorePathToSecretForbidden with default headers values +func NewGetSecretStorePathToSecretForbidden() *GetSecretStorePathToSecretForbidden { + return &GetSecretStorePathToSecretForbidden{} +} + +/*GetSecretStorePathToSecretForbidden handles this case with default header values. + +Forbidden. +*/ +type GetSecretStorePathToSecretForbidden struct { +} + +func (o *GetSecretStorePathToSecretForbidden) Error() string { + return fmt.Sprintf("[GET /secret/{store}/{path-to-secret}][%d] getSecretStorePathToSecretForbidden ", 403) +} + +func (o *GetSecretStorePathToSecretForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewGetSecretStorePathToSecretNotFound creates a GetSecretStorePathToSecretNotFound with default headers values +func NewGetSecretStorePathToSecretNotFound() *GetSecretStorePathToSecretNotFound { + return &GetSecretStorePathToSecretNotFound{} +} + +/*GetSecretStorePathToSecretNotFound handles this case with default header values. + +Secret not found. +*/ +type GetSecretStorePathToSecretNotFound struct { +} + +func (o *GetSecretStorePathToSecretNotFound) Error() string { + return fmt.Sprintf("[GET /secret/{store}/{path-to-secret}][%d] getSecretStorePathToSecretNotFound ", 404) +} + +func (o *GetSecretStorePathToSecretNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/dcos/secrets/client/secrets/patch_secret_store_path_to_secret_parameters.go b/dcos/secrets/client/secrets/patch_secret_store_path_to_secret_parameters.go new file mode 100644 index 0000000..dcc483e --- /dev/null +++ b/dcos/secrets/client/secrets/patch_secret_store_path_to_secret_parameters.go @@ -0,0 +1,181 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package secrets + +// 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" + + strfmt "github.com/go-openapi/strfmt" + + models "github.com/dcos/client-go/dcos/secrets/models" +) + +// NewPatchSecretStorePathToSecretParams creates a new PatchSecretStorePathToSecretParams object +// with the default values initialized. +func NewPatchSecretStorePathToSecretParams() *PatchSecretStorePathToSecretParams { + var () + return &PatchSecretStorePathToSecretParams{ + + timeout: cr.DefaultTimeout, + } +} + +// NewPatchSecretStorePathToSecretParamsWithTimeout creates a new PatchSecretStorePathToSecretParams object +// with the default values initialized, and the ability to set a timeout on a request +func NewPatchSecretStorePathToSecretParamsWithTimeout(timeout time.Duration) *PatchSecretStorePathToSecretParams { + var () + return &PatchSecretStorePathToSecretParams{ + + timeout: timeout, + } +} + +// NewPatchSecretStorePathToSecretParamsWithContext creates a new PatchSecretStorePathToSecretParams object +// with the default values initialized, and the ability to set a context for a request +func NewPatchSecretStorePathToSecretParamsWithContext(ctx context.Context) *PatchSecretStorePathToSecretParams { + var () + return &PatchSecretStorePathToSecretParams{ + + Context: ctx, + } +} + +// NewPatchSecretStorePathToSecretParamsWithHTTPClient creates a new PatchSecretStorePathToSecretParams object +// with the default values initialized, and the ability to set a custom HTTPClient for a request +func NewPatchSecretStorePathToSecretParamsWithHTTPClient(client *http.Client) *PatchSecretStorePathToSecretParams { + var () + return &PatchSecretStorePathToSecretParams{ + HTTPClient: client, + } +} + +/*PatchSecretStorePathToSecretParams contains all the parameters to send to the API endpoint +for the patch secret store path to secret operation typically these are written to a http.Request +*/ +type PatchSecretStorePathToSecretParams struct { + + /*Body + Secret value. + + */ + Body *models.Secret + /*PathToSecret + The path for the secret to update. + + */ + PathToSecret string + /*Store + The backend to store the secret in. + + */ + Store string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithTimeout adds the timeout to the patch secret store path to secret params +func (o *PatchSecretStorePathToSecretParams) WithTimeout(timeout time.Duration) *PatchSecretStorePathToSecretParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the patch secret store path to secret params +func (o *PatchSecretStorePathToSecretParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the patch secret store path to secret params +func (o *PatchSecretStorePathToSecretParams) WithContext(ctx context.Context) *PatchSecretStorePathToSecretParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the patch secret store path to secret params +func (o *PatchSecretStorePathToSecretParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the patch secret store path to secret params +func (o *PatchSecretStorePathToSecretParams) WithHTTPClient(client *http.Client) *PatchSecretStorePathToSecretParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the patch secret store path to secret params +func (o *PatchSecretStorePathToSecretParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the patch secret store path to secret params +func (o *PatchSecretStorePathToSecretParams) WithBody(body *models.Secret) *PatchSecretStorePathToSecretParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the patch secret store path to secret params +func (o *PatchSecretStorePathToSecretParams) SetBody(body *models.Secret) { + o.Body = body +} + +// WithPathToSecret adds the pathToSecret to the patch secret store path to secret params +func (o *PatchSecretStorePathToSecretParams) WithPathToSecret(pathToSecret string) *PatchSecretStorePathToSecretParams { + o.SetPathToSecret(pathToSecret) + return o +} + +// SetPathToSecret adds the pathToSecret to the patch secret store path to secret params +func (o *PatchSecretStorePathToSecretParams) SetPathToSecret(pathToSecret string) { + o.PathToSecret = pathToSecret +} + +// WithStore adds the store to the patch secret store path to secret params +func (o *PatchSecretStorePathToSecretParams) WithStore(store string) *PatchSecretStorePathToSecretParams { + o.SetStore(store) + return o +} + +// SetStore adds the store to the patch secret store path to secret params +func (o *PatchSecretStorePathToSecretParams) SetStore(store string) { + o.Store = store +} + +// WriteToRequest writes these params to a swagger request +func (o *PatchSecretStorePathToSecretParams) 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 path-to-secret + if err := r.SetPathParam("path-to-secret", o.PathToSecret); err != nil { + return err + } + + // path param store + if err := r.SetPathParam("store", o.Store); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/dcos/secrets/client/secrets/patch_secret_store_path_to_secret_responses.go b/dcos/secrets/client/secrets/patch_secret_store_path_to_secret_responses.go new file mode 100644 index 0000000..d8d2d49 --- /dev/null +++ b/dcos/secrets/client/secrets/patch_secret_store_path_to_secret_responses.go @@ -0,0 +1,112 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package secrets + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + + "github.com/go-openapi/runtime" + + strfmt "github.com/go-openapi/strfmt" +) + +// PatchSecretStorePathToSecretReader is a Reader for the PatchSecretStorePathToSecret structure. +type PatchSecretStorePathToSecretReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PatchSecretStorePathToSecretReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + + case 204: + result := NewPatchSecretStorePathToSecretNoContent() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + + case 403: + result := NewPatchSecretStorePathToSecretForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + + case 404: + result := NewPatchSecretStorePathToSecretNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + + default: + return nil, runtime.NewAPIError("unknown error", response, response.Code()) + } +} + +// NewPatchSecretStorePathToSecretNoContent creates a PatchSecretStorePathToSecretNoContent with default headers values +func NewPatchSecretStorePathToSecretNoContent() *PatchSecretStorePathToSecretNoContent { + return &PatchSecretStorePathToSecretNoContent{} +} + +/*PatchSecretStorePathToSecretNoContent handles this case with default header values. + +Secret updated. +*/ +type PatchSecretStorePathToSecretNoContent struct { +} + +func (o *PatchSecretStorePathToSecretNoContent) Error() string { + return fmt.Sprintf("[PATCH /secret/{store}/{path-to-secret}][%d] patchSecretStorePathToSecretNoContent ", 204) +} + +func (o *PatchSecretStorePathToSecretNoContent) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewPatchSecretStorePathToSecretForbidden creates a PatchSecretStorePathToSecretForbidden with default headers values +func NewPatchSecretStorePathToSecretForbidden() *PatchSecretStorePathToSecretForbidden { + return &PatchSecretStorePathToSecretForbidden{} +} + +/*PatchSecretStorePathToSecretForbidden handles this case with default header values. + +Forbidden. +*/ +type PatchSecretStorePathToSecretForbidden struct { +} + +func (o *PatchSecretStorePathToSecretForbidden) Error() string { + return fmt.Sprintf("[PATCH /secret/{store}/{path-to-secret}][%d] patchSecretStorePathToSecretForbidden ", 403) +} + +func (o *PatchSecretStorePathToSecretForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewPatchSecretStorePathToSecretNotFound creates a PatchSecretStorePathToSecretNotFound with default headers values +func NewPatchSecretStorePathToSecretNotFound() *PatchSecretStorePathToSecretNotFound { + return &PatchSecretStorePathToSecretNotFound{} +} + +/*PatchSecretStorePathToSecretNotFound handles this case with default header values. + +Secret not found. +*/ +type PatchSecretStorePathToSecretNotFound struct { +} + +func (o *PatchSecretStorePathToSecretNotFound) Error() string { + return fmt.Sprintf("[PATCH /secret/{store}/{path-to-secret}][%d] patchSecretStorePathToSecretNotFound ", 404) +} + +func (o *PatchSecretStorePathToSecretNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/dcos/secrets/client/secrets/put_secret_store_path_to_secret_parameters.go b/dcos/secrets/client/secrets/put_secret_store_path_to_secret_parameters.go new file mode 100644 index 0000000..d077fd6 --- /dev/null +++ b/dcos/secrets/client/secrets/put_secret_store_path_to_secret_parameters.go @@ -0,0 +1,181 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package secrets + +// 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" + + strfmt "github.com/go-openapi/strfmt" + + models "github.com/dcos/client-go/dcos/secrets/models" +) + +// NewPutSecretStorePathToSecretParams creates a new PutSecretStorePathToSecretParams object +// with the default values initialized. +func NewPutSecretStorePathToSecretParams() *PutSecretStorePathToSecretParams { + var () + return &PutSecretStorePathToSecretParams{ + + timeout: cr.DefaultTimeout, + } +} + +// NewPutSecretStorePathToSecretParamsWithTimeout creates a new PutSecretStorePathToSecretParams object +// with the default values initialized, and the ability to set a timeout on a request +func NewPutSecretStorePathToSecretParamsWithTimeout(timeout time.Duration) *PutSecretStorePathToSecretParams { + var () + return &PutSecretStorePathToSecretParams{ + + timeout: timeout, + } +} + +// NewPutSecretStorePathToSecretParamsWithContext creates a new PutSecretStorePathToSecretParams object +// with the default values initialized, and the ability to set a context for a request +func NewPutSecretStorePathToSecretParamsWithContext(ctx context.Context) *PutSecretStorePathToSecretParams { + var () + return &PutSecretStorePathToSecretParams{ + + Context: ctx, + } +} + +// NewPutSecretStorePathToSecretParamsWithHTTPClient creates a new PutSecretStorePathToSecretParams object +// with the default values initialized, and the ability to set a custom HTTPClient for a request +func NewPutSecretStorePathToSecretParamsWithHTTPClient(client *http.Client) *PutSecretStorePathToSecretParams { + var () + return &PutSecretStorePathToSecretParams{ + HTTPClient: client, + } +} + +/*PutSecretStorePathToSecretParams contains all the parameters to send to the API endpoint +for the put secret store path to secret operation typically these are written to a http.Request +*/ +type PutSecretStorePathToSecretParams struct { + + /*Body + Secret value. + + */ + Body *models.Secret + /*PathToSecret + The path to store the secret in. + + */ + PathToSecret string + /*Store + The backend to store the secret in. + + */ + Store string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithTimeout adds the timeout to the put secret store path to secret params +func (o *PutSecretStorePathToSecretParams) WithTimeout(timeout time.Duration) *PutSecretStorePathToSecretParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the put secret store path to secret params +func (o *PutSecretStorePathToSecretParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the put secret store path to secret params +func (o *PutSecretStorePathToSecretParams) WithContext(ctx context.Context) *PutSecretStorePathToSecretParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the put secret store path to secret params +func (o *PutSecretStorePathToSecretParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the put secret store path to secret params +func (o *PutSecretStorePathToSecretParams) WithHTTPClient(client *http.Client) *PutSecretStorePathToSecretParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the put secret store path to secret params +func (o *PutSecretStorePathToSecretParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the put secret store path to secret params +func (o *PutSecretStorePathToSecretParams) WithBody(body *models.Secret) *PutSecretStorePathToSecretParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the put secret store path to secret params +func (o *PutSecretStorePathToSecretParams) SetBody(body *models.Secret) { + o.Body = body +} + +// WithPathToSecret adds the pathToSecret to the put secret store path to secret params +func (o *PutSecretStorePathToSecretParams) WithPathToSecret(pathToSecret string) *PutSecretStorePathToSecretParams { + o.SetPathToSecret(pathToSecret) + return o +} + +// SetPathToSecret adds the pathToSecret to the put secret store path to secret params +func (o *PutSecretStorePathToSecretParams) SetPathToSecret(pathToSecret string) { + o.PathToSecret = pathToSecret +} + +// WithStore adds the store to the put secret store path to secret params +func (o *PutSecretStorePathToSecretParams) WithStore(store string) *PutSecretStorePathToSecretParams { + o.SetStore(store) + return o +} + +// SetStore adds the store to the put secret store path to secret params +func (o *PutSecretStorePathToSecretParams) SetStore(store string) { + o.Store = store +} + +// WriteToRequest writes these params to a swagger request +func (o *PutSecretStorePathToSecretParams) 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 path-to-secret + if err := r.SetPathParam("path-to-secret", o.PathToSecret); err != nil { + return err + } + + // path param store + if err := r.SetPathParam("store", o.Store); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/dcos/secrets/client/secrets/put_secret_store_path_to_secret_responses.go b/dcos/secrets/client/secrets/put_secret_store_path_to_secret_responses.go new file mode 100644 index 0000000..aca4ba9 --- /dev/null +++ b/dcos/secrets/client/secrets/put_secret_store_path_to_secret_responses.go @@ -0,0 +1,140 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package secrets + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + + "github.com/go-openapi/runtime" + + strfmt "github.com/go-openapi/strfmt" +) + +// PutSecretStorePathToSecretReader is a Reader for the PutSecretStorePathToSecret structure. +type PutSecretStorePathToSecretReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PutSecretStorePathToSecretReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + + case 201: + result := NewPutSecretStorePathToSecretCreated() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + + case 400: + result := NewPutSecretStorePathToSecretBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + + case 403: + result := NewPutSecretStorePathToSecretForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + + case 409: + result := NewPutSecretStorePathToSecretConflict() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + + default: + return nil, runtime.NewAPIError("unknown error", response, response.Code()) + } +} + +// NewPutSecretStorePathToSecretCreated creates a PutSecretStorePathToSecretCreated with default headers values +func NewPutSecretStorePathToSecretCreated() *PutSecretStorePathToSecretCreated { + return &PutSecretStorePathToSecretCreated{} +} + +/*PutSecretStorePathToSecretCreated handles this case with default header values. + +Secret created. +*/ +type PutSecretStorePathToSecretCreated struct { +} + +func (o *PutSecretStorePathToSecretCreated) Error() string { + return fmt.Sprintf("[PUT /secret/{store}/{path-to-secret}][%d] putSecretStorePathToSecretCreated ", 201) +} + +func (o *PutSecretStorePathToSecretCreated) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewPutSecretStorePathToSecretBadRequest creates a PutSecretStorePathToSecretBadRequest with default headers values +func NewPutSecretStorePathToSecretBadRequest() *PutSecretStorePathToSecretBadRequest { + return &PutSecretStorePathToSecretBadRequest{} +} + +/*PutSecretStorePathToSecretBadRequest handles this case with default header values. + +Unsupported Content-Type header. +*/ +type PutSecretStorePathToSecretBadRequest struct { +} + +func (o *PutSecretStorePathToSecretBadRequest) Error() string { + return fmt.Sprintf("[PUT /secret/{store}/{path-to-secret}][%d] putSecretStorePathToSecretBadRequest ", 400) +} + +func (o *PutSecretStorePathToSecretBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewPutSecretStorePathToSecretForbidden creates a PutSecretStorePathToSecretForbidden with default headers values +func NewPutSecretStorePathToSecretForbidden() *PutSecretStorePathToSecretForbidden { + return &PutSecretStorePathToSecretForbidden{} +} + +/*PutSecretStorePathToSecretForbidden handles this case with default header values. + +Forbidden. +*/ +type PutSecretStorePathToSecretForbidden struct { +} + +func (o *PutSecretStorePathToSecretForbidden) Error() string { + return fmt.Sprintf("[PUT /secret/{store}/{path-to-secret}][%d] putSecretStorePathToSecretForbidden ", 403) +} + +func (o *PutSecretStorePathToSecretForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewPutSecretStorePathToSecretConflict creates a PutSecretStorePathToSecretConflict with default headers values +func NewPutSecretStorePathToSecretConflict() *PutSecretStorePathToSecretConflict { + return &PutSecretStorePathToSecretConflict{} +} + +/*PutSecretStorePathToSecretConflict handles this case with default header values. + +Secret already exists. +*/ +type PutSecretStorePathToSecretConflict struct { +} + +func (o *PutSecretStorePathToSecretConflict) Error() string { + return fmt.Sprintf("[PUT /secret/{store}/{path-to-secret}][%d] putSecretStorePathToSecretConflict ", 409) +} + +func (o *PutSecretStorePathToSecretConflict) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/dcos/secrets/client/secrets/secrets_client.go b/dcos/secrets/client/secrets/secrets_client.go new file mode 100644 index 0000000..b9e7001 --- /dev/null +++ b/dcos/secrets/client/secrets/secrets_client.go @@ -0,0 +1,150 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package secrets + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "github.com/go-openapi/runtime" + + strfmt "github.com/go-openapi/strfmt" +) + +// New creates a new secrets API client. +func New(transport runtime.ClientTransport, formats strfmt.Registry) *Client { + return &Client{transport: transport, formats: formats} +} + +/* +Client for secrets API +*/ +type Client struct { + transport runtime.ClientTransport + formats strfmt.Registry +} + +/* +DeleteSecretStorePathToSecret deletes a secret + +Delete a secret. +*/ +func (a *Client) DeleteSecretStorePathToSecret(params *DeleteSecretStorePathToSecretParams) (*DeleteSecretStorePathToSecretNoContent, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewDeleteSecretStorePathToSecretParams() + } + + result, err := a.transport.Submit(&runtime.ClientOperation{ + ID: "DeleteSecretStorePathToSecret", + Method: "DELETE", + PathPattern: "/secret/{store}/{path-to-secret}", + ProducesMediaTypes: []string{""}, + ConsumesMediaTypes: []string{""}, + Schemes: []string{"https"}, + Params: params, + Reader: &DeleteSecretStorePathToSecretReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + }) + if err != nil { + return nil, err + } + return result.(*DeleteSecretStorePathToSecretNoContent), nil + +} + +/* +GetSecretStorePathToSecret reads or list a secret from the store by its path + +Read or list a secret from the store by its path. +*/ +func (a *Client) GetSecretStorePathToSecret(params *GetSecretStorePathToSecretParams) (*GetSecretStorePathToSecretOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewGetSecretStorePathToSecretParams() + } + + result, err := a.transport.Submit(&runtime.ClientOperation{ + ID: "GetSecretStorePathToSecret", + Method: "GET", + PathPattern: "/secret/{store}/{path-to-secret}", + ProducesMediaTypes: []string{""}, + ConsumesMediaTypes: []string{""}, + Schemes: []string{"https"}, + Params: params, + Reader: &GetSecretStorePathToSecretReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + }) + if err != nil { + return nil, err + } + return result.(*GetSecretStorePathToSecretOK), nil + +} + +/* +PatchSecretStorePathToSecret updates secret + +Update existing secret in the specified store. +*/ +func (a *Client) PatchSecretStorePathToSecret(params *PatchSecretStorePathToSecretParams) (*PatchSecretStorePathToSecretNoContent, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPatchSecretStorePathToSecretParams() + } + + result, err := a.transport.Submit(&runtime.ClientOperation{ + ID: "PatchSecretStorePathToSecret", + Method: "PATCH", + PathPattern: "/secret/{store}/{path-to-secret}", + ProducesMediaTypes: []string{""}, + ConsumesMediaTypes: []string{""}, + Schemes: []string{"https"}, + Params: params, + Reader: &PatchSecretStorePathToSecretReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + }) + if err != nil { + return nil, err + } + return result.(*PatchSecretStorePathToSecretNoContent), nil + +} + +/* +PutSecretStorePathToSecret creates a secret in the store at the path + +Create a secret in the store at the path. +*/ +func (a *Client) PutSecretStorePathToSecret(params *PutSecretStorePathToSecretParams) (*PutSecretStorePathToSecretCreated, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPutSecretStorePathToSecretParams() + } + + result, err := a.transport.Submit(&runtime.ClientOperation{ + ID: "PutSecretStorePathToSecret", + Method: "PUT", + PathPattern: "/secret/{store}/{path-to-secret}", + ProducesMediaTypes: []string{""}, + ConsumesMediaTypes: []string{""}, + Schemes: []string{"https"}, + Params: params, + Reader: &PutSecretStorePathToSecretReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + }) + if err != nil { + return nil, err + } + return result.(*PutSecretStorePathToSecretCreated), nil + +} + +// SetTransport changes the transport on the client +func (a *Client) SetTransport(transport runtime.ClientTransport) { + a.transport = transport +} diff --git a/dcos/secrets/models/secret.go b/dcos/secrets/models/secret.go new file mode 100644 index 0000000..473137e --- /dev/null +++ b/dcos/secrets/models/secret.go @@ -0,0 +1,43 @@ +// 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 ( + strfmt "github.com/go-openapi/strfmt" + + "github.com/go-openapi/swag" +) + +// Secret secret +// swagger:model Secret +type Secret struct { + + // value + Value string `json:"value,omitempty"` +} + +// Validate validates this secret +func (m *Secret) Validate(formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *Secret) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *Secret) UnmarshalBinary(b []byte) error { + var res Secret + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/example.go b/example.go new file mode 100644 index 0000000..198e245 --- /dev/null +++ b/example.go @@ -0,0 +1,168 @@ +package main + +import ( + "fmt" + "log" + "os" + + "github.com/dcos/client-go/dcos" + "github.com/dcos/client-go/dcos/secrets/client/secrets" + secretsmodels "github.com/dcos/client-go/dcos/secrets/models" + + "github.com/dcos/client-go/dcos/cosmos" + cosmosoperations "github.com/dcos/client-go/dcos/cosmos/client/operations" + cosmosmodels "github.com/dcos/client-go/dcos/cosmos/models" +) + +const serverURL = "http://tball-client-go-0-23411561.us-east-1.elb.amazonaws.com" + +func listUsers(client *dcos.Client) error { + users, err := client.IAM.Users.GetUsers(nil) + if err != nil { + return err + } + + log.Println("Listing users...") + + for _, u := range users.Payload.Array { + fmt.Printf("\tUser %q, description=%q\n", *u.UID, *u.Description) + } + + return nil +} + +func createSecret(client *dcos.Client, secretName, secretValue string) error { + paramsSecret := secrets. + NewPutSecretStorePathToSecretParams(). + WithStore("default"). + WithPathToSecret(secretName). + WithBody(&secretsmodels.Secret{Value: secretValue}) + + result, err := client.Secrets.Secrets.PutSecretStorePathToSecret(paramsSecret) + if err != nil { + switch err.(type) { + case *secrets.PutSecretStorePathToSecretConflict: + log.Printf("Secret %q already created", secretName) + default: + return err + } + } + + log.Printf("Secret created: %+v\n", result) + + return nil +} + +func getSecret(client *dcos.Client, secretName string) error { + paramsSecret := secrets. + NewGetSecretStorePathToSecretParams(). + WithStore("default"). + WithPathToSecret(secretName) + + result, err := client.Secrets.Secrets.GetSecretStorePathToSecret(paramsSecret) + if err != nil { + return err + } + + log.Printf("Secret fetched: %+v\n", result) + + return nil +} + +func installPackage(client *dcos.Client, packageName string, options *cosmos.PackageOptions) error { + paramsPackageInstall := cosmosoperations. + NewPackageInstallParams(). + WithBody(&cosmosmodels.InstallRequest{ + PackageName: &packageName, + Options: options, + }) + + result, err := client.Cosmos.Operations.PackageInstall(paramsPackageInstall) + if err != nil { + switch err.(type) { + case *cosmosoperations.PackageInstallConflict: + log.Printf("Package %q is already installed", packageName) + return nil + default: + return err + } + } + + log.Printf("Package installed: %+v\n", result.Payload.AppID) + + return nil +} + +func main() { + if len(os.Args) != 3 { + log.Fatalf("Usage: go run example.org USERNAME PASSWORD") + } + + config := dcos.NewConfig(nil) + config.SetURL(serverURL) + + httpClient, err := dcos.NewHTTPClient(config) + if err != nil { + log.Fatalf("Creating new HTTP client failed: %s\n", err) + } + + client, err := dcos.NewClientWithOptions(httpClient, config) + if err != nil { + log.Fatalf("Creating new client failed: %s\n", err) + } + + err = listUsers(client) + if err != nil { + log.Printf("Listing users WITHOUT token failed: %s\n", err) + } + + token, err := client.Login(os.Args[1], os.Args[2]) + if err != nil { + log.Fatalf("Login failed: %s\n", err) + } + + config.SetACSToken(token) + + httpClient, err = dcos.NewHTTPClient(config) + if err != nil { + log.Fatalf("Creating new HTTP client failed: %s\n", err) + } + + authClient, err := dcos.NewClientWithOptions(httpClient, config) + if err != nil { + log.Fatalf("Creating new client failed: %s\n", err) + } + + log.Printf("Login successful") + + err = listUsers(authClient) + if err != nil { + log.Fatalf("Listing users failed: %s\n", err) + } + + err = createSecret(authClient, "biggestsecret3", "i am a dog") + if err != nil { + log.Fatalf("Creating secrets failed: %s\n", err) + } + + err = getSecret(authClient, "biggestsecret3") + if err != nil { + log.Fatalf("Creating secrets failed: %s\n", err) + } + + err = installPackage(authClient, "marathon-lb", nil) + if err != nil { + log.Fatalf("Installing package failed: %s\n", err) + } + + jenkinsOptions := &cosmos.PackageOptions{ + Security: cosmos.PackageSecurityOptions{ + StrictMode: true, + }, + } + + err = installPackage(authClient, "jenkins", jenkinsOptions) + if err != nil { + log.Fatalf("Installing package failed: %s\n", err) + } +} diff --git a/generate_swagger.sh b/generate_swagger.sh new file mode 100755 index 0000000..7886d24 --- /dev/null +++ b/generate_swagger.sh @@ -0,0 +1,27 @@ +#!/usr/bin/env bash + +mkdir -p dcos/iam && \ +swagger generate client \ + -t dcos/iam \ + --default-scheme=https \ + --additional-initialism=DCOS \ + --template-dir=swagger/templates \ + -f swagger/iam.yaml + +mkdir -p dcos/secrets && \ +swagger generate client \ + -t dcos/secrets \ + --default-scheme=https \ + --additional-initialism=DCOS \ + --template-dir=swagger/templates \ + -f swagger/secrets.yaml + +mkdir -p dcos/cosmos && \ +swagger generate client \ + -t dcos/cosmos \ + --default-scheme=https \ + --additional-initialism=DCOS \ + --template-dir=swagger/templates \ + -f swagger/cosmos.yaml + +# go get -u -f ./... diff --git a/swagger/cosmos.yaml b/swagger/cosmos.yaml new file mode 100644 index 0000000..cd32415 --- /dev/null +++ b/swagger/cosmos.yaml @@ -0,0 +1,938 @@ +swagger: '2.0' +info: + title: Cosmos + description: DC/OS Package and Service + version: '' +securityDefinitions: + token: + type: apiKey + in: header + name: Authorization +security: + - token: [] +definitions: + algo: + enum: + - sha256 + type: string + assets: + additionalProperties: false + properties: + container: + additionalProperties: false + properties: + docker: + $ref: '#/definitions/docker' + type: object + uris: + $ref: '#/definitions/uris' + type: object + base64String: + pattern: '^([A-Za-z0-9+/]{4})*([A-Za-z0-9+/]{4}|[A-Za-z0-9+/]{3}=|[A-Za-z0-9+/]{2}==)$' + type: string + binaries: + additionalProperties: false + minProperties: 1 + properties: + darwin: + $ref: '#/definitions/os' + linux: + $ref: '#/definitions/os' + windows: + $ref: '#/definitions/os' + type: object + cli: + additionalProperties: false + properties: + binaries: + $ref: '#/definitions/binaries' + required: + - binaries + type: object + unitHealth: + additionalProperties: false + type: object + properties: + id: + type: string + name: + type: string + health: + type: integer + output: + type: string + description: + type: string + help: + type: string + systemHealth: + additionalProperties: false + type: object + properties: + mesosID: + type: string + ip: + type: string + hostname: + type: string + nodeRole: + type: string + dcosVersion: + type: string + dcosDiagnosticsVersion: + type: string + units: + type: array + items: + $ref: '#/definitions/unitHealth' + systemNodes: + additionalProperties: false + type: object + properties: + nodes: + type: array + items: + $ref: '#/definitions/systemNode' + systemNode: + additionalProperties: false + type: object + properties: + host_ip: + type: string + health: + type: integer + role: + type: string + phaseStep: + additionalProperties: false + type: object + properties: + id: + type: string + status: + type: string + name: + type: string + message: + type: string + planPhase: + additionalProperties: false + type: object + properties: + name: + type: string + id: + type: string + strategy: + type: string + status: + type: string + steps: + type: array + items: + $ref: '#/definitions/phaseStep' + planDefinition: + additionalProperties: false + type: object + properties: + status: + type: string + phases: + type: array + items: + $ref: '#/definitions/planPhase' + errors: + type: array + items: + type: string + required: + - status + cliInfo: + additionalProperties: false + properties: + contentHash: + items: + $ref: '#/definitions/hash' + minItems: 1 + type: array + kind: + enum: + - executable + - zip + type: string + url: + $ref: '#/definitions/url' + required: + - contentHash + - kind + - url + type: object + command: + additionalProperties: false + properties: + pip: + description: '[Deprecated v3.x] An array of strings representing of the requirements file to use for installing the subcommand for Pip. Each item is interpreted as a line in the requirements file.' + items: + type: string + type: array + required: + - pip + type: object + config: + additionalProperties: true + type: object + packageDescribeRequest: + additionalProperties: false + properties: + packageName: + type: string + packageVersion: + type: string + required: + - packageName + type: object + docker: + additionalProperties: + type: string + type: object + error: + additionalProperties: false + properties: + type: + type: string + message: + type: string + data: + type: object + required: + - type + - message + hash: + additionalProperties: false + properties: + algo: + $ref: '#/definitions/algo' + value: + type: string + required: + - algo + - value + type: object + images: + additionalProperties: false + properties: + icon-large: + description: 'PNG icon URL, preferably 256 by 256 pixels.' + type: string + icon-medium: + description: 'PNG icon URL, preferably 128 by 128 pixels.' + type: string + icon-small: + description: 'PNG icon URL, preferably 48 by 48 pixels.' + type: string + screenshots: + items: + description: 'PNG screen URL, preferably 1024 by 1024 pixels.' + type: string + type: array + type: object + installRequest: + additionalProperties: false + properties: + appId: + type: string + options: + additionalProperties: true + type: object + packageName: + type: string + packageVersion: + type: string + required: + - packageName + type: object + installResponse: + additionalProperties: false + properties: + appId: + type: string + cli: + $ref: '#/definitions/cli' + packageName: + type: string + packageVersion: + type: string + postInstallNotes: + type: string + required: + - packageName + - packageVersion + type: object + serviceUpdateRequest: + additionalProperties: false + properties: + appId: + type: string + options: + additionalProperties: true + type: object + packageName: + type: string + packageVersion: + type: string + replace: + description: If true any stored configuration will be ignored when producing the updated service configuration. + type: boolean + required: + - appId + - replace + type: object + serviceUpdateResponse: + additionalProperties: false + properties: + marathonDeploymentId: + type: string + package: + $ref: '#/definitions/v50PackageDefinition' + resolvedOptions: + additionalProperties: true + description: The result of merging the default package options with the user supplied options + type: object + required: + - marathonDeploymentId + - package + - resolvedOptions + type: object + uninstallRequest: + additionalProperties: false + properties: + appId: + type: string + packageName: + type: string + all: + type: boolean + required: + - packageName + type: object + uninstallResponse: + additionalProperties: false + properties: + appId: + type: string + packageName: + type: string + packageVersion: + type: string + postUninstallNotes: + type: string + required: + - packageName + - appId + type: object + kubernetesAuthDataResponse: + additionalProperties: false + properties: + caCrt: + type: string + token: + type: string + required: + - caCrt + - token + type: object + licence: + additionalProperties: false + properties: + name: + description: 'The name of the license. For example one of [Apache License Version 2.0 | MIT License | BSD License | Proprietary]' + type: string + url: + $ref: '#/definitions/url' + required: + - name + - url + type: object + licences: + items: + $ref: '#/definitions/licence' + type: array + marathon: + additionalProperties: false + properties: + v2AppMustacheTemplate: + $ref: '#/definitions/base64String' + required: + - v2AppMustacheTemplate + type: object + os: + additionalProperties: false + properties: + x86-64: + $ref: '#/definitions/cliInfo' + required: + - x86-64 + type: object + packageDetails: + additionalProperties: false + properties: + description: + type: string + framework: + default: false + description: True if this package installs a new Mesos framework. + type: boolean + licenses: + $ref: '#/definitions/licences' + maintainer: + type: string + name: + type: string + packagingVersion: + type: string + postInstallNotes: + description: Post installation notes that would be useful to the user of this package. + type: string + postUninstallNotes: + description: Post uninstallation notes that would be useful to the user of this package. + type: string + preInstallNotes: + description: Pre installation notes that would be useful to the user of this package. + type: string + releaseVersion: + description: Corresponds to the revision index from the universe directory structure + minimum: 0 + type: integer + scm: + type: string + selected: + default: false + description: Flag indicating if the package is selected in search results + type: boolean + tags: + items: + pattern: '^[^\s]+$' + type: string + type: array + version: + type: string + website: + type: string + required: + - description + - maintainer + - name + - packagingVersion + - tags + - version + type: object + serviceDescribeRequest: + additionalProperties: false + properties: + appId: + type: string + managerId: + type: string + required: + - appId + - managerId + type: object + packageDeleteRepoRequest: + additionalProperties: false + properties: + name: + type: string + uri: + $ref: '#/definitions/url' + type: object + packageDeleteRepoResponse: + additionalProperties: false + properties: + repositories: + type: array + items: + $ref: '#/definitions/pkgRepo' + required: + - repositories + type: object + packageAddRepoRequest: + additionalProperties: false + properties: + name: + type: string + uri: + $ref: '#/definitions/url' + index: + type: integer + minimum: 0 + required: + - name + - uri + type: object + packageAddRepoResponse: + additionalProperties: false + properties: + repositories: + type: array + items: + $ref: '#/definitions/pkgRepo' + required: + - repositories + type: object + serviceDescribeResponse: + additionalProperties: false + properties: + downgradesTo: + items: + type: string + type: array + package: + $ref: '#/definitions/v50PackageDefinition' + resolvedOptions: + additionalProperties: true + description: The result of merging the default package options with the user supplied options + type: object + upgradesTo: + items: + type: string + type: array + userProvidedOptions: + additionalProperties: true + description: The options the user provided to run the service + type: object + required: + - downgradesTo + - package + - upgradesTo + type: object + uris: + additionalProperties: + type: string + type: object + url: + format: uri + pattern: '^https?://' + type: string + pkgRepo: + type: object + additionalProperties: false + properties: + name: + type: string + uri: + $ref: '#/definitions/url' + required: + - name + - uri + v30Resource: + additionalProperties: false + properties: + assets: + $ref: '#/definitions/assets' + cli: + $ref: '#/definitions/cli' + images: + $ref: '#/definitions/images' + type: object + v3PackageDescribeResponse: + additionalProperties: false + properties: + package: + $ref: '#/definitions/v50PackageDefinition' + required: + - package + type: object + v50PackageDefinition: + additionalProperties: false + properties: + command: + $ref: '#/definitions/command' + config: + $ref: '#/definitions/config' + description: + type: string + downgradesTo: + description: 'List of versions that this package can downgrade to. If the property is a list containing the string ''*'', this package can downgrade to any version. If the property is not set or the empty list, this package cannot downgrade.' + items: + type: string + type: array + framework: + default: false + description: True if this package installs a new Mesos framework. + type: boolean + licenses: + $ref: '#/definitions/licences' + maintainer: + type: string + marathon: + $ref: '#/definitions/marathon' + minDcosReleaseVersion: + description: The minimum DC/OS Release Version the package can run on. + pattern: '^(?:0|[1-9][0-9]*)(?:\.(?:0|[1-9][0-9]*))*$' + type: string + name: + type: string + packagingVersion: + enum: + - '5.0' + type: string + postInstallNotes: + description: Post installation notes that would be useful to the user of this package. + type: string + postUninstallNotes: + description: Post uninstallation notes that would be useful to the user of this package. + type: string + preInstallNotes: + description: Pre installation notes that would be useful to the user of this package. + type: string + releaseVersion: + description: Corresponds to the revision index from the universe directory structure + minimum: 0 + type: integer + resource: + $ref: '#/definitions/v30Resource' + scm: + type: string + selected: + default: false + description: Flag indicating if the package is selected in search results + type: boolean + tags: + items: + pattern: '^[^\s]+$' + type: string + type: array + upgradesFrom: + description: 'List of versions that can upgrade to this package. If the property is a list containing the string ''*'', any version can upgrade to this package. If the property is not set or the empty list, no version can upgrade to this package.' + items: + type: string + type: array + version: + pattern: '^[-a-zA-Z0-9.]+$' + type: string + website: + type: string + manager: + $ref: '#/definitions/manager' + required: + - description + - maintainer + - name + - packagingVersion + - releaseVersion + - tags + - version + type: object + manager: + additionalProperties: false + properties: + packageName: + type: string + minPackageVersion: + type: string + required: + - packageName + type: object +paths: + /system/health/v1: + get: + description: DC/OS system health. + operationId: dcos-system-health + produces: + - application/json + consumes: + - application/json + parameters: [] + tags: [] + responses: + '200': + description: System is healthy. + schema: + $ref: '#/definitions/systemHealth' + default: + description: Unexpected error. + schema: + $ref: '#/definitions/error' + /service/{appId}/v1/health: + get: + description: Healthcheck service. + operationId: healthchech-service + produces: + - text/plain + consumes: + - text/plain + parameters: + - name: appId + in: path + required: true + type: string + tags: [] + responses: + '200': + description: Service is healthy. + '404': + description: Service not found. + schema: + $ref: '#/definitions/error' + /system/health/v1/nodes: + get: + description: DC/OS nodes. + operationId: dcos-system-nodes + produces: + - application/json + consumes: + - application/json + parameters: [] + tags: [] + responses: + '200': + description: The nodes. + schema: + $ref: '#/definitions/systemNodes' + default: + description: Unexpected error. + schema: + $ref: '#/definitions/error' + /service/{appId}/v1/plans/{plan}: + get: + description: Service plan. + operationId: service-plan + produces: + - application/json + consumes: + - application/json + parameters: + - name: appId + in: path + required: true + type: string + - name: plan + in: path + required: true + type: string + tags: [] + responses: + '200': + description: Service plan. + schema: + $ref: '#/definitions/planDefinition' + '404': + description: Service plan not found. + schema: + $ref: '#/definitions/error' + /package/repository/delete: + post: + operationId: package-repository-delete + description: Deletes a package repository (for example Universe) from DC/OS. + consumes: + - application/vnd.dcos.package.repository.delete-request+json;charset=utf-8;version=v1 + produces: + - application/vnd.dcos.package.repository.delete-response+json;charset=utf-8;version=v1 + parameters: + - in: body + name: body + schema: + $ref: '#/definitions/packageDeleteRepoRequest' + responses: + '200': + description: '' + schema: + $ref: '#/definitions/packageDeleteRepoResponse' + '400': + description: '' + schema: + $ref: '#/definitions/error' + '404': + description: '' + schema: + $ref: '#/definitions/error' + /package/repository/add: + post: + operationId: package-repository-add + description: | + Adds a package repository (for example Universe) for use by DC/OS. To add a package + repository to the beginning of the list set the index to zero (0). To add a package + repository to the end of the list do not specify an index. + consumes: + - application/vnd.dcos.package.repository.add-request+json;charset=utf-8;version=v1 + produces: + - application/vnd.dcos.package.repository.add-response+json;charset=utf-8;version=v1 + parameters: + - in: body + name: body + schema: + $ref: '#/definitions/packageAddRepoRequest' + responses: + '200': + description: '' + schema: + $ref: '#/definitions/packageAddRepoResponse' + '400': + description: '' + schema: + $ref: '#/definitions/error' + '409': + description: '' + schema: + $ref: '#/definitions/error' + /cosmos/service/describe: + post: + consumes: + - application/vnd.dcos.service.describe-request+json;charset=utf-8;version=v1 + description: Describes a DC/OS Service + operationId: service-describe + parameters: + - in: body + name: body + schema: + $ref: '#/definitions/serviceDescribeRequest' + produces: + - application/vnd.dcos.service.describe-response+json;charset=utf-8;version=v1 + responses: + '200': + description: '' + schema: + $ref: '#/definitions/serviceDescribeResponse' + '400': + description: '' + schema: + $ref: '#/definitions/error' + /package/describe: + post: + consumes: + - application/vnd.dcos.package.describe-request+json;charset=utf-8;version=v1 + description: 'Show information about the package, including the required resources and configuration to start the service, and command line extensions that are included with the package.' + operationId: package-describe + parameters: + - in: body + name: body + schema: + $ref: '#/definitions/packageDescribeRequest' + produces: + - application/vnd.dcos.package.describe-response+json;charset=utf-8;version=v3 + responses: + '200': + description: '' + schema: + $ref: '#/definitions/v3PackageDescribeResponse' + '400': + description: '' + schema: + $ref: '#/definitions/error' + /package/uninstall: + post: + operationId: package-uninstall + consumes: + - application/vnd.dcos.package.uninstall-request+json;charset=utf-8;version=v1 + produces: + - application/vnd.dcos.package.uninstall-response+json;charset=utf-8;version=v1 + parameters: + - in: body + name: body + required: true + schema: + $ref: '#/definitions/uninstallRequest' + - name: Accept + in: header + required: false + enum: + - application/vnd.dcos.package.uninstall-response+json;charset=utf-8;version=v1 + type: string + responses: + '200': + description: '' + schema: + $ref: '#/definitions/uninstallResponse' + '400': + description: '' + schema: + $ref: '#/definitions/error' + '404': + description: '' + schema: + $ref: '#/definitions/error' + '409': + description: '' + schema: + $ref: '#/definitions/error' + /package/install: + post: + consumes: + - application/vnd.dcos.package.install-request+json;charset=utf-8;version=v1 + description: Runs a service from a Universe package. + operationId: package-install + parameters: + - in: body + name: body + required: true + schema: + $ref: '#/definitions/installRequest' + produces: + - application/vnd.dcos.package.install-response+json;charset=utf-8;version=v1 + responses: + '200': + description: '' + schema: + $ref: '#/definitions/installResponse' + '400': + description: '' + schema: + $ref: '#/definitions/error' + '409': + description: '' + schema: + $ref: '#/definitions/error' + /service/{appId}/v1/auth/data: + get: + description: Kuberentes Auth Data + operationId: kubernetes-auth-data + produces: + - text/plain + consumes: + - text/plain + parameters: + - name: appId + in: path + required: true + type: string + tags: [] + responses: + '200': + description: '' + schema: + $ref: '#/definitions/kubernetesAuthDataResponse' + '404': + description: Service not found. + schema: + $ref: '#/definitions/error' + /cosmos/service/update: + post: + consumes: + - application/vnd.dcos.service.update-request+json;charset=utf-8;version=v1 + description: Runs a service update. + operationId: service-update + parameters: + - in: body + name: body + required: true + schema: + $ref: '#/definitions/serviceUpdateRequest' + produces: + - application/vnd.dcos.service.update-response+json;charset=utf-8;version=v1 + responses: + '200': + description: '' + schema: + $ref: '#/definitions/serviceUpdateResponse' + '400': + description: '' + schema: + $ref: '#/definitions/error' + '404': + description: '' + schema: + $ref: '#/definitions/error' + '409': + description: '' + schema: + $ref: '#/definitions/error' diff --git a/swagger/iam.yaml b/swagger/iam.yaml new file mode 100644 index 0000000..0c3b989 --- /dev/null +++ b/swagger/iam.yaml @@ -0,0 +1,1655 @@ +# Auto-generated YAML file. Do not edit manually. +# Run `docs/openapi-spec-extension/build-extended-spec.py` to regenerate. +swagger: '2.0' +info: + version: 1.0.0 + title: Identity and Access Management API +schemes: +- http +- https +basePath: /acs/api/v1 +securityDefinitions: + token: + type: apiKey + in: header + name: Authorization +security: + - token: [] +tags: +- name: login + description: Login- and authentication-related endpoints +- name: oidc + description: OpenID Connect endpoints, including provider management +- name: users + description: User management endpoints +- name: groups + description: Group management endpoints +- name: permissions + description: Permission management endpoints +- name: saml + description: SAML 2.0 endpoints, including provider management +- name: ldap + description: Directory (LDAP) back-end configuration and interaction endpoints +paths: + /acls: + get: + summary: Retrieve all ACL objects. + description: Get array of `ACL` objects. + tags: + - permissions + produces: + - application/json + responses: + '200': + description: Success + schema: + type: object + properties: + array: + type: array + items: + $ref: '#/definitions/ACL' + /acls/{rid}: + get: + summary: Retrieve ACL for a certain resource. + description: Retrieve single `ACL` object, for a specific resource. + tags: + - permissions + produces: + - application/json + parameters: + - name: rid + in: path + required: true + description: The ID of the resource to retrieve the ACL for. + type: string + responses: + 200: + description: Success. + schema: + $ref: '#/definitions/ACL' + put: + summary: Create ACL for a certain resource. + description: Create new ACL for resource with ID `rid` (description in body, + no permissions by default). + tags: + - permissions + consumes: + - application/json + parameters: + - name: rid + in: path + required: true + description: The ID of the resource for which the ACL should be created. + type: string + - name: ACL + in: body + required: true + schema: + $ref: '#/definitions/ACLCreate' + responses: + 201: + description: ACL created. + 409: + description: Already exists (this resource already has an ACL set). + patch: + summary: Update ACL for a certain resource. + description: Update ACL for resource with ID `rid`. + tags: + - permissions + consumes: + - application/json + parameters: + - name: rid + in: path + required: true + description: The ID of the resource for which the ACL should be created. + type: string + - name: ACL update object + description: New ACL. + in: body + required: true + schema: + $ref: '#/definitions/ACLUpdate' + responses: + 204: + description: Success. + delete: + summary: Delete ACL for a certain resource. + description: Delete ACL of resource with ID `rid`. + tags: + - permissions + parameters: + - name: rid + in: path + required: true + description: The ID of resource for which the ACL should be deleted. + type: string + responses: + 204: + description: Success. + 404: + description: ACL not found. + /acls/{rid}/groups/{gid}: + get: + summary: Get allowed actions for given resource and group. + description: Get allowed actions for given resource and group. + tags: + - permissions + produces: + - application/json + parameters: + - name: rid + in: path + required: true + description: resource ID + type: string + - name: gid + in: path + required: true + description: group ID + type: string + responses: + 200: + description: Success. + schema: + type: object + properties: + array: + type: array + items: + $ref: '#/definitions/Action' + delete: + summary: Forbid all actions of given group to given resource. + description: Forbid all actions of given group to given resource. + tags: + - permissions + parameters: + - name: rid + in: path + required: true + description: resource ID. + type: string + - name: gid + in: path + required: true + description: group ID. + type: string + responses: + 204: + description: Success. + /acls/{rid}/groups/{gid}/{action}: + get: + summary: Query whether action is allowed or not. + description: Query whether action is allowed or not. + tags: + - permissions + produces: + - application/json + parameters: + - name: rid + in: path + required: true + description: resource ID + type: string + - name: gid + in: path + required: true + description: group ID + type: string + - name: action + in: path + required: true + description: action name + type: string + responses: + 200: + description: Boolean answer in JSON response body. + schema: + $ref: '#/definitions/ActionAllowed' + put: + summary: Permit single action for given resource and group. + description: Permit single action for given resource and group. + tags: + - permissions + parameters: + - name: rid + in: path + required: true + description: resource ID. + type: string + - name: gid + in: path + required: true + description: group ID. + type: string + - name: action + in: path + required: true + description: action name + type: string + responses: + 204: + description: Success. + delete: + summary: Forbid single action for given resource and group. + description: Forbid single action for given resource and group. + tags: + - permissions + parameters: + - name: rid + in: path + required: true + description: resource ID. + type: string + - name: gid + in: path + required: true + description: group ID. + type: string + - name: action + in: path + required: true + description: action name + type: string + responses: + 204: + description: Success. + /acls/{rid}/permissions: + get: + summary: Retrieve all permissions for resource. + description: Retrieve all permissions that are set for a specific resource. + tags: + - permissions + produces: + - application/json + parameters: + - name: rid + in: path + required: true + description: resource ID + type: string + responses: + 200: + description: Success. + schema: + $ref: '#/definitions/ACLPermissions' + /acls/{rid}/users/{uid}: + get: + summary: Get allowed actions for given resource and user. + description: Get allowed actions for given resource and user. + tags: + - permissions + produces: + - application/json + parameters: + - name: rid + in: path + required: true + description: resource ID + type: string + - name: uid + in: path + required: true + description: account ID + type: string + responses: + 200: + description: Success. + schema: + type: object + properties: + array: + type: array + items: + $ref: '#/definitions/Action' + delete: + summary: Forbid all actions of given account to given resource. + description: Forbid all actions of given account to given resource. + tags: + - permissions + parameters: + - name: rid + in: path + required: true + description: resource ID. + type: string + - name: uid + in: path + required: true + description: account ID. + type: string + responses: + 204: + description: Success. + /acls/{rid}/users/{uid}/{action}: + get: + summary: Query whether action is allowed or not. + description: Query whether action is allowed or not. + tags: + - permissions + produces: + - application/json + parameters: + - name: rid + in: path + required: true + description: resource ID + type: string + - name: uid + in: path + required: true + description: account ID + type: string + - name: action + in: path + required: true + description: action name + type: string + responses: + 200: + description: Boolean answer in JSON response body. + schema: + $ref: '#/definitions/ActionAllowed' + put: + summary: Permit single action for given account and resource. + description: Permit single action for given account and resource. + tags: + - permissions + parameters: + - name: rid + in: path + required: true + description: resource ID. + type: string + - name: uid + in: path + required: true + description: account ID. + type: string + - name: action + in: path + required: true + description: action name + type: string + responses: + 204: + description: Success. + 409: + description: Already exists (this account already has this action). + delete: + summary: Forbid single action for given account and resource. + description: Forbid single action for given account and resource. + tags: + - permissions + parameters: + - name: rid + in: path + required: true + description: resource ID. + type: string + - name: uid + in: path + required: true + description: account ID. + type: string + - name: action + in: path + required: true + description: action name + type: string + responses: + 204: + description: Success. + /auth/jwks: + get: + summary: Get the IAM's JSON Web Key Set (JWKS, according to RFCs 7517/7518). + description: 'This endpoint provides the IAM''s JSON Web Key Set (JWKS), exposing + public key details required for the process of DC/OS authentication token + verification: the public key material can be used for verifying authentication + tokens signed by the IAM''s private key. The DC/OS authentication token is + a JSON Web Token (JWT) of type RS256, and is required to have the two claims + `exp` and `uid`. For interpretation of the data provided by the JWKS endpoint + see https://tools.ietf.org/html/rfc7517 and https://tools.ietf.org/html/rfc7518.' + responses: + 200: + description: The response body contains a JSON Web Key Set document. + /auth/login: + post: + summary: Log in (obtain a DC/OS authentication token). + description: 'Exchange user credentials (regular user account: uid and password; + service user account: uid and service login token) for a DC/OS authentication + token. The resulting DC/OS authentication token is an RFC 7519 JSON Web Token + (JWT) of type RS256. It has a limited lifetime which depends on the IAM configuration + (only, i.e. the lifetime cannot be chosen as part of the login HTTP request). + The DC/OS authentication token can be verified out-of-band using a standards-compliant + RS256 JWT verification procedure based on the long-lived public key material + presented by the IAM''s /auth/jwks endpoint, and by requiring the two claims + `exp` and `uid` to be present.' + tags: + - login + consumes: + - application/json + produces: + - application/json + parameters: + - name: LoginObject + description: uid & password or uid & service login token. + in: body + required: true + schema: + $ref: '#/definitions/LoginObject' + responses: + 200: + description: Login successful. The response body contains a JSON object + providing the authentication token. + schema: + $ref: '#/definitions/AuthToken' + headers: + Set-Cookie: + description: A cookie containing the auth token (implementation detail + for browser support, should not be of interest to general API consumers). + type: string + 401: + description: Login failed. + get: + summary: Log in using an external identity provider. + description: Log in using an external identity provider (via e.g. OpenID Connect), + as specified via query parameter. This request initiates a single sign-on + flow. + tags: + - login + parameters: + - name: oidc-provider + description: OIDC provider ID + in: query + required: false + type: string + responses: + 200: + description: Redirect to the identity provider. + /auth/oidc/callback: + get: + summary: OpenID Connect callback URL. + description: After successfully logging in to an OpenID Connect identity provider, + the end-user is being redirected back to the IAM via this callback URL. API + consumers are not required to explicitly interact with this endpoint. This + URL usually needs to be handed over to an OpenID Connect provider (often called + "redirect" or "callback" URL). + tags: + - oidc + responses: + 302: + description: OIDC authentication flow successful. + 401: + description: Problem in authentication flow. + /auth/oidc/providers: + get: + summary: Get an overview for the configured OIDC providers. + description: Get an overview for the configured OIDC providers. The response + contains a JSON object, with each key being an OIDC provider ID, and each + value being the corresponding provider description string. This endpoint does + not expose sensitive provider configuration details. + tags: + - oidc + produces: + - application/json + responses: + 200: + description: Success. + /auth/oidc/providers/{provider-id}: + get: + summary: Get configuration for a specific provider. + description: Get configuration for a specific provider. + tags: + - oidc + produces: + - application/json + parameters: + - name: provider-id + in: path + required: true + description: The ID of the OIDC provider to retrieve the config for. + type: string + responses: + 200: + description: Success. + schema: + $ref: '#/definitions/OIDCProviderConfig' + put: + summary: Configure a new OIDC provider. + description: Set up OIDC provider with the ID as specified in the URL, and with + the config as specified via JSON in the request body. + tags: + - oidc + consumes: + - application/json + parameters: + - name: provider-id + in: path + required: true + description: The ID of the provider to create. + type: string + - name: Provider config object + description: Provider config JSON object + in: body + required: true + schema: + $ref: '#/definitions/OIDCProviderConfig' + responses: + 201: + description: Provider created. + 409: + description: Provider already exists. + patch: + summary: Update OIDC provider config. + description: Update config for existing OIDC provider. + tags: + - oidc + consumes: + - application/json + parameters: + - name: provider-id + in: path + required: true + description: The ID of the provider to modify. + type: string + - name: Provider config object + description: Provider config JSON object + in: body + required: true + schema: + $ref: '#/definitions/OIDCProviderConfig' + responses: + 204: + description: Update applied. + 400: + description: Various errors (e.g. provider not yet configured). + delete: + summary: Delete provider. + description: Delete provider (disables authentication with that provider). + tags: + - oidc + parameters: + - name: provider-id + in: path + required: true + description: The ID of the OIDC provider to delete. + type: string + responses: + 204: + description: Success. + /auth/saml/providers: + get: + summary: Get an overview for the configured SAML 2.0 providers. + description: Get an overview for the configured SAML 2.0 providers. The response + contains a JSON object, with each key being a SAML provider ID, and each value + being the corresponding provider description string. This endpoint does not + expose sensitive provider configuration details. + tags: + - saml + produces: + - application/json + responses: + 200: + description: Success. + /auth/saml/providers/{provider-id}: + get: + summary: Get configuration for a specific SAML provider. + description: Get configuration for a specific SAML provider. + tags: + - saml + produces: + - application/json + parameters: + - name: provider-id + in: path + required: true + description: The ID of the SAML provider to retrieve the config for. + type: string + responses: + 200: + description: Success. + schema: + $ref: '#/definitions/SAMLProviderConfig' + put: + summary: Configure a new SAML provider. + description: Set up a SAML provider with the ID as specified in the URL, and + with the config as given by the JSON document in the request body. + tags: + - saml + consumes: + - application/json + parameters: + - name: provider-id + in: path + required: true + description: The ID of the provider to create. + type: string + - name: Provider config object + description: Provider config JSON object + in: body + required: true + schema: + $ref: '#/definitions/SAMLProviderConfig' + responses: + 201: + description: Provider created. + 409: + description: Provider already exists. + patch: + summary: Update SAML provider config. + description: Update config for existing SAML provider. + tags: + - saml + consumes: + - application/json + parameters: + - name: provider-id + in: path + required: true + description: The ID of the provider to modify. + type: string + - name: Provider config object + description: Provider config JSON object + in: body + required: true + schema: + $ref: '#/definitions/SAMLProviderConfig' + responses: + 204: + description: Update applied. + 400: + description: Various errors (e.g. provider not yet configured). + delete: + summary: Delete provider. + description: Delete provider (disables authentication with that provider). + tags: + - saml + parameters: + - name: provider-id + in: path + required: true + description: The ID of the SAML provider to delete. + type: string + responses: + 204: + description: Success. + /auth/saml/providers/{provider-id}/acs-callback: + post: + summary: The SP ACS callback endpoint. + description: The IAM acts as SAML service provider (SP). As part of the authentication + flow, a SAML identity provider (IdP) makes the end-user submit an authentication + response to this endpoint. + tags: + - saml + parameters: + - name: provider-id + in: path + required: true + description: The ID of the provider the authentication response is meant for. + type: string + responses: + 302: + description: SAML authentication flow successful. + 401: + description: Problem in authentication flow. + /auth/saml/providers/{provider-id}/acs-callback-url: + get: + summary: Get the authentication callback URL for this SP. + description: The IAM acts as SAML service provider (SP). A SAML identity provider + (IdP) usually requires to be configured with the Assertion Consumer Service + (ACS) callback URL of the SP (which is where the IdP makes the end-user submit + the authentication response). + tags: + - saml + produces: + - application/json + parameters: + - name: provider-id + in: path + required: true + description: The ID of the SAML provider to retrieve the ACS callback URL + for. + type: string + responses: + 200: + description: The response body contains a JSON object declaring the callback + URL + schema: + $ref: '#/definitions/SAMLACSCallbackUrlObject' + /auth/saml/providers/{provider-id}/sp-metadata: + get: + summary: Get SP metadata (XML). + description: The IAM acts as SAML service provider (SP). This endpoint provides + the SP metadata as an XML document. Certain identity providers (IdPs) may + want to directly consume this document. + tags: + - saml + produces: + - application/samlmetadata+xml + parameters: + - name: provider-id + in: path + required: true + description: The ID of the SAML provider to retrieve the metadata for. + type: string + responses: + 200: + description: The response body contains the metadata in UTF-8 encoding, + setting the Content-Type to `application/samlmetadata+xml`. + /groups: + get: + summary: Retrieve all group objects. + description: Retrieve array of `Group` objects. + tags: + - groups + produces: + - application/json + responses: + '200': + description: Success. + schema: + type: object + properties: + array: + type: array + items: + $ref: '#/definitions/Group' + /groups/{gid}: + get: + summary: Get single group object. + description: Get specific `Group` object. + tags: + - groups + produces: + - application/json + parameters: + - name: gid + in: path + required: true + description: The ID of the group to retrieve. + type: string + responses: + 200: + description: Success. + schema: + $ref: '#/definitions/Group' + put: + summary: Create a group. + description: Create a group. + tags: + - groups + consumes: + - application/json + parameters: + - name: gid + in: path + required: true + description: The ID of the group. + type: string + - name: Group creation object + in: body + required: true + schema: + $ref: '#/definitions/GroupCreate' + responses: + 201: + description: Group created. + 409: + description: Group exists. + patch: + summary: Update group. + description: Update existing group (description). + tags: + - groups + consumes: + - application/json + parameters: + - name: gid + in: path + required: true + description: The ID of the group to modify. + type: string + - name: Group update object + in: body + required: true + schema: + $ref: '#/definitions/GroupUpdate' + responses: + 204: + description: Update applied. + delete: + summary: Delete group. + description: Delete group. + tags: + - groups + parameters: + - name: gid + in: path + required: true + description: The ID of the group to delete. + type: string + responses: + 204: + description: Success + /groups/{gid}/permissions: + get: + summary: Retrieve group permissions. + description: Retrieve permissions of this group. + tags: + - groups + produces: + - application/json + parameters: + - name: gid + in: path + required: true + description: The group ID. + type: string + responses: + 200: + description: Success. + schema: + $ref: '#/definitions/GroupPermissions' + /groups/{gid}/users: + get: + summary: Retrieve members of a group. + description: Retrieve users that are member of this group. Allows to query service + accounts, defaults to list only user accounts. + tags: + - groups + produces: + - application/json + parameters: + - name: gid + in: path + required: true + description: The group ID. + type: string + - name: type + in: query + description: If set to `service`, list only service accounts. If unset, default + to only listing user accounts members of a group. + type: string + responses: + 200: + description: Success. + schema: + $ref: '#/definitions/GroupUsers' + /groups/{gid}/users/{uid}: + delete: + summary: Delete user account from group. + description: Delete user account from group. + tags: + - groups + parameters: + - name: gid + in: path + required: true + description: The ID of the group to delete from. + type: string + - name: uid + in: path + required: true + description: The ID of the user account. + type: string + responses: + 204: + description: Success. + put: + summary: Add account to group. + description: Add account to group. + tags: + - groups + parameters: + - name: gid + in: path + required: true + description: The ID of the group to add the user account to. + type: string + - name: uid + description: The ID of the account to add. + in: path + required: true + type: string + responses: + 204: + description: Success + 409: + description: account is already part of the group. + /ldap/config: + get: + summary: Retrieve current LDAP configuration. + description: Retrieve current directory (LDAP) back-end configuration. + produces: + - application/json + tags: + - ldap + responses: + 200: + description: The response body contains a JSON object providing the current + configuration. + schema: + $ref: '#/definitions/LDAPConfiguration' + 400: + description: Various errors. If no config has yet been stored, the custom + error code `ERR_LDAP_CONFIG_NOT_AVAILABLE` is set in the response. + put: + summary: Set new LDAP configuration. + description: Set new directory (LDAP) back-end configuration. Replace current + configuration, if existing. + tags: + - ldap + consumes: + - application/json + parameters: + - name: LDAP configuration + description: JSON object containing the LDAP configuration details. + in: body + required: true + schema: + $ref: '#/definitions/LDAPConfiguration' + responses: + 200: + description: Configuration has been persisted. Basic validation tests passed, + but the directory service was not contacted. You're encouraged to now + perform a basic feature check against the directory back-end with the + newly set configuration by using the the config test endpoint. + 400: + description: Various errors. If the configuration object itself is invalid, + the custom error code `ERR_LDAP_CONFIG_INVALID` is set in the response + and a description sheds light onto the problem specifics. + delete: + summary: Delete current LDAP configuration. + description: Delete current directory (LDAP) back-end configuration. This deactivates + the LDAP authentication. + tags: + - ldap + responses: + 204: + description: Configuration deleted. + 400: + description: Various errors. If no config has yet been stored, the custom + error code `ERR_LDAP_CONFIG_NOT_AVAILABLE` is set in the response. + /ldap/config/test: + post: + summary: Test connection to the LDAP back-end. + description: Perform basic feature tests. Verify that the current directory + (LDAP) configuration parameters allow for a successful connection to the directory + back-end. For instance, this endpoint simulates the procedure for authentication + via LDAP, but provides more useful feedback upon failure than the actual login + endpoint. + tags: + - ldap + consumes: + - application/json + parameters: + - name: Test user credentials + description: JSON object containing `uid` and password of an LDAP user. For + the most expressive test result, choose credentials different from the lookup + credentials. The `uid` is the string the user is supposed to log in with + after successful LDAP back-end configuration. + in: body + required: true + schema: + $ref: '#/definitions/LDAPTestCredentials' + responses: + 200: + description: Directory back-end was reached and all feature tests passed. + schema: + $ref: '#/definitions/LDAPTestResultObject' + 502: + description: Either there was a connection error or one of the feature tests + failed. To distinguish this response from a proxy-generated 502, a JSON + object is included in the response. It contains a message in its `description` + property, describing the problem in more detail. + schema: + $ref: '#/definitions/LDAPTestResultObject' + /ldap/importgroup: + post: + summary: Import an LDAP group. + description: Attempt to import a group of users from the configured directory + (LDAP) back-end. See docs/ldap.md for details on group import. + tags: + - ldap + consumes: + - application/json + parameters: + - name: LDAP groupname + description: A JSON object specifying the name of the group to be imported. + The meaning of the name depends on the group search settings. + in: body + required: true + schema: + $ref: '#/definitions/LDAPImportGroupObject' + responses: + 201: + description: Success. + 400: + description: Various errors. If no directory back-end has been configured + yet, the custom error code `ERR_LDAP_CONFIG_NOT_AVAILABLE` is set in the + response. If there was no LDAP search result or an error occured during + the search process, one of the custom error codes `ERR_LDAP_IMPORT_GROUP_NOT_FOUND` + and `ERR_LDAP_IMPORT_SEARCH_FAILED` is set in the response, and a description + is provided to report the problem specifics. + /ldap/importuser: + post: + summary: Import an LDAP user. + description: Attempt to import a user from the configured directory (LDAP) back-end. + tags: + - ldap + consumes: + - application/json + parameters: + - name: LDAP username + description: 'A JSON object specifying the username (read: "login" or "user + ID") of the user that should be imported. That string is equivalent to the + `uid` the user is supposed to log in with after successful import. The exact + meaning of this string depends on the configured LDAP authentication method.' + in: body + required: true + schema: + $ref: '#/definitions/LDAPImportUserObject' + responses: + 201: + description: Success. + 400: + description: Various errors. If no directory back-end has been configured + yet, the custom error code `ERR_LDAP_CONFIG_NOT_AVAILABLE` is set in the + response. If there was no LDAP search result or an error occured during + the search process, one of the custom error codes `ERR_LDAP_IMPORT_USER_NOT_FOUND` + and `ERR_LDAP_IMPORT_SEARCH_FAILED` is set in the response, and a description + is provided to report the problem specifics. + /users: + get: + summary: Retrieve all regular user accounts or service user accounts. + description: Retrieve `User` objects. By default the list consists of regular + user accounts, only. Alternatively, service user accounts may be requested + instead. + tags: + - users + parameters: + - name: type + in: query + description: If set to `service`, list only service user accounts. If unset, + default to only listing regular user accounts. + type: string + produces: + - application/json + responses: + 200: + description: Success. + schema: + type: object + properties: + array: + type: array + items: + $ref: '#/definitions/User' + /users/{uid}: + get: + summary: Get single user object. + description: Get specific `User` object. + tags: + - users + produces: + - application/json + parameters: + - name: uid + in: path + required: true + description: The ID of the user object to retrieve. + type: string + responses: + 200: + description: Success. + schema: + $ref: '#/definitions/User' + put: + summary: Create user account. + description: Create user (uid in url, details incl. credentials in body). + tags: + - users + consumes: + - application/json + parameters: + - name: uid + in: path + required: true + description: The ID of the user account to create. + type: string + - name: User creation object + description: Password/description. + in: body + required: true + schema: + $ref: '#/definitions/UserCreate' + responses: + 201: + description: User created. + 409: + description: User already exists. + patch: + summary: Update user account. + description: Update existing user account (meta data and/or password). + tags: + - users + consumes: + - application/json + parameters: + - name: uid + in: path + required: true + description: The ID of the user account to modify. + type: string + - name: User update object + description: Password/description. + in: body + required: true + schema: + $ref: '#/definitions/UserUpdate' + responses: + 204: + description: Update applied. + 501: + description: Not implemented for service user accounts. + delete: + summary: Delete account. + description: Delete account. + tags: + - users + parameters: + - name: uid + in: path + required: true + description: The ID of the user account to delete. + type: string + responses: + 204: + description: Success. + 404: + description: User account not found. + 400: + description: Bad request. + /users/{uid}/groups: + get: + summary: Retrieve groups the user is member of. + description: Retrieve groups the user is member of. + tags: + - users + produces: + - application/json + parameters: + - name: uid + in: path + required: true + description: The ID of the user. + type: string + responses: + 200: + description: Success. + schema: + $ref: '#/definitions/UserGroups' + /users/{uid}/permissions: + get: + summary: Retrieve permissions an account has. + description: Retrieve the permissions for this account with direct permissions + distinguished from those that are obtained through group membership. + produces: + - application/json + tags: + - users + parameters: + - name: uid + in: path + required: true + description: The id of the user. + type: string + responses: + 200: + description: Success. + schema: + $ref: '#/definitions/UserPermissions' +definitions: + LoginObject: + type: object + properties: + uid: + type: string + password: + type: string + token: + type: string + AuthToken: + type: object + required: + - token + properties: + token: + type: string + additionalProperties: false + User: + type: object + required: + - uid + - url + - description + - is_remote + - provider_type + - provider_id + properties: + uid: + type: string + url: + type: string + description: + type: string + is_remote: + type: boolean + is_service: + type: boolean + public_key: + type: string + provider_type: + type: string + provider_id: + type: string + additionalProperties: false + UserCreate: + type: object + properties: + description: + type: string + password: + type: string + public_key: + type: string + provider_type: + type: string + provider_id: + type: string + cluster_url: + type: string + creator_uid: + type: string + additionalProperties: false + UserUpdate: + type: object + properties: + description: + type: string + password: + type: string + additionalProperties: false + OIDCProviderConfig: + type: object + required: + - description + - issuer + - base_url + - client_secret + - client_id + properties: + description: + type: string + issuer: + type: string + base_url: + type: string + client_secret: + type: string + client_id: + type: string + verify_server_certificate: + type: boolean + ca_certs: + type: string + additionalProperties: false + Action: + type: object + required: + - name + - url + properties: + name: + type: string + url: + type: string + additionalProperties: false + UserGroups: + type: object + properties: + array: + type: array + items: + type: object + required: + - group + - membershipurl + properties: + membershipurl: + type: string + group: + $ref: '#/definitions/Group' + additionalProperties: false + UserPermissions: + type: object + properties: + direct: + type: array + items: + type: object + required: + - rid + - description + - aclurl + - actions + properties: + rid: + type: string + description: + type: string + aclurl: + type: string + actions: + type: array + items: + $ref: '#/definitions/Action' + additionalProperties: false + groups: + type: array + items: + type: object + required: + - rid + - gid + - description + - aclurl + - membershipurl + - actions + properties: + rid: + type: string + gid: + type: string + description: + type: string + aclurl: + type: string + membershipurl: + type: string + actions: + type: array + items: + $ref: '#/definitions/Action' + additionalProperties: false + additionalProperties: false + Group: + type: object + required: + - gid + - url + - description + - provider_type + properties: + gid: + type: string + url: + type: string + description: + type: string + provider_type: + type: string + additionalProperties: false + GroupCreate: + type: object + required: + - description + properties: + description: + type: string + provider_type: + type: string + additionalProperties: false + GroupUpdate: + type: object + required: + - description + properties: + description: + type: string + additionalProperties: false + GroupUsers: + type: object + properties: + array: + type: array + items: + type: object + required: + - membershipurl + - user + properties: + membershipurl: + type: string + user: + $ref: '#/definitions/User' + additionalProperties: false + GroupPermissions: + type: object + properties: + array: + type: array + items: + type: object + required: + - rid + - description + - aclurl + - actions + properties: + rid: + type: string + description: + type: string + aclurl: + type: string + actions: + type: array + items: + $ref: '#/definitions/Action' + additionalProperties: false + ACL: + type: object + required: + - rid + - url + - description + properties: + rid: + type: string + url: + type: string + description: + type: string + additionalProperties: false + ACLCreate: + type: object + required: + - description + properties: + description: + type: string + additionalProperties: false + ACLUpdate: + type: object + required: + - description + properties: + description: + type: string + additionalProperties: false + ACLPermissions: + type: object + properties: + groups: + type: array + items: + type: object + required: + - gid + - groupurl + - actions + properties: + gid: + type: string + groupurl: + type: string + actions: + type: array + items: + $ref: '#/definitions/Action' + users: + type: array + items: + type: object + required: + - uid + - userurl + - actions + properties: + uid: + type: string + userurl: + type: string + actions: + type: array + items: + $ref: '#/definitions/Action' + additionalProperties: false + ActionAllowed: + type: object + required: + - allowed + properties: + allowed: + type: boolean + additionalProperties: false + SAMLProviderConfig: + type: object + required: + - description + - idp_metadata + - sp_base_url + properties: + description: + type: string + idp_metadata: + type: string + sp_base_url: + type: string + additionalProperties: false + SAMLACSCallbackUrlObject: + type: object + required: + - acs-callback-url + properties: + acs-callback-url: + type: string + additionalProperties: false + LDAPUserSearchConfig: + type: object + required: + - search-base + - search-filter-template + properties: + search-base: + type: string + search-filter-template: + type: string + additionalProperties: false + LDAPGroupSearchConfig: + type: object + required: + - search-base + - search-filter-template + properties: + search-base: + type: string + search-filter-template: + type: string + member-attributes: + type: array + items: + type: string + additionalProperties: false + LDAPConfiguration: + type: object + required: + - host + - port + - enforce-starttls + - use-ldaps + properties: + host: + type: string + dntemplate: + type: string + port: + type: integer + enforce-starttls: + type: boolean + use-ldaps: + type: boolean + lookup-dn: + type: string + lookup-password: + type: string + user-search: + $ref: '#/definitions/LDAPUserSearchConfig' + group-search: + $ref: '#/definitions/LDAPGroupSearchConfig' + ca-certs: + type: string + client-cert: + type: string + additionalProperties: false + LDAPImportUserObject: + type: object + required: + - username + properties: + username: + type: string + additionalProperties: false + LDAPImportGroupObject: + type: object + required: + - groupname + properties: + groupname: + type: string + additionalProperties: false + LDAPTestCredentials: + type: object + required: + - uid + - password + properties: + uid: + type: string + password: + type: string + additionalProperties: false + LDAPTestResultObject: + type: object + required: + - code + - description + properties: + code: + type: string + description: + type: string + additionalProperties: false diff --git a/swagger/secrets.yaml b/swagger/secrets.yaml new file mode 100644 index 0000000..849d360 --- /dev/null +++ b/swagger/secrets.yaml @@ -0,0 +1,141 @@ +swagger: '2.0' +basePath: /secrets/v1 +info: + version: 1.0.0 + title: ' DC/OS Secrets API' +tags: + - name: backend + description: Secret stores related API endpoints + - name: secrets + description: Secrets manipulation +securityDefinitions: + token: + type: apiKey + in: header + name: Authorization +security: + - token: [] +paths: + /secret/{store}/{path-to-secret}: + get: + tags: + - secrets + summary: Read or list a secret from the store by its path. + description: Read or list a secret from the store by its path. + parameters: + - name: store + description: The backend store from which to get the secret. + in: path + required: true + type: string + - name: list + in: query + description: | + If set to true, list only secret keys. + type: string + - name: path-to-secret + description: The path to store the secret in. + in: path + required: true + type: string + responses: + 200: + description: Response body contains secret authorized content. + schema: + $ref: '#/definitions/Secret' + 400: + description: Unsupported Accept header. + 403: + description: Forbidden. + 404: + description: Secret not found. + put: + tags: + - secrets + summary: Create a secret in the store at the path. + description: Create a secret in the store at the path. + parameters: + - in: body + name: body + description: Secret value. + required: true + schema: + $ref: '#/definitions/Secret' + - name: store + description: The backend to store the secret in. + in: path + required: true + type: string + - name: path-to-secret + description: The path to store the secret in. + in: path + required: true + type: string + responses: + 201: + description: Secret created. + 400: + description: Unsupported Content-Type header. + 403: + description: Forbidden. + 409: + description: Secret already exists. + patch: + tags: + - secrets + summary: Update secret. + description: Update existing secret in the specified store. + parameters: + - in: body + name: body + description: Secret value. + required: true + schema: + $ref: '#/definitions/Secret' + - name: store + description: The backend to store the secret in. + in: path + required: true + type: string + - name: path-to-secret + description: The path for the secret to update. + in: path + required: true + type: string + responses: + 204: + description: Secret updated. + 403: + description: Forbidden. + 404: + description: Secret not found. + delete: + tags: + - secrets + summary: Delete a secret. + description: Delete a secret. + parameters: + - name: store + description: The backend to delete the secret from. + in: path + required: true + type: string + - name: path-to-secret + description: The path to the secret to delete. + in: path + required: true + type: string + responses: + 204: + description: Success. + 403: + description: Forbidden. + 404: + description: Secret not found. +definitions: + Secret: + type: object + properties: + value: + type: string + additionalProperties: false diff --git a/swagger/templates/client/client.gotmpl b/swagger/templates/client/client.gotmpl new file mode 100644 index 0000000..92724cf --- /dev/null +++ b/swagger/templates/client/client.gotmpl @@ -0,0 +1,80 @@ +// Code generated by go-swagger; DO NOT EDIT. + + +{{ if .Copyright -}}// {{ comment .Copyright -}}{{ end }} + + +package {{ .Name }} + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "net/http" + "github.com/go-openapi/errors" + "github.com/go-openapi/swag" + "github.com/go-openapi/runtime" + "github.com/go-openapi/validate" + + strfmt "github.com/go-openapi/strfmt" + + {{ range .DefaultImports }}{{ printf "%q" .}} + {{ end }} + {{ range $key, $value := .Imports }}{{ $key }} {{ printf "%q" $value }} + {{ end }} +) + +// New creates a new {{ humanize .Name }} API client. +func New(transport runtime.ClientTransport, formats strfmt.Registry) *Client { + return &Client{transport: transport, formats: formats} +} + +/* +Client {{ if .Summary }}{{ .Summary }}{{ if .Description }} + +{{ blockcomment .Description }}{{ end }}{{ else if .Description}}{{ blockcomment .Description }}{{ else }}for {{ humanize .Name }} API{{ end }} +*/ +type Client struct { + transport runtime.ClientTransport + formats strfmt.Registry +} + +{{ range .Operations }}/* +{{ pascalize .Name }} {{ if .Summary }}{{ pluralizeFirstWord (humanize .Summary) }}{{ if .Description }} + +{{ blockcomment .Description }}{{ end }}{{ else if .Description}}{{ blockcomment .Description }}{{ else }}{{ humanize .Name }} API{{ end }} +*/ +func (a *Client) {{ pascalize .Name }}(params *{{ pascalize .Name }}Params{{ if .HasStreamingResponse }}, writer io.Writer{{ end }}) {{ if .SuccessResponse }}({{ range .SuccessResponses }}*{{ pascalize .Name }}, {{ end }}{{ end }}error{{ if .SuccessResponse }}){{ end }} { + // TODO: Validate the params before sending + if params == nil { + params = New{{ pascalize .Name }}Params() + } + {{ $length := len .SuccessResponses }} + {{ if .SuccessResponse }}result{{else}}_{{ end }}, err := a.transport.Submit(&runtime.ClientOperation{ + ID: {{ printf "%q" .Name }}, + Method: {{ printf "%q" .Method }}, + PathPattern: {{ printf "%q" .Path }}, + ProducesMediaTypes: {{ printf "%#v" .ProducesMediaTypes }}, + ConsumesMediaTypes: {{ printf "%#v" .ConsumesMediaTypes }}, + Schemes: {{ printf "%#v" .Schemes }}, + Params: params, + Reader: &{{ pascalize .Name }}Reader{formats: a.formats{{ if .HasStreamingResponse }}, writer: writer{{ end }}}, + Context: params.Context, + Client: params.HTTPClient, + }) + if err != nil { + return {{ if .SuccessResponse }}{{ padSurround "nil" "nil" 0 $length }}, {{ end }}err + } + {{ if .SuccessResponse }}{{ if eq $length 1 }}return result.(*{{ pascalize .SuccessResponse.Name }}), nil{{ else }}switch value := result.(type) { {{ range $i, $v := .SuccessResponses }} + case *{{ pascalize $v.Name }}: + return {{ padSurround "value" "nil" $i $length }}, nil{{ end }} } + return {{ padSurround "nil" "nil" 0 $length }}, nil{{ end }} + {{ else }}return nil{{ end }} + +} +{{ end }} + +// SetTransport changes the transport on the client +func (a *Client) SetTransport(transport runtime.ClientTransport) { + a.transport = transport +}