jkawamoto/roadie

View on GitHub
cloud/azure/batch/client/certificates/certificate_delete_parameters.go

Summary

Maintainability
F
3 days
Test Coverage
package certificates

// 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"
    "time"

    "golang.org/x/net/context"

    "github.com/go-openapi/errors"
    "github.com/go-openapi/runtime"
    cr "github.com/go-openapi/runtime/client"
    "github.com/go-openapi/swag"

    strfmt "github.com/go-openapi/strfmt"
)

// NewCertificateDeleteParams creates a new CertificateDeleteParams object
// with the default values initialized.
func NewCertificateDeleteParams() *CertificateDeleteParams {
    var (
        returnClientRequestIDDefault = bool(false)
        timeoutDefault               = int32(30)
    )
    return &CertificateDeleteParams{
        ReturnClientRequestID: &returnClientRequestIDDefault,
        Timeout:               &timeoutDefault,

        requestTimeout: cr.DefaultTimeout,
    }
}

// NewCertificateDeleteParamsWithTimeout creates a new CertificateDeleteParams object
// with the default values initialized, and the ability to set a timeout on a request
func NewCertificateDeleteParamsWithTimeout(timeout time.Duration) *CertificateDeleteParams {
    var (
        returnClientRequestIDDefault = bool(false)
        timeoutDefault               = int32(30)
    )
    return &CertificateDeleteParams{
        ReturnClientRequestID: &returnClientRequestIDDefault,
        Timeout:               &timeoutDefault,

        requestTimeout: timeout,
    }
}

// NewCertificateDeleteParamsWithContext creates a new CertificateDeleteParams object
// with the default values initialized, and the ability to set a context for a request
func NewCertificateDeleteParamsWithContext(ctx context.Context) *CertificateDeleteParams {
    var (
        returnClientRequestIdDefault = bool(false)
        timeoutDefault               = int32(30)
    )
    return &CertificateDeleteParams{
        ReturnClientRequestID: &returnClientRequestIdDefault,
        Timeout:               &timeoutDefault,

        Context: ctx,
    }
}

/*CertificateDeleteParams contains all the parameters to send to the API endpoint
for the certificate delete operation typically these are written to a http.Request
*/
type CertificateDeleteParams struct {

    /*APIVersion
      Client API Version.

    */
    APIVersion string
    /*ClientRequestID
      The caller-generated request identity, in the form of a GUID with no decoration such as curly braces, e.g. 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0.

    */
    ClientRequestID *string
    /*OcpDate
      The time the request was issued. If not specified, this header will be automatically populated with the current system clock time.

    */
    OcpDate *string
    /*ReturnClientRequestID
      Whether the server should return the client-request-id in the response.

    */
    ReturnClientRequestID *bool
    /*Thumbprint
      The thumbprint of the certificate to be deleted.

    */
    Thumbprint string
    /*ThumbprintAlgorithm
      The algorithm used to derive the thumbprint parameter. This must be sha1.

    */
    ThumbprintAlgorithm string
    /*Timeout
      The maximum time that the server can spend processing the request, in seconds. The default is 30 seconds.

    */
    Timeout *int32

    requestTimeout time.Duration
    Context        context.Context
    HTTPClient     *http.Client
}

// WithRequestTimeout adds the timeout to the certificate delete params
func (o *CertificateDeleteParams) WithRequestTimeout(timeout time.Duration) *CertificateDeleteParams {
    o.SetRequestTimeout(timeout)
    return o
}

// SetRequestTimeout adds the timeout to the certificate delete params
func (o *CertificateDeleteParams) SetRequestTimeout(timeout time.Duration) {
    o.requestTimeout = timeout
}

// WithContext adds the context to the certificate delete params
func (o *CertificateDeleteParams) WithContext(ctx context.Context) *CertificateDeleteParams {
    o.SetContext(ctx)
    return o
}

// SetContext adds the context to the certificate delete params
func (o *CertificateDeleteParams) SetContext(ctx context.Context) {
    o.Context = ctx
}

// WithAPIVersion adds the aPIVersion to the certificate delete params
func (o *CertificateDeleteParams) WithAPIVersion(aPIVersion string) *CertificateDeleteParams {
    o.SetAPIVersion(aPIVersion)
    return o
}

// SetAPIVersion adds the apiVersion to the certificate delete params
func (o *CertificateDeleteParams) SetAPIVersion(aPIVersion string) {
    o.APIVersion = aPIVersion
}

// WithClientRequestID adds the clientRequestID to the certificate delete params
func (o *CertificateDeleteParams) WithClientRequestID(clientRequestID *string) *CertificateDeleteParams {
    o.SetClientRequestID(clientRequestID)
    return o
}

// SetClientRequestID adds the clientRequestId to the certificate delete params
func (o *CertificateDeleteParams) SetClientRequestID(clientRequestID *string) {
    o.ClientRequestID = clientRequestID
}

// WithOcpDate adds the ocpDate to the certificate delete params
func (o *CertificateDeleteParams) WithOcpDate(ocpDate *string) *CertificateDeleteParams {
    o.SetOcpDate(ocpDate)
    return o
}

// SetOcpDate adds the ocpDate to the certificate delete params
func (o *CertificateDeleteParams) SetOcpDate(ocpDate *string) {
    o.OcpDate = ocpDate
}

// WithReturnClientRequestID adds the returnClientRequestID to the certificate delete params
func (o *CertificateDeleteParams) WithReturnClientRequestID(returnClientRequestID *bool) *CertificateDeleteParams {
    o.SetReturnClientRequestID(returnClientRequestID)
    return o
}

// SetReturnClientRequestID adds the returnClientRequestId to the certificate delete params
func (o *CertificateDeleteParams) SetReturnClientRequestID(returnClientRequestID *bool) {
    o.ReturnClientRequestID = returnClientRequestID
}

// WithThumbprint adds the thumbprint to the certificate delete params
func (o *CertificateDeleteParams) WithThumbprint(thumbprint string) *CertificateDeleteParams {
    o.SetThumbprint(thumbprint)
    return o
}

// SetThumbprint adds the thumbprint to the certificate delete params
func (o *CertificateDeleteParams) SetThumbprint(thumbprint string) {
    o.Thumbprint = thumbprint
}

// WithThumbprintAlgorithm adds the thumbprintAlgorithm to the certificate delete params
func (o *CertificateDeleteParams) WithThumbprintAlgorithm(thumbprintAlgorithm string) *CertificateDeleteParams {
    o.SetThumbprintAlgorithm(thumbprintAlgorithm)
    return o
}

// SetThumbprintAlgorithm adds the thumbprintAlgorithm to the certificate delete params
func (o *CertificateDeleteParams) SetThumbprintAlgorithm(thumbprintAlgorithm string) {
    o.ThumbprintAlgorithm = thumbprintAlgorithm
}

// WithTimeout adds the timeout to the certificate delete params
func (o *CertificateDeleteParams) WithTimeout(timeout *int32) *CertificateDeleteParams {
    o.SetTimeout(timeout)
    return o
}

// SetTimeout adds the timeout to the certificate delete params
func (o *CertificateDeleteParams) SetTimeout(timeout *int32) {
    o.Timeout = timeout
}

// WriteToRequest writes these params to a swagger request
func (o *CertificateDeleteParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {

    r.SetTimeout(o.requestTimeout)
    var res []error

    // query param api-version
    qrAPIVersion := o.APIVersion
    qAPIVersion := qrAPIVersion
    if qAPIVersion != "" {
        if err := r.SetQueryParam("api-version", qAPIVersion); err != nil {
            return err
        }
    }

    if o.ClientRequestID != nil {

        // header param client-request-id
        if err := r.SetHeaderParam("client-request-id", *o.ClientRequestID); err != nil {
            return err
        }

    }

    if o.OcpDate != nil {

        // header param ocp-date
        if err := r.SetHeaderParam("ocp-date", *o.OcpDate); err != nil {
            return err
        }

    }

    if o.ReturnClientRequestID != nil {

        // header param return-client-request-id
        if err := r.SetHeaderParam("return-client-request-id", swag.FormatBool(*o.ReturnClientRequestID)); err != nil {
            return err
        }

    }

    // path param thumbprint
    if err := r.SetPathParam("thumbprint", o.Thumbprint); err != nil {
        return err
    }

    // path param thumbprintAlgorithm
    if err := r.SetPathParam("thumbprintAlgorithm", o.ThumbprintAlgorithm); err != nil {
        return err
    }

    if o.Timeout != nil {

        // query param timeout
        var qrTimeout int32
        if o.Timeout != nil {
            qrTimeout = *o.Timeout
        }
        qTimeout := swag.FormatInt32(qrTimeout)
        if qTimeout != "" {
            if err := r.SetQueryParam("timeout", qTimeout); err != nil {
                return err
            }
        }

    }

    if len(res) > 0 {
        return errors.CompositeValidationError(res...)
    }
    return nil
}