context

package
v0.1.30549 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateEnvVarWithGQL

func CreateEnvVarWithGQL(c *graphql.Client, params CreateEnvVarWithRestParams) error

func DeleteContextWithGQL

func DeleteContextWithGQL(c *graphql.Client, contextID string) error

func DeleteEnvVarWithGQL

func DeleteEnvVarWithGQL(c *graphql.Client, params DeleteEnvVarWithRestParams) error

func IsRestAPIAvailable

func IsRestAPIAvailable(c restClient) error

Types

type Context

type Context struct {
	CreatedAt time.Time `json:"created_at"`
	ID        string    `json:"id"`
	Name      string    `json:"name"`
}

A Context is the owner of EnvironmentVariables.

func CreateContextWithGQL

func CreateContextWithGQL(c *graphql.Client, params CreateContextWithGQLParams) (Context, error)

func CreateContextWithRest

func CreateContextWithRest(client *rest.Client, params CreateContextWithRestParams) (Context, error)

Creates a new context. Binding to https://circleci.com/docs/api/v2/index.html#operation/createContext

func ListAllContextsWithRest

func ListAllContextsWithRest(client *rest.Client, params ListContextsWithRestParams) ([]Context, error)

Gets all pages of ListContexts

func ListContextsWithGQL

func ListContextsWithGQL(c *graphql.Client, params ListContextsWithGQLParams) ([]Context, error)

type ContextInterface

type ContextInterface interface {
	Contexts() ([]Context, error)
	ContextByName(name string) (Context, error)
	CreateContext(name string) error
	DeleteContext(contextID string) error
	EnvironmentVariables(contextID string) ([]EnvironmentVariable, error)
	CreateEnvironmentVariable(contextID, variable, value string) error
	DeleteEnvironmentVariable(contextID, variable string) error
}

ContextInterface is the interface to interact with contexts and environment variables.

func NewContextClient

func NewContextClient(config *settings.Config, orgID, vcsType, orgName string) ContextInterface

type CreateContextWithGQLParams

type CreateContextWithGQLParams struct {
	OwnerId     string `json:"ownerId"`
	OwnerType   string `json:"ownerType"`
	ContextName string `json:"contextName"`
}

type CreateContextWithRestParams

type CreateContextWithRestParams struct {
	Name  string `json:"name"`
	Owner struct {
		Type string `json:"type"`
		Id   string `json:"id,omitempty"`
		Slug string `json:"slug,omitempty"`
	} `json:"owner"`
}

type CreateEnvVarWithGQLParams

type CreateEnvVarWithGQLParams struct {
	ContextID string `json:"contextId"`
	Variable  string `json:"variable"`
	Value     string `json:"value"`
}

type CreateEnvVarWithRestParams

type CreateEnvVarWithRestParams struct {
	ContextID string
	Name      string
	Value     string
}

type DeleteContextWithRestResponse

type DeleteContextWithRestResponse struct {
	Message string `json:"message"`
}

func DeleteContextWithRest

func DeleteContextWithRest(client *rest.Client, contextID string) (DeleteContextWithRestResponse, error)

type DeleteEnvVarWithGQLParams

type DeleteEnvVarWithGQLParams struct {
	ContextID string `json:"contextId"`
	Variable  string `json:"variable"`
}

type DeleteEnvVarWithRestParams

type DeleteEnvVarWithRestParams struct {
	ContextID string
	Name      string
}

type DeleteEnvVarWithRestResponse

type DeleteEnvVarWithRestResponse struct {
	Message string `json:"message"`
}

type EnvironmentVariable

type EnvironmentVariable struct {
	Variable  string    `json:"variable"`
	ContextID string    `json:"context_id"`
	CreatedAt time.Time `json:"created_at"`
	UpdatedAt time.Time `json:"updated_at"`
}

An EnvironmentVariable has a Variable, a ContextID (its owner), and a CreatedAt date.

func CreateEnvVarWithRest

func CreateEnvVarWithRest(client *rest.Client, params CreateEnvVarWithRestParams) (EnvironmentVariable, error)

func ListAllEnvVarsWithRest

func ListAllEnvVarsWithRest(client *rest.Client, params ListEnvVarsWithRestParams) ([]EnvironmentVariable, error)

func ListEnvVarsWithGQL

func ListEnvVarsWithGQL(c *graphql.Client, contextID string) ([]EnvironmentVariable, error)

type ListContextsResponse

type ListContextsResponse struct {
	Items         []Context `json:"items"`
	NextPageToken string    `json:"next_page_token"`
}

func ListContextsWithRest

func ListContextsWithRest(client *rest.Client, params ListContextsWithRestParams) (ListContextsResponse, error)

List all contexts for an owner. Binding to https://circleci.com/docs/api/v2/index.html#operation/listContexts

type ListContextsWithGQLParams

type ListContextsWithGQLParams struct {
	OrgID   string
	OrgName string
	VCSType string
}

type ListContextsWithRestParams

type ListContextsWithRestParams struct {
	OwnerID   string
	OwnerSlug string
	OwnerType string
	PageToken string
}

type ListEnvVarsResponse

type ListEnvVarsResponse struct {
	Items         []EnvironmentVariable `json:"items"`
	NextPageToken string                `json:"next_page_token"`
}

func ListEnvVarsWithRest

func ListEnvVarsWithRest(client *rest.Client, params ListEnvVarsWithRestParams) (ListEnvVarsResponse, error)

type ListEnvVarsWithRestParams

type ListEnvVarsWithRestParams struct {
	ContextID string
	PageToken string
}

Jump to

Keyboard shortcuts

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