opslevel

package module
v0.4.4 Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2022 License: MIT Imports: 15 Imported by: 3

README

opslevel-go

Package opslevel provides an OpsLevel API client implementation.

NOTE: this library is still a WIP and does not match the API 100% yet

Installation

opslevel requires Go version 1.8 or later.

go get -u github.com/opslevel/opslevel-go

Usage

Construct a client, specifying the API token. Then, you can use it to make GraphQL queries and mutations.

client := opslevel.NewClient("XXX_API_TOKEN_XXX")
// Use client...

You can validate the client can successfully talk to the OpsLevel API.

client := opslevel.NewClient("XXX_API_TOKEN_XXX")
if err := client.Validate() {
	panic(err)
}

Every resource (IE: service, lifecycle, tier, etc) in OpsLevel API has a corresponding data structure in go as well as the graphql query & mutation inputs. Additionally there is also some helper functions that use native go types like string and []string to make it easier to work with. The following are a handful of examples:

Find a service given an alias and print the owning team name:

foundService, foundServiceErr := client.GetServiceWithAlias("MyCoolService")
if foundServiceErr != nil {

	panic(foundServiceErr)
}
fmt.Println(foundService.Owner.Name)

Create a new service in OpsLevel and print the ID:

serviceCreateInput := opslevel.ServiceCreateInput{
	Name:        "MyCoolService",
	Product:     "MyProduct",
	Description: "The Coolest Service",
	Language:    "go",
}
newService, newServiceErr := client.CreateService(serviceCreateInput)
if newServiceErr != nil {
	panic(newServiceErr)
}
fmt.Println(newService.Id)

Assign the tag {"hello": "world"} to our newly created service and print all the tags currently on it:

allTagsOnThisService, err := client.AssignTagForId(newService.Id, "Hello", "World")
for tagKey, tagValue := range allTagsOnThisService {
	fmt.Printf("Tag '{%s : %s}'", tagKey, tagValue)
}

List all the tags for a service:

tags, tagsErr := client.GetTagsForServiceWithAlias("MyCoolService")
for _, tag := range tags {
	fmt.Printf("Tag '{%s : %s}'\n", tag.Key, tag.Value)
}
// OR
service, serviceErr := client.GetServiceWithAlias("MyCoolService")
tags, tagsErr := client.GetTagsForService(service.Id)
for _, tag := range tags {
	fmt.Printf("Tag '{%s : %s}'\n", tag.Key, tag.Value)
}

Build a lookup table of teams:

func GetTeams(client *opslevel.Client) (map[string]opslevel.Team, error) {
	teams := make(map[string]opslevel.Team)
	data, dataErr := client.ListTeams()
	if dataErr != nil {
		return teams, dataErr
	}
	for _, team := range data {
		teams[string(team.Alias)] = team
	}
	return teams, nil
}

Advanced Usage

The client also exposes functions Query and Mutate for doing custom query or mutations. We are running ontop of this go graphql library so you can read up on how to define go structures that represent a query or mutation there but examples of each can be found here.

Documentation

Overview

Package opslevel provides an OpsLevel API client implementation.

see README for more details.

Index

Constants

This section is empty.

Variables

View Source
var Cache = &Cacher{
	mutex:        sync.Mutex{},
	Tiers:        make(map[string]Tier),
	Lifecycles:   make(map[string]Lifecycle),
	Teams:        make(map[string]Team),
	Categories:   make(map[string]Category),
	Levels:       make(map[string]Level),
	Filters:      make(map[string]Filter),
	Integrations: make(map[string]Integration),
	Repositories: make(map[string]Repository),
}
View Source
var TagKeyErrorMsg = "must start with a letter and only lowercase alphanumerics, underscores, hyphens, periods, and slashes are allowed."
View Source
var TagKeyRegex = regexp.MustCompile("\\A[a-z][0-9a-z_\\.\\/\\\\-]*\\z")

Functions

func AllAliasOwnerTypeEnum added in v0.4.1

func AllAliasOwnerTypeEnum() []string

All AliasOwnerTypeEnum as []string

func AllCheckStatus added in v0.4.0

func AllCheckStatus() []string

All CheckStatus as []string

func AllCheckType added in v0.4.0

func AllCheckType() []string

All CheckType as []string

func AllConnectiveEnum added in v0.4.0

func AllConnectiveEnum() []string

All ConnectiveEnum as []string

func AllContactType added in v0.4.0

func AllContactType() []string

All ContactType as []string

func AllFrequencyTimeScale added in v0.4.0

func AllFrequencyTimeScale() []string

All FrequencyTimeScale as []string

func AllPredicateKeyEnum added in v0.4.0

func AllPredicateKeyEnum() []string

All PredicateKeyEnum as []string

func AllPredicateTypeEnum added in v0.4.0

func AllPredicateTypeEnum() []string

All PredicateTypeEnum as []string

func AllServicePropertyTypeEnum added in v0.4.0

func AllServicePropertyTypeEnum() []string

All ServicePropertyTypeEnum as []string

func AllTaggableResource added in v0.4.0

func AllTaggableResource() []string

All TaggableResource as []string

func AllToolCategory added in v0.4.0

func AllToolCategory() []string

All ToolCategory as []string

func AllUserRole added in v0.4.0

func AllUserRole() []string

All UserRole as []string

func Bool added in v0.3.0

func Bool(v bool) *bool

Bool is a helper routine that allocates a new bool value to store v and returns a pointer to it.

func FormatErrors

func FormatErrors(errs []OpsLevelErrors) error

func NewID added in v0.3.0

func NewID(id string) *graphql.ID

func NewISO8601Date added in v0.3.0

func NewISO8601Date(datetime string) iso8601.Time

func NewInt added in v0.3.0

func NewInt(i int) *int

Types

type AliasCreateInput

type AliasCreateInput struct {
	Alias   string     `json:"alias"`
	OwnerId graphql.ID `json:"ownerId"`
}

type AliasDeleteInput added in v0.4.1

type AliasDeleteInput struct {
	Alias     string             `json:"alias"`
	OwnerType AliasOwnerTypeEnum `json:"ownerType"`
}

type AliasOwnerTypeEnum added in v0.4.1

type AliasOwnerTypeEnum string

AliasOwnerTypeEnum represents the owner type an alias is assigned to.

const (
	AliasOwnerTypeEnumService AliasOwnerTypeEnum = "service" // Aliases that are assigned to services.
	AliasOwnerTypeEnumTeam    AliasOwnerTypeEnum = "team"    // Aliases that are assigned to teams.
)

type Cacher added in v0.4.2

type Cacher struct {
	Tiers        map[string]Tier
	Lifecycles   map[string]Lifecycle
	Teams        map[string]Team
	Categories   map[string]Category
	Levels       map[string]Level
	Filters      map[string]Filter
	Integrations map[string]Integration
	Repositories map[string]Repository
	// contains filtered or unexported fields
}

func (*Cacher) CacheAll added in v0.4.2

func (c *Cacher) CacheAll(client *Client)

func (*Cacher) CacheCategories added in v0.4.2

func (c *Cacher) CacheCategories(client *Client)

func (*Cacher) CacheFilters added in v0.4.2

func (c *Cacher) CacheFilters(client *Client)

func (*Cacher) CacheIntegrations added in v0.4.2

func (c *Cacher) CacheIntegrations(client *Client)

func (*Cacher) CacheLevels added in v0.4.2

func (c *Cacher) CacheLevels(client *Client)

func (*Cacher) CacheLifecycles added in v0.4.2

func (c *Cacher) CacheLifecycles(client *Client)

func (*Cacher) CacheRepositories added in v0.4.2

func (c *Cacher) CacheRepositories(client *Client)

func (*Cacher) CacheTeams added in v0.4.2

func (c *Cacher) CacheTeams(client *Client)

func (*Cacher) CacheTiers added in v0.4.2

func (c *Cacher) CacheTiers(client *Client)

func (*Cacher) TryGetCategory added in v0.4.2

func (c *Cacher) TryGetCategory(alias string) (*Category, bool)

func (*Cacher) TryGetFilter added in v0.4.2

func (c *Cacher) TryGetFilter(alias string) (*Filter, bool)

func (*Cacher) TryGetIntegration added in v0.4.2

func (c *Cacher) TryGetIntegration(alias string) (*Integration, bool)

func (*Cacher) TryGetLevel added in v0.4.2

func (c *Cacher) TryGetLevel(alias string) (*Level, bool)

func (*Cacher) TryGetLifecycle added in v0.4.2

func (c *Cacher) TryGetLifecycle(alias string) (*Lifecycle, bool)

func (*Cacher) TryGetRepository added in v0.4.2

func (c *Cacher) TryGetRepository(alias string) (*Repository, bool)

func (*Cacher) TryGetTeam added in v0.4.2

func (c *Cacher) TryGetTeam(alias string) (*Team, bool)

func (*Cacher) TryGetTier added in v0.4.2

func (c *Cacher) TryGetTier(alias string) (*Tier, bool)

type Category added in v0.2.2

type Category struct {
	Id   graphql.ID `json:"id"`
	Name string
}

func (*Category) Alias added in v0.4.2

func (self *Category) Alias() string

type CategoryConnection added in v0.2.2

type CategoryConnection struct {
	Nodes      []Category
	PageInfo   PageInfo
	TotalCount graphql.Int
}

func (*CategoryConnection) Hydrate added in v0.2.2

func (conn *CategoryConnection) Hydrate(client *Client) error

type CategoryCreateInput added in v0.2.2

type CategoryCreateInput struct {
	Name string `json:"name"`
}

type CategoryDeleteInput added in v0.2.2

type CategoryDeleteInput struct {
	Id graphql.ID `json:"id"`
}

type CategoryUpdateInput added in v0.2.2

type CategoryUpdateInput struct {
	Id   graphql.ID `json:"id"`
	Name string     `json:"name"`
}

type Check added in v0.3.0

type Check struct {
	Category    Category   `graphql:"category"`
	Description string     `graphql:"description"`
	Enabled     bool       `graphql:"enabled"`
	Filter      Filter     `graphql:"filter"`
	Id          graphql.ID `graphql:"id"`
	Level       Level      `graphql:"level"`
	Name        string     `graphql:"name"`
	Notes       string     `graphql:"notes"`
	Owner       CheckOwner `graphql:"owner"`
	Type        CheckType  `graphql:"type"`

	CustomEventCheckFragment      `graphql:"... on CustomEventCheck"`
	ManualCheckFragment           `graphql:"... on ManualCheck"`
	RepositoryFileCheckFragment   `graphql:"... on RepositoryFileCheck"`
	RepositorySearchCheckFragment `graphql:"... on RepositorySearchCheck"`
	ServicePropertyCheckFragment  `graphql:"... on ServicePropertyCheck"`
	TagDefinedCheckFragment       `graphql:"... on TagDefinedCheck"`
	ToolUsageCheckFragment        `graphql:"... on ToolUsageCheck"`
}

type CheckConnection added in v0.3.0

type CheckConnection struct {
	Nodes      []Check
	PageInfo   PageInfo
	TotalCount graphql.Int
}

func (*CheckConnection) Hydrate added in v0.3.0

func (conn *CheckConnection) Hydrate(client *Client) error

type CheckCreateInput added in v0.3.0

type CheckCreateInput struct {
	Name     string      `json:"name"`
	Enabled  bool        `json:"enabled"`
	Category graphql.ID  `json:"categoryId"`
	Level    graphql.ID  `json:"levelId"`
	Owner    *graphql.ID `json:"ownerId,omitempty"`
	Filter   *graphql.ID `json:"filterId,omitempty"`
	Notes    string      `json:"notes,omitempty"`
}

func (*CheckCreateInput) GetCheckCreateInput added in v0.3.0

func (c *CheckCreateInput) GetCheckCreateInput() *CheckCreateInput

type CheckCreateInputProvider added in v0.3.0

type CheckCreateInputProvider interface {
	GetCheckCreateInput() *CheckCreateInput
}

type CheckCustomEventCreateInput added in v0.3.0

type CheckCustomEventCreateInput struct {
	CheckCreateInput

	Integration      graphql.ID `json:"integrationId"`
	ServiceSelector  string     `json:"serviceSelector"`
	SuccessCondition string     `json:"successCondition"`
	Message          string     `json:"resultMessage,omitempty"`
}

type CheckCustomEventUpdateInput added in v0.3.0

type CheckCustomEventUpdateInput struct {
	CheckUpdateInput

	ServiceSelector  string      `json:"serviceSelector,omitempty"`
	SuccessCondition string      `json:"successCondition,omitempty"`
	Message          string      `json:"resultMessage,omitempty"`
	Integration      *graphql.ID `json:"integrationId,omitempty"`
}

type CheckDeleteInput added in v0.3.0

type CheckDeleteInput struct {
	Id graphql.ID `json:"id"`
}

type CheckManualCreateInput added in v0.3.0

type CheckManualCreateInput struct {
	CheckCreateInput

	UpdateFrequency       *ManualCheckFrequencyInput `json:"updateFrequency,omitempty"`
	UpdateRequiresComment bool                       `json:"updateRequiresComment"`
}

type CheckManualUpdateInput added in v0.3.0

type CheckManualUpdateInput struct {
	CheckUpdateInput

	UpdateFrequency       *ManualCheckFrequencyInput `json:"updateFrequency,omitempty"`
	UpdateRequiresComment bool                       `json:"updateRequiresComment,omitempty"`
}

type CheckOwner added in v0.3.0

type CheckOwner struct {
	Team TeamId `graphql:"... on Team"`
}

type CheckRepositoryFileCreateInput added in v0.3.0

type CheckRepositoryFileCreateInput struct {
	CheckCreateInput

	DirectorySearch       bool            `json:"directorySearch"`
	Filepaths             []string        `json:"filePaths"`
	FileContentsPredicate *PredicateInput `json:"fileContentsPredicate,omitempty"`
}

type CheckRepositoryFileUpdateInput added in v0.3.0

type CheckRepositoryFileUpdateInput struct {
	CheckUpdateInput

	DirectorySearch       bool            `json:"directorySearch,omitempty"`
	Filepaths             []string        `json:"filePaths,omitempty"`
	FileContentsPredicate *PredicateInput `json:"fileContentsPredicate,omitempty"`
}

type CheckRepositoryIntegratedCreateInput added in v0.3.0

type CheckRepositoryIntegratedCreateInput struct {
	CheckCreateInput
}

type CheckRepositoryIntegratedUpdateInput added in v0.3.0

type CheckRepositoryIntegratedUpdateInput struct {
	CheckUpdateInput
}

type CheckRepositorySearchCreateInput added in v0.3.0

type CheckRepositorySearchCreateInput struct {
	CheckCreateInput

	FileExtensions        []string       `json:"fileExtensions,omitempty"`
	FileContentsPredicate PredicateInput `json:"fileContentsPredicate"`
}

type CheckRepositorySearchUpdateInput added in v0.3.0

type CheckRepositorySearchUpdateInput struct {
	CheckUpdateInput

	FileExtensions        []string        `json:"fileExtensions,omitempty"`
	FileContentsPredicate *PredicateInput `json:"fileContentsPredicate,omitempty"`
}

type CheckResponsePayload added in v0.3.0

type CheckResponsePayload struct {
	Check  Check
	Errors []OpsLevelErrors
}

Encompass CheckCreatePayload and CheckUpdatePayload into 1 struct

func (*CheckResponsePayload) Mutate added in v0.3.0

func (p *CheckResponsePayload) Mutate(client *Client, m interface{}, v map[string]interface{}) (*Check, error)

type CheckServiceConfigurationCreateInput added in v0.3.0

type CheckServiceConfigurationCreateInput struct {
	CheckCreateInput
}

type CheckServiceConfigurationUpdateInput added in v0.3.0

type CheckServiceConfigurationUpdateInput struct {
	CheckUpdateInput
}

type CheckServiceOwnershipCreateInput added in v0.3.0

type CheckServiceOwnershipCreateInput struct {
	CheckCreateInput
}

type CheckServiceOwnershipUpdateInput added in v0.3.0

type CheckServiceOwnershipUpdateInput struct {
	CheckUpdateInput
}

type CheckServicePropertyCreateInput added in v0.3.0

type CheckServicePropertyCreateInput struct {
	CheckCreateInput

	Property  ServicePropertyTypeEnum `json:"serviceProperty"`
	Predicate *PredicateInput         `json:"propertyValuePredicate,omitempty"`
}

type CheckServicePropertyUpdateInput added in v0.3.0

type CheckServicePropertyUpdateInput struct {
	CheckUpdateInput

	Property  ServicePropertyTypeEnum `json:"serviceProperty,omitempty"`
	Predicate *PredicateInput         `json:"propertyValuePredicate,omitempty"`
}

type CheckStatus added in v0.4.0

type CheckStatus string

CheckStatus represents the evaluation status of the check.

const (
	CheckStatusPassed  CheckStatus = "passed"  // The check evaluated to a truthy value based on some conditions.
	CheckStatusFailed  CheckStatus = "failed"  // The check evaluated to a falsy value based on some conditions.
	CheckStatusPending CheckStatus = "pending" // The check has not been evaluated yet..
)

type CheckTagDefinedCreateInput added in v0.3.0

type CheckTagDefinedCreateInput struct {
	CheckCreateInput

	TagKey       string          `json:"tagKey"`
	TagPredicate *PredicateInput `json:"tagPredicate,omitempty"`
}

type CheckTagDefinedUpdateInput added in v0.3.0

type CheckTagDefinedUpdateInput struct {
	CheckUpdateInput

	TagKey       string          `json:"tagKey,omitempty"`
	TagPredicate *PredicateInput `json:"tagPredicate,omitempty"`
}

type CheckToolUsageCreateInput added in v0.3.0

type CheckToolUsageCreateInput struct {
	CheckCreateInput

	ToolCategory         ToolCategory    `json:"toolCategory"`
	ToolNamePredicate    *PredicateInput `json:"toolNamePredicate,omitempty"`
	EnvironmentPredicate *PredicateInput `json:"environmentPredicate,omitempty"`
}

type CheckToolUsageUpdateInput added in v0.3.0

type CheckToolUsageUpdateInput struct {
	CheckUpdateInput

	ToolCategory         ToolCategory    `json:"toolCategory,omitempty"`
	ToolNamePredicate    *PredicateInput `json:"toolNamePredicate,omitempty"`
	EnvironmentPredicate *PredicateInput `json:"environmentPredicate,omitempty"`
}

type CheckType added in v0.3.0

type CheckType string

CheckType represents the type of check.

const (
	CheckTypeHasOwner         CheckType = "has_owner"          // Verifies that the service has an owner defined.
	CheckTypeServiceProperty  CheckType = "service_property"   // Verifies that a service property is set or matches a specified format.
	CheckTypeHasServiceConfig CheckType = "has_service_config" // Verifies that the service is maintained though the use of an opslevel.yml service config.
	CheckTypeHasRepository    CheckType = "has_repository"     // Verifies that the service has a repository integrated.
	CheckTypeToolUsage        CheckType = "tool_usage"         // Verifies that the service is using a tool of a particular category or name.
	CheckTypeTagDefined       CheckType = "tag_defined"        // Verifies that the service has the specified tag defined.
	CheckTypeRepoFile         CheckType = "repo_file"          // Verifies that the service's repository contains a file with a certain path. (Optional: Can also be used to check for specific file contents).
	CheckTypeRepoSearch       CheckType = "repo_search"        // Searches the service's repository and verifies if any file matches the given contents.
	CheckTypeCustom           CheckType = "custom"             // Allows for the creation of programmatic checks that use an API to mark the status as passing or failing.
	CheckTypePayload          CheckType = "payload"            // Requires a payload integration api call to complete a check for the service.
	CheckTypeManual           CheckType = "manual"             // Requires a service owner to manually complete a check for the service.
	CheckTypeGeneric          CheckType = "generic"            // Requires a generic integration api call to complete a series of checks for multiple services.
)

type CheckUpdateInput added in v0.3.0

type CheckUpdateInput struct {
	Id       graphql.ID  `json:"id"`
	Name     string      `json:"name,omitempty"`
	Enabled  *bool       `json:"enabled,omitempty"`
	Category *graphql.ID `json:"categoryId,omitempty"`
	Level    *graphql.ID `json:"levelId,omitempty"`
	Owner    *graphql.ID `json:"ownerId,omitempty"`
	Filter   *graphql.ID `json:"filterId,omitempty"`
	Notes    string      `json:"notes,omitempty"`
}

func (*CheckUpdateInput) GetCheckUpdateInput added in v0.3.0

func (c *CheckUpdateInput) GetCheckUpdateInput() *CheckUpdateInput

type CheckUpdateInputProvider added in v0.3.0

type CheckUpdateInputProvider interface {
	GetCheckUpdateInput() *CheckUpdateInput
}

type Client

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

func NewClient

func NewClient(apiToken string, options ...Option) *Client

func (*Client) AddContact added in v0.4.0

func (client *Client) AddContact(team *TeamId, contact ContactInput) (*Contact, error)

func (*Client) AddContactWithTeamAlias added in v0.4.0

func (client *Client) AddContactWithTeamAlias(team string, contact ContactInput) (*Contact, error)

func (*Client) AddMember added in v0.4.0

func (client *Client) AddMember(team *TeamId, email string) ([]User, error)

func (*Client) AddMembers added in v0.4.0

func (client *Client) AddMembers(team *TeamId, emails []string) ([]User, error)

func (*Client) AssignTagForAlias

func (client *Client) AssignTagForAlias(alias string, key string, value string) ([]Tag, error)

func (*Client) AssignTagForId

func (client *Client) AssignTagForId(id graphql.ID, key string, value string) ([]Tag, error)

func (*Client) AssignTags

func (client *Client) AssignTags(input TagAssignInput) ([]Tag, error)

func (*Client) AssignTagsForAlias

func (client *Client) AssignTagsForAlias(alias string, tags map[string]string) ([]Tag, error)

func (*Client) AssignTagsForId

func (client *Client) AssignTagsForId(id graphql.ID, tags map[string]string) ([]Tag, error)

func (*Client) ConnectServiceRepository added in v0.2.1

func (client *Client) ConnectServiceRepository(service *ServiceId, repository *Repository) (*ServiceRepository, error)

func (*Client) CreateAlias

func (client *Client) CreateAlias(input AliasCreateInput) ([]string, error)

func (*Client) CreateAliases

func (client *Client) CreateAliases(ownerId graphql.ID, aliases []string) ([]string, error)

#region Create TODO: make sure duplicate aliases throw an error that we can catch

func (*Client) CreateCategory added in v0.2.2

func (client *Client) CreateCategory(input CategoryCreateInput) (*Category, error)

func (*Client) CreateCheckCustomEvent added in v0.3.0

func (client *Client) CreateCheckCustomEvent(input CheckCustomEventCreateInput) (*Check, error)

func (*Client) CreateCheckManual added in v0.3.0

func (client *Client) CreateCheckManual(input CheckManualCreateInput) (*Check, error)

func (*Client) CreateCheckRepositoryFile added in v0.3.0

func (client *Client) CreateCheckRepositoryFile(input CheckRepositoryFileCreateInput) (*Check, error)

func (*Client) CreateCheckRepositoryIntegrated added in v0.3.0

func (client *Client) CreateCheckRepositoryIntegrated(input CheckRepositoryIntegratedCreateInput) (*Check, error)

func (*Client) CreateCheckRepositorySearch added in v0.3.0

func (client *Client) CreateCheckRepositorySearch(input CheckRepositorySearchCreateInput) (*Check, error)

func (*Client) CreateCheckServiceConfiguration added in v0.3.0

func (client *Client) CreateCheckServiceConfiguration(input CheckServiceConfigurationCreateInput) (*Check, error)

func (*Client) CreateCheckServiceOwnership added in v0.3.0

func (client *Client) CreateCheckServiceOwnership(input CheckServiceOwnershipCreateInput) (*Check, error)

func (*Client) CreateCheckServiceProperty added in v0.3.0

func (client *Client) CreateCheckServiceProperty(input CheckServicePropertyCreateInput) (*Check, error)

func (*Client) CreateCheckTagDefined added in v0.3.0

func (client *Client) CreateCheckTagDefined(input CheckTagDefinedCreateInput) (*Check, error)

func (*Client) CreateCheckToolUsage added in v0.3.0

func (client *Client) CreateCheckToolUsage(input CheckToolUsageCreateInput) (*Check, error)

func (*Client) CreateFilter added in v0.3.0

func (client *Client) CreateFilter(input FilterCreateInput) (*Filter, error)

func (*Client) CreateLevel added in v0.2.2

func (client *Client) CreateLevel(input LevelCreateInput) (*Level, error)

func (*Client) CreateService

func (client *Client) CreateService(input ServiceCreateInput) (*Service, error)

func (*Client) CreateServiceRepository added in v0.2.1

func (client *Client) CreateServiceRepository(input ServiceRepositoryCreateInput) (*ServiceRepository, error)

func (*Client) CreateTag

func (client *Client) CreateTag(input TagCreateInput) (*Tag, error)

func (*Client) CreateTags

func (client *Client) CreateTags(alias string, tags map[string]string) ([]Tag, error)

func (*Client) CreateTagsForId

func (client *Client) CreateTagsForId(id graphql.ID, tags map[string]string) ([]Tag, error)

func (*Client) CreateTeam

func (client *Client) CreateTeam(input TeamCreateInput) (*Team, error)

func (*Client) CreateTool

func (client *Client) CreateTool(input ToolCreateInput) (*Tool, error)

func (*Client) DeleteAlias added in v0.4.1

func (client *Client) DeleteAlias(input AliasDeleteInput) error

func (*Client) DeleteCategory added in v0.2.2

func (client *Client) DeleteCategory(id graphql.ID) error

func (*Client) DeleteCheck added in v0.3.0

func (client *Client) DeleteCheck(id graphql.ID) error

func (*Client) DeleteFilter added in v0.3.0

func (client *Client) DeleteFilter(id graphql.ID) error

func (*Client) DeleteLevel added in v0.2.2

func (client *Client) DeleteLevel(id graphql.ID) error

func (*Client) DeleteService

func (client *Client) DeleteService(input ServiceDeleteInput) error

TODO: we should have a method that takes and ID and that follows the convention of other delete functions

func (*Client) DeleteServiceAlias added in v0.4.1

func (client *Client) DeleteServiceAlias(alias string) error

func (*Client) DeleteServiceRepository added in v0.3.0

func (client *Client) DeleteServiceRepository(id graphql.ID) error

func (*Client) DeleteServiceWithAlias added in v0.3.0

func (client *Client) DeleteServiceWithAlias(alias string) error

func (*Client) DeleteTag

func (client *Client) DeleteTag(id graphql.ID) error

func (*Client) DeleteTeam

func (client *Client) DeleteTeam(id graphql.ID) error

func (*Client) DeleteTeamAlias added in v0.4.1

func (client *Client) DeleteTeamAlias(alias string) error

func (*Client) DeleteTeamWithAlias

func (client *Client) DeleteTeamWithAlias(alias string) error

func (*Client) DeleteTeamWithId deprecated

func (client *Client) DeleteTeamWithId(id graphql.ID) error

Deprecated: use DeleteTeam instead

func (*Client) DeleteTool added in v0.3.0

func (client *Client) DeleteTool(id graphql.ID) error

func (*Client) GetCategory added in v0.3.0

func (client *Client) GetCategory(id graphql.ID) (*Category, error)

func (*Client) GetCheck added in v0.3.0

func (client *Client) GetCheck(id graphql.ID) (*Check, error)

func (*Client) GetFilter added in v0.3.0

func (client *Client) GetFilter(id graphql.ID) (*Filter, error)

func (*Client) GetIntegration added in v0.3.0

func (client *Client) GetIntegration(id graphql.ID) (*Integration, error)

func (*Client) GetLevel added in v0.3.0

func (client *Client) GetLevel(id graphql.ID) (*Level, error)

func (*Client) GetRepository added in v0.2.1

func (client *Client) GetRepository(id graphql.ID) (*Repository, error)

func (*Client) GetRepositoryWithAlias added in v0.2.1

func (client *Client) GetRepositoryWithAlias(alias string) (*Repository, error)

func (*Client) GetService

func (client *Client) GetService(id graphql.ID) (*Service, error)

func (*Client) GetServiceCount

func (client *Client) GetServiceCount() (int, error)

func (*Client) GetServiceIdWithAlias

func (client *Client) GetServiceIdWithAlias(alias string) (*ServiceId, error)

This is a lightweight api call to lookup a service id by and alias - it does not return a full Service object

func (*Client) GetServiceWithAlias

func (client *Client) GetServiceWithAlias(alias string) (*Service, error)

func (*Client) GetServiceWithId deprecated

func (client *Client) GetServiceWithId(id graphql.ID) (*Service, error)

Deprecated: Use GetService instead

func (*Client) GetTagCount

func (client *Client) GetTagCount(service graphql.ID) (int, error)

func (*Client) GetTagsForService

func (client *Client) GetTagsForService(service graphql.ID) ([]Tag, error)

func (*Client) GetTagsForServiceWithAlias

func (client *Client) GetTagsForServiceWithAlias(alias string) ([]Tag, error)

func (*Client) GetTagsForServiceWithId deprecated

func (client *Client) GetTagsForServiceWithId(service graphql.ID) ([]Tag, error)

Deprecated: use GetTagsForService instead

func (*Client) GetTeam

func (client *Client) GetTeam(id graphql.ID) (*Team, error)

func (*Client) GetTeamCount

func (client *Client) GetTeamCount() (int, error)

func (*Client) GetTeamWithAlias

func (client *Client) GetTeamWithAlias(alias string) (*Team, error)

func (*Client) GetTeamWithId deprecated

func (client *Client) GetTeamWithId(id graphql.ID) (*Team, error)

Deprecated: use GetTeam instead

func (*Client) GetToolCount

func (client *Client) GetToolCount(service graphql.ID) (int, error)

func (*Client) GetToolsForService

func (client *Client) GetToolsForService(service graphql.ID) ([]Tool, error)

func (*Client) GetToolsForServiceWithAlias

func (client *Client) GetToolsForServiceWithAlias(alias string) ([]Tool, error)

func (*Client) GetToolsForServiceWithId deprecated

func (client *Client) GetToolsForServiceWithId(service graphql.ID) ([]Tool, error)

Deprecated: Use GetToolsForService instead

func (*Client) InitialPageVariables added in v0.3.0

func (c *Client) InitialPageVariables() PayloadVariables

func (*Client) ListCategories added in v0.2.2

func (client *Client) ListCategories() ([]Category, error)

func (*Client) ListChecks added in v0.3.0

func (client *Client) ListChecks() ([]Check, error)

func (*Client) ListFilters added in v0.3.0

func (client *Client) ListFilters() ([]Filter, error)

func (*Client) ListIntegrations added in v0.3.0

func (client *Client) ListIntegrations() ([]Integration, error)

func (*Client) ListLevels added in v0.2.2

func (client *Client) ListLevels() ([]Level, error)

func (*Client) ListLifecycles

func (client *Client) ListLifecycles() ([]Lifecycle, error)

func (*Client) ListRepositories added in v0.2.1

func (client *Client) ListRepositories() ([]Repository, error)

func (*Client) ListRepositoriesWithTier added in v0.3.0

func (client *Client) ListRepositoriesWithTier(tier string) ([]Repository, error)

func (*Client) ListServices

func (client *Client) ListServices() ([]Service, error)

func (*Client) ListServicesWithFramework added in v0.3.0

func (client *Client) ListServicesWithFramework(framework string) ([]Service, error)

func (*Client) ListServicesWithLanguage added in v0.3.0

func (client *Client) ListServicesWithLanguage(language string) ([]Service, error)

func (*Client) ListServicesWithLifecycle added in v0.3.0

func (client *Client) ListServicesWithLifecycle(lifecycle string) ([]Service, error)

func (*Client) ListServicesWithOwner added in v0.3.0

func (client *Client) ListServicesWithOwner(owner string) ([]Service, error)

func (*Client) ListServicesWithProduct added in v0.3.0

func (client *Client) ListServicesWithProduct(product string) ([]Service, error)

func (*Client) ListServicesWithTag added in v0.3.0

func (client *Client) ListServicesWithTag(tag TagArgs) ([]Service, error)

func (*Client) ListServicesWithTier added in v0.3.0

func (client *Client) ListServicesWithTier(tier string) ([]Service, error)

func (*Client) ListTeams

func (client *Client) ListTeams() ([]Team, error)

func (*Client) ListTeamsWithManager added in v0.3.0

func (client *Client) ListTeamsWithManager(email string) ([]Team, error)

func (*Client) ListTiers

func (client *Client) ListTiers() ([]Tier, error)

func (*Client) Mutate

func (c *Client) Mutate(m interface{}, variables map[string]interface{}) error

func (*Client) Query

func (c *Client) Query(q interface{}, variables map[string]interface{}) error

Should we create a context for every query/mutate ?

func (*Client) RemoveContact added in v0.4.0

func (client *Client) RemoveContact(contact graphql.ID) error

func (*Client) RemoveMember added in v0.4.0

func (client *Client) RemoveMember(team *TeamId, email string) ([]User, error)

func (*Client) RemoveMembers added in v0.4.0

func (client *Client) RemoveMembers(team *TeamId, emails []string) ([]User, error)

func (*Client) UpdateCategory added in v0.2.2

func (client *Client) UpdateCategory(input CategoryUpdateInput) (*Category, error)

func (*Client) UpdateCheckCustomEvent added in v0.3.0

func (client *Client) UpdateCheckCustomEvent(input CheckCustomEventUpdateInput) (*Check, error)

func (*Client) UpdateCheckManual added in v0.3.0

func (client *Client) UpdateCheckManual(input CheckManualUpdateInput) (*Check, error)

func (*Client) UpdateCheckRepositoryFile added in v0.3.0

func (client *Client) UpdateCheckRepositoryFile(input CheckRepositoryFileUpdateInput) (*Check, error)

func (*Client) UpdateCheckRepositoryIntegrated added in v0.3.0

func (client *Client) UpdateCheckRepositoryIntegrated(input CheckRepositoryIntegratedUpdateInput) (*Check, error)

func (*Client) UpdateCheckRepositorySearch added in v0.3.0

func (client *Client) UpdateCheckRepositorySearch(input CheckRepositorySearchUpdateInput) (*Check, error)

func (*Client) UpdateCheckServiceConfiguration added in v0.3.0

func (client *Client) UpdateCheckServiceConfiguration(input CheckServiceConfigurationUpdateInput) (*Check, error)

func (*Client) UpdateCheckServiceOwnership added in v0.3.0

func (client *Client) UpdateCheckServiceOwnership(input CheckServiceOwnershipUpdateInput) (*Check, error)

func (*Client) UpdateCheckServiceProperty added in v0.3.0

func (client *Client) UpdateCheckServiceProperty(input CheckServicePropertyUpdateInput) (*Check, error)

func (*Client) UpdateCheckTagDefined added in v0.3.0

func (client *Client) UpdateCheckTagDefined(input CheckTagDefinedUpdateInput) (*Check, error)

func (*Client) UpdateCheckToolUsage added in v0.3.0

func (client *Client) UpdateCheckToolUsage(input CheckToolUsageUpdateInput) (*Check, error)

func (*Client) UpdateContact added in v0.4.0

func (client *Client) UpdateContact(id graphql.ID, contact ContactInput) (*Contact, error)

func (*Client) UpdateFilter added in v0.3.0

func (client *Client) UpdateFilter(input FilterUpdateInput) (*Filter, error)

func (*Client) UpdateLevel added in v0.2.2

func (client *Client) UpdateLevel(input LevelUpdateInput) (*Level, error)

func (*Client) UpdateService

func (client *Client) UpdateService(input ServiceUpdateInput) (*Service, error)

func (*Client) UpdateServiceRepository added in v0.2.1

func (client *Client) UpdateServiceRepository(input ServiceRepositoryUpdateInput) (*ServiceRepository, error)

func (*Client) UpdateTag

func (client *Client) UpdateTag(input TagUpdateInput) (*Tag, error)

func (*Client) UpdateTeam

func (client *Client) UpdateTeam(input TeamUpdateInput) (*Team, error)

func (*Client) UpdateTool added in v0.3.0

func (client *Client) UpdateTool(input ToolUpdateInput) (*Tool, error)

func (*Client) Validate

func (c *Client) Validate() error

type ClientSettings

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

type ConnectiveEnum added in v0.4.0

type ConnectiveEnum string

ConnectiveEnum represents the logical operator to be used in conjunction with multiple filters (requires filters to be supplied).

const (
	ConnectiveEnumAnd ConnectiveEnum = "and" // Used to ensure **all** filters match for a given resource.
	ConnectiveEnumOr  ConnectiveEnum = "or"  // Used to ensure **any** filters match for a given resource.
)

type Contact

type Contact struct {
	Address     string
	DisplayName string
	Id          graphql.ID
	Type        ContactType
}

type ContactCreateInput added in v0.4.0

type ContactCreateInput struct {
	Type        ContactType `json:"type"`
	DisplayName string      `json:"displayName,omitempty"`
	Address     string      `json:"address"`
	TeamId      *graphql.ID `json:"teamId,omitempty"`
	TeamAlias   string      `json:"teamAlias,omitempty"`
}

type ContactDeleteInput added in v0.4.0

type ContactDeleteInput struct {
	Id graphql.ID `json:"id"`
}

type ContactInput

type ContactInput struct {
	Type        ContactType `json:"type"`
	DisplayName string      `json:"displayName,omitEmpty"`
	Address     string      `json:"address"`
}

func CreateContactEmail added in v0.4.0

func CreateContactEmail(email string, name string) ContactInput

func CreateContactSlack added in v0.4.0

func CreateContactSlack(channel string, name string) ContactInput

func CreateContactWeb added in v0.4.0

func CreateContactWeb(address string, name string) ContactInput

type ContactType added in v0.4.0

type ContactType string

ContactType represents the method of contact.

const (
	ContactTypeSlack       ContactType = "slack"        // A Slack channel contact method.
	ContactTypeSlackHandle ContactType = "slack_handle" // A Slack handle contact method.
	ContactTypeEmail       ContactType = "email"        // An email contact method.
	ContactTypeWeb         ContactType = "web"          // A website contact method.
)

type ContactUpdateInput added in v0.4.0

type ContactUpdateInput struct {
	Id          graphql.ID   `json:"id"`
	Type        *ContactType `json:"type,omitempty"`
	DisplayName string       `json:"displayName,omitempty"`
	Address     string       `json:"address,omitempty"`
}

type CustomEventCheckFragment added in v0.3.0

type CustomEventCheckFragment struct {
	Integration      Integration `graphql:"integration"`
	ResultMessage    string      `graphql:"resultMessage"`
	ServiceSelector  string      `graphql:"serviceSelector"`
	SuccessCondition string      `graphql:"successCondition"`
}

type DeleteInput added in v0.3.0

type DeleteInput struct {
	Id graphql.ID `json:"id"`
}

type Filter added in v0.3.0

type Filter struct {
	Connective ConnectiveEnum
	HtmlURL    string
	Id         graphql.ID
	Name       string
	Predicates []FilterPredicate
}

func (*Filter) Alias added in v0.4.2

func (self *Filter) Alias() string

type FilterConnection added in v0.3.0

type FilterConnection struct {
	Nodes      []Filter
	PageInfo   PageInfo
	TotalCount graphql.Int
}

func (*FilterConnection) Hydrate added in v0.3.0

func (conn *FilterConnection) Hydrate(client *Client) error

type FilterCreateInput added in v0.3.0

type FilterCreateInput struct {
	Name       string            `json:"name"`
	Predicates []FilterPredicate `json:"predicates"`
	Connective ConnectiveEnum    `json:"connective,omitempty"`
}

type FilterPredicate added in v0.3.0

type FilterPredicate struct {
	Key     PredicateKeyEnum  `json:"key"`
	KeyData string            `json:"keyData,omitempty"`
	Type    PredicateTypeEnum `json:"type"`
	Value   string            `json:"value,omitempty"`
}

type FilterUpdateInput added in v0.3.0

type FilterUpdateInput struct {
	Id         graphql.ID        `json:"id"`
	Name       string            `json:"name,omitempty"`
	Predicates []FilterPredicate `json:"predicates"` //The list of predicates used to select which services apply to the filter. All existing predicates will be replaced by these predicates.
	Connective ConnectiveEnum    `json:"connective,omitempty"`
}

type FrequencyTimeScale added in v0.3.0

type FrequencyTimeScale string

FrequencyTimeScale represents the time scale type for the frequency.

const (
	FrequencyTimeScaleDay   FrequencyTimeScale = "day"   // Consider the time scale of days.
	FrequencyTimeScaleWeek  FrequencyTimeScale = "week"  // Consider the time scale of weeks.
	FrequencyTimeScaleMonth FrequencyTimeScale = "month" // Consider the time scale of months.
	FrequencyTimeScaleYear  FrequencyTimeScale = "year"  // Consider the time scale of years.
)

type IdResponsePayload added in v0.3.0

type IdResponsePayload struct {
	Id     graphql.ID `graphql:"deletedCheckId"`
	Errors []OpsLevelErrors
}

func (*IdResponsePayload) Mutate added in v0.3.0

func (p *IdResponsePayload) Mutate(client *Client, m interface{}, v PayloadVariables) error

type IdentifierInput added in v0.2.1

type IdentifierInput struct {
	Id    graphql.ID     `graphql:"id,omitempty" json:"id,omitempty"`
	Alias graphql.String `graphql:"alias,omitempty" json:"alias,omitempty"`
}

func NewId added in v0.2.1

func NewId(id string) *IdentifierInput

func NewIdFromAlias added in v0.2.1

func NewIdFromAlias(alias string) *IdentifierInput

type Integration added in v0.3.0

type Integration struct {
	Id   graphql.ID `json:"id"`
	Name string     `json:"name"`
	Type string     `json:"type"`
}

func (*Integration) Alias added in v0.4.2

func (self *Integration) Alias() string

type IntegrationConnection added in v0.3.0

type IntegrationConnection struct {
	Nodes      []Integration
	PageInfo   PageInfo
	TotalCount graphql.Int
}

func (*IntegrationConnection) Hydrate added in v0.3.0

func (conn *IntegrationConnection) Hydrate(client *Client) error

type Language added in v0.2.1

type Language struct {
	Name  string
	Usage float32
}

type Level added in v0.2.2

type Level struct {
	Alias       string
	Description string     `json:"description,omitempty"`
	Id          graphql.ID `json:"id"`
	Index       int
	Name        string
}

type LevelConnection added in v0.2.2

type LevelConnection struct {
	Nodes      []Level
	PageInfo   PageInfo
	TotalCount graphql.Int
}

func (*LevelConnection) Hydrate added in v0.2.2

func (conn *LevelConnection) Hydrate(client *Client) error

type LevelCreateInput added in v0.2.2

type LevelCreateInput struct {
	Name        string `json:"name"`
	Description string `json:"description,omitempty"`
	Index       *int   `json:"index,omitempty"`
}

type LevelDeleteInput added in v0.2.2

type LevelDeleteInput struct {
	Id graphql.ID `json:"id"`
}

type LevelUpdateInput added in v0.2.2

type LevelUpdateInput struct {
	Id          graphql.ID `json:"id"`
	Name        string     `json:"name"`
	Description string     `json:"description,omitempty"`
}

type Lifecycle

type Lifecycle struct {
	Alias       string
	Description string
	Id          graphql.ID
	Index       int
	Name        string
}

type ManualCheckFragment added in v0.3.0

type ManualCheckFragment struct {
	UpdateFrequency       *ManualCheckFrequency `graphql:"updateFrequency"`
	UpdateRequiresComment bool                  `graphql:"updateRequiresComment"`
}

type ManualCheckFrequency added in v0.3.0

type ManualCheckFrequency struct {
	StartingDate       iso8601.Time       `graphql:"startingDate"`
	FrequencyTimeScale FrequencyTimeScale `graphql:"frequencyTimeScale"`
	FrequencyValue     int                `graphql:"frequencyValue"`
}

type ManualCheckFrequencyInput added in v0.3.0

type ManualCheckFrequencyInput struct {
	StartingDate       iso8601.Time       `json:"startingDate"`
	FrequencyTimeScale FrequencyTimeScale `json:"frequencyTimeScale"`
	FrequencyValue     int                `json:"frequencyValue"`
}

func NewManualCheckFrequencyInput added in v0.3.0

func NewManualCheckFrequencyInput(startingDate string, timeScale FrequencyTimeScale, value int) *ManualCheckFrequencyInput

type OpsLevelErrors

type OpsLevelErrors struct {
	Message string
	Path    []string
}

type Option added in v0.4.3

type Option func(*ClientSettings)

func SetAPIVisibility

func SetAPIVisibility(visibility string) Option

func SetContext

func SetContext(ctx context.Context) Option

func SetPageSize

func SetPageSize(size int) Option

func SetTimeout added in v0.4.3

func SetTimeout(amount time.Duration) Option

func SetURL

func SetURL(url string) Option

func SetUserAgentExtra added in v0.4.0

func SetUserAgentExtra(extra string) Option

type PageInfo

type PageInfo struct {
	HasNextPage     graphql.Boolean `graphql:"hasNextPage"`
	HasPreviousPage graphql.Boolean `graphql:"hasPreviousPage"`
	Start           graphql.String  `graphql:"startCursor"`
	End             graphql.String  `graphql:"endCursor"`
}

type PayloadVariables

type PayloadVariables map[string]interface{}

type Predicate added in v0.3.0

type Predicate struct {
	Type  PredicateTypeEnum `graphql:"type"`
	Value string            `graphql:"value"`
}

type PredicateInput added in v0.3.0

type PredicateInput struct {
	Type  PredicateTypeEnum `json:"type"`
	Value string            `json:"value,omitempty"`
}

type PredicateKeyEnum added in v0.3.0

type PredicateKeyEnum string

PredicateKeyEnum represents fields that can be used as part of filter for services.

const (
	PredicateKeyEnumTierIndex      PredicateKeyEnum = "tier_index"      // Filter by `tier` field.
	PredicateKeyEnumLifecycleIndex PredicateKeyEnum = "lifecycle_index" // Filter by `lifecycle` field.
	PredicateKeyEnumLanguage       PredicateKeyEnum = "language"        // Filter by `language` field.
	PredicateKeyEnumFramework      PredicateKeyEnum = "framework"       // Filter by `framework` field.
	PredicateKeyEnumProduct        PredicateKeyEnum = "product"         // Filter by `product` field.
	PredicateKeyEnumName           PredicateKeyEnum = "name"            // Filter by `name` field.
	PredicateKeyEnumTags           PredicateKeyEnum = "tags"            // Filter by `tags` field.
	PredicateKeyEnumOwnerID        PredicateKeyEnum = "owner_id"        // Filter by `owner` field.
)

type PredicateTypeEnum added in v0.4.0

type PredicateTypeEnum string

PredicateTypeEnum represents operations that can be used on predicates.

const (
	PredicateTypeEnumContains                   PredicateTypeEnum = "contains"                     // Contains a specific value.
	PredicateTypeEnumDoesNotContain             PredicateTypeEnum = "does_not_contain"             // Does not contain a specific value.
	PredicateTypeEnumDoesNotEqual               PredicateTypeEnum = "does_not_equal"               // Does not equal a specific value.
	PredicateTypeEnumDoesNotExist               PredicateTypeEnum = "does_not_exist"               // Specific attribute does not exist.
	PredicateTypeEnumEndsWith                   PredicateTypeEnum = "ends_with"                    // Ends with a specific value.
	PredicateTypeEnumEquals                     PredicateTypeEnum = "equals"                       // Equals a specific value.
	PredicateTypeEnumExists                     PredicateTypeEnum = "exists"                       // Specific attribute exists.
	PredicateTypeEnumGreaterThanOrEqualTo       PredicateTypeEnum = "greater_than_or_equal_to"     // Greater than or equal to a specific value (numeric only).
	PredicateTypeEnumLessThanOrEqualTo          PredicateTypeEnum = "less_than_or_equal_to"        // Less than or equal to a specific value (numeric only).
	PredicateTypeEnumStartsWith                 PredicateTypeEnum = "starts_with"                  // Starts with a specific value.
	PredicateTypeEnumSatisfiesVersionConstraint PredicateTypeEnum = "satisfies_version_constraint" // Satisfies version constraint (tag value only).
	PredicateTypeEnumMatchesRegex               PredicateTypeEnum = "matches_regex"                // Matches a value using a regular expression.
	PredicateTypeEnumSatisfiesJqExpression      PredicateTypeEnum = "satisfies_jq_expression"      // Satisfies an expression defined in jq.
)

type Repository added in v0.2.1

type Repository struct {
	ArchivedAt         iso8601.Time
	CreatedOn          iso8601.Time
	DefaultAlias       string
	DefaultBranch      string
	Description        string
	Forked             bool
	HtmlUrl            string
	Id                 graphql.ID
	Languages          []Language
	LastOwnerChangedAt iso8601.Time
	Name               string
	Organization       string
	Owner              TeamId
	Private            bool
	RepoKey            string
	Services           RepositoryServiceConnection
	Tags               RepositoryTagConnection
	Tier               Tier
	Type               string
	Url                string
	Visible            bool
}

func (*Repository) GetService added in v0.2.1

func (r *Repository) GetService(service graphql.ID, directory string) *ServiceRepository

func (*Repository) Hydrate added in v0.2.1

func (r *Repository) Hydrate(client *Client) error

type RepositoryConnection added in v0.2.1

type RepositoryConnection struct {
	HiddenCount       int
	Nodes             []Repository
	OrganizationCount int
	OwnedCount        int
	PageInfo          PageInfo
	TotalCount        int
	VisibleCount      int
}

func (*RepositoryConnection) Hydrate added in v0.2.1

func (conn *RepositoryConnection) Hydrate(client *Client) error

type RepositoryFileCheckFragment added in v0.3.0

type RepositoryFileCheckFragment struct {
	DirectorySearch       bool       `graphql:"directorySearch"`
	Filepaths             []string   `graphql:"filePaths"`
	FileContentsPredicate *Predicate `graphql:"fileContentsPredicate"`
}

type RepositoryId added in v0.2.1

type RepositoryId struct {
	Id           graphql.ID
	DefaultAlias string
}

Lightweight Repository struct used to make some API calls return less data

type RepositoryPath added in v0.2.1

type RepositoryPath struct {
	Href string
	Path string
}

type RepositorySearchCheckFragment added in v0.3.0

type RepositorySearchCheckFragment struct {
	FileExtensions        []string  `graphql:"fileExtensions"`
	FileContentsPredicate Predicate `graphql:"fileContentsPredicate"`
}

type RepositoryServiceConnection added in v0.2.1

type RepositoryServiceConnection struct {
	Edges      []RepositoryServiceEdge
	PageInfo   PageInfo
	TotalCount graphql.Int
}

func (*RepositoryServiceConnection) Hydrate added in v0.2.1

func (conn *RepositoryServiceConnection) Hydrate(id graphql.ID, client *Client) error

type RepositoryServiceEdge added in v0.2.1

type RepositoryServiceEdge struct {
	AtRoot              bool
	Node                ServiceId
	Paths               []RepositoryPath
	ServiceRepositories []ServiceRepository
}

type RepositoryTagConnection added in v0.2.1

type RepositoryTagConnection struct {
	Nodes      []Tag
	PageInfo   PageInfo
	TotalCount graphql.Int
}

func (*RepositoryTagConnection) Hydrate added in v0.2.1

func (conn *RepositoryTagConnection) Hydrate(id graphql.ID, client *Client) error

type Service

type Service struct {
	Aliases     []string `json:"aliases,omitempty"`
	Description string   `json:"description,omitempty"`
	Framework   string   `json:"framework,omitempty"`
	HtmlURL     string   `json:"htmlUrl"`
	ServiceId
	Language     string                      `json:"language,omitempty"`
	Lifecycle    Lifecycle                   `json:"lifecycle,omitempty"`
	Name         string                      `json:"name,omitempty"`
	Owner        TeamId                      `json:"owner,omitempty"`
	Product      string                      `json:"product,omitempty"`
	Repositories ServiceRepositoryConnection `json:"repos,omitempty" graphql:"repos"`
	Tags         TagConnection               `json:"tags,omitempty"`
	Tier         Tier                        `json:"tier,omitempty"`
	Tools        ToolConnection              `json:"tools,omitempty"`
}

func (*Service) HasAlias

func (s *Service) HasAlias(alias string) bool

func (*Service) HasTag

func (s *Service) HasTag(key string, value string) bool

func (*Service) HasTool

func (s *Service) HasTool(category ToolCategory, name string, environment string) bool

func (*Service) Hydrate

func (s *Service) Hydrate(client *Client) error

type ServiceConnection

type ServiceConnection struct {
	Nodes      []Service
	PageInfo   PageInfo
	TotalCount graphql.Int
}

func (*ServiceConnection) Hydrate

func (conn *ServiceConnection) Hydrate(client *Client) error

func (*ServiceConnection) Query added in v0.3.0

func (conn *ServiceConnection) Query(client *Client, q interface{}, v PayloadVariables) ([]Service, error)

TODO: maybe we can find a way to merge ServiceConnection.Query & Hydrate

type ServiceCreateInput

type ServiceCreateInput struct {
	Name        string `json:"name"`
	Product     string `json:"product,omitempty"`
	Description string `json:"description,omitempty"`
	Language    string `json:"language,omitempty"`
	Framework   string `json:"framework,omitempty"`
	Tier        string `json:"tierAlias,omitempty"`
	Owner       string `json:"ownerAlias,omitempty"`
	Lifecycle   string `json:"lifecycleAlias,omitempty"`
}

type ServiceDeleteInput

type ServiceDeleteInput struct {
	Id    graphql.ID `json:"id,omitempty"`
	Alias string     `json:"alias,omitempty"`
}

type ServiceId

type ServiceId struct {
	Id graphql.ID `json:"id"`
}

type ServicePropertyCheckFragment added in v0.3.0

type ServicePropertyCheckFragment struct {
	Property  ServicePropertyTypeEnum `graphql:"serviceProperty"`
	Predicate *Predicate              `graphql:"propertyValuePredicate"`
}

type ServicePropertyTypeEnum added in v0.4.0

type ServicePropertyTypeEnum string

ServicePropertyTypeEnum represents properties of services that can be validated.

const (
	ServicePropertyTypeEnumDescription    ServicePropertyTypeEnum = "description"     // The description of a service.
	ServicePropertyTypeEnumName           ServicePropertyTypeEnum = "name"            // The name of a service.
	ServicePropertyTypeEnumLanguage       ServicePropertyTypeEnum = "language"        // The primary programming language of a service.
	ServicePropertyTypeEnumFramework      ServicePropertyTypeEnum = "framework"       // The primary software development framework of a service.
	ServicePropertyTypeEnumProduct        ServicePropertyTypeEnum = "product"         // The product that is associated with a service.
	ServicePropertyTypeEnumLifecycleIndex ServicePropertyTypeEnum = "lifecycle_index" // The index of the lifecycle a service belongs to.
	ServicePropertyTypeEnumTierIndex      ServicePropertyTypeEnum = "tier_index"      // The index of the tier a service belongs to.
)

type ServiceRepository added in v0.2.1

type ServiceRepository struct {
	BaseDirectory string
	DisplayName   string
	Id            graphql.ID
	Repository    RepositoryId
	Service       ServiceId
}

type ServiceRepositoryConnection added in v0.2.1

type ServiceRepositoryConnection struct {
	Edges      []ServiceRepositoryEdge
	PageInfo   PageInfo
	TotalCount graphql.Int
}

func (*ServiceRepositoryConnection) Hydrate added in v0.2.1

func (conn *ServiceRepositoryConnection) Hydrate(id graphql.ID, client *Client) error

type ServiceRepositoryCreateInput added in v0.2.1

type ServiceRepositoryCreateInput struct {
	Service       IdentifierInput `json:"service"`
	Repository    IdentifierInput `json:"repository"`
	BaseDirectory string          `json:"baseDirectory"`
	DisplayName   string          `json:"displayName,omitempty"`
}

type ServiceRepositoryEdge added in v0.2.1

type ServiceRepositoryEdge struct {
	Node                RepositoryId
	ServiceRepositories []ServiceRepository
}

type ServiceRepositoryUpdateInput added in v0.2.1

type ServiceRepositoryUpdateInput struct {
	Id            graphql.ID `json:"id"`
	BaseDirectory string     `json:"baseDirectory,omitempty"`
	DisplayName   string     `json:"displayName,omitempty"`
}

type ServiceUpdateInput

type ServiceUpdateInput struct {
	Id          graphql.ID `json:"id,omitempty"`
	Alias       string     `json:"alias,omitempty"`
	Name        string     `json:"name,omitempty"`
	Product     string     `json:"product,omitempty"`
	Description string     `json:"description,omitempty"`
	Language    string     `json:"language,omitempty"`
	Framework   string     `json:"framework,omitempty"`
	Tier        string     `json:"tierAlias,omitempty"`
	Owner       string     `json:"ownerAlias,omitempty"`
	Lifecycle   string     `json:"lifecycleAlias,omitempty"`
}

type Tag

type Tag struct {
	Id    graphql.ID `json:"id"`
	Key   string     `json:"key"`
	Value string     `json:"value"`
}

type TagArgs added in v0.3.0

type TagArgs struct {
	Key   string `json:"key,omitempty"`
	Value string `json:"value,omitempty"`
}

func NewTagArgs added in v0.3.0

func NewTagArgs(tag string) TagArgs

type TagAssignInput

type TagAssignInput struct {
	Id    graphql.ID       `json:"id,omitempty"`
	Alias string           `json:"alias,omitempty"`
	Type  TaggableResource `json:"type,omitempty"`
	Tags  []TagInput       `json:"tags"`
}

func (*TagAssignInput) Validate added in v0.3.0

func (t *TagAssignInput) Validate() error

type TagConnection

type TagConnection struct {
	Nodes      []Tag
	PageInfo   PageInfo
	TotalCount int
}

func (*TagConnection) Hydrate

func (conn *TagConnection) Hydrate(service graphql.ID, client *Client) error

type TagCreateInput

type TagCreateInput struct {
	Id    graphql.ID       `json:"id"`
	Alias string           `json:"alias,omitempty"`
	Type  TaggableResource `json:"type,omitempty"`
	Key   string           `json:"key"`
	Value string           `json:"value"`
}

func (*TagCreateInput) Validate added in v0.3.0

func (t *TagCreateInput) Validate() error

type TagDefinedCheckFragment added in v0.3.0

type TagDefinedCheckFragment struct {
	TagKey       string     `graphql:"tagKey"`
	TagPredicate *Predicate `graphql:"tagPredicate"`
}

type TagDeleteInput

type TagDeleteInput struct {
	Id graphql.ID `json:"id"`
}

type TagInput

type TagInput struct {
	Key   string `json:"key"`
	Value string `json:"value"`
}

func (*TagInput) Validate added in v0.3.0

func (t *TagInput) Validate() error

type TagOwner

type TagOwner string
const (
	TagOwnerService    TagOwner = "Service"
	TagOwnerRepository TagOwner = "Repository"
)

type TagUpdateInput

type TagUpdateInput struct {
	Id    graphql.ID `json:"id"`
	Key   string     `json:"key,omitempty"`
	Value string     `json:"value,omitempty"`
}

func (*TagUpdateInput) Validate added in v0.3.0

func (t *TagUpdateInput) Validate() error

type TaggableResource

type TaggableResource string

TaggableResource represents possible types to apply tags to.

const (
	TaggableResourceService    TaggableResource = "Service"    // Used to identify a Service.
	TaggableResourceRepository TaggableResource = "Repository" // Used to identify a Repository.
)

type Team

type Team struct {
	TeamId

	Aliases          []string
	Contacts         []Contact
	HTMLUrl          string
	Manager          User
	Members          UserConnection
	Name             string
	Responsibilities string
}

func (*Team) Hydrate added in v0.4.0

func (self *Team) Hydrate(client *Client) error

type TeamConnection

type TeamConnection struct {
	Nodes    []Team
	PageInfo PageInfo
}

func (*TeamConnection) Hydrate added in v0.4.0

func (conn *TeamConnection) Hydrate(client *Client) error

func (*TeamConnection) Query added in v0.4.0

func (conn *TeamConnection) Query(client *Client, q interface{}, v PayloadVariables) ([]Team, error)

type TeamCreateInput

type TeamCreateInput struct {
	Name             string         `json:"name"`
	ManagerEmail     string         `json:"managerEmail,omitempty"`
	Responsibilities string         `json:"responsibilities,omitempty"`
	Contacts         []ContactInput `json:"contacts,omitempty"`
}

type TeamDeleteInput

type TeamDeleteInput struct {
	Id    graphql.ID `json:"id,omitempty"`
	Alias string     `json:"alias,omitempty"`
}

type TeamId added in v0.4.0

type TeamId struct {
	Alias string
	Id    graphql.ID
}

type TeamMembershipCreateInput added in v0.4.0

type TeamMembershipCreateInput struct {
	TeamId  graphql.ID                `json:"teamId"`
	Members []TeamMembershipUserInput `json:"members"`
}

type TeamMembershipDeleteInput added in v0.4.0

type TeamMembershipDeleteInput struct {
	TeamId  graphql.ID                `json:"teamId"`
	Members []TeamMembershipUserInput `json:"members"`
}

type TeamMembershipUserInput added in v0.4.0

type TeamMembershipUserInput struct {
	Email string `json:"email"`
}

func BuildMembershipInput added in v0.4.0

func BuildMembershipInput(members []string) (output []TeamMembershipUserInput)

type TeamUpdateInput

type TeamUpdateInput struct {
	Id               graphql.ID `json:"id,omitempty"`
	Alias            string     `json:"alias,omitempty"`
	Name             string     `json:"name,omitempty"`
	ManagerEmail     string     `json:"managerEmail,omitempty"`
	Responsibilities string     `json:"responsibilities,omitempty"`
}

type Tier

type Tier struct {
	Alias       string
	Description string
	Id          graphql.ID
	Index       int
	Name        string
}

type Tool

type Tool struct {
	Category      ToolCategory
	CategoryAlias string `json:",omitempty"`
	DisplayName   string
	Environment   string     `json:",omitempty"`
	Id            graphql.ID `json:",omitempty"`
	Url           string
	Service       ServiceId
}

type ToolCategory

type ToolCategory string

ToolCategory represents the specific categories that a tool can belong to.

const (
	ToolCategoryAdmin                 ToolCategory = "admin"                  // Tools used for administrative purposes.
	ToolCategoryAPIDocumentation      ToolCategory = "api_documentation"      // Tools used as API documentation for this service.
	ToolCategoryCode                  ToolCategory = "code"                   // Tools used for source code.
	ToolCategoryContinuousIntegration ToolCategory = "continuous_integration" // Tools used for building/unit testing a service.
	ToolCategoryDeployment            ToolCategory = "deployment"             // Tools used for deploying changes to a service.
	ToolCategoryErrors                ToolCategory = "errors"                 // Tools used for tracking/reporting errors.
	ToolCategoryFeatureFlag           ToolCategory = "feature_flag"           // Tools used for managing feature flags.
	ToolCategoryHealthChecks          ToolCategory = "health_checks"          // Tools used for tracking/reporting the health of a service.
	ToolCategoryIncidents             ToolCategory = "incidents"              // Tools used to surface incidents on a service.
	ToolCategoryLogs                  ToolCategory = "logs"                   // Tools used for displaying logs from services.
	ToolCategoryMetrics               ToolCategory = "metrics"                // Tools used for tracking/reporting service metrics.
	ToolCategoryOrchestrator          ToolCategory = "orchestrator"           // Tools used for orchestrating a service.
	ToolCategoryRunbooks              ToolCategory = "runbooks"               // Tools used for managing runbooks for a service.
	ToolCategoryStatusPage            ToolCategory = "status_page"            // Tools used for reporting the status of a service.
	ToolCategoryWiki                  ToolCategory = "wiki"                   // Tools used as a wiki for this service.
	ToolCategoryOther                 ToolCategory = "other"                  // Tools that do not fit into the available categories.
)

type ToolConnection

type ToolConnection struct {
	Nodes      []Tool
	PageInfo   PageInfo
	TotalCount int
}

func (*ToolConnection) Hydrate

func (conn *ToolConnection) Hydrate(service graphql.ID, client *Client) error

type ToolCreateInput

type ToolCreateInput struct {
	Category     ToolCategory `json:"category"`
	DisplayName  string       `json:"displayName"`
	Url          string       `json:"url"`
	Environment  string       `json:"environment,omitempty"`
	ServiceId    graphql.ID   `json:"serviceId,omitempty"`
	ServiceAlias string       `json:"serviceAlias,omitempty"`
}

type ToolDeleteInput added in v0.3.0

type ToolDeleteInput struct {
	Id graphql.ID `json:"id"`
}

type ToolUpdateInput added in v0.3.0

type ToolUpdateInput struct {
	Id          graphql.ID   `json:"id"`
	Category    ToolCategory `json:"category,omitempty"`
	DisplayName string       `json:"displayName,omitempty"`
	Url         string       `json:"url,omitempty"`
	Environment string       `json:"environment,omitempty"`
}

type ToolUsageCheckFragment added in v0.3.0

type ToolUsageCheckFragment struct {
	ToolCategory         ToolCategory `graphql:"toolCategory"`
	ToolNamePredicate    *Predicate   `graphql:"toolNamePredicate"`
	EnvironmentPredicate *Predicate   `graphql:"environmentPredicate"`
}

type User

type User struct {
	Email   string
	HTMLUrl string
	Id      graphql.ID
	Name    string
	Role    UserRole
}

type UserConnection added in v0.4.0

type UserConnection struct {
	Nodes    []User
	PageInfo PageInfo
}

func (*UserConnection) Hydrate added in v0.4.0

func (conn *UserConnection) Hydrate(id graphql.ID, client *Client) error

type UserRole added in v0.4.0

type UserRole string

UserRole represents a role that can be assigned to a user.

const (
	UserRoleUser  UserRole = "user"  // A regular user on the account.
	UserRoleAdmin UserRole = "admin" // An administrator on the account.
)

Directories

Path Synopsis
Wrapping the client can be useful when you want to override default behavior, such as always setting context or disallowing (to the best of Go's ability) access to specific receiver functions on `opslevel.Client`.
Wrapping the client can be useful when you want to override default behavior, such as always setting context or disallowing (to the best of Go's ability) access to specific receiver functions on `opslevel.Client`.

Jump to

Keyboard shortcuts

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