client

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2021 License: MIT Imports: 8 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 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) CreateContext

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

CreateContext creates a new context and returns the created context object

func (*Client) CreateOrUpdateContextEnvironmentVariable added in v0.6.0

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

CreateOrUpdateContextEnvironmentVariable creates a new context environment variable

func (*Client) CreateProjectEnvironmentVariable

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

CreateProjectEnvironmentVariable creates a new project environment variable

func (*Client) DeleteContext

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

func (*Client) DeleteContextEnvironmentVariable

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

DeleteContextEnvironmentVariable deletes a context environment variable by context ID and name

func (*Client) DeleteProjectEnvironmentVariable

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

DeleteProjectEnvironmentVariable deletes an existing project environment variable

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(org, 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, org string) (*api.Context, error)

GetContextByName gets an existing context by its name

func (*Client) HasContextEnvironmentVariable

func (c *Client) HasContextEnvironmentVariable(ctx, 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) HasProjectEnvironmentVariable

func (c *Client) HasProjectEnvironmentVariable(org, 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(ctx string) (*[]api.EnvironmentVariable, error)

ListContextEnvironmentVariables lists all environment variables for a given context

func (*Client) Organization

func (c *Client) Organization(org string) (string, error)

Organization returns the organization for a request. If an organization is provided, that is returned. Next, an organization configured in the provider is returned. If neither are set, an error is returned.

func (*Client) Slug

func (c *Client) Slug(org, 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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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