cloud/azure/resource/client/tags/tags_client.go
package tags
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"github.com/go-openapi/runtime"
strfmt "github.com/go-openapi/strfmt"
)
// New creates a new tags API client.
func New(transport runtime.ClientTransport, formats strfmt.Registry) *Client {
return &Client{transport: transport, formats: formats}
}
/*
Client for tags API
*/
type Client struct {
transport runtime.ClientTransport
formats strfmt.Registry
}
/*
TagsCreateOrUpdate creates a tag in the subscription
The tag name can have a maximum of 512 characters and is case insensitive. Tag names created by Azure have prefixes of microsoft, azure, or windows. You cannot create tags with one of these prefixes.
*/
func (a *Client) TagsCreateOrUpdate(params *TagsCreateOrUpdateParams, authInfo runtime.ClientAuthInfoWriter) (*TagsCreateOrUpdateOK, *TagsCreateOrUpdateCreated, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewTagsCreateOrUpdateParams()
}
result, err := a.transport.Submit(&runtime.ClientOperation{
ID: "Tags_CreateOrUpdate",
Method: "PUT",
PathPattern: "/subscriptions/{subscriptionId}/tagNames/{tagName}",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"https"},
Params: params,
Reader: &TagsCreateOrUpdateReader{formats: a.formats},
AuthInfo: authInfo,
Context: params.Context,
Client: params.HTTPClient,
})
if err != nil {
return nil, nil, err
}
switch value := result.(type) {
case *TagsCreateOrUpdateOK:
return value, nil, nil
case *TagsCreateOrUpdateCreated:
return nil, value, nil
}
return nil, nil, nil
}
/*
TagsCreateOrUpdateValue Creates a tag value. The name of the tag must already exist.
*/
func (a *Client) TagsCreateOrUpdateValue(params *TagsCreateOrUpdateValueParams, authInfo runtime.ClientAuthInfoWriter) (*TagsCreateOrUpdateValueOK, *TagsCreateOrUpdateValueCreated, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewTagsCreateOrUpdateValueParams()
}
result, err := a.transport.Submit(&runtime.ClientOperation{
ID: "Tags_CreateOrUpdateValue",
Method: "PUT",
PathPattern: "/subscriptions/{subscriptionId}/tagNames/{tagName}/tagValues/{tagValue}",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"https"},
Params: params,
Reader: &TagsCreateOrUpdateValueReader{formats: a.formats},
AuthInfo: authInfo,
Context: params.Context,
Client: params.HTTPClient,
})
if err != nil {
return nil, nil, err
}
switch value := result.(type) {
case *TagsCreateOrUpdateValueOK:
return value, nil, nil
case *TagsCreateOrUpdateValueCreated:
return nil, value, nil
}
return nil, nil, nil
}
/*
TagsDelete deletes a tag from the subscription
You must remove all values from a resource tag before you can delete it.
*/
func (a *Client) TagsDelete(params *TagsDeleteParams, authInfo runtime.ClientAuthInfoWriter) (*TagsDeleteOK, *TagsDeleteNoContent, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewTagsDeleteParams()
}
result, err := a.transport.Submit(&runtime.ClientOperation{
ID: "Tags_Delete",
Method: "DELETE",
PathPattern: "/subscriptions/{subscriptionId}/tagNames/{tagName}",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"https"},
Params: params,
Reader: &TagsDeleteReader{formats: a.formats},
AuthInfo: authInfo,
Context: params.Context,
Client: params.HTTPClient,
})
if err != nil {
return nil, nil, err
}
switch value := result.(type) {
case *TagsDeleteOK:
return value, nil, nil
case *TagsDeleteNoContent:
return nil, value, nil
}
return nil, nil, nil
}
/*
TagsDeleteValue Deletes a tag value.
*/
func (a *Client) TagsDeleteValue(params *TagsDeleteValueParams, authInfo runtime.ClientAuthInfoWriter) (*TagsDeleteValueOK, *TagsDeleteValueNoContent, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewTagsDeleteValueParams()
}
result, err := a.transport.Submit(&runtime.ClientOperation{
ID: "Tags_DeleteValue",
Method: "DELETE",
PathPattern: "/subscriptions/{subscriptionId}/tagNames/{tagName}/tagValues/{tagValue}",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"https"},
Params: params,
Reader: &TagsDeleteValueReader{formats: a.formats},
AuthInfo: authInfo,
Context: params.Context,
Client: params.HTTPClient,
})
if err != nil {
return nil, nil, err
}
switch value := result.(type) {
case *TagsDeleteValueOK:
return value, nil, nil
case *TagsDeleteValueNoContent:
return nil, value, nil
}
return nil, nil, nil
}
/*
TagsList Gets the names and values of all resource tags that are defined in a subscription.
*/
func (a *Client) TagsList(params *TagsListParams, authInfo runtime.ClientAuthInfoWriter) (*TagsListOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewTagsListParams()
}
result, err := a.transport.Submit(&runtime.ClientOperation{
ID: "Tags_List",
Method: "GET",
PathPattern: "/subscriptions/{subscriptionId}/tagNames",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"https"},
Params: params,
Reader: &TagsListReader{formats: a.formats},
AuthInfo: authInfo,
Context: params.Context,
Client: params.HTTPClient,
})
if err != nil {
return nil, err
}
return result.(*TagsListOK), nil
}
// SetTransport changes the transport on the client
func (a *Client) SetTransport(transport runtime.ClientTransport) {
a.transport = transport
}