attributestags

package
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 17, 2019 License: Apache-2.0 Imports: 1 Imported by: 26

Documentation

Overview

Package attributestags manages Tags on Resources created by the OpenStack Neutron Service.

This enables tagging via a standard interface for resources types which support it.

See https://developer.openstack.org/api-ref/network/v2/#standard-attributes-tag-extension for more information on the underlying API.

Example to ReplaceAll Resource Tags

network, err := networks.Create(conn, createOpts).Extract()

tagReplaceAllOpts := attributestags.ReplaceAllOpts{
    Tags:         []string{"abc", "123"},
}
attributestags.ReplaceAll(conn, "networks", network.ID, tagReplaceAllOpts)

Example to List all Resource Tags

tags, err = attributestags.List(conn, "networks", network.ID).Extract()

Example to Delete all Resource Tags

err = attributestags.DeleteAll(conn, "networks", network.ID).ExtractErr()

Example to Add a tag to a Resource

err = attributestags.Add(client, "networks", network.ID, "atag").ExtractErr()

Example to Delete a tag from a Resource

err = attributestags.Delete(client, "networks", network.ID, "atag").ExtractErr()

Example to confirm if a tag exists on a resource

exists, _ := attributestags.Confirm(client, "networks", network.ID, "atag").Extract()

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AddResult

type AddResult struct {
	gophercloud.ErrResult
}

AddResult is the result from an Add operation. Call its ExtractErr method to determine if the call succeeded or failed.

func Add

func Add(client *gophercloud.ServiceClient, resourceType string, resourceID string, tag string) (r AddResult)

Add a tag on a resource

type ConfirmResult

type ConfirmResult struct {
	gophercloud.Result
}

ConfirmResult is the result from an Confirm operation.

func Confirm

func Confirm(client *gophercloud.ServiceClient, resourceType string, resourceID string, tag string) (r ConfirmResult)

Confirm if a tag exists on a resource

func (ConfirmResult) Extract

func (r ConfirmResult) Extract() (bool, error)

type DeleteResult

type DeleteResult struct {
	gophercloud.ErrResult
}

DeleteResult is the result from a Delete/DeleteAll operation. Call its ExtractErr method to determine if the call succeeded or failed.

func Delete

func Delete(client *gophercloud.ServiceClient, resourceType string, resourceID string, tag string) (r DeleteResult)

Delete a tag on a resource

func DeleteAll

func DeleteAll(client *gophercloud.ServiceClient, resourceType string, resourceID string) (r DeleteResult)

DeleteAll deletes all tags on a resource

type ListResult

type ListResult struct {
	// contains filtered or unexported fields
}

func List

func List(client *gophercloud.ServiceClient, resourceType string, resourceID string) (r ListResult)

List all tags on a resource

func (ListResult) Extract

func (r ListResult) Extract() ([]string, error)

Extract interprets tagResult to return the list of tags

type ReplaceAllOpts

type ReplaceAllOpts struct {
	Tags []string `json:"tags" required:"true"`
}

ReplaceAllOpts provides options used to create Tags on a Resource

func (ReplaceAllOpts) ToAttributeTagsReplaceAllMap

func (opts ReplaceAllOpts) ToAttributeTagsReplaceAllMap() (map[string]interface{}, error)

ToAttributeTagsReplaceAllMap formats a ReplaceAllOpts into the body of the replace request

type ReplaceAllOptsBuilder

type ReplaceAllOptsBuilder interface {
	ToAttributeTagsReplaceAllMap() (map[string]interface{}, error)
}

ReplaceAllOptsBuilder allows extensions to add additional parameters to the ReplaceAll request.

type ReplaceAllResult

type ReplaceAllResult struct {
	// contains filtered or unexported fields
}

ReplaceAllResult represents the result of a replace operation. Call its Extract method to interpret it as a slice of strings.

func ReplaceAll

func ReplaceAll(client *gophercloud.ServiceClient, resourceType string, resourceID string, opts ReplaceAllOptsBuilder) (r ReplaceAllResult)

ReplaceAll updates all tags on a resource, replacing any existing tags

func (ReplaceAllResult) Extract

func (r ReplaceAllResult) Extract() ([]string, error)

Extract interprets tagResult to return the list of tags

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL