api

package
v0.1.4308 Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2018 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func OrbLatestVersion added in v0.1.1813

func OrbLatestVersion(opts Options, namespace string, orb string) (string, error)

OrbLatestVersion finds the latest published version of an orb and returns it. If it doesn't find a version, it will return 0.0.0 for the orb's version

func OrbSource

func OrbSource(opts Options, orbRef string) (string, error)

OrbSource gets the source of an orb

Types

type BuildConfigResponse added in v0.1.2969

type BuildConfigResponse struct {
	BuildConfig struct {
		ConfigResponse
	}
}

BuildConfigResponse wraps the GQL result of the ConfigQuery

type ConfigResponse

type ConfigResponse struct {
	Valid      bool
	SourceYaml string
	OutputYaml string

	Errors GQLErrorsCollection
}

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(opts Options, configPath string) (*ConfigResponse, error)

ConfigQuery calls the GQL API to validate and process config

func OrbQuery

func OrbQuery(opts Options, configPath string) (*ConfigResponse, error)

OrbQuery validated and processes an orb.

type CreateNamespaceResponse

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

		Errors GQLErrorsCollection
	}
}

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

func CreateNamespace

func CreateNamespace(opts Options, name string, organizationName string, organizationVcs string) (*CreateNamespaceResponse, error)

CreateNamespace creates (reserves) a namespace for an organization

type CreateOrbResponse

type CreateOrbResponse struct {
	CreateOrb struct {
		Orb    Orb
		Errors GQLErrorsCollection
	}
}

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

func CreateOrb

func CreateOrb(opts Options, namespace string, name string) (*CreateOrbResponse, error)

CreateOrb creates (reserves) an orb within a namespace

type GQLErrorsCollection added in v0.1.2969

type GQLErrorsCollection []GQLResponseError

GQLErrorsCollection is a slice of errors returned by the GraphQL server. Each error is made up of a GQLResponseError type.

func (GQLErrorsCollection) Error added in v0.1.2969

func (errs GQLErrorsCollection) Error() string

Error turns a GQLErrorsCollection into an acceptable error string that can be printed to the user.

type GQLResponseError added in v0.1.2969

type GQLResponseError struct {
	Message       string
	Value         string
	AllowedValues []string
	EnumType      string
	Type          string
}

GQLResponseError is a mapping of the data returned by the GraphQL server of key-value pairs. Typically used with the structure "Message: string", but other response errors provide additional fields.

type GetNamespaceResponse added in v0.1.2969

type GetNamespaceResponse struct {
	RegistryNamespace struct {
		ID string
	}
}

GetNamespaceResponse type wraps the GQL response for fetching a namespace

type GetOrganizationResponse added in v0.1.2969

type GetOrganizationResponse struct {
	Organization struct {
		ID string
	}
}

GetOrganizationResponse type wraps the GQL response for fetching an organization and ID.

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(opts Options) (*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 NamespaceOrbResponse added in v0.1.2969

type NamespaceOrbResponse struct {
	RegistryNamespace struct {
		Name string
		Orbs struct {
			Edges []struct {
				Cursor string
				Node   OrbWithData
			}
			TotalCount int
			PageInfo   struct {
				HasNextPage bool
			}
		}
	}
}

NamespaceOrbResponse type matches the result from GQL. So that we can use mapstructure to convert from nested maps to a strongly typed struct.

type Options added in v0.1.3807

type Options struct {
	Context context.Context
	Client  *client.Client
}

Options wraps common requirements for API functions into a single struct.

type Orb added in v0.1.1845

type Orb struct {
	ID        string
	Name      string
	Namespace string
	CreatedAt string

	Source         string
	HighestVersion string `json:"version"`

	Commands  map[string]OrbElement
	Jobs      map[string]OrbElement
	Executors map[string]OrbElement
	Versions  []OrbVersion
}

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

func OrbIncrementVersion added in v0.1.1813

func OrbIncrementVersion(opts Options, configPath string, namespace string, orb string, segment string) (*Orb, error)

OrbIncrementVersion accepts an orb and segment to increment the orb.

func OrbPromote added in v0.1.1813

func OrbPromote(opts Options, namespace string, orb string, label string, segment string) (*Orb, error)

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

func OrbPublishByID added in v0.1.1813

func OrbPublishByID(opts Options, configPath string, orbID string, orbVersion string) (*Orb, error)

OrbPublishByID publishes a new version of an orb by id

type OrbConfigResponse added in v0.1.2969

type OrbConfigResponse struct {
	OrbConfig struct {
		ConfigResponse
	}
}

OrbConfigResponse wraps the GQL result for OrbQuery.

type OrbElement added in v0.1.3541

type OrbElement RealOrbElement

OrbElement implements RealOrbElement interface and allows us to deserialize by hand.

func (*OrbElement) UnmarshalYAML added in v0.1.4180

func (orbElement *OrbElement) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML method allows OrbElement to be a string or a map. For now, don't even try to dereference the string, just return what is essentially an empty OrbElement (no description or parameters)

type OrbElementParameter added in v0.1.3541

type OrbElementParameter struct {
	Description string      `json:"-"`
	Type        string      `json:"-"`
	Default     interface{} `json:"-"`
}

OrbElementParameter represents the yaml-unmarshled contents of a parameter for a command/job/executor

type OrbIDResponse added in v0.1.2969

type OrbIDResponse struct {
	Orb struct {
		ID string
	}
	RegistryNamespace struct {
		ID string
	}
}

OrbIDResponse matches the GQL response for fetching an Orb and ID

func OrbID added in v0.1.1813

func OrbID(opts Options, namespace string, orb string) (*OrbIDResponse, error)

OrbID fetches an orb returning the ID

type OrbLatestVersionResponse added in v0.1.2969

type OrbLatestVersionResponse struct {
	Orb struct {
		Versions []OrbVersion
	}
}

OrbLatestVersionResponse wraps the GQL result of fetching an Orb and latest version

type OrbListResponse added in v0.1.2969

type OrbListResponse struct {
	Orbs struct {
		TotalCount int
		Edges      []struct {
			Cursor string
			Node   OrbWithData
		}
		PageInfo struct {
			HasNextPage bool
		}
	}
}

OrbListResponse type matches the result from GQL. So that we can use mapstructure to convert from nested maps to a strongly typed struct.

type OrbPromoteResponse added in v0.1.1813

type OrbPromoteResponse struct {
	PromoteOrb struct {
		Orb Orb

		Errors GQLErrorsCollection
	}
}

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

type OrbPublishResponse added in v0.1.1813

type OrbPublishResponse struct {
	PublishOrb struct {
		Orb Orb

		Errors GQLErrorsCollection
	}
}

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

type OrbVersion added in v0.1.2331

type OrbVersion struct {
	ID        string
	Version   string
	Orb       Orb
	Source    string
	CreatedAt string
}

OrbVersion wraps the GQL result used by OrbSource and OrbInfo

func OrbInfo added in v0.1.3807

func OrbInfo(opts Options, orbRef string) (*OrbVersion, error)

OrbInfo gets the meta-data of an orb

type OrbWithData added in v0.1.3923

type OrbWithData struct {
	Name           string `json:"name"`
	HighestVersion string `json:"version"`
	Versions       []struct {
		Version string `json:"version"`
		Source  string `json:"source"`
	} `json:"versions"`

	// These fields are printing manually when --details flag is added so hidden from JSON output.
	Commands  map[string]OrbElement `json:"-"`
	Jobs      map[string]OrbElement `json:"-"`
	Executors map[string]OrbElement `json:"-"`
}

OrbWithData wraps an orb with select fields for deserializing into JSON.

type OrbsForListing added in v0.1.3923

type OrbsForListing struct {
	Orbs      []OrbWithData `json:"orbs"`
	Namespace string        `json:"namespace,omitempty"`
}

OrbsForListing is a container type for multiple orbs that includes the namespace and orbs for deserializing back into JSON.

func ListNamespaceOrbs added in v0.1.1845

func ListNamespaceOrbs(opts Options, namespace string) (*OrbsForListing, error)

ListNamespaceOrbs queries the API to find all orbs belonging to the given namespace. Returns a collection of Orb objects containing their relevant data.

func ListOrbs added in v0.1.2113

func ListOrbs(opts Options, uncertified bool) (*OrbsForListing, error)

ListOrbs queries the API to find all orbs. Returns a collection of Orb objects containing their relevant data.

type RealOrbElement added in v0.1.4180

type RealOrbElement struct {
	Description string                         `json:"-"`
	Parameters  map[string]OrbElementParameter `json:"-"`
}

RealOrbElement represents the yaml-unmarshled contents of a named element under a command/job/executor

type WhoamiResponse added in v0.1.2295

type WhoamiResponse struct {
	Me struct {
		Name string
	}
}

WhoamiResponse type matches the data shape of the GQL response for the current user

func WhoamiQuery added in v0.1.2295

func WhoamiQuery(opts Options) (*WhoamiResponse, error)

WhoamiQuery returns the result of querying the `/me` endpoint of the API

Jump to

Keyboard shortcuts

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