api

package
v0.1.2001 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2018 License: MIT Imports: 13 Imported by: 12

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EnvEndpointHost added in v0.1.1430

func EnvEndpointHost() (string, string)

EnvEndpointHost pulls the endpoint and host values from viper

func GraphQLServerAddress added in v0.1.1418

func GraphQLServerAddress(endpoint string, host string) (string, error)

GraphQLServerAddress returns the full address to CircleCI GraphQL API server

func OrbID added in v0.1.1813

func OrbID(ctx context.Context, logger *logger.Logger, namespace string, orb string) (string, error)

OrbID fetches an orb returning the ID

func OrbLatestVersion added in v0.1.1813

func OrbLatestVersion(ctx context.Context, logger *logger.Logger, namespace string, orb string) (string, error)

OrbLatestVersion finds the latest published version of an orb and returns it.

func OrbSource

func OrbSource(ctx context.Context, logger *logger.Logger, namespace string, orb string) (string, error)

OrbSource gets the source or an orb

Types

type ConfigResponse

type ConfigResponse struct {
	Valid      bool
	SourceYaml string
	OutputYaml string

	GQLResponseErrors
}

ConfigResponse is a structure that matches the result of the GQL query, so that we can use mapstructure to convert from nested maps to a strongly typed struct.

func ConfigQuery

func ConfigQuery(ctx context.Context, logger *logger.Logger, configPath string) (*ConfigResponse, error)

ConfigQuery calls the GQL API to validate and process config

func OrbQuery

func OrbQuery(ctx context.Context, logger *logger.Logger, configPath string) (*ConfigResponse, error)

OrbQuery validated and processes an orb.

type CreateNamespaceResponse

type CreateNamespaceResponse struct {
	Namespace struct {
		CreatedAt string
		ID        string
	}

	GQLResponseErrors
}

CreateNamespaceResponse type matches the data shape of the GQL response for creating a namespace

func CreateNamespace

func CreateNamespace(ctx context.Context, logger *logger.Logger, name string, organizationName string, organizationVcs string) (*CreateNamespaceResponse, error)

CreateNamespace creates (reserves) a namespace for an organization

type CreateOrbResponse

type CreateOrbResponse struct {
	Orb struct {
		ID string
	}

	GQLResponseErrors
}

CreateOrbResponse type matches the data shape of the GQL response for creating an orb

func CreateOrb

func CreateOrb(ctx context.Context, logger *logger.Logger, namespace string, name string) (*CreateOrbResponse, error)

CreateOrb creates (reserves) an orb within a namespace

type GQLResponseErrors

type GQLResponseErrors struct {
	Errors []struct {
		Message string
	}
}

GQLResponseErrors is a slice of errors returned by the GraphQL server. Each error message is a key-value pair with the structure "Message: string"

func (GQLResponseErrors) ToError

func (response GQLResponseErrors) ToError() error

ToError returns all GraphQL errors for a single response concatenated, or nil.

type IntrospectionResponse added in v0.1.2001

type IntrospectionResponse struct {
	Schema struct {
		MutationType struct {
			Name string
		}
		QueryType struct {
			Name string
		}
		Types []struct {
			Description string
			Fields      []struct {
				Name string
			}
			Kind string
			Name string
		}
	} `json:"__schema"`
}

IntrospectionResponse matches the result from making an introspection query

func IntrospectionQuery added in v0.1.2001

func IntrospectionQuery(ctx context.Context, logger *logger.Logger) (*IntrospectionResponse, error)

IntrospectionQuery makes a query on the API asking for bits of the schema This query isn't intended to get the entire schema, there are better tools for that.

type Orb added in v0.1.1845

type Orb struct {
	Commands  map[string]struct{}
	Jobs      map[string]struct{}
	Executors map[string]struct{}
}

Orb is a struct for containing the yaml-unmarshaled contents of an orb

func ListNamespaceOrbs added in v0.1.1845

func ListNamespaceOrbs(ctx context.Context, logger *logger.Logger, namespace string) ([]Orb, error)

ListNamespaceOrbs queries the API to find all orbs belonging to the given namespace. Prints the orbs and their jobs and commands to the supplied logger.

func (Orb) String added in v0.1.1845

func (orb Orb) String() string

type OrbPromoteResponse added in v0.1.1813

type OrbPromoteResponse struct {
	Orb struct {
		CreatedAt string
		Version   string
		Source    string
	}

	GQLResponseErrors
}

The OrbPromoteResponse type matches the data shape of the GQL response for promoting an orb.

func OrbPromote added in v0.1.1813

func OrbPromote(ctx context.Context, logger *logger.Logger, namespace string, orb string, label string, segment string) (*OrbPromoteResponse, error)

OrbPromote takes an orb and a development version and increments a semantic release with the given segment.

type OrbPublishResponse added in v0.1.1813

type OrbPublishResponse struct {
	Orb struct {
		CreatedAt string
		Version   string
	}

	GQLResponseErrors
}

The OrbPublishResponse type matches the data shape of the GQL response for publishing an orb.

func OrbIncrementVersion added in v0.1.1813

func OrbIncrementVersion(ctx context.Context, logger *logger.Logger, configPath string, namespace string, orb string, segment string) (*OrbPublishResponse, error)

OrbIncrementVersion accepts an orb and segment to increment the orb.

func OrbPublishByID added in v0.1.1813

func OrbPublishByID(ctx context.Context, logger *logger.Logger,
	configPath string, orbID string, orbVersion string) (*OrbPublishResponse, error)

OrbPublishByID publishes a new version of an orb by id

Jump to

Keyboard shortcuts

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