client

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2022 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrContextNotFound = errors.New("context not found")

Functions

This section is empty.

Types

type CheckoutKey

type CheckoutKey struct {
	PublicKey   string `json:"public_key"`
	Type        string `json:"type"`
	Fingerprint string `json:"fingerprint"`
	Preferred   bool   `json:"preferred"`
	CreatedAt   string `json:"created_at"`
}

type Client

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

Client provides access to the CircleCI REST API It uses upstream client functionality where possible and defines its own methods as needed

func New

func New(config Config) (*Client, error)

New initializes a client object for the provider

func (*Client) ComposeElementId

func (c *Client) ComposeElementId(identifiers []string) (string, error)

func (*Client) CreateCheckoutKey

func (c *Client) CreateCheckoutKey(project, keyType string) (*CheckoutKey, error)

CreateCheckoutKey creates a new checkout key and returns the created object

func (*Client) CreateContext

func (c *Client) CreateContext(name string) (*api.Context, error)

CreateContext creates a new context and returns the created context object

func (*Client) CreateOrUpdateContextEnvironmentVariable

func (c *Client) CreateOrUpdateContextEnvironmentVariable(context_name, variable, value string) error

CreateOrUpdateContextEnvironmentVariable creates a new context environment variable

func (*Client) CreateProjectEnvironmentVariable

func (c *Client) CreateProjectEnvironmentVariable(project, name, value string) error

CreateProjectEnvironmentVariable creates a new project environment variable

func (*Client) DecomposeElementId

func (c *Client) DecomposeElementId(id string, identifiers []string) (map[string]string, error)

func (*Client) DeleteCheckoutKey

func (c *Client) DeleteCheckoutKey(project, fingerprint string) error

DeleteCheckoutKey deletes an existing checkout key and returns the created object

func (*Client) DeleteContext

func (c *Client) DeleteContext(id string) error

func (*Client) DeleteContextEnvironmentVariable

func (c *Client) DeleteContextEnvironmentVariable(context_name, variable string) error

DeleteContextEnvironmentVariable deletes a context environment variable by context ID and name

func (*Client) DeleteProjectEnvironmentVariable

func (c *Client) DeleteProjectEnvironmentVariable(project, name string) error

DeleteProjectEnvironmentVariable deletes an existing project environment variable

func (*Client) GetCheckoutKey

func (c *Client) GetCheckoutKey(project, fingerprint string) (*CheckoutKey, error)

GetCheckoutKey gets an existing project's checkout key by its fingerprint

func (*Client) GetContext

func (c *Client) GetContext(id string) (*api.Context, error)

GetContext gets an existing context by its ID (UUID)

func (*Client) GetContextByIDOrName

func (c *Client) GetContextByIDOrName(id string) (*api.Context, error)

GetContextByIDOrName gets a context by ID if a UUID is specified, and by name otherwise

func (*Client) GetContextByName

func (c *Client) GetContextByName(name string) (*api.Context, error)

GetContextByName gets an existing context by its name

func (*Client) GetProject

func (c *Client) GetProject(project string) (*Project, error)

GetProject gets an existing project by its project slug (vcs-slug/org-name/repo-name)

func (*Client) HasContextEnvironmentVariable

func (c *Client) HasContextEnvironmentVariable(context_name, variable string) (bool, error)

HasContextEnvironmentVariable lists all environment variables for a given context and checks whether the specified variable is defined. If either the context or the variable does not exist, it returns false.

func (*Client) HasProjectCheckoutKey

func (c *Client) HasProjectCheckoutKey(project, fingerprint string) (bool, error)

HasProjectCheckoutKey checks if an existing project contains checkout key by its fingerprint

func (*Client) HasProjectEnvironmentVariable

func (c *Client) HasProjectEnvironmentVariable(project, name string) (bool, error)

HasProjectEnvironmentVariable checks for the existence of a matching project environment variable by name

func (*Client) ListContextEnvironmentVariables

func (c *Client) ListContextEnvironmentVariables(context_name string) (*[]api.EnvironmentVariable, error)

ListContextEnvironmentVariables lists all environment variables for a given context

func (*Client) Organization

func (c *Client) Organization() string

Organization returns the organization for a request. The organization configured in the provider is returned.

func (*Client) Slug

func (c *Client) Slug(project string) (string, error)

Slug returns a project slug, including the VCS, organization, and project names

type Config

type Config struct {
	URL   string
	Token string

	VCS          string
	Organization string
}

Config configures a Client

type Project

type Project struct {
	Slug             string  `json:"slug"`
	Name             string  `json:"name"`
	ID               string  `json:"id"`
	OrganizationName string  `json:"organization_name"`
	OrganizationSlug string  `json:"organization_slug"`
	OrganizationID   string  `json:"organization_id"`
	VCSInfo          VCSInfo `json:"vcs_info"`
}

type VCSInfo

type VCSInfo struct {
	URL           string `json:"vcs_url"`
	Provider      string `json:"provider"`
	DefaultBranch string `json:"default_branch"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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