client

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2022 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrBadRequest represents an HTTP 400 error
	ErrBadRequest = errors.New("bad request")
	// ErrSystemUnavailable represents an hTTP 5xx error
	ErrSystemUnavailable = errors.New("system unavailable")
	// ErrUnauthorized represents an HTTP 401 error
	ErrUnauthorized = errors.New("unauthorized")
	// ErrForbidden represents an HTTP 403 permissions issue
	ErrForbidden = errors.New("access denied, check that you have access to this resource")
)

Functions

This section is empty.

Types

type APIKeyedError

type APIKeyedError map[apiErrorKey]apiErrorDescriptions

type Client

type Client struct {
	Config    Config
	UserAgent string
	// contains filtered or unexported fields
}

Client is the main Broker API interface. Use NewClient to get started

func NewClient

func NewClient(httpClient *http.Client, config Config) *Client

NewClient creates a new Broker API client with sensible but overridable defaults

func (*Client) AddAdminRoleToUser

func (c *Client) AddAdminRoleToUser(p broker.User) (*broker.User, error)

AddAdminRoleToUser converts a user to an administrator

func (*Client) AppendTeamAssignments

func (c *Client) AppendTeamAssignments(r broker.TeamsAssignmentRequest) (*broker.TeamsAssignmentResponse, error)

AppendTeamAssignments adds users to an existing Team (does not remove absent ones)

func (*Client) CreateEnvironment added in v0.3.4

CreateEnvironment creates an Environment

func (*Client) CreatePacticipant

func (c *Client) CreatePacticipant(p broker.Pacticipant) (*broker.Pacticipant, error)

CreatePacticipant creates a new Pacticipant

func (*Client) CreateRole

func (c *Client) CreateRole(p broker.Role) (*broker.Role, error)

CreateRole creates a Role

func (*Client) CreateSecret

func (c *Client) CreateSecret(s broker.Secret) (*broker.SecretResponse, error)

CreateSecret creates a new secret TODO: better response message for OSS broker vs Pactflow

func (*Client) CreateTeam

func (c *Client) CreateTeam(t broker.Team) (*broker.Team, error)

CreateTeam creates a Team

func (*Client) CreateUser

func (c *Client) CreateUser(p broker.User) (*broker.User, error)

CreateUser creates a user

func (*Client) CreateWebhook

func (c *Client) CreateWebhook(w broker.Webhook) (*broker.WebhookResponse, error)

CreateWebhook creates a new webhook

func (*Client) DeleteEnvironment added in v0.3.4

func (c *Client) DeleteEnvironment(p broker.Environment) error

DeleteEnvironment removes an Environment

func (*Client) DeletePacticipant

func (c *Client) DeletePacticipant(p broker.Pacticipant) error

DeletePacticipant removes an existing Pacticipant

func (*Client) DeleteRole

func (c *Client) DeleteRole(p broker.Role) error

DeleteRole removes a role

func (*Client) DeleteSecret

func (c *Client) DeleteSecret(s broker.Secret) error

DeleteSecret removes an existing secret

func (*Client) DeleteTeam

func (c *Client) DeleteTeam(t broker.Team) error

DeleteTeam deletes the Team

func (*Client) DeleteTeamAssignment

func (c *Client) DeleteTeamAssignment(t broker.Team, u broker.User) error

DeleteTeamAssignment removes a single user from a team

func (*Client) DeleteTeamAssignments

func (c *Client) DeleteTeamAssignments(t broker.TeamsAssignmentRequest) error

DeleteTeamAssignments removes specified users from the team

func (*Client) DeleteUser

func (c *Client) DeleteUser(p broker.User) error

DeleteUser simply de-activates an existing user. Users are global on the platform, but can be enabled/disabled at the tenant level

func (*Client) DeleteWebhook

func (c *Client) DeleteWebhook(w broker.Webhook) error

DeleteWebhook removes an existing webhook

func (*Client) FindTokenByType

func (c *Client) FindTokenByType(tokenType string) (*broker.APIToken, error)

FindTokenByType finds a token given it's s NOTE: this API will be deprecated once a full CRUD API is available

func (*Client) ReadEnvironment added in v0.3.4

func (c *Client) ReadEnvironment(uuid string) (*broker.Environment, error)

ReadEnvironment gets an Environment

func (*Client) ReadPacticipant

func (c *Client) ReadPacticipant(name string) (*broker.Pacticipant, error)

ReadPacticipant gets a pacticipant

func (*Client) ReadRole

func (c *Client) ReadRole(uuid string) (*broker.Role, error)

ReadRole gets a Role

func (*Client) ReadSecret

func (c *Client) ReadSecret(uuid string) (*broker.SecretResponse, error)

ReadSecret gets the current Secret information (the actual secret is not returned)

func (*Client) ReadTeam

func (c *Client) ReadTeam(t broker.Team) (*broker.Team, error)

ReadTeam gets a Team

func (*Client) ReadTeamAssignments

func (c *Client) ReadTeamAssignments(t broker.Team) (*broker.TeamsAssignmentResponse, error)

ReadTeamAssignments finds all users currently in a team

func (*Client) ReadTenantAuthenticationSettings

func (c *Client) ReadTenantAuthenticationSettings() (*broker.AuthenticationSettings, error)

ReadTenantAuthenticationSettings configures the authentication settings on a given Pactflow account

func (*Client) ReadToken

func (c *Client) ReadToken(uuid string) (*broker.APIToken, error)

ReadToken finds an API token given a UUID

func (*Client) ReadTokens

func (c *Client) ReadTokens() (*broker.APITokensResponse, error)

ReadTokens lists all tokens for the given user principal

func (*Client) ReadUser

func (c *Client) ReadUser(uuid string) (*broker.User, error)

ReadUser gets a User

func (*Client) ReadWebhook

func (c *Client) ReadWebhook(id string) (*broker.Webhook, error)

ReadWebhook returns a Webhook or an error for a given ID

func (*Client) RegenerateToken

func (c *Client) RegenerateToken(t broker.APIToken) (*broker.APITokenResponse, error)

RegenerateToken generates a new API Token for the given UUID

func (*Client) RemoveAdminRoleFromUser

func (c *Client) RemoveAdminRoleFromUser(p broker.User) (*broker.User, error)

RemoveAdminRoleFromUser removes the administrator role from a user

func (*Client) SetTenantAuthenticationSettings

func (c *Client) SetTenantAuthenticationSettings(r broker.AuthenticationSettings) (*broker.AuthenticationSettings, error)

SetTenantAuthenticationSettings configures the authentication settings on a given Pactflow account

func (*Client) SetUserRoles

func (c *Client) SetUserRoles(uuid string, r broker.SetUserRolesRequest) error

SetUserRoles sets the roles for a given user, removing any not given and adding those that were provided

func (*Client) UpdateEnvironment added in v0.3.4

UpdateEnvironment updates an Environment

func (*Client) UpdatePacticipant

func (c *Client) UpdatePacticipant(p broker.Pacticipant) (*broker.Pacticipant, error)

UpdatePacticipant updates an existing Pacticipant

func (*Client) UpdateRole

func (c *Client) UpdateRole(p broker.Role) (*broker.Role, error)

UpdateRole updates an existing Role

func (*Client) UpdateSecret

func (c *Client) UpdateSecret(s broker.Secret) (*broker.SecretResponse, error)

UpdateSecret updates an existing secret. All values may be changed

func (*Client) UpdateTeam

func (c *Client) UpdateTeam(t broker.Team) (*broker.Team, error)

UpdateTeam updates the team

func (*Client) UpdateTeamAssignments

func (c *Client) UpdateTeamAssignments(r broker.TeamsAssignmentRequest) (*broker.TeamsAssignmentResponse, error)

UpdateTeamAssignments sets the users for a given team, removing any existing users not in the specified request

func (*Client) UpdateUser

func (c *Client) UpdateUser(p broker.User) (*broker.User, error)

UpdateUser updates an existing User currently only supports modifying the "active" property

func (*Client) UpdateWebhook

func (c *Client) UpdateWebhook(w broker.Webhook) (*broker.WebhookResponse, error)

UpdateWebhook updates an existing webhook. Not all properties are mutable

type Config

type Config struct {
	AccessToken       string
	BasicAuthUsername string
	BasicAuthPassword string
	BaseURL           *url.URL
	CustomTLSConfig   *tls.Config
}

Config is the primary means to modify the Pact Broker http client

Jump to

Keyboard shortcuts

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