Documentation ¶
Index ¶
- Constants
- Variables
- func JwtTokenGenerator(payload map[string]any, secret string) common.DynamicHeadersGenerator
- type AuthMetadataVars
- type Connector
- func (c *Connector) Delete(ctx context.Context, config common.DeleteParams) (*common.DeleteResult, error)
- func (c *Connector) GetPostAuthInfo(ctx context.Context) (*common.PostAuthInfo, error)
- func (c *Connector) HTTPClient() *common.HTTPClient
- func (c *Connector) JSONHTTPClient() *common.JSONHTTPClient
- func (c *Connector) ListObjectMetadata(ctx context.Context, _ []string) (*common.ListObjectMetadataResult, error)
- func (c *Connector) Provider() providers.Provider
- func (c *Connector) Read(ctx context.Context, config common.ReadParams) (*common.ReadResult, error)
- func (c *Connector) String() string
- func (c *Connector) Write(ctx context.Context, config common.WriteParams) (*common.WriteResult, error)
- type Option
- func WithAuthenticatedClient(client common.AuthenticatedHTTPClient) Option
- func WithClient(ctx context.Context, client *http.Client, config *oauth2.Config, ...) Option
- func WithMetadata(metadata map[string]string) Option
- func WithModule(module common.ModuleID) Option
- func WithWorkspace(workspaceRef string) Option
- type ResponseMessagesError
- type ResponseStatusError
Constants ¶
const ( // ModuleEmpty is used for proxying requests through. ModuleEmpty common.ModuleID = "module-empty" // ModuleJira is the module used for listing Jira issues. ModuleJira common.ModuleID = "jira" // ModuleAtlassianJiraConnect is the module used for Atlassian Connect. ModuleAtlassianJiraConnect common.ModuleID = "atlassian-connect" )
const QuerySeparator = "&" // nolint:gochecknoglobals
Variables ¶
var ( ErrDiscoveryFailure = errors.New("failed to collect post authentication data") ErrContainerNotFound = errors.New("cloud container was not found for chosen workspace") )
var ( ErrParsingMetadata = errors.New("couldn't parse metadata") ErrMissingMetadata = errors.New("there is no metadata for object") )
var ErrMissingCloudId = errors.New("connector missing cloud id")
ErrMissingCloudId happens when cloud id was not provided via WithMetadata.
Functions ¶
func JwtTokenGenerator ¶
func JwtTokenGenerator(payload map[string]any, secret string) common.DynamicHeadersGenerator
JwtTokenGenerator generates the claims on a per-request basis for Atlassian Connect. The JWT needs a query request hash, an issued time and an expiration time. The implementation has been adapted from https://bitbucket.org/atlassian/atlassian-jwt-js.git.
Types ¶
type AuthMetadataVars ¶
type AuthMetadataVars struct {
CloudId string
}
AuthMetadataVars is a complete list of authentication metadata associated with connector. This model serves as a documentation of map[string]string contents.
func NewAuthMetadataVars ¶
func NewAuthMetadataVars(dictionary map[string]string) *AuthMetadataVars
NewAuthMetadataVars parses map into the model.
func (AuthMetadataVars) AsMap ¶
func (v AuthMetadataVars) AsMap() *map[string]string
AsMap converts model back to the map.
type Connector ¶
type Connector struct { Client *common.JSONHTTPClient Module common.Module *providers.ProviderInfo // contains filtered or unexported fields }
func NewConnector ¶
func (*Connector) Delete ¶
func (c *Connector) Delete(ctx context.Context, config common.DeleteParams) (*common.DeleteResult, error)
Delete removes Jira issue.
func (*Connector) GetPostAuthInfo ¶
func (*Connector) HTTPClient ¶
func (c *Connector) HTTPClient() *common.HTTPClient
func (*Connector) JSONHTTPClient ¶
func (c *Connector) JSONHTTPClient() *common.JSONHTTPClient
JSONHTTPClient returns the underlying JSON HTTP client.
func (*Connector) ListObjectMetadata ¶
func (c *Connector) ListObjectMetadata(ctx context.Context, _ []string) (*common.ListObjectMetadataResult, error)
ListObjectMetadata lists builtin and custom fields. Supports only Issue object. Therefore, objectNames argument is ignored. API Reference: https://developer.atlassian.com/cloud/jira/platform/rest/v2/api-group-issue-fields/#api-rest-api-2-field-get
func (*Connector) Read ¶
func (c *Connector) Read(ctx context.Context, config common.ReadParams) (*common.ReadResult, error)
Read only returns a list of Jira Issues. You can provide the following values: * ObjectName - ignored. * NextPage - to get next page which may have no elements left. * Since - to scope the time frame, precision is in minutes.
func (*Connector) Write ¶
func (c *Connector) Write(ctx context.Context, config common.WriteParams) (*common.WriteResult, error)
Write will either create or update a Jira issue. Create issue docs: https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issues/#api-rest-api-3-issue-post Update issue docs: https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issues/#api-rest-api-3-issue-issueidorkey-put
type Option ¶
type Option = func(params *parameters)
Option is a function which mutates the connector configuration.
func WithAuthenticatedClient ¶
func WithAuthenticatedClient(client common.AuthenticatedHTTPClient) Option
func WithClient ¶
func WithMetadata ¶
WithMetadata sets authentication metadata expected by connector.
func WithModule ¶
WithModule sets the Atlassian API module to use for the connector. It's required.
func WithWorkspace ¶
type ResponseMessagesError ¶
type ResponseMessagesError struct { ErrorMessages []string `json:"errorMessages"` WarningMessages []string `json:"warningMessages"` Errors map[string]string `json:"errors"` }
func (ResponseMessagesError) CombineErr ¶
func (r ResponseMessagesError) CombineErr(base error) error
CombineErr will produce dynamic error from server response body. The base error serves as a main static error on top of stacked errors. That static error should be used in conditional decisions. Ex: common.ErrBadRequest.
type ResponseStatusError ¶
type ResponseStatusError struct { Status int `json:"status"` Error string `json:"error"` Message string `json:"message"` Path string `json:"path"` Timestamp time.Time `json:"timestamp"` }
func (ResponseStatusError) CombineErr ¶
func (r ResponseStatusError) CombineErr(base error) error