cloud/azure/compute/client/usage/usage_list_parameters.go
package usage
// 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"
)
// NewUsageListParams creates a new UsageListParams object
// with the default values initialized.
func NewUsageListParams() *UsageListParams {
var ()
return &UsageListParams{
timeout: cr.DefaultTimeout,
}
}
// NewUsageListParamsWithTimeout creates a new UsageListParams object
// with the default values initialized, and the ability to set a timeout on a request
func NewUsageListParamsWithTimeout(timeout time.Duration) *UsageListParams {
var ()
return &UsageListParams{
timeout: timeout,
}
}
// NewUsageListParamsWithContext creates a new UsageListParams object
// with the default values initialized, and the ability to set a context for a request
func NewUsageListParamsWithContext(ctx context.Context) *UsageListParams {
var ()
return &UsageListParams{
Context: ctx,
}
}
/*UsageListParams contains all the parameters to send to the API endpoint
for the usage list operation typically these are written to a http.Request
*/
type UsageListParams struct {
/*APIVersion
Client Api Version.
*/
APIVersion string
/*Location
The location for which resource usage is queried.
*/
Location 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 usage list params
func (o *UsageListParams) WithTimeout(timeout time.Duration) *UsageListParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the usage list params
func (o *UsageListParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
}
// WithContext adds the context to the usage list params
func (o *UsageListParams) WithContext(ctx context.Context) *UsageListParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the usage list params
func (o *UsageListParams) SetContext(ctx context.Context) {
o.Context = ctx
}
// WithAPIVersion adds the aPIVersion to the usage list params
func (o *UsageListParams) WithAPIVersion(aPIVersion string) *UsageListParams {
o.SetAPIVersion(aPIVersion)
return o
}
// SetAPIVersion adds the apiVersion to the usage list params
func (o *UsageListParams) SetAPIVersion(aPIVersion string) {
o.APIVersion = aPIVersion
}
// WithLocation adds the location to the usage list params
func (o *UsageListParams) WithLocation(location string) *UsageListParams {
o.SetLocation(location)
return o
}
// SetLocation adds the location to the usage list params
func (o *UsageListParams) SetLocation(location string) {
o.Location = location
}
// WithSubscriptionID adds the subscriptionID to the usage list params
func (o *UsageListParams) WithSubscriptionID(subscriptionID string) *UsageListParams {
o.SetSubscriptionID(subscriptionID)
return o
}
// SetSubscriptionID adds the subscriptionId to the usage list params
func (o *UsageListParams) SetSubscriptionID(subscriptionID string) {
o.SubscriptionID = subscriptionID
}
// WriteToRequest writes these params to a swagger request
func (o *UsageListParams) 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 location
if err := r.SetPathParam("location", o.Location); 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
}