tags

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2019 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CategoryURL      = "/com/vmware/cis/tagging/category"
	ErrAlreadyExists = "already_exists"
)
View Source
const (
	RestPrefix = "/rest"
)
View Source
const (
	TagAssociationURL = "/com/vmware/cis/tagging/tag-association"
)
View Source
const (
	TagURL = "/com/vmware/cis/tagging/tag"
)

Variables

View Source
var Logger = logrus.New()

Functions

This section is empty.

Types

type AssociatedObject

type AssociatedObject struct {
	ID   *string `json:"id"`
	Type *string `json:"type"`
}

type Category

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

type CategoryCreate

type CategoryCreate struct {
	AssociableTypes []string `json:"associable_types"`
	Cardinality     string   `json:"cardinality"`
	Description     string   `json:"description"`
	Name            string   `json:"name"`
}

type CategoryCreateSpec

type CategoryCreateSpec struct {
	CreateSpec CategoryCreate `json:"create_spec"`
}

type CategoryUpdate

type CategoryUpdate struct {
	AssociableTypes []string `json:"associable_types"`
	Cardinality     string   `json:"cardinality"`
	Description     string   `json:"description"`
	Name            string   `json:"name"`
}

type CategoryUpdateSpec

type CategoryUpdateSpec struct {
	UpdateSpec CategoryUpdate `json:"update_spec"`
}

type RestClient

type RestClient struct {
	HTTP *http.Client
	// contains filtered or unexported fields
}

func NewClient

func NewClient(u *url.URL, insecure bool, thumbprint string) *RestClient

func NewClientWithSessionID

func NewClientWithSessionID(u *url.URL, insecure bool, thumbprint string, sessionID string) *RestClient

NewClientWithSessionID creates a new REST client with a supplied session ID to re-connect to existing sessions.

Note that the session is not checked for validity - to check for a valid session after creating the client, use the Valid method. If the session is no longer valid and the session needs to be re-saved, Login should be called again before calling SessionID to extract the new session ID. Clients created with this function function work in the exact same way as clients created with NewClient, including supporting re-login on invalid sessions on all SDK calls.

func (*RestClient) AttachTagToObject

func (c *RestClient) AttachTagToObject(ctx context.Context, tagID string, objID string, objType string) error

func (*RestClient) CreateCategory

func (c *RestClient) CreateCategory(ctx context.Context, spec *CategoryCreateSpec) (*string, error)

func (*RestClient) CreateCategoryIfNotExist

func (c *RestClient) CreateCategoryIfNotExist(ctx context.Context, name string, description string, categoryType string, multiValue bool) (*string, error)

func (*RestClient) CreateTag

func (c *RestClient) CreateTag(ctx context.Context, spec *TagCreateSpec) (*string, error)

func (*RestClient) CreateTagIfNotExist

func (c *RestClient) CreateTagIfNotExist(ctx context.Context, name string, description string, categoryID string) (*string, error)

func (*RestClient) DeleteCategory

func (c *RestClient) DeleteCategory(ctx context.Context, id string) error

func (*RestClient) DeleteTag

func (c *RestClient) DeleteTag(ctx context.Context, id string) error

func (*RestClient) DeleteTagIfNoObjectAttached

func (c *RestClient) DeleteTagIfNoObjectAttached(ctx context.Context, id string) error

func (*RestClient) DetachTagFromObject

func (c *RestClient) DetachTagFromObject(ctx context.Context, tagID string, objID string, objType string) error

func (*RestClient) GetAttachedTagsByNamePattern

func (c *RestClient) GetAttachedTagsByNamePattern(ctx context.Context, namePattern string, objID string, objType string) ([]Tag, error)

Get attached tags through tag name pattern

func (*RestClient) GetCategoriesByName

func (c *RestClient) GetCategoriesByName(ctx context.Context, name string) ([]Category, error)

func (*RestClient) GetCategory

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

func (*RestClient) GetTag

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

func (*RestClient) GetTagByNameForCategory

func (c *RestClient) GetTagByNameForCategory(ctx context.Context, name string, id string) ([]Tag, error)

Get tag through tag name and category id

func (*RestClient) ListAttachedObjects

func (c *RestClient) ListAttachedObjects(ctx context.Context, tagID string) ([]AssociatedObject, error)

func (*RestClient) ListAttachedTags

func (c *RestClient) ListAttachedTags(ctx context.Context, objID string, objType string) ([]string, error)

func (*RestClient) ListCategories

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

func (*RestClient) ListTags

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

func (*RestClient) ListTagsForCategory

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

func (*RestClient) Login

func (c *RestClient) Login(ctx context.Context) error

func (*RestClient) SessionID

func (c *RestClient) SessionID() string

SessionID returns the current session ID of the REST client. An empty string means there was no session cookie currently loaded.

func (*RestClient) UpdateCategory

func (c *RestClient) UpdateCategory(ctx context.Context, id string, spec *CategoryUpdateSpec) error

func (*RestClient) UpdateTag

func (c *RestClient) UpdateTag(ctx context.Context, id string, spec *TagUpdateSpec) error

func (*RestClient) Valid

func (c *RestClient) Valid(ctx context.Context) bool

Valid checks to see if the session cookies in a REST client are still valid. This should be used when restoring a session to determine if a new login is necessary.

type Tag

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

type TagAssociationSpec

type TagAssociationSpec struct {
	ObjectID *AssociatedObject `json:"object_id,omitempty"`
	TagID    *string           `json:"tag_id,omitempty"`
}

type TagCreate

type TagCreate struct {
	CategoryID  string `json:"category_id"`
	Description string `json:"description"`
	Name        string `json:"name"`
}

type TagCreateSpec

type TagCreateSpec struct {
	CreateSpec TagCreate `json:"create_spec"`
}

type TagUpdate

type TagUpdate struct {
	Description string `json:"description"`
	Name        string `json:"name"`
}

type TagUpdateSpec

type TagUpdateSpec struct {
	UpdateSpec TagUpdate `json:"update_spec"`
}

Jump to

Keyboard shortcuts

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