jkawamoto/roadie

View on GitHub
cloud/azure/resource/client/resource_groups/resource_groups_list_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"
    "github.com/go-openapi/swag"

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

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

        timeout: cr.DefaultTimeout,
    }
}

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

        timeout: timeout,
    }
}

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

        Context: ctx,
    }
}

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

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

    /*NrDollarFilter
      The filter to apply on the operation.

    */
    DollarFilter *string
    /*NrDollarTop
      The number of results to return. If null is passed, returns all resource groups.

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

    */
    APIVersion 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 list params
func (o *ResourceGroupsListParams) WithTimeout(timeout time.Duration) *ResourceGroupsListParams {
    o.SetTimeout(timeout)
    return o
}

// SetTimeout adds the timeout to the resource groups list params
func (o *ResourceGroupsListParams) SetTimeout(timeout time.Duration) {
    o.timeout = timeout
}

// WithContext adds the context to the resource groups list params
func (o *ResourceGroupsListParams) WithContext(ctx context.Context) *ResourceGroupsListParams {
    o.SetContext(ctx)
    return o
}

// SetContext adds the context to the resource groups list params
func (o *ResourceGroupsListParams) SetContext(ctx context.Context) {
    o.Context = ctx
}

// WithHTTPClient adds the HTTPClient to the resource groups list params
func (o *ResourceGroupsListParams) WithHTTPClient(client *http.Client) *ResourceGroupsListParams {
    o.SetHTTPClient(client)
    return o
}

// SetHTTPClient adds the HTTPClient to the resource groups list params
func (o *ResourceGroupsListParams) SetHTTPClient(client *http.Client) {
    o.HTTPClient = client
}

// WithDollarFilter adds the dollarFilter to the resource groups list params
func (o *ResourceGroupsListParams) WithDollarFilter(dollarFilter *string) *ResourceGroupsListParams {
    o.SetDollarFilter(dollarFilter)
    return o
}

// SetDollarFilter adds the dollarFilter to the resource groups list params
func (o *ResourceGroupsListParams) SetDollarFilter(dollarFilter *string) {
    o.DollarFilter = dollarFilter
}

// WithDollarTop adds the dollarTop to the resource groups list params
func (o *ResourceGroupsListParams) WithDollarTop(dollarTop *int32) *ResourceGroupsListParams {
    o.SetDollarTop(dollarTop)
    return o
}

// SetDollarTop adds the dollarTop to the resource groups list params
func (o *ResourceGroupsListParams) SetDollarTop(dollarTop *int32) {
    o.DollarTop = dollarTop
}

// WithAPIVersion adds the aPIVersion to the resource groups list params
func (o *ResourceGroupsListParams) WithAPIVersion(aPIVersion string) *ResourceGroupsListParams {
    o.SetAPIVersion(aPIVersion)
    return o
}

// SetAPIVersion adds the apiVersion to the resource groups list params
func (o *ResourceGroupsListParams) SetAPIVersion(aPIVersion string) {
    o.APIVersion = aPIVersion
}

// WithSubscriptionID adds the subscriptionID to the resource groups list params
func (o *ResourceGroupsListParams) WithSubscriptionID(subscriptionID string) *ResourceGroupsListParams {
    o.SetSubscriptionID(subscriptionID)
    return o
}

// SetSubscriptionID adds the subscriptionId to the resource groups list params
func (o *ResourceGroupsListParams) SetSubscriptionID(subscriptionID string) {
    o.SubscriptionID = subscriptionID
}

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

    if err := r.SetTimeout(o.timeout); err != nil {
        return err
    }
    var res []error

    if o.DollarFilter != nil {

        // query param $filter
        var qrNrDollarFilter string
        if o.DollarFilter != nil {
            qrNrDollarFilter = *o.DollarFilter
        }
        qNrDollarFilter := qrNrDollarFilter
        if qNrDollarFilter != "" {
            if err := r.SetQueryParam("$filter", qNrDollarFilter); err != nil {
                return err
            }
        }

    }

    if o.DollarTop != nil {

        // query param $top
        var qrNrDollarTop int32
        if o.DollarTop != nil {
            qrNrDollarTop = *o.DollarTop
        }
        qNrDollarTop := swag.FormatInt32(qrNrDollarTop)
        if qNrDollarTop != "" {
            if err := r.SetQueryParam("$top", qNrDollarTop); err != nil {
                return err
            }
        }

    }

    // query param api-version
    qrAPIVersion := o.APIVersion
    qAPIVersion := qrAPIVersion
    if qAPIVersion != "" {
        if err := r.SetQueryParam("api-version", qAPIVersion); 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
}