jkawamoto/roadie

View on GitHub
cloud/azure/resource/client/resource_groups/resource_groups_create_or_update_parameters.go

Summary

Maintainability
D
2 days
Test Coverage
package resource_groups

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

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

        timeout: cr.DefaultTimeout,
    }
}

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

        timeout: timeout,
    }
}

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

        Context: ctx,
    }
}

// NewResourceGroupsCreateOrUpdateParamsWithHTTPClient creates a new ResourceGroupsCreateOrUpdateParams object
// with the default values initialized, and the ability to set a custom HTTPClient for a request
func NewResourceGroupsCreateOrUpdateParamsWithHTTPClient(client *http.Client) *ResourceGroupsCreateOrUpdateParams {
    var ()
    return &ResourceGroupsCreateOrUpdateParams{
        HTTPClient: client,
    }
}

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

    /*APIVersion
      The API version to use for this operation.

    */
    APIVersion string
    /*Parameters
      Parameters supplied to the create or update a resource group.

    */
    Parameters *models.ResourceGroup
    /*ResourceGroupName
      The name of the resource group to create or update.

    */
    ResourceGroupName string
    /*SubscriptionID
      The ID of the target subscription.

    */
    SubscriptionID string

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

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

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

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

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

// WithHTTPClient adds the HTTPClient to the resource groups create or update params
func (o *ResourceGroupsCreateOrUpdateParams) WithHTTPClient(client *http.Client) *ResourceGroupsCreateOrUpdateParams {
    o.SetHTTPClient(client)
    return o
}

// SetHTTPClient adds the HTTPClient to the resource groups create or update params
func (o *ResourceGroupsCreateOrUpdateParams) SetHTTPClient(client *http.Client) {
    o.HTTPClient = client
}

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

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

// WithParameters adds the parameters to the resource groups create or update params
func (o *ResourceGroupsCreateOrUpdateParams) WithParameters(parameters *models.ResourceGroup) *ResourceGroupsCreateOrUpdateParams {
    o.SetParameters(parameters)
    return o
}

// SetParameters adds the parameters to the resource groups create or update params
func (o *ResourceGroupsCreateOrUpdateParams) SetParameters(parameters *models.ResourceGroup) {
    o.Parameters = parameters
}

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

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

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

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

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

    if err := r.SetTimeout(o.timeout); err != nil {
        return err
    }
    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.Parameters == nil {
        o.Parameters = new(models.ResourceGroup)
    }

    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
}