jkawamoto/roadie

View on GitHub
cloud/azure/compute/client/availability_sets/availability_sets_create_or_update_parameters.go

Summary

Maintainability
D
2 days
Test Coverage
package availability_sets

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

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

        timeout: cr.DefaultTimeout,
    }
}

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

        timeout: timeout,
    }
}

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

        Context: ctx,
    }
}

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

    /*APIVersion
      Client Api Version.

    */
    APIVersion string
    /*Name
      The name of the availability set.

    */
    Name string
    /*Parameters
      Parameters supplied to the Create Availability Set operation.

    */
    Parameters *models.AvailabilitySet
    /*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 availability sets create or update params
func (o *AvailabilitySetsCreateOrUpdateParams) WithTimeout(timeout time.Duration) *AvailabilitySetsCreateOrUpdateParams {
    o.SetTimeout(timeout)
    return o
}

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

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

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

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

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

// WithName adds the name to the availability sets create or update params
func (o *AvailabilitySetsCreateOrUpdateParams) WithName(name string) *AvailabilitySetsCreateOrUpdateParams {
    o.SetName(name)
    return o
}

// SetName adds the name to the availability sets create or update params
func (o *AvailabilitySetsCreateOrUpdateParams) SetName(name string) {
    o.Name = name
}

// WithParameters adds the parameters to the availability sets create or update params
func (o *AvailabilitySetsCreateOrUpdateParams) WithParameters(parameters *models.AvailabilitySet) *AvailabilitySetsCreateOrUpdateParams {
    o.SetParameters(parameters)
    return o
}

// SetParameters adds the parameters to the availability sets create or update params
func (o *AvailabilitySetsCreateOrUpdateParams) SetParameters(parameters *models.AvailabilitySet) {
    o.Parameters = parameters
}

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

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

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

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

// WriteToRequest writes these params to a swagger request
func (o *AvailabilitySetsCreateOrUpdateParams) 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 name
    if err := r.SetPathParam("name", o.Name); err != nil {
        return err
    }

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

    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
}