tags

package
v0.19.0 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2018 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Category

type Category struct {
	ID              string   `json:"id,omitempty"`
	Name            string   `json:"name,omitempty"`
	Description     string   `json:"description,omitempty"`
	Cardinality     string   `json:"cardinality,omitempty"`
	AssociableTypes []string `json:"associable_types,omitempty"`
	UsedBy          []string `json:"used_by,omitempty"`
}

Category provides methods to create, read, update, delete, and enumerate categories.

func (*Category) Patch

func (c *Category) Patch(src *Category)

Patch merges Category changes from the given src. AssociableTypes can only be appended to and cannot shrink.

type Manager

type Manager struct {
	*rest.Client
}

Manager extends rest.Client, adding tag related methods.

func NewManager

func NewManager(client *rest.Client) *Manager

NewManager creates a new Manager instance with the given client.

func (*Manager) AttachTag

func (c *Manager) AttachTag(ctx context.Context, tagID string, ref mo.Reference) error

AttachTag attaches a tag ID to a managed object.

func (*Manager) CreateCategory

func (c *Manager) CreateCategory(ctx context.Context, category *Category) (string, error)

CreateCategory creates a new category and returns the category ID.

func (*Manager) CreateTag

func (c *Manager) CreateTag(ctx context.Context, tag *Tag) (string, error)

CreateTag creates a new tag with the given Name, Description and CategoryID.

func (*Manager) DeleteCategory

func (c *Manager) DeleteCategory(ctx context.Context, category *Category) error

DeleteCategory deletes an existing category.

func (*Manager) DeleteTag

func (c *Manager) DeleteTag(ctx context.Context, tag *Tag) error

DeleteTag deletes an existing tag.

func (*Manager) DetachTag

func (c *Manager) DetachTag(ctx context.Context, tagID string, ref mo.Reference) error

DetachTag detaches a tag ID from a managed object. If the tag is already removed from the object, then this operation is a no-op and an error will not be thrown.

func (*Manager) GetAttachedTags

func (c *Manager) GetAttachedTags(ctx context.Context, ref mo.Reference) ([]Tag, error)

GetAttachedTags fetches the array of tags attached to the given object.

func (*Manager) GetCategories

func (c *Manager) GetCategories(ctx context.Context) ([]Category, error)

GetCategories fetches an array of category information in the system.

func (*Manager) GetCategory

func (c *Manager) GetCategory(ctx context.Context, id string) (*Category, error)

GetCategory fetches the category information for the given identifier. The id parameter can be a Category ID or Category Name.

func (*Manager) GetTag

func (c *Manager) GetTag(ctx context.Context, id string) (*Tag, error)

GetTag fetches the tag information for the given identifier. The id parameter can be a Tag ID or Tag Name.

func (*Manager) GetTags

func (c *Manager) GetTags(ctx context.Context) ([]Tag, error)

GetTags fetches an array of tag information in the system.

func (*Manager) GetTagsForCategory

func (c *Manager) GetTagsForCategory(ctx context.Context, id string) ([]Tag, error)

The id parameter can be a Category ID or Category Name.

func (*Manager) ListAttachedObjects

func (c *Manager) ListAttachedObjects(ctx context.Context, tagID string) ([]mo.Reference, error)

ListAttachedObjects fetches the array of attached objects for the given tag ID.

func (*Manager) ListAttachedTags

func (c *Manager) ListAttachedTags(ctx context.Context, ref mo.Reference) ([]string, error)

ListAttachedTags fetches the array of tag IDs attached to the given object.

func (*Manager) ListCategories

func (c *Manager) ListCategories(ctx context.Context) ([]string, error)

ListCategories returns all category IDs in the system.

func (*Manager) ListTags

func (c *Manager) ListTags(ctx context.Context) ([]string, error)

ListTags returns all tag IDs in the system.

func (*Manager) ListTagsForCategory

func (c *Manager) ListTagsForCategory(ctx context.Context, id string) ([]string, error)

The id parameter can be a Category ID or Category Name.

func (*Manager) UpdateCategory

func (c *Manager) UpdateCategory(ctx context.Context, category *Category) error

UpdateCategory can update one or more of the AssociableTypes, Cardinality, Description and Name fields.

func (*Manager) UpdateTag

func (c *Manager) UpdateTag(ctx context.Context, tag *Tag) error

UpdateTag can update one or both of the tag Description and Name fields.

type Tag

type Tag struct {
	ID          string   `json:"id,omitempty"`
	Description string   `json:"description,omitempty"`
	Name        string   `json:"name,omitempty"`
	CategoryID  string   `json:"category_id,omitempty"`
	UsedBy      []string `json:"used_by,omitempty"`
}

Tag provides methods to create, read, update, delete, and enumerate tags.

func (*Tag) Patch

func (t *Tag) Patch(src *Tag)

Patch merges updates from the given src.

Jump to

Keyboard shortcuts

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