diff --git a/go/models/create_env_vars_params_body_items.go b/go/models/create_env_vars_params_body_items.go index 05b788ba..ea22a2b0 100644 --- a/go/models/create_env_vars_params_body_items.go +++ b/go/models/create_env_vars_params_body_items.go @@ -20,7 +20,7 @@ import ( // swagger:model createEnvVarsParamsBodyItems type CreateEnvVarsParamsBodyItems struct { - // Secret values are only readable by code running on Netlify’s systems. With secrets, only the local development context values are readable from the UI, API, and CLI. By default, environment variable values are not secret. + // Secret values are only readable by code running on Netlify's systems. With secrets, only the local development context values are readable from the UI, API, and CLI. By default, environment variable values are not secret. IsSecret bool `json:"is_secret,omitempty"` // The existing or new name of the key, if you wish to rename it (case-sensitive) diff --git a/go/models/env_var.go b/go/models/env_var.go index 500aa541..969948e3 100644 --- a/go/models/env_var.go +++ b/go/models/env_var.go @@ -20,7 +20,7 @@ import ( // swagger:model envVar type EnvVar struct { - // Secret values are only readable by code running on Netlify’s systems. With secrets, only the local development context values are readable from the UI, API, and CLI. By default, environment variable values are not secret. + // Secret values are only readable by code running on Netlify's systems. With secrets, only the local development context values are readable from the UI, API, and CLI. By default, environment variable values are not secret. IsSecret bool `json:"is_secret,omitempty"` // The environment variable key, like ALGOLIA_ID (case-sensitive) diff --git a/go/models/update_env_var_params_body.go b/go/models/update_env_var_params_body.go index da4a6fc3..120ae21e 100644 --- a/go/models/update_env_var_params_body.go +++ b/go/models/update_env_var_params_body.go @@ -20,7 +20,7 @@ import ( // swagger:model updateEnvVarParamsBody type UpdateEnvVarParamsBody struct { - // Secret values are only readable by code running on Netlify’s systems. With secrets, only the local development context values are readable from the UI, API, and CLI. By default, environment variable values are not secret. + // Secret values are only readable by code running on Netlify's systems. With secrets, only the local development context values are readable from the UI, API, and CLI. By default, environment variable values are not secret. IsSecret bool `json:"is_secret,omitempty"` // The existing or new name of the key, if you wish to rename it (case-sensitive) diff --git a/go/plumbing/operations/get_all_certificates_parameters.go b/go/plumbing/operations/get_all_certificates_parameters.go new file mode 100644 index 00000000..7e0d0412 --- /dev/null +++ b/go/plumbing/operations/get_all_certificates_parameters.go @@ -0,0 +1,155 @@ +// 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" + "github.com/go-openapi/strfmt" +) + +// NewGetAllCertificatesParams creates a new GetAllCertificatesParams object +// with the default values initialized. +func NewGetAllCertificatesParams() *GetAllCertificatesParams { + var () + return &GetAllCertificatesParams{ + + timeout: cr.DefaultTimeout, + } +} + +// NewGetAllCertificatesParamsWithTimeout creates a new GetAllCertificatesParams object +// with the default values initialized, and the ability to set a timeout on a request +func NewGetAllCertificatesParamsWithTimeout(timeout time.Duration) *GetAllCertificatesParams { + var () + return &GetAllCertificatesParams{ + + timeout: timeout, + } +} + +// NewGetAllCertificatesParamsWithContext creates a new GetAllCertificatesParams object +// with the default values initialized, and the ability to set a context for a request +func NewGetAllCertificatesParamsWithContext(ctx context.Context) *GetAllCertificatesParams { + var () + return &GetAllCertificatesParams{ + + Context: ctx, + } +} + +// NewGetAllCertificatesParamsWithHTTPClient creates a new GetAllCertificatesParams object +// with the default values initialized, and the ability to set a custom HTTPClient for a request +func NewGetAllCertificatesParamsWithHTTPClient(client *http.Client) *GetAllCertificatesParams { + var () + return &GetAllCertificatesParams{ + HTTPClient: client, + } +} + +/* +GetAllCertificatesParams contains all the parameters to send to the API endpoint +for the get all certificates operation typically these are written to a http.Request +*/ +type GetAllCertificatesParams struct { + + /*Domain*/ + Domain string + /*SiteID*/ + SiteID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithTimeout adds the timeout to the get all certificates params +func (o *GetAllCertificatesParams) WithTimeout(timeout time.Duration) *GetAllCertificatesParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the get all certificates params +func (o *GetAllCertificatesParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the get all certificates params +func (o *GetAllCertificatesParams) WithContext(ctx context.Context) *GetAllCertificatesParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the get all certificates params +func (o *GetAllCertificatesParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the get all certificates params +func (o *GetAllCertificatesParams) WithHTTPClient(client *http.Client) *GetAllCertificatesParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the get all certificates params +func (o *GetAllCertificatesParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithDomain adds the domain to the get all certificates params +func (o *GetAllCertificatesParams) WithDomain(domain string) *GetAllCertificatesParams { + o.SetDomain(domain) + return o +} + +// SetDomain adds the domain to the get all certificates params +func (o *GetAllCertificatesParams) SetDomain(domain string) { + o.Domain = domain +} + +// WithSiteID adds the siteID to the get all certificates params +func (o *GetAllCertificatesParams) WithSiteID(siteID string) *GetAllCertificatesParams { + o.SetSiteID(siteID) + return o +} + +// SetSiteID adds the siteId to the get all certificates params +func (o *GetAllCertificatesParams) SetSiteID(siteID string) { + o.SiteID = siteID +} + +// WriteToRequest writes these params to a swagger request +func (o *GetAllCertificatesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // query param domain + qrDomain := o.Domain + qDomain := qrDomain + if qDomain != "" { + if err := r.SetQueryParam("domain", qDomain); err != nil { + return err + } + } + + // path param site_id + if err := r.SetPathParam("site_id", o.SiteID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/go/plumbing/operations/get_all_certificates_responses.go b/go/plumbing/operations/get_all_certificates_responses.go new file mode 100644 index 00000000..688c566c --- /dev/null +++ b/go/plumbing/operations/get_all_certificates_responses.go @@ -0,0 +1,124 @@ +// 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" + "github.com/go-openapi/strfmt" + + "github.com/netlify/open-api/v2/go/models" +) + +// GetAllCertificatesReader is a Reader for the GetAllCertificates structure. +type GetAllCertificatesReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *GetAllCertificatesReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewGetAllCertificatesOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 404: + result := NewGetAllCertificatesNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 422: + result := NewGetAllCertificatesUnprocessableEntity() + 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()) + } +} + +// NewGetAllCertificatesOK creates a GetAllCertificatesOK with default headers values +func NewGetAllCertificatesOK() *GetAllCertificatesOK { + return &GetAllCertificatesOK{} +} + +/* +GetAllCertificatesOK handles this case with default header values. + +Array of SNI Certificates +*/ +type GetAllCertificatesOK struct { + Payload []*models.SniCertificate +} + +func (o *GetAllCertificatesOK) Error() string { + return fmt.Sprintf("[GET /sites/{site_id}/ssl/certificates][%d] getAllCertificatesOK %+v", 200, o.Payload) +} + +func (o *GetAllCertificatesOK) GetPayload() []*models.SniCertificate { + return o.Payload +} + +func (o *GetAllCertificatesOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + // response payload + if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewGetAllCertificatesNotFound creates a GetAllCertificatesNotFound with default headers values +func NewGetAllCertificatesNotFound() *GetAllCertificatesNotFound { + return &GetAllCertificatesNotFound{} +} + +/* +GetAllCertificatesNotFound handles this case with default header values. + +Not Found +*/ +type GetAllCertificatesNotFound struct { +} + +func (o *GetAllCertificatesNotFound) Error() string { + return fmt.Sprintf("[GET /sites/{site_id}/ssl/certificates][%d] getAllCertificatesNotFound ", 404) +} + +func (o *GetAllCertificatesNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewGetAllCertificatesUnprocessableEntity creates a GetAllCertificatesUnprocessableEntity with default headers values +func NewGetAllCertificatesUnprocessableEntity() *GetAllCertificatesUnprocessableEntity { + return &GetAllCertificatesUnprocessableEntity{} +} + +/* +GetAllCertificatesUnprocessableEntity handles this case with default header values. + +Unprocessable Entity +*/ +type GetAllCertificatesUnprocessableEntity struct { +} + +func (o *GetAllCertificatesUnprocessableEntity) Error() string { + return fmt.Sprintf("[GET /sites/{site_id}/ssl/certificates][%d] getAllCertificatesUnprocessableEntity ", 422) +} + +func (o *GetAllCertificatesUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/go/plumbing/operations/operations_client.go b/go/plumbing/operations/operations_client.go index de9576a6..ef6f16ba 100644 --- a/go/plumbing/operations/operations_client.go +++ b/go/plumbing/operations/operations_client.go @@ -121,6 +121,8 @@ type ClientService interface { GetAccountMember(params *GetAccountMemberParams, authInfo runtime.ClientAuthInfoWriter) (*GetAccountMemberOK, error) + GetAllCertificates(params *GetAllCertificatesParams, authInfo runtime.ClientAuthInfoWriter) (*GetAllCertificatesOK, error) + GetCurrentUser(params *GetCurrentUserParams, authInfo runtime.ClientAuthInfoWriter) (*GetCurrentUserOK, error) GetDNSForSite(params *GetDNSForSiteParams, authInfo runtime.ClientAuthInfoWriter) (*GetDNSForSiteOK, error) @@ -1895,6 +1897,41 @@ func (a *Client) GetAccountMember(params *GetAccountMemberParams, authInfo runti return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) } +/* +GetAllCertificates get all certificates API +*/ +func (a *Client) GetAllCertificates(params *GetAllCertificatesParams, authInfo runtime.ClientAuthInfoWriter) (*GetAllCertificatesOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewGetAllCertificatesParams() + } + + result, err := a.transport.Submit(&runtime.ClientOperation{ + ID: "getAllCertificates", + Method: "GET", + PathPattern: "/sites/{site_id}/ssl/certificates", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"https"}, + Params: params, + Reader: &GetAllCertificatesReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + }) + if err != nil { + return nil, err + } + success, ok := result.(*GetAllCertificatesOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for getAllCertificates: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + /* GetCurrentUser get current user API */ diff --git a/swagger.yml b/swagger.yml index de4274bb..ad67e8ee 100644 --- a/swagger.yml +++ b/swagger.yml @@ -14,7 +14,7 @@ info: explore. For more detailed instructions for common uses, please visit the [online documentation](https://www.netlify.com/docs/api/). Visit our Community forum to join the conversation about - [understanding and using Netlify’s API](https://community.netlify.com/t/common-issue-understanding-and-using-netlifys-api/160). + [understanding and using Netlify's API](https://community.netlify.com/t/common-issue-understanding-and-using-netlifys-api/160). Additionally, we have two API clients for your convenience: @@ -194,6 +194,30 @@ paths: $ref: '#/definitions/sniCertificate' default: $ref: '#/responses/error' + /sites/{site_id}/ssl/certificates: + get: + operationId: getAllCertificates + tags: [sniCertificate] + parameters: + - name: site_id + type: string + in: path + required: true + - name: domain + type: string + in: query + required: true + responses: + '200': + description: Array of SNI Certificates + schema: + type: array + items: + $ref: '#/definitions/sniCertificate' + '404': + description: Not Found + '422': + description: Unprocessable Entity /accounts/{account_id}/env: get: tags: @@ -281,7 +305,7 @@ paths: is_secret: type: boolean description: >- - Secret values are only readable by code running on Netlify’s systems. + Secret values are only readable by code running on Netlify's systems. With secrets, only the local development context values are readable from the UI, API, and CLI. By default, environment variable values are not secret. - name: account_id @@ -425,7 +449,7 @@ paths: is_secret: type: boolean description: >- - Secret values are only readable by code running on Netlify’s systems. + Secret values are only readable by code running on Netlify's systems. With secrets, only the local development context values are readable from the UI, API, and CLI. By default, environment variable values are not secret. - name: site_id @@ -2992,7 +3016,7 @@ definitions: is_secret: type: boolean description: >- - Secret values are only readable by code running on Netlify’s systems. + Secret values are only readable by code running on Netlify's systems. With secrets, only the local development context values are readable from the UI, API, and CLI. By default, environment variable values are not secret. updated_at: