jkawamoto/roadie

View on GitHub
cloud/azure/compute/client/images/images_create_or_update_parameters.go

Summary

Maintainability
D
2 days
Test Coverage
package images

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

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

    "github.com/jkawamoto/roadie/cloud/azure/compute/models"
)

// NewImagesCreateOrUpdateParams creates a new ImagesCreateOrUpdateParams object
// with the default values initialized.
func NewImagesCreateOrUpdateParams() *ImagesCreateOrUpdateParams {
    var ()
    return &ImagesCreateOrUpdateParams{

        timeout: cr.DefaultTimeout,
    }
}

// NewImagesCreateOrUpdateParamsWithTimeout creates a new ImagesCreateOrUpdateParams object
// with the default values initialized, and the ability to set a timeout on a request
func NewImagesCreateOrUpdateParamsWithTimeout(timeout time.Duration) *ImagesCreateOrUpdateParams {
    var ()
    return &ImagesCreateOrUpdateParams{

        timeout: timeout,
    }
}

// NewImagesCreateOrUpdateParamsWithContext creates a new ImagesCreateOrUpdateParams object
// with the default values initialized, and the ability to set a context for a request
func NewImagesCreateOrUpdateParamsWithContext(ctx context.Context) *ImagesCreateOrUpdateParams {
    var ()
    return &ImagesCreateOrUpdateParams{

        Context: ctx,
    }
}

/*ImagesCreateOrUpdateParams contains all the parameters to send to the API endpoint
for the images create or update operation typically these are written to a http.Request
*/
type ImagesCreateOrUpdateParams struct {

    /*APIVersion
      Client Api Version.

    */
    APIVersion string
    /*ImageName
      The name of the image.

    */
    ImageName string
    /*Parameters
      Parameters supplied to the Create Image operation.

    */
    Parameters *models.Image
    /*ResourceGroupName
      The name of the resource group.

    */
    ResourceGroupName string
    /*SubscriptionID
      Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.

    */
    SubscriptionID string

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

// WithTimeout adds the timeout to the images create or update params
func (o *ImagesCreateOrUpdateParams) WithTimeout(timeout time.Duration) *ImagesCreateOrUpdateParams {
    o.SetTimeout(timeout)
    return o
}

// SetTimeout adds the timeout to the images create or update params
func (o *ImagesCreateOrUpdateParams) SetTimeout(timeout time.Duration) {
    o.timeout = timeout
}

// WithContext adds the context to the images create or update params
func (o *ImagesCreateOrUpdateParams) WithContext(ctx context.Context) *ImagesCreateOrUpdateParams {
    o.SetContext(ctx)
    return o
}

// SetContext adds the context to the images create or update params
func (o *ImagesCreateOrUpdateParams) SetContext(ctx context.Context) {
    o.Context = ctx
}

// WithAPIVersion adds the aPIVersion to the images create or update params
func (o *ImagesCreateOrUpdateParams) WithAPIVersion(aPIVersion string) *ImagesCreateOrUpdateParams {
    o.SetAPIVersion(aPIVersion)
    return o
}

// SetAPIVersion adds the apiVersion to the images create or update params
func (o *ImagesCreateOrUpdateParams) SetAPIVersion(aPIVersion string) {
    o.APIVersion = aPIVersion
}

// WithImageName adds the imageName to the images create or update params
func (o *ImagesCreateOrUpdateParams) WithImageName(imageName string) *ImagesCreateOrUpdateParams {
    o.SetImageName(imageName)
    return o
}

// SetImageName adds the imageName to the images create or update params
func (o *ImagesCreateOrUpdateParams) SetImageName(imageName string) {
    o.ImageName = imageName
}

// WithParameters adds the parameters to the images create or update params
func (o *ImagesCreateOrUpdateParams) WithParameters(parameters *models.Image) *ImagesCreateOrUpdateParams {
    o.SetParameters(parameters)
    return o
}

// SetParameters adds the parameters to the images create or update params
func (o *ImagesCreateOrUpdateParams) SetParameters(parameters *models.Image) {
    o.Parameters = parameters
}

// WithResourceGroupName adds the resourceGroupName to the images create or update params
func (o *ImagesCreateOrUpdateParams) WithResourceGroupName(resourceGroupName string) *ImagesCreateOrUpdateParams {
    o.SetResourceGroupName(resourceGroupName)
    return o
}

// SetResourceGroupName adds the resourceGroupName to the images create or update params
func (o *ImagesCreateOrUpdateParams) SetResourceGroupName(resourceGroupName string) {
    o.ResourceGroupName = resourceGroupName
}

// WithSubscriptionID adds the subscriptionID to the images create or update params
func (o *ImagesCreateOrUpdateParams) WithSubscriptionID(subscriptionID string) *ImagesCreateOrUpdateParams {
    o.SetSubscriptionID(subscriptionID)
    return o
}

// SetSubscriptionID adds the subscriptionId to the images create or update params
func (o *ImagesCreateOrUpdateParams) SetSubscriptionID(subscriptionID string) {
    o.SubscriptionID = subscriptionID
}

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

    r.SetTimeout(o.timeout)
    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
        }
    }

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

    if o.Parameters == nil {
        o.Parameters = new(models.Image)
    }

    if err := r.SetBodyParam(o.Parameters); err != nil {
        return err
    }

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

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

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