agents

package
v2.0.2 Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2024 License: Apache-2.0 Imports: 9 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExtractAgentsInto

func ExtractAgentsInto(r pagination.Page, v interface{}) error

func List

func List(c *gophercloud.ServiceClient, opts ListOptsBuilder) pagination.Pager

List returns a Pager which allows you to iterate over a collection of agents. It accepts a ListOpts struct, which allows you to filter the returned collection for greater efficiency.

Types

type Agent

type Agent struct {
	DisplayName  string                 `json:"display_name"`
	AgentID      string                 `json:"agent_id"`
	Project      string                 `json:"project"`
	Organization string                 `json:"organization"`
	Facts        map[string]interface{} `json:"facts"`
	Tags         map[string]string      `json:"tags"`
	CreatedAt    time.Time              `json:"created_at"`
	UpdatedAt    time.Time              `json:"updated_at"`
	UpdatedWith  string                 `json:"updated_with"`
	UpdatedBy    string                 `json:"updated_by"`
}

Agent represents an Arc Agent.

func ExtractAgents

func ExtractAgents(r pagination.Page) ([]Agent, error)

ExtractAgents accepts a Page struct, specifically an AgentPage struct, and extracts the elements into a slice of Agent structs. In other words, a generic collection is mapped into a relevant slice.

func (*Agent) UnmarshalJSON

func (r *Agent) UnmarshalJSON(b []byte) error

type AgentPage

type AgentPage struct {
	pagination.MarkerPageBase
}

AgentPage is the page returned by a pager when traversing over a collection of agents.

func (AgentPage) IsEmpty

func (r AgentPage) IsEmpty() (bool, error)

IsEmpty checks whether a AgentPage struct is empty.

func (AgentPage) LastMarker

func (r AgentPage) LastMarker() (string, error)

LastMarker returns the next page in a ListResult.

func (AgentPage) NextPageURL

func (r AgentPage) NextPageURL() (string, error)

NextPageURL is invoked when a paginated collection of agents has reached the end of a page and the pager seeks to traverse over a new one. In order to do this, it needs to construct the next page's URL.

type CreateTagsBuilder

type CreateTagsBuilder interface {
	ToTagsCreateMap() (map[string]string, error)
}

CreateTagsBuilder allows extensions to add additional parameters to the CreateTags request.

type DeleteResult

type DeleteResult struct {
	gophercloud.ErrResult
}

DeleteResult represents the result of a delete operation. Call its ExtractErr method to determine if the request succeeded or failed.

func Delete

func Delete(ctx context.Context, c *gophercloud.ServiceClient, id string) (r DeleteResult)

Delete accepts a unique ID and deletes the agent associated with it.

type Facts

type Facts map[string]interface{}

type FactsResult

type FactsResult struct {
	gophercloud.Result
}

FactsResult is the result of a facts request. Call its Extract method to interpret it as a map[string]string.

func GetFacts

func GetFacts(ctx context.Context, client *gophercloud.ServiceClient, agentID string) (r FactsResult)

GetFacts lists tags for a given agent.

func (FactsResult) Extract

func (r FactsResult) Extract() (map[string]interface{}, error)

Extract interprets any FactsResult as map[string]string.

type GetResult

type GetResult struct {
	gophercloud.Result
}

func Get

func Get(ctx context.Context, c *gophercloud.ServiceClient, id string) (r GetResult)

Get retrieves a specific agent based on its unique ID.

func (GetResult) Extract

func (r GetResult) Extract() (*Agent, error)

Extract is a function that accepts a result and extracts an agent resource.

func (GetResult) ExtractInto

func (r GetResult) ExtractInto(v interface{}) error

type InitHeader

type InitHeader struct {
	ContentType string `json:"Content-Type"`
}

InitHeader represents the headers returned in the response from an Init request.

type InitJSON

type InitJSON struct {
	Token        string `json:"token"`
	URL          string `json:"url"`
	EndpointURL  string `json:"endpoint_url"`
	UpdateURL    string `json:"update_url"`
	RenewCertURL string `json:"renew_cert_url"`
}

InitJSON represents the structure returned in the response from an Init request.

type InitOpts

type InitOpts struct {
	// Valid options:
	// * application/json
	// * text/x-shellscript
	// * text/x-powershellscript
	// * text/cloud-config
	Accept string `h:"Accept" required:"true"`
}

InitOpts represents the attributes used when initializing a new agent.

func (InitOpts) ToAgentInitMap

func (opts InitOpts) ToAgentInitMap() (map[string]string, error)

ToAgentInitMap formats a InitOpts into a map of headers.

type InitOptsBuilder

type InitOptsBuilder interface {
	ToAgentInitMap() (map[string]string, error)
}

InitOptsBuilder allows extensions to add additional parameters to the Init request.

type InitResult

type InitResult struct {
	gophercloud.HeaderResult
	Body []byte
}

InitResult represents the result of an init operation. Call its ExtractHeaders method to interpret it as an init agent response headers or ExtractContent method to interpret it as a response content.

func Init

func Init(ctx context.Context, c *gophercloud.ServiceClient, opts InitOptsBuilder) (r InitResult)

Init accepts an InitOpts struct and initializes a new agent using the values provided.

func (*InitResult) ExtractContent

func (r *InitResult) ExtractContent() ([]byte, error)

ExtractContent is a function that takes a InitResult's io.Reader body and reads all available data into a slice of bytes. Please be aware that due the nature of io.Reader is forward-only - meaning that it can only be read once and not rewound. You can recreate a reader from the output of this function by using bytes.NewReader(initBytes)

func (InitResult) ExtractHeaders

func (r InitResult) ExtractHeaders() (*InitHeader, error)

ExtractHeaders will return a struct of headers returned from a call to Init.

type ListOpts

type ListOpts struct {
	Page    int `q:"page"`
	PerPage int `q:"per_page"`
	// E.g. '@os = "darwin" OR (landscape = "staging" AND pool = "green")'
	// where:
	// @fact - fact
	// tag - tag
	Filter string `q:"q"`
}

ListOpts allows the filtering of paginated collections through the API. Filtering is achieved by passing in filter value. Page and PerPage are used for pagination.

func (ListOpts) ToAgentListQuery

func (opts ListOpts) ToAgentListQuery() (string, error)

ToAgentListQuery formats a ListOpts into a query string.

type ListOptsBuilder

type ListOptsBuilder interface {
	ToAgentListQuery() (string, error)
}

ListOptsBuilder allows extensions to add additional parameters to the List request.

type Tags

type Tags map[string]string

func (Tags) ToTagsCreateMap

func (opts Tags) ToTagsCreateMap() (map[string]string, error)

ToTagsCreateMap converts a Tags into a request body.

type TagsErrResult

type TagsErrResult struct {
	gophercloud.ErrResult
}

TagsDeleteResult is the response from a tags Delete operation. Call its ExtractErr to determine if the request succeeded or failed.

func CreateTags

func CreateTags(ctx context.Context, client *gophercloud.ServiceClient, agentID string, opts Tags) (r TagsErrResult)

CreateTags adds/updates tags for a given agent.

func DeleteTag

func DeleteTag(ctx context.Context, client *gophercloud.ServiceClient, agentID, key string) (r TagsErrResult)

DeleteTag deletes an individual tag from an agent.

type TagsResult

type TagsResult struct {
	gophercloud.Result
}

TagsResult is the result of a tags request. Call its Extract method to interpret it as a map[string]string.

func GetTags

func GetTags(ctx context.Context, client *gophercloud.ServiceClient, agentID string) (r TagsResult)

GetTags lists tags for a given agent.

func (TagsResult) Extract

func (r TagsResult) Extract() (map[string]string, error)

Extract interprets any TagsResult as map[string]string.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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