v3client

package
v0.0.0-...-8a9b062 Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2024 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MasheryTokenSystemProperty = "MasheryV3AccessToken"
	MasheryTokenEndpoint       = "https://api.mashery.com/v3/token"
)
View Source
const AccessTokenEnv = "MASHERY_V3_TOKEN"
View Source
const ApiKeyEnv = "MASHERY_V3API_KEY"
View Source
const ApiKeySecretEnv = "MASHERY_V3API_SECRET"
View Source
const AreaIdEnv = "MASHERY_AREA_ID"
View Source
const PackagePlanMethodAppCtx = "package plan method"
View Source
const PackagePlanMethodFilterAppCtx = "package plan method filter"
View Source
const UserNameEnv = "MASHERY_USER"
View Source
const UserPassEnv = "MASHERY_PASS"

Variables

View Source
var EmptyQuery = map[string]string{}
View Source
var MasheryApplicationPackageKeyFields = append(MasheryPackageKeyFields,
	"package", "plan")
View Source
var MasheryEmailTemplateSetFields = []string{"id", "created", "updated", "name", "type", "emailTemplates"}
View Source
var MasheryEmailTemplateSetFieldsStr = strings.Join(MasheryEmailTemplateSetFields, ",")
View Source
var MasheryEndpointFields = []string{
	"id", "allowMissingApiKey", "apiKeyValueLocationKey", "apiKeyValueLocations",
	"apiMethodDetectionKey", "apiMethodDetectionLocations", "cache", "connectionTimeoutForSystemDomainRequest",
	"connectionTimeoutForSystemDomainResponse", "cookiesDuringHttpRedirectsEnabled", "cors",
	"created", "customRequestAuthenticationAdapter", "dropApiKeyFromIncomingCall", "forceGzipOfBackendCall",
	"gzipPassthroughSupportEnabled", "headersToExcludeFromIncomingCall", "highSecurity",
	"hostPassthroughIncludedInBackendCallHeader", "inboundSslRequired", "inboundMsslRequired", "jsonpCallbackParameter",
	"jsonpCallbackParameterValue", "scheduledMaintenanceEvent", "forwardedHeaders", "returnedHeaders",
	"methods", "name", "numberOfHttpRedirectsToFollow", "outboundRequestTargetPath", "outboundRequestTargetQueryParameters",
	"outboundTransportProtocol", "processor", "publicDomains", "requestAuthenticationType",
	"requestPathAlias", "requestProtocol", "oauthGrantTypes", "stringsToTrimFromApiKey", "supportedHttpMethods",
	"systemDomainAuthentication", "systemDomains", "trafficManagerDomain", "updated", "useSystemDomainCredentials",
	"systemDomainCredentialKey", "systemDomainCredentialSecret",
	"errorSet", "userControlledErrorLocation", "userControlledErrorLocationKey",
}
View Source
var MasheryEndpointFieldsStr = strings.Join(MasheryEndpointFields, ",")
View Source
var MasheryErrorSetFields = []string{
	"id", "name", "type", "jsonp", "jsonpType", "errorMessages",
}

MasheryErrorSetFields all fields of Mashery error set

View Source
var MasheryMethodsFields = []string{"id", "name", "created", "updated", "sampleJsonResponse", "sampleXmlResponse"}
View Source
var MasheryMethodsFieldsStr = strings.Join(MasheryMethodsFields, ",")
View Source
var MasheryPackageFields = []string{
	"id", "name", "created", "updated", "description", "notifyDeveloperPeriod",
	"notifyDeveloperNearQuota", "notifyDeveloperOverQuota", "notifyDeveloperOverThrottle", "notifyAdminNearQuota",
	"notifyAdminPeriod", "notifyAdminOverQuota", "notifyAdminOverThrottle", "notifyAdminEmails",
	"nearQuotaThreshold", "eav", "keyAdapter", "keyLength",
	"sharedSecretLength", "plans", "organization",
}
View Source
var MasheryPackageFieldsStr = strings.Join(MasheryPackageFields, ",")
View Source
var MasheryPackageKeyFields = []string{
	"id", "apikey", "secret", "created", "updated", "rateLimitCeiling", "rateLimitExempt", "qpsLimitCeiling",
	"qpsLimitExempt", "status", "limits",
}
View Source
var MasheryPackageKeyFieldsStr = strings.Join(MasheryPackageKeyFields, ",")
View Source
var MasheryPackageKeyFullFields = append(MasheryPackageKeyFields, "package", "plan")
View Source
var MasheryPackageKeyFullFieldsStr = strings.Join(MasheryPackageKeyFullFields, ",")
View Source
var MasheryPlanFields = []string{
	"id", "created", "updated", "name", "description", "eav", "selfServiceKeyProvisioningEnabled",
	"adminKeyProvisioningEnabled", "notes", "maxNumKeysAllowed", "numKeysBeforeReview", "qpsLimitCeiling", "qpsLimitExempt",
	"qpsLimitKeyOverrideAllowed", "rateLimitCeiling", "rateLimitExempt", "rateLimitKeyOverrideAllowed", "rateLimitPeriod",
	"responseFilterOverrideAllowed", "status", "emailTemplateSetId", "adminEmailTemplateSetId",
	"services.id", "services.endpoints", "roles",
}
View Source
var MasheryPlanFieldsStr = strings.Join(MasheryPlanFields, ",")
View Source
var MasheryResponseFilterFields = []string{"id", "name", "created", "updated", "notes", "notes", "xmlFilterFields", "jsonFilterFields"}
View Source
var MasheryResponseFilterFieldsStr = strings.Join(MasheryResponseFilterFields, ",")
View Source
var MasheryServiceFields = []string{
	"id", "name", "created", "updated", "editorHandle", "revisionNumber", "robotsPolicy",
	"crossdomainPolicy", "description", "errorSets", "qpsLimitOverall", "rfc3986Encode",
	"securityProfile", "version", "cache", "organization",
}

MasheryServiceFields Usual mashery service fields without endpoints

View Source
var MasheryServiceFieldsWithEndpoinds = append(MasheryServiceFields, "endpoints")
View Source
var MasheryServiceFullFieldsStr = strings.Join(MasheryServiceFieldsWithEndpoinds, ",")

Joined strings, representing all fields of Mashery service. Used (frequently) in {@link HttpTransport#GetService}

Functions

func AccessTokenFromContext

func AccessTokenFromContext(ctx context.Context) string

func ContextWithAccessToken

func ContextWithAccessToken(ctx context.Context, token string) context.Context

func CreatePackagePlanMethodFilter

CreatePackagePlanMethodFilter Create a new service cache

func CreatePackagePlanServiceEndpointMethod

CreatePackagePlanServiceEndpointMethod Create a new service cache

func DefaultCredentialsFile

func DefaultCredentialsFile() string

func DefaultGetFieldsFromContext

func DefaultGetFieldsFromContext(defaultFields []string) func(context.Context) []string

func DefaultSavedAccessTokenFilePath

func DefaultSavedAccessTokenFilePath() string

func DeletePackagePlanMethod

DeletePackagePlanMethod Create a new service.

func DeleteServiceRoles

DeleteServiceRoles delete service roles

func EncryptInPlace

func EncryptInPlace(path string, pass string) error

func GetApplicationExtendedAttributes

func GetApplicationExtendedAttributes(ctx context.Context, appId masherytypes.ApplicationIdentifier, transport *transport.HttpTransport) (map[string]string, error)

func GetPackagePlanMethod

GetPackagePlanMethod Retrieve the information about a package plan method.

func GetServiceRoles

GetServiceRoles retrieve the roles that are attached to this service.

func LoadV3TokenResponse

func LoadV3TokenResponse(path string) (*masherytypes.TimedAccessTokenResponse, error)

func PersistV3TokenResponse

func PersistV3TokenResponse(dat *masherytypes.TimedAccessTokenResponse, path string) error

func ReadCiphertext

func ReadCiphertext(fileName string, pass string) ([]byte, error)

func ReadSavedV3TokenData

func ReadSavedV3TokenData(fp string) (*masherytypes.TimedAccessTokenResponse, error)

func ResponseDate

func ResponseDate(resp *http.Response) time.Time

func ReturnFields

func ReturnFields(ctx context.Context, v []string) context.Context

func RootCreator

func RootCreator[TParent, T any](creator CRUDCreator[TParent, T], rootIdent TParent) func(ctx context.Context, t T, c *transport.HttpTransport) (T, error)

func RootFetcher

func RootFetcher[TParent, T any](fetcher CRUDAllFetcher[TParent, T], rootIdent TParent) func(ctx context.Context, c *transport.HttpTransport) ([]T, error)

RootFetcher builds a fetch-all function that wraps a parent context object. Useful to shorten the signature where the object retrieved is already root, or to enforce a particular parent object context

func RootFilteredCounter

func RootFilteredCounter[TParent, T any](counter CRUDFilteredCounter[TParent, T], rootIdent TParent) func(context.Context, map[string]string, *transport.HttpTransport) (int64, error)

func RootFilteredFetcher

func RootFilteredFetcher[TParent, T any](fetcher CRUDFilteredFetcher[TParent, T], rootIdent TParent) func(context.Context, map[string]string, *transport.HttpTransport) ([]T, error)

func SetServiceRoles

SetServiceRoles set service roles for the given service. Empty array effectively deletes all associated roles.

func UpdateApplicationExtendedAttributes

func UpdateApplicationExtendedAttributes(ctx context.Context, appId masherytypes.ApplicationIdentifier, params map[string]string, transport *transport.HttpTransport) (map[string]string, error)

Types

type AsyncFetchResult

type AsyncFetchResult struct {
	Data *http.Response
	Err  error
}

type BiConsumer

type BiConsumer[T1, T2 any] func(t1 T1, t2 T2)

type BiConsumerCanErr

type BiConsumerCanErr[T1, T2 any] func(t1 T1, t2 T2) error

type BiConsumerCanErrLocator

type BiConsumerCanErrLocator[TInA, TInB any] func(cl Client) BiConsumerCanErr[TInA, TInB]

type BiExchangeFunc

type BiExchangeFunc[TRequest1, TRequest2, TResponse any] func(ctx context.Context, req1 TRequest1, req TRequest2, c *transport.HttpTransport) (TResponse, error)

type CRUDAllFetcher

type CRUDAllFetcher[TParent, T any] func(ctx context.Context, ident TParent, c *transport.HttpTransport) ([]T, error)

type CRUDCreator

type CRUDCreator[TParent, T any] func(ctx context.Context, ident TParent, upsert T, c *transport.HttpTransport) (T, error)

type CRUDFilteredCounter

type CRUDFilteredCounter[TParent, T any] func(ctx context.Context, ident TParent, filter map[string]string, c *transport.HttpTransport) (int64, error)

type CRUDFilteredFetcher

type CRUDFilteredFetcher[TParent, T any] func(ctx context.Context, ident TParent, filter map[string]string, c *transport.HttpTransport) ([]T, error)

type CRUDGetter

type CRUDGetter[TIdent, T any] func(ctx context.Context, ident TIdent, c *transport.HttpTransport) (T, bool, error)

func GetWithFields

func GetWithFields[TIdent, T any](fields []string, getter CRUDGetter[TIdent, T]) CRUDGetter[TIdent, T]

type Client

type Client interface {
	// GetPublicDomains Get public domains in this area
	GetPublicDomains(ctx context.Context) ([]masherytypes.DomainAddress, error)
	GetSystemDomains(ctx context.Context) ([]masherytypes.DomainAddress, error)

	// GetApplication Retrieve the details of the application
	GetApplication(ctx context.Context, appId masherytypes.ApplicationIdentifier) (masherytypes.Application, bool, error)
	GetApplicationExtendedAttributes(ctx context.Context, appId masherytypes.ApplicationIdentifier) (map[string]string, error)
	UpdateApplicationExtendedAttributes(ctx context.Context, appId masherytypes.ApplicationIdentifier, params map[string]string) (map[string]string, error)
	GetApplicationPackageKeys(ctx context.Context, appId masherytypes.ApplicationIdentifier) ([]masherytypes.ApplicationPackageKey, error)
	CountApplicationPackageKeys(ctx context.Context, appId masherytypes.ApplicationIdentifier) (int64, error)
	GetFullApplication(ctx context.Context, id masherytypes.ApplicationIdentifier) (masherytypes.Application, bool, error)
	CreateApplication(ctx context.Context, memberId masherytypes.MemberIdentifier, app masherytypes.Application) (masherytypes.Application, error)
	UpdateApplication(ctx context.Context, app masherytypes.Application) (masherytypes.Application, error)
	DeleteApplication(ctx context.Context, appId masherytypes.ApplicationIdentifier) error
	CountApplicationsOfMember(ctx context.Context, memberId masherytypes.MemberIdentifier) (int64, error)
	ListApplications(ctx context.Context) ([]masherytypes.Application, error)
	ListApplicationsFiltered(ctx context.Context, p map[string]string) ([]masherytypes.Application, error)

	// Email template sets
	GetEmailTemplateSet(ctx context.Context, id string) (masherytypes.EmailTemplateSet, bool, error)
	ListEmailTemplateSets(ctx context.Context) ([]masherytypes.EmailTemplateSet, error)
	ListEmailTemplateSetsFiltered(ctx context.Context, params map[string]string) ([]masherytypes.EmailTemplateSet, error)

	// Endpoints
	ListEndpoints(ctx context.Context, serviceId masherytypes.ServiceIdentifier) ([]masherytypes.AddressableV3Object, error)
	ListEndpointsWithFullInfo(ctx context.Context, serviceId masherytypes.ServiceIdentifier) ([]masherytypes.Endpoint, error)
	CreateEndpoint(ctx context.Context, serviceId masherytypes.ServiceIdentifier, endp masherytypes.Endpoint) (masherytypes.Endpoint, error)
	UpdateEndpoint(ctx context.Context, endp masherytypes.Endpoint) (masherytypes.Endpoint, error)
	GetEndpoint(ctx context.Context, ident masherytypes.ServiceEndpointIdentifier) (masherytypes.Endpoint, bool, error)
	DeleteEndpoint(ctx context.Context, ident masherytypes.ServiceEndpointIdentifier) error
	CountEndpointsOf(ctx context.Context, serviceId masherytypes.ServiceIdentifier) (int64, error)

	// Endpoint methods
	ListEndpointMethods(ctx context.Context, ident masherytypes.ServiceEndpointIdentifier) ([]masherytypes.AddressableV3Object, error)
	ListEndpointMethodsWithFullInfo(ctx context.Context, dent masherytypes.ServiceEndpointIdentifier) ([]masherytypes.ServiceEndpointMethod, error)
	CreateEndpointMethod(ctx context.Context, ident masherytypes.ServiceEndpointIdentifier, methodUpsert masherytypes.ServiceEndpointMethod) (masherytypes.ServiceEndpointMethod, error)
	UpdateEndpointMethod(ctx context.Context, methUpsert masherytypes.ServiceEndpointMethod) (masherytypes.ServiceEndpointMethod, error)
	GetEndpointMethod(ctx context.Context, ident masherytypes.ServiceEndpointMethodIdentifier) (masherytypes.ServiceEndpointMethod, bool, error)
	DeleteEndpointMethod(ctx context.Context, ident masherytypes.ServiceEndpointMethodIdentifier) error
	CountEndpointsMethodsOf(ctx context.Context, identifier masherytypes.ServiceEndpointIdentifier) (int64, error)

	// Endpoint method filters
	ListEndpointMethodFilters(ctx context.Context, ident masherytypes.ServiceEndpointMethodIdentifier) ([]masherytypes.AddressableV3Object, error)
	ListEndpointMethodFiltersWithFullInfo(ctx context.Context, ident masherytypes.ServiceEndpointMethodIdentifier) ([]masherytypes.ServiceEndpointMethodFilter, error)
	CreateEndpointMethodFilter(ctx context.Context, ident masherytypes.ServiceEndpointMethodIdentifier, filterUpsert masherytypes.ServiceEndpointMethodFilter) (masherytypes.ServiceEndpointMethodFilter, error)
	UpdateEndpointMethodFilter(ctx context.Context, methUpsert masherytypes.ServiceEndpointMethodFilter) (masherytypes.ServiceEndpointMethodFilter, error)
	GetEndpointMethodFilter(ctx context.Context, ident masherytypes.ServiceEndpointMethodFilterIdentifier) (masherytypes.ServiceEndpointMethodFilter, bool, error)
	DeleteEndpointMethodFilter(ctx context.Context, ident masherytypes.ServiceEndpointMethodFilterIdentifier) error
	CountEndpointsMethodsFiltersOf(ctx context.Context, ident masherytypes.ServiceEndpointMethodIdentifier) (int64, error)

	// Member
	GetMember(ctx context.Context, id masherytypes.MemberIdentifier) (masherytypes.Member, bool, error)
	GetFullMember(ctx context.Context, id masherytypes.MemberIdentifier) (masherytypes.Member, bool, error)
	CreateMember(ctx context.Context, member masherytypes.Member) (masherytypes.Member, error)
	UpdateMember(ctx context.Context, member masherytypes.Member) (masherytypes.Member, error)
	DeleteMember(ctx context.Context, memberId masherytypes.MemberIdentifier) error
	ListMembers(ctx context.Context) ([]masherytypes.Member, error)
	ListMembersFiltered(ctx context.Context, params map[string]string) ([]masherytypes.Member, error)

	// Packages
	GetPackage(ctx context.Context, id masherytypes.PackageIdentifier) (masherytypes.Package, bool, error)
	CreatePackage(ctx context.Context, pack masherytypes.Package) (masherytypes.Package, error)
	UpdatePackage(ctx context.Context, pack masherytypes.Package) (masherytypes.Package, error)
	ResetPackageOwnership(ctx context.Context, pack masherytypes.PackageIdentifier) (masherytypes.Package, error)
	DeletePackage(ctx context.Context, packId masherytypes.PackageIdentifier) error
	ListPackages(ctx context.Context) ([]masherytypes.Package, error)
	ListPackagesFiltered(ctx context.Context, params map[string]string) ([]masherytypes.Package, error)

	// Package plans
	CreatePlanService(ctx context.Context, planService masherytypes.PackagePlanServiceIdentifier) (masherytypes.AddressableV3Object, error)
	CheckPlanServiceExists(ctx context.Context, planService masherytypes.PackagePlanServiceIdentifier) (bool, error)
	DeletePlanService(ctx context.Context, planService masherytypes.PackagePlanServiceIdentifier) error
	CreatePlanEndpoint(ctx context.Context, planEndp masherytypes.PackagePlanServiceEndpointIdentifier) (masherytypes.AddressableV3Object, error)
	CheckPlanEndpointExists(ctx context.Context, planEndp masherytypes.PackagePlanServiceEndpointIdentifier) (bool, error)
	DeletePlanEndpoint(ctx context.Context, planEndp masherytypes.PackagePlanServiceEndpointIdentifier) error
	ListPlanEndpoints(ctx context.Context, planService masherytypes.PackagePlanServiceIdentifier) ([]masherytypes.AddressableV3Object, error)
	CountPlanService(ctx context.Context, ident masherytypes.PackagePlanIdentifier) (int64, error)
	GetPlan(ctx context.Context, ident masherytypes.PackagePlanIdentifier) (masherytypes.Plan, bool, error)
	CreatePlan(ctx context.Context, packageId masherytypes.PackageIdentifier, plan masherytypes.Plan) (masherytypes.Plan, error)
	UpdatePlan(ctx context.Context, plan masherytypes.Plan) (masherytypes.Plan, error)
	DeletePlan(ctx context.Context, ident masherytypes.PackagePlanIdentifier) error
	CountPlans(ctx context.Context, packageId masherytypes.PackageIdentifier) (int64, error)
	ListPlans(ctx context.Context, packageId masherytypes.PackageIdentifier) ([]masherytypes.Plan, error)
	ListPlansFiltered(ctx context.Context, packageId masherytypes.PackageIdentifier, params map[string]string) ([]masherytypes.Plan, error)
	ListPlanServices(ctx context.Context, ident masherytypes.PackagePlanIdentifier) ([]masherytypes.Service, error)

	CountPlanEndpoints(ctx context.Context, planService masherytypes.PackagePlanServiceIdentifier) (int64, error)

	// Plan methods
	ListPackagePlanMethods(ctx context.Context, id masherytypes.PackagePlanServiceEndpointIdentifier) ([]masherytypes.PackagePlanServiceEndpointMethod, error)
	GetPackagePlanMethod(ctx context.Context, id masherytypes.PackagePlanServiceEndpointMethodIdentifier) (masherytypes.PackagePlanServiceEndpointMethod, bool, error)
	CreatePackagePlanMethod(ctx context.Context, id masherytypes.PackagePlanServiceEndpointMethodIdentifier) (masherytypes.PackagePlanServiceEndpointMethod, error)
	DeletePackagePlanMethod(ctx context.Context, id masherytypes.PackagePlanServiceEndpointMethodIdentifier) error

	// PLan method filter
	GetPackagePlanMethodFilter(ctx context.Context, id masherytypes.PackagePlanServiceEndpointMethodIdentifier) (masherytypes.PackagePlanServiceEndpointMethodFilter, bool, error)
	CreatePackagePlanMethodFilter(ctx context.Context, id masherytypes.PackagePlanServiceEndpointMethodFilterIdentifier) (masherytypes.PackagePlanServiceEndpointMethodFilter, error)
	DeletePackagePlanMethodFilter(ctx context.Context, id masherytypes.PackagePlanServiceEndpointMethodIdentifier) error

	// GetPackageKey Retrieves the application package key
	GetApplicationPackageKey(ctx context.Context, id masherytypes.ApplicationPackageKeyIdentifier) (masherytypes.ApplicationPackageKey, bool, error)
	CreateApplicationPackageKey(ctx context.Context, appId masherytypes.ApplicationIdentifier, packageKey masherytypes.ApplicationPackageKey) (masherytypes.ApplicationPackageKey, error)
	UpdateApplicationPackageKey(ctx context.Context, packageKey masherytypes.ApplicationPackageKey) (masherytypes.ApplicationPackageKey, error)
	DeleteApplicationPackageKey(ctx context.Context, keyId masherytypes.ApplicationPackageKeyIdentifier) error

	GetPackageKey(ctx context.Context, id masherytypes.PackageKeyIdentifier) (masherytypes.PackageKey, bool, error)
	CreatePackageKey(ctx context.Context, packageKey masherytypes.PackageKey) (masherytypes.PackageKey, error)
	UpdatePackageKey(ctx context.Context, packageKey masherytypes.PackageKey) (masherytypes.PackageKey, error)
	DeletePackageKey(ctx context.Context, keyId masherytypes.PackageKeyIdentifier) error

	ListPackageKeysFiltered(ctx context.Context, params map[string]string) ([]masherytypes.PackageKey, error)
	ListPackageKeys(ctx context.Context) ([]masherytypes.PackageKey, error)

	// Roles
	GetRole(ctx context.Context, id string) (masherytypes.Role, bool, error)
	ListRoles(ctx context.Context) ([]masherytypes.Role, error)
	ListRolesFiltered(ctx context.Context, params map[string]string) ([]masherytypes.Role, error)

	// GetService retrieves service based on the service identifier
	GetService(ctx context.Context, id masherytypes.ServiceIdentifier) (masherytypes.Service, bool, error)
	CreateService(ctx context.Context, service masherytypes.Service) (masherytypes.Service, error)
	UpdateService(ctx context.Context, service masherytypes.Service) (masherytypes.Service, error)
	DeleteService(ctx context.Context, serviceId masherytypes.ServiceIdentifier) error
	ListServicesFiltered(ctx context.Context, params map[string]string) ([]masherytypes.Service, error)
	ListServices(ctx context.Context) ([]masherytypes.Service, error)
	CountServices(ctx context.Context, params map[string]string) (int64, error)

	ListErrorSets(ctx context.Context, serviceId masherytypes.ServiceIdentifier, qs map[string]string) ([]masherytypes.ErrorSet, error)
	GetErrorSet(ctx context.Context, ident masherytypes.ErrorSetIdentifier) (masherytypes.ErrorSet, bool, error)
	CreateErrorSet(ctx context.Context, serviceId masherytypes.ServiceIdentifier, set masherytypes.ErrorSet) (masherytypes.ErrorSet, error)
	UpdateErrorSet(ctx context.Context, setData masherytypes.ErrorSet) (masherytypes.ErrorSet, error)
	DeleteErrorSet(ctx context.Context, ident masherytypes.ErrorSetIdentifier) error
	UpdateErrorSetMessage(ctx context.Context, msg masherytypes.MasheryErrorMessage) (masherytypes.MasheryErrorMessage, error)

	GetServiceRoles(ctx context.Context, serviceId masherytypes.ServiceIdentifier) ([]masherytypes.RolePermission, bool, error)
	SetServiceRoles(ctx context.Context, id masherytypes.ServiceIdentifier, roles []masherytypes.RolePermission) error
	DeleteServiceRoles(ctx context.Context, id masherytypes.ServiceIdentifier) error

	// Service cache
	GetServiceCache(ctx context.Context, id masherytypes.ServiceIdentifier) (masherytypes.ServiceCache, bool, error)
	CreateServiceCache(ctx context.Context, id masherytypes.ServiceIdentifier, service masherytypes.ServiceCache) (masherytypes.ServiceCache, error)
	UpdateServiceCache(ctx context.Context, service masherytypes.ServiceCache) (masherytypes.ServiceCache, error)
	DeleteServiceCache(ctx context.Context, id masherytypes.ServiceIdentifier) error

	// GetServiceOAuthSecurityProfile Service OAuth
	GetServiceOAuthSecurityProfile(ctx context.Context, id masherytypes.ServiceIdentifier) (masherytypes.MasheryOAuth, bool, error)
	CreateServiceOAuthSecurityProfile(ctx context.Context, id masherytypes.ServiceIdentifier, service masherytypes.MasheryOAuth) (masherytypes.MasheryOAuth, error)
	UpdateServiceOAuthSecurityProfile(ctx context.Context, service masherytypes.MasheryOAuth) (masherytypes.MasheryOAuth, error)
	DeleteServiceOAuthSecurityProfile(ctx context.Context, id masherytypes.ServiceIdentifier) error

	// ListOrganizations list all organizations defined
	ListOrganizations(ctx context.Context) ([]masherytypes.Organization, error)
	// ListOrganizationsFiltered list organizations matching the query string.
	ListOrganizationsFiltered(ctx context.Context, qs map[string]string) ([]masherytypes.Organization, error)
}

func NewCustomClient

func NewCustomClient(schema *ClientMethodSchema) Client

func NewHttpClient

func NewHttpClient(p Params) Client

func NewHttpClientWithBadRequestAutoRetries

func NewHttpClientWithBadRequestAutoRetries(p Params) Client

type ClientCredentialsProvider

type ClientCredentialsProvider struct {
	V3OAuthHelper

	Response *masherytypes.TimedAccessTokenResponse
	// contains filtered or unexported fields
}

func NewClientCredentialsProvider

func NewClientCredentialsProvider(credentials MasheryV3Credentials, tlsCfg *tls.Config) *ClientCredentialsProvider

func NewLiveCredentialsProviderUsing

func NewLiveCredentialsProviderUsing(credentials MasheryV3Credentials, endpoint string, tlsCfg *tls.Config) *ClientCredentialsProvider

func (*ClientCredentialsProvider) AccessToken

func (lcp *ClientCredentialsProvider) AccessToken(_ context.Context) (string, error)

func (*ClientCredentialsProvider) Close

func (lcp *ClientCredentialsProvider) Close()

func (*ClientCredentialsProvider) EnsureRefresh

func (lcp *ClientCredentialsProvider) EnsureRefresh()

func (*ClientCredentialsProvider) HeaderAuthorization

func (lcp *ClientCredentialsProvider) HeaderAuthorization(ctx context.Context) (map[string]string, error)

func (*ClientCredentialsProvider) OnPostRefresh

func (lcp *ClientCredentialsProvider) OnPostRefresh(f func())

func (*ClientCredentialsProvider) QueryStringAuthorization

func (lcp *ClientCredentialsProvider) QueryStringAuthorization(_ context.Context) (map[string]string, error)

func (*ClientCredentialsProvider) Refresh

func (lcp *ClientCredentialsProvider) Refresh() error

func (*ClientCredentialsProvider) TokenData

type ClientMethodSchema

type ClientMethodSchema struct {
	// Public and System Domains
	GetPublicDomains func(ctx context.Context, transport *transport.HttpTransport) ([]masherytypes.DomainAddress, error)
	GetSystemDomains func(ctx context.Context, transport *transport.HttpTransport) ([]masherytypes.DomainAddress, error)

	// Applications
	GetApplicationContext               func(ctx context.Context, appId masherytypes.ApplicationIdentifier, transport *transport.HttpTransport) (masherytypes.Application, bool, error)
	GetApplicationExtendedAttributes    func(ctx context.Context, appId masherytypes.ApplicationIdentifier, transport *transport.HttpTransport) (map[string]string, error)
	UpdateApplicationExtendedAttributes func(ctx context.Context, appId masherytypes.ApplicationIdentifier, params map[string]string, transport *transport.HttpTransport) (map[string]string, error)

	GetApplicationPackageKeys   func(ctx context.Context, appId masherytypes.ApplicationIdentifier, transport *transport.HttpTransport) ([]masherytypes.ApplicationPackageKey, error)
	CountApplicationPackageKeys func(ctx context.Context, appId masherytypes.ApplicationIdentifier, c *transport.HttpTransport) (int64, error)
	GetFullApplication          func(ctx context.Context, id masherytypes.ApplicationIdentifier, c *transport.HttpTransport) (masherytypes.Application, bool, error)
	CreateApplication           func(ctx context.Context, memberId masherytypes.MemberIdentifier, app masherytypes.Application, c *transport.HttpTransport) (masherytypes.Application, error)
	UpdateApplication           func(ctx context.Context, app masherytypes.Application, c *transport.HttpTransport) (masherytypes.Application, error)
	DeleteApplication           func(ctx context.Context, appId masherytypes.ApplicationIdentifier, c *transport.HttpTransport) error
	CountApplicationsOfMember   func(ctx context.Context, memberId masherytypes.MemberIdentifier, c *transport.HttpTransport) (int64, error)
	ListApplications            func(ctx context.Context, c *transport.HttpTransport) ([]masherytypes.Application, error)
	ListApplicationsFiltered    func(ctx context.Context, params map[string]string, c *transport.HttpTransport) ([]masherytypes.Application, error)

	// Email template set
	GetEmailTemplateSet           func(ctx context.Context, id string, c *transport.HttpTransport) (masherytypes.EmailTemplateSet, bool, error)
	ListEmailTemplateSets         func(ctx context.Context, c *transport.HttpTransport) ([]masherytypes.EmailTemplateSet, error)
	ListEmailTemplateSetsFiltered func(ctx context.Context, params map[string]string, c *transport.HttpTransport) ([]masherytypes.EmailTemplateSet, error)

	// Endpoints
	ListEndpoints             func(ctx context.Context, serviceId masherytypes.ServiceIdentifier, c *transport.HttpTransport) ([]masherytypes.AddressableV3Object, error)
	ListEndpointsWithFullInfo func(ctx context.Context, serviceId masherytypes.ServiceIdentifier, c *transport.HttpTransport) ([]masherytypes.Endpoint, error)
	CreateEndpoint            func(ctx context.Context, serviceId masherytypes.ServiceIdentifier, endp masherytypes.Endpoint, c *transport.HttpTransport) (masherytypes.Endpoint, error)
	UpdateEndpoint            func(ctx context.Context, endpoint masherytypes.Endpoint, c *transport.HttpTransport) (masherytypes.Endpoint, error)
	GetEndpoint               func(ctx context.Context, ident masherytypes.ServiceEndpointIdentifier, c *transport.HttpTransport) (masherytypes.Endpoint, bool, error)
	DeleteEndpoint            func(ctx context.Context, ident masherytypes.ServiceEndpointIdentifier, c *transport.HttpTransport) error
	CountEndpointsOf          func(ctx context.Context, serviceId masherytypes.ServiceIdentifier, c *transport.HttpTransport) (int64, error)

	// Endpoint Methods
	ListEndpointMethods             func(ctx context.Context, ident masherytypes.ServiceEndpointIdentifier, c *transport.HttpTransport) ([]masherytypes.AddressableV3Object, error)
	ListEndpointMethodsWithFullInfo func(ctx context.Context, ident masherytypes.ServiceEndpointIdentifier, c *transport.HttpTransport) ([]masherytypes.ServiceEndpointMethod, error)
	CreateEndpointMethod            func(ctx context.Context, ident masherytypes.ServiceEndpointIdentifier, methoUpsert masherytypes.ServiceEndpointMethod, c *transport.HttpTransport) (masherytypes.ServiceEndpointMethod, error)
	UpdateEndpointMethod            func(ctx context.Context, methUpsert masherytypes.ServiceEndpointMethod, c *transport.HttpTransport) (masherytypes.ServiceEndpointMethod, error)
	GetEndpointMethod               func(ctx context.Context, ident masherytypes.ServiceEndpointMethodIdentifier, c *transport.HttpTransport) (masherytypes.ServiceEndpointMethod, bool, error)
	DeleteEndpointMethod            func(ctx context.Context, ident masherytypes.ServiceEndpointMethodIdentifier, c *transport.HttpTransport) error
	CountEndpointsMethodsOf         func(ctx context.Context, ident masherytypes.ServiceEndpointIdentifier, c *transport.HttpTransport) (int64, error)

	// Endpoint method filters
	ListEndpointMethodFilters             func(ctx context.Context, ident masherytypes.ServiceEndpointMethodIdentifier, c *transport.HttpTransport) ([]masherytypes.AddressableV3Object, error)
	ListEndpointMethodFiltersWithFullInfo func(ctx context.Context, ident masherytypes.ServiceEndpointMethodIdentifier, c *transport.HttpTransport) ([]masherytypes.ServiceEndpointMethodFilter, error)
	CreateEndpointMethodFilter            func(ctx context.Context, ident masherytypes.ServiceEndpointMethodIdentifier, filterUpsert masherytypes.ServiceEndpointMethodFilter, c *transport.HttpTransport) (masherytypes.ServiceEndpointMethodFilter, error)
	UpdateEndpointMethodFilter            func(ctx context.Context, methUpsert masherytypes.ServiceEndpointMethodFilter, c *transport.HttpTransport) (masherytypes.ServiceEndpointMethodFilter, error)
	GetEndpointMethodFilter               func(ctx context.Context, ident masherytypes.ServiceEndpointMethodFilterIdentifier, c *transport.HttpTransport) (masherytypes.ServiceEndpointMethodFilter, bool, error)
	DeleteEndpointMethodFilter            func(ctx context.Context, dent masherytypes.ServiceEndpointMethodFilterIdentifier, c *transport.HttpTransport) error
	CountEndpointsMethodsFiltersOf        func(ctx context.Context, ident masherytypes.ServiceEndpointMethodIdentifier, c *transport.HttpTransport) (int64, error)

	// Member
	GetMember           func(ctx context.Context, id masherytypes.MemberIdentifier, c *transport.HttpTransport) (masherytypes.Member, bool, error)
	GetFullMember       func(ctx context.Context, id masherytypes.MemberIdentifier, c *transport.HttpTransport) (masherytypes.Member, bool, error)
	CreateMember        func(ctx context.Context, member masherytypes.Member, c *transport.HttpTransport) (masherytypes.Member, error)
	UpdateMember        func(ctx context.Context, member masherytypes.Member, c *transport.HttpTransport) (masherytypes.Member, error)
	DeleteMember        func(ctx context.Context, memberId masherytypes.MemberIdentifier, c *transport.HttpTransport) error
	ListMembers         func(ctx context.Context, c *transport.HttpTransport) ([]masherytypes.Member, error)
	ListMembersFiltered func(ctx context.Context, m map[string]string, c *transport.HttpTransport) ([]masherytypes.Member, error)

	// Packages
	GetPackage            func(ctx context.Context, id masherytypes.PackageIdentifier, c *transport.HttpTransport) (masherytypes.Package, bool, error)
	CreatePackage         func(ctx context.Context, pack masherytypes.Package, c *transport.HttpTransport) (masherytypes.Package, error)
	UpdatePackage         func(ctx context.Context, pack masherytypes.Package, c *transport.HttpTransport) (masherytypes.Package, error)
	ResetPackageOwnership func(ctx context.Context, pack masherytypes.PackageIdentifier, c *transport.HttpTransport) (masherytypes.Package, error)

	DeletePackage        func(ctx context.Context, packId masherytypes.PackageIdentifier, c *transport.HttpTransport) error
	ListPackages         func(ctx context.Context, c *transport.HttpTransport) ([]masherytypes.Package, error)
	ListPackagesFiltered func(ctx context.Context, params map[string]string, c *transport.HttpTransport) ([]masherytypes.Package, error)

	// Package plans
	CreatePlanService       func(ctx context.Context, planService masherytypes.PackagePlanServiceIdentifier, c *transport.HttpTransport) (masherytypes.AddressableV3Object, error)
	CheckPlanServiceExists  func(ctx context.Context, planService masherytypes.PackagePlanServiceIdentifier, c *transport.HttpTransport) (bool, error)
	DeletePlanService       func(ctx context.Context, planService masherytypes.PackagePlanServiceIdentifier, c *transport.HttpTransport) error
	CreatePlanEndpoint      func(ctx context.Context, planEndp masherytypes.PackagePlanServiceEndpointIdentifier, c *transport.HttpTransport) (masherytypes.AddressableV3Object, error)
	CheckPlanEndpointExists func(ctx context.Context, planEndp masherytypes.PackagePlanServiceEndpointIdentifier, c *transport.HttpTransport) (bool, error)
	DeletePlanEndpoint      func(ctx context.Context, planEndp masherytypes.PackagePlanServiceEndpointIdentifier, c *transport.HttpTransport) error
	ListPlanEndpoints       func(ctx context.Context, planService masherytypes.PackagePlanServiceIdentifier, c *transport.HttpTransport) ([]masherytypes.AddressableV3Object, error)

	CountPlanEndpoints func(ctx context.Context, planService masherytypes.PackagePlanServiceIdentifier, c *transport.HttpTransport) (int64, error)
	CountPlanService   func(ctx context.Context, ident masherytypes.PackagePlanIdentifier, c *transport.HttpTransport) (int64, error)
	GetPlan            func(ctx context.Context, ident masherytypes.PackagePlanIdentifier, c *transport.HttpTransport) (masherytypes.Plan, bool, error)
	CreatePlan         func(ctx context.Context, packageId masherytypes.PackageIdentifier, plan masherytypes.Plan, c *transport.HttpTransport) (masherytypes.Plan, error)
	UpdatePlan         func(ctx context.Context, plan masherytypes.Plan, c *transport.HttpTransport) (masherytypes.Plan, error)
	DeletePlan         func(ctx context.Context, dent masherytypes.PackagePlanIdentifier, c *transport.HttpTransport) error
	CountPlans         func(ctx context.Context, packageId masherytypes.PackageIdentifier, c *transport.HttpTransport) (int64, error)
	ListPlans          func(ctx context.Context, packageId masherytypes.PackageIdentifier, c *transport.HttpTransport) ([]masherytypes.Plan, error)
	ListPlansFiltered  func(ctx context.Context, packageId masherytypes.PackageIdentifier, params map[string]string, c *transport.HttpTransport) ([]masherytypes.Plan, error)
	ListPlanServices   func(ctx context.Context, dent masherytypes.PackagePlanIdentifier, c *transport.HttpTransport) ([]masherytypes.Service, error)

	// Plan methods
	ListPackagePlanMethods  func(ctx context.Context, id masherytypes.PackagePlanServiceEndpointIdentifier, c *transport.HttpTransport) ([]masherytypes.PackagePlanServiceEndpointMethod, error)
	GetPackagePlanMethod    func(ctx context.Context, id masherytypes.PackagePlanServiceEndpointMethodIdentifier, c *transport.HttpTransport) (masherytypes.PackagePlanServiceEndpointMethod, bool, error)
	CreatePackagePlanMethod func(ctx context.Context, ident masherytypes.PackagePlanServiceEndpointMethodIdentifier, c *transport.HttpTransport) (masherytypes.PackagePlanServiceEndpointMethod, error)
	DeletePackagePlanMethod func(ctx context.Context, id masherytypes.PackagePlanServiceEndpointMethodIdentifier, c *transport.HttpTransport) error

	// Plan method filter
	GetPackagePlanMethodFilter    func(ctx context.Context, id masherytypes.PackagePlanServiceEndpointMethodIdentifier, c *transport.HttpTransport) (masherytypes.PackagePlanServiceEndpointMethodFilter, bool, error)
	CreatePackagePlanMethodFilter func(ctx context.Context, ident masherytypes.PackagePlanServiceEndpointMethodFilterIdentifier, c *transport.HttpTransport) (masherytypes.PackagePlanServiceEndpointMethodFilter, error)
	DeletePackagePlanMethodFilter func(ctx context.Context, id masherytypes.PackagePlanServiceEndpointMethodIdentifier, c *transport.HttpTransport) error

	// Package key
	GetApplicationPackageKey    func(ctx context.Context, id masherytypes.ApplicationPackageKeyIdentifier, c *transport.HttpTransport) (masherytypes.ApplicationPackageKey, bool, error)
	CreateApplicationPackageKey func(ctx context.Context, appId masherytypes.ApplicationIdentifier, packageKey masherytypes.ApplicationPackageKey, c *transport.HttpTransport) (masherytypes.ApplicationPackageKey, error)
	UpdateApplicationPackageKey func(ctx context.Context, packageKey masherytypes.ApplicationPackageKey, c *transport.HttpTransport) (masherytypes.ApplicationPackageKey, error)
	DeleteApplicationPackageKey func(ctx context.Context, keyId masherytypes.ApplicationPackageKeyIdentifier, c *transport.HttpTransport) error

	GetPackageKey    func(ctx context.Context, id masherytypes.PackageKeyIdentifier, c *transport.HttpTransport) (masherytypes.PackageKey, bool, error)
	CreatePackageKey func(ctx context.Context, packageKey masherytypes.PackageKey, c *transport.HttpTransport) (masherytypes.PackageKey, error)
	UpdatePackageKey func(ctx context.Context, packageKey masherytypes.PackageKey, c *transport.HttpTransport) (masherytypes.PackageKey, error)
	DeletePackageKey func(ctx context.Context, keyId masherytypes.PackageKeyIdentifier, c *transport.HttpTransport) error

	ListPackageKeysFiltered func(ctx context.Context, params map[string]string, c *transport.HttpTransport) ([]masherytypes.PackageKey, error)
	ListPackageKeys         func(ctx context.Context, c *transport.HttpTransport) ([]masherytypes.PackageKey, error)

	// Roles
	GetRole           func(ctx context.Context, id string, c *transport.HttpTransport) (masherytypes.Role, bool, error)
	ListRoles         func(ctx context.Context, c *transport.HttpTransport) ([]masherytypes.Role, error)
	ListRolesFiltered func(ctx context.Context, params map[string]string, c *transport.HttpTransport) ([]masherytypes.Role, error)

	// Services
	GetService           func(ctx context.Context, id masherytypes.ServiceIdentifier, c *transport.HttpTransport) (masherytypes.Service, bool, error)
	CreateService        func(ctx context.Context, service masherytypes.Service, c *transport.HttpTransport) (masherytypes.Service, error)
	UpdateService        func(ctx context.Context, service masherytypes.Service, c *transport.HttpTransport) (masherytypes.Service, error)
	DeleteService        func(ctx context.Context, serviceId masherytypes.ServiceIdentifier, c *transport.HttpTransport) error
	ListServicesFiltered func(ctx context.Context, params map[string]string, c *transport.HttpTransport) ([]masherytypes.Service, error)
	ListServices         func(ctx context.Context, c *transport.HttpTransport) ([]masherytypes.Service, error)
	CountServices        func(ctx context.Context, params map[string]string, c *transport.HttpTransport) (int64, error)

	ListErrorSets         func(ctx context.Context, serviceId masherytypes.ServiceIdentifier, qs map[string]string, c *transport.HttpTransport) ([]masherytypes.ErrorSet, error)
	GetErrorSet           func(ctx context.Context, ident masherytypes.ErrorSetIdentifier, c *transport.HttpTransport) (masherytypes.ErrorSet, bool, error)
	CreateErrorSet        func(ctx context.Context, serviceId masherytypes.ServiceIdentifier, set masherytypes.ErrorSet, c *transport.HttpTransport) (masherytypes.ErrorSet, error)
	UpdateErrorSet        func(ctx context.Context, setData masherytypes.ErrorSet, c *transport.HttpTransport) (masherytypes.ErrorSet, error)
	DeleteErrorSet        func(ctx context.Context, ident masherytypes.ErrorSetIdentifier, c *transport.HttpTransport) error
	UpdateErrorSetMessage func(ctx context.Context, msg masherytypes.MasheryErrorMessage, c *transport.HttpTransport) (masherytypes.MasheryErrorMessage, error)

	GetServiceRoles    func(ctx context.Context, serviceId masherytypes.ServiceIdentifier, c *transport.HttpTransport) ([]masherytypes.RolePermission, bool, error)
	SetServiceRoles    func(ctx context.Context, id masherytypes.ServiceIdentifier, roles []masherytypes.RolePermission, c *transport.HttpTransport) error
	DeleteServiceRoles func(ctx context.Context, id masherytypes.ServiceIdentifier, c *transport.HttpTransport) error

	// Service cache
	GetServiceCache    func(ctx context.Context, id masherytypes.ServiceIdentifier, c *transport.HttpTransport) (masherytypes.ServiceCache, bool, error)
	CreateServiceCache func(ctx context.Context, id masherytypes.ServiceIdentifier, service masherytypes.ServiceCache, c *transport.HttpTransport) (masherytypes.ServiceCache, error)
	UpdateServiceCache func(ctx context.Context, service masherytypes.ServiceCache, c *transport.HttpTransport) (masherytypes.ServiceCache, error)
	DeleteServiceCache func(ctx context.Context, id masherytypes.ServiceIdentifier, c *transport.HttpTransport) error

	// Service OAuth
	GetServiceOAuthSecurityProfile    func(ctx context.Context, id masherytypes.ServiceIdentifier, c *transport.HttpTransport) (masherytypes.MasheryOAuth, bool, error)
	CreateServiceOAuthSecurityProfile func(ctx context.Context, id masherytypes.ServiceIdentifier, service masherytypes.MasheryOAuth, c *transport.HttpTransport) (masherytypes.MasheryOAuth, error)
	UpdateServiceOAuthSecurityProfile func(ctx context.Context, service masherytypes.MasheryOAuth, c *transport.HttpTransport) (masherytypes.MasheryOAuth, error)
	DeleteServiceOAuthSecurityProfile func(ctx context.Context, id masherytypes.ServiceIdentifier, c *transport.HttpTransport) error

	ListOrganizations         func(ctx context.Context, c *transport.HttpTransport) ([]masherytypes.Organization, error)
	ListOrganizationsFiltered func(ctx context.Context, qs map[string]string, c *transport.HttpTransport) ([]masherytypes.Organization, error)
}

func AutoRetryOnBadRequestMethodSchema

func AutoRetryOnBadRequestMethodSchema() *ClientMethodSchema

func StandardClientMethodSchema

func StandardClientMethodSchema() *ClientMethodSchema

type Consumer

type Consumer[T any] func(t1 T)

type ContextTokenProvider

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

func (*ContextTokenProvider) AccessToken

func (f *ContextTokenProvider) AccessToken(ctx context.Context) (string, error)

func (*ContextTokenProvider) Close

func (f *ContextTokenProvider) Close()

func (*ContextTokenProvider) HeaderAuthorization

func (f *ContextTokenProvider) HeaderAuthorization(ctx context.Context) (map[string]string, error)

func (*ContextTokenProvider) QueryStringAuthorization

func (f *ContextTokenProvider) QueryStringAuthorization(_ context.Context) (map[string]string, error)

type ExchangeBoolFunc

type ExchangeBoolFunc[TRequest, TResponse any] func(ctx context.Context, req TRequest, c *transport.HttpTransport) (TResponse, bool, error)

type ExchangeFunc

type ExchangeFunc[TRequest, TResponse any] func(ctx context.Context, req TRequest, c *transport.HttpTransport) (TResponse, error)

type FileSystemTokenProvider

type FileSystemTokenProvider struct {
	FixedTokenProvider

	Response *masherytypes.TimedAccessTokenResponse
	// contains filtered or unexported fields
}

FileSystemTokenProvider An access token provider that serve access token that has been pre-saved and persisted. The file will be periodically checked for the modification. The provider will retain the most recent successfully read response.

func (*FileSystemTokenProvider) AccessToken

func (f *FileSystemTokenProvider) AccessToken(ctx context.Context) (string, error)

func (*FileSystemTokenProvider) Close

func (f *FileSystemTokenProvider) Close()

func (*FileSystemTokenProvider) HeaderAuthorization

func (f *FileSystemTokenProvider) HeaderAuthorization(_ context.Context) (map[string]string, error)

type FixedSchemeClient

type FixedSchemeClient struct {
	PluggableClient
}

FixedSchemeClient Fixed method scheme client that will not allow changing schema after it was created.

func (*FixedSchemeClient) AssumeSchema

func (fsc *FixedSchemeClient) AssumeSchema(_ *ClientMethodSchema)

type FixedTokenProvider

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

FixedTokenProvider Implementation of a fixed access token provider

func (*FixedTokenProvider) AccessToken

func (f *FixedTokenProvider) AccessToken(_ context.Context) (string, error)

func (*FixedTokenProvider) Close

func (f *FixedTokenProvider) Close()

func (*FixedTokenProvider) HeaderAuthorization

func (f *FixedTokenProvider) HeaderAuthorization(_ context.Context) (map[string]string, error)

func (*FixedTokenProvider) QueryStringAuthorization

func (f *FixedTokenProvider) QueryStringAuthorization(_ context.Context) (map[string]string, error)

func (*FixedTokenProvider) UpdateToken

func (f *FixedTokenProvider) UpdateToken(tkn string)

type GenericCRUD

type GenericCRUD[TParent, TIdent, T any] struct {
	AppContext string
	Decorator  GenericCRUDDecorator[TParent, TIdent, T]
	// contains filtered or unexported fields
}

func NewCRUD

func NewCRUD[TParent, TIdent, T any](appContext string, d *GenericCRUDDecorator[TParent, TIdent, T]) *GenericCRUD[TParent, TIdent, T]

func (*GenericCRUD[TParent, TIdent, T]) Count

func (crud *GenericCRUD[TParent, TIdent, T]) Count(ctx context.Context, id TParent, c *transport.HttpTransport) (int64, error)

func (*GenericCRUD[TParent, TIdent, T]) CountFiltered

func (crud *GenericCRUD[TParent, TIdent, T]) CountFiltered(ctx context.Context, id TParent, filter map[string]string, c *transport.HttpTransport) (int64, error)

func (*GenericCRUD[TParent, TIdent, T]) Create

func (crud *GenericCRUD[TParent, TIdent, T]) Create(ctx context.Context, ident TParent, upsert T, c *transport.HttpTransport) (T, error)

func (*GenericCRUD[TParent, TIdent, T]) Delete

func (crud *GenericCRUD[TParent, TIdent, T]) Delete(ctx context.Context, id TIdent, c *transport.HttpTransport) error

func (*GenericCRUD[TParent, TIdent, T]) Exists

func (crud *GenericCRUD[TParent, TIdent, T]) Exists(ctx context.Context, ident TIdent, c *transport.HttpTransport) (bool, error)

func (*GenericCRUD[TParent, TIdent, T]) FetchAll

func (crud *GenericCRUD[TParent, TIdent, T]) FetchAll(ctx context.Context, id TParent, c *transport.HttpTransport) ([]T, error)

func (*GenericCRUD[TParent, TIdent, T]) FetchAllAsAddressable

func (crud *GenericCRUD[TParent, TIdent, T]) FetchAllAsAddressable(ctx context.Context, id TParent, c *transport.HttpTransport) ([]masherytypes.AddressableV3Object, error)

func (*GenericCRUD[TParent, TIdent, T]) FetchAllAsAddressableFiltered

func (crud *GenericCRUD[TParent, TIdent, T]) FetchAllAsAddressableFiltered(ctx context.Context, id TParent, filter map[string]string, c *transport.HttpTransport) ([]masherytypes.AddressableV3Object, error)

func (*GenericCRUD[TParent, TIdent, T]) FetchFiltered

func (crud *GenericCRUD[TParent, TIdent, T]) FetchFiltered(ctx context.Context, id TParent, filter map[string]string, c *transport.HttpTransport) ([]T, error)

func (*GenericCRUD[TParent, TIdent, T]) Get

func (crud *GenericCRUD[TParent, TIdent, T]) Get(ctx context.Context, ident TIdent, c *transport.HttpTransport) (T, bool, error)

func (*GenericCRUD[TParent, TIdent, T]) StubValue

func (crud *GenericCRUD[TParent, TIdent, T]) StubValue() T

func (*GenericCRUD[TParent, TIdent, T]) Update

func (crud *GenericCRUD[TParent, TIdent, T]) Update(ctx context.Context, upsert T, c *transport.HttpTransport) (T, error)

type GenericCRUDDecorator

type GenericCRUDDecorator[ParentIdent, TIdent, T any] struct {
	ValueSupplier      transport.Supplier[T]
	ValueArraySupplier transport.Supplier[[]T]
	ResourceFor        func(TIdent) (string, error)
	// ResourceForUpsert Return a resource for upsert operation.
	ResourceForUpsert func(T) (string, error)
	ResourceForParent func(ParentIdent) (string, error)

	UpsertCleaner func(*T)

	DefaultFields []string
	GetFields     func(context.Context) []string
	Pagination    transport.PaginationType

	AcceptObjectIdent BiConsumer[TIdent, *T]
	AcceptParentIdent BiConsumer[ParentIdent, *T]
	AcceptIdentFrom   BiConsumer[T, *T]
}

type MasheryV3Credentials

type MasheryV3Credentials struct {
	AreaId   string `yaml:"areaId,omitempty"`
	ApiKey   string `yaml:"apiKey,omitempty"`
	Secret   string `yaml:"secret,omitempty"`
	Username string `yaml:"username,omitempty"`
	Password string `yaml:"password,omitempty"`
	MaxQPS   int    `yaml:"maxQPS,omitempty"`
}

func DeriveAccessCredentials

func DeriveAccessCredentials(customFile, filePass string, fallbackCreds *MasheryV3Credentials) MasheryV3Credentials

DeriveAccessCredentials derives credentials from all applicable sources, including the command line The sequence of derivation is: - Environment variables, overridden by - User settings file, overridden by - Credentials file in the working directory, overriden by - Command line arguments

func (*MasheryV3Credentials) FullySpecified

func (m *MasheryV3Credentials) FullySpecified() bool

func (*MasheryV3Credentials) Inherit

func (m *MasheryV3Credentials) Inherit(other *MasheryV3Credentials)

type OAuthHelperParams

type OAuthHelperParams struct {
	transport.HTTPClientParams
	MasheryTokenEndpoint string
}

func (*OAuthHelperParams) FillDefaults

func (ohp *OAuthHelperParams) FillDefaults()

type OrganizationCRUDDecorator

type OrganizationCRUDDecorator struct {
}

func (OrganizationCRUDDecorator) ValueArraySupplier

func (OrganizationCRUDDecorator) ValueSupplier

type Params

type Params struct {
	transport.HTTPClientParams

	MashEndpoint  string
	Authorizer    transport.Authorizer
	QPS           int64
	AvgNetLatency time.Duration

	Pipeline []transport.ChainedMiddlewareFunc
}

func (*Params) FillDefaults

func (p *Params) FillDefaults()

type PluggableClient

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

func (*PluggableClient) AssumeSchema

func (c *PluggableClient) AssumeSchema(sch *ClientMethodSchema)

AssumeSchema Allows a pluggable client to assume a schema. This method should be mainly used in the test contexts.

func (*PluggableClient) CheckPlanEndpointExists

func (c *PluggableClient) CheckPlanEndpointExists(ctx context.Context, planEndp masherytypes.PackagePlanServiceEndpointIdentifier) (bool, error)

func (*PluggableClient) CheckPlanServiceExists

func (c *PluggableClient) CheckPlanServiceExists(ctx context.Context, planService masherytypes.PackagePlanServiceIdentifier) (bool, error)

func (*PluggableClient) CountApplicationPackageKeys

func (c *PluggableClient) CountApplicationPackageKeys(ctx context.Context, appId masherytypes.ApplicationIdentifier) (int64, error)

func (*PluggableClient) CountApplicationsOfMember

func (c *PluggableClient) CountApplicationsOfMember(ctx context.Context, memberId masherytypes.MemberIdentifier) (int64, error)

func (*PluggableClient) CountEndpointsMethodsFiltersOf

func (c *PluggableClient) CountEndpointsMethodsFiltersOf(ctx context.Context, ident masherytypes.ServiceEndpointMethodIdentifier) (int64, error)

func (*PluggableClient) CountEndpointsMethodsOf

func (c *PluggableClient) CountEndpointsMethodsOf(ctx context.Context, ident masherytypes.ServiceEndpointIdentifier) (int64, error)

func (*PluggableClient) CountEndpointsOf

func (c *PluggableClient) CountEndpointsOf(ctx context.Context, serviceId masherytypes.ServiceIdentifier) (int64, error)

func (*PluggableClient) CountPlanEndpoints

func (c *PluggableClient) CountPlanEndpoints(ctx context.Context, planService masherytypes.PackagePlanServiceIdentifier) (int64, error)

func (*PluggableClient) CountPlanService

func (c *PluggableClient) CountPlanService(ctx context.Context, ident masherytypes.PackagePlanIdentifier) (int64, error)

func (*PluggableClient) CountPlans

func (c *PluggableClient) CountPlans(ctx context.Context, packageId masherytypes.PackageIdentifier) (int64, error)

func (*PluggableClient) CountServices

func (c *PluggableClient) CountServices(ctx context.Context, params map[string]string) (int64, error)

func (*PluggableClient) CreateApplication

func (*PluggableClient) CreateEndpoint

func (*PluggableClient) CreateErrorSet

func (*PluggableClient) CreateMember

func (c *PluggableClient) CreateMember(ctx context.Context, member masherytypes.Member) (masherytypes.Member, error)

func (*PluggableClient) CreatePackage

func (*PluggableClient) CreatePackageKey

func (c *PluggableClient) CreatePackageKey(ctx context.Context, packageKey masherytypes.PackageKey) (masherytypes.PackageKey, error)

func (*PluggableClient) CreatePlan

func (*PluggableClient) CreatePlanService

func (*PluggableClient) CreateService

func (c *PluggableClient) CreateService(ctx context.Context, service masherytypes.Service) (masherytypes.Service, error)

func (*PluggableClient) CreateServiceOAuthSecurityProfile

func (c *PluggableClient) CreateServiceOAuthSecurityProfile(ctx context.Context, id masherytypes.ServiceIdentifier, oauth masherytypes.MasheryOAuth) (masherytypes.MasheryOAuth, error)

func (*PluggableClient) DeleteApplication

func (c *PluggableClient) DeleteApplication(ctx context.Context, appId masherytypes.ApplicationIdentifier) error

func (*PluggableClient) DeleteApplicationPackageKey

func (c *PluggableClient) DeleteApplicationPackageKey(ctx context.Context, keyId masherytypes.ApplicationPackageKeyIdentifier) error

func (*PluggableClient) DeleteEndpoint

func (*PluggableClient) DeleteEndpointMethod

func (*PluggableClient) DeleteEndpointMethodFilter

func (c *PluggableClient) DeleteEndpointMethodFilter(ctx context.Context, ident masherytypes.ServiceEndpointMethodFilterIdentifier) error

func (*PluggableClient) DeleteErrorSet

func (c *PluggableClient) DeleteErrorSet(ctx context.Context, ident masherytypes.ErrorSetIdentifier) error

func (*PluggableClient) DeleteMember

func (c *PluggableClient) DeleteMember(ctx context.Context, memberId masherytypes.MemberIdentifier) error

func (*PluggableClient) DeletePackage

func (c *PluggableClient) DeletePackage(ctx context.Context, packId masherytypes.PackageIdentifier) error

func (*PluggableClient) DeletePackageKey

func (c *PluggableClient) DeletePackageKey(ctx context.Context, keyId masherytypes.PackageKeyIdentifier) error

func (*PluggableClient) DeletePackagePlanMethod

func (*PluggableClient) DeletePackagePlanMethodFilter

func (*PluggableClient) DeletePlan

func (*PluggableClient) DeletePlanEndpoint

func (*PluggableClient) DeletePlanService

func (c *PluggableClient) DeletePlanService(ctx context.Context, planService masherytypes.PackagePlanServiceIdentifier) error

func (*PluggableClient) DeleteService

func (c *PluggableClient) DeleteService(ctx context.Context, serviceId masherytypes.ServiceIdentifier) error

func (*PluggableClient) DeleteServiceCache

func (c *PluggableClient) DeleteServiceCache(ctx context.Context, id masherytypes.ServiceIdentifier) error

func (*PluggableClient) DeleteServiceOAuthSecurityProfile

func (c *PluggableClient) DeleteServiceOAuthSecurityProfile(ctx context.Context, id masherytypes.ServiceIdentifier) error

func (*PluggableClient) DeleteServiceRoles

func (c *PluggableClient) DeleteServiceRoles(ctx context.Context, serviceId masherytypes.ServiceIdentifier) error

func (*PluggableClient) GetApplication

func (*PluggableClient) GetApplicationExtendedAttributes

func (c *PluggableClient) GetApplicationExtendedAttributes(ctx context.Context, appId masherytypes.ApplicationIdentifier) (map[string]string, error)

func (*PluggableClient) GetApplicationPackageKeys

func (*PluggableClient) GetEmailTemplateSet

func (c *PluggableClient) GetEmailTemplateSet(ctx context.Context, id string) (masherytypes.EmailTemplateSet, bool, error)

func (*PluggableClient) GetEndpoint

func (*PluggableClient) GetErrorSet

func (*PluggableClient) GetFullApplication

func (*PluggableClient) GetFullMember

func (*PluggableClient) GetMember

func (*PluggableClient) GetPackage

func (*PluggableClient) GetPackageKey

func (*PluggableClient) GetPlan

func (*PluggableClient) GetPublicDomains

func (c *PluggableClient) GetPublicDomains(ctx context.Context) ([]masherytypes.DomainAddress, error)

func (*PluggableClient) GetRole

func (c *PluggableClient) GetRole(ctx context.Context, id string) (masherytypes.Role, bool, error)

func (*PluggableClient) GetService

func (*PluggableClient) GetServiceCache

func (*PluggableClient) GetServiceOAuthSecurityProfile

func (c *PluggableClient) GetServiceOAuthSecurityProfile(ctx context.Context, id masherytypes.ServiceIdentifier) (masherytypes.MasheryOAuth, bool, error)

Service OAtuh

func (*PluggableClient) GetServiceRoles

func (*PluggableClient) GetSystemDomains

func (c *PluggableClient) GetSystemDomains(ctx context.Context) ([]masherytypes.DomainAddress, error)

func (*PluggableClient) ListApplications

func (c *PluggableClient) ListApplications(ctx context.Context) ([]masherytypes.Application, error)

func (*PluggableClient) ListApplicationsFiltered

func (c *PluggableClient) ListApplicationsFiltered(ctx context.Context, params map[string]string) ([]masherytypes.Application, error)

func (*PluggableClient) ListEmailTemplateSets

func (c *PluggableClient) ListEmailTemplateSets(ctx context.Context) ([]masherytypes.EmailTemplateSet, error)

func (*PluggableClient) ListEmailTemplateSetsFiltered

func (c *PluggableClient) ListEmailTemplateSetsFiltered(ctx context.Context, params map[string]string) ([]masherytypes.EmailTemplateSet, error)

func (*PluggableClient) ListEndpointMethods

func (*PluggableClient) ListEndpointMethodsWithFullInfo

func (*PluggableClient) ListEndpoints

func (*PluggableClient) ListEndpointsWithFullInfo

func (c *PluggableClient) ListEndpointsWithFullInfo(ctx context.Context, serviceId masherytypes.ServiceIdentifier) ([]masherytypes.Endpoint, error)

func (*PluggableClient) ListErrorSets

func (c *PluggableClient) ListErrorSets(ctx context.Context, serviceId masherytypes.ServiceIdentifier, qs map[string]string) ([]masherytypes.ErrorSet, error)

func (*PluggableClient) ListMembers

func (c *PluggableClient) ListMembers(ctx context.Context) ([]masherytypes.Member, error)

func (*PluggableClient) ListMembersFiltered

func (c *PluggableClient) ListMembersFiltered(ctx context.Context, params map[string]string) ([]masherytypes.Member, error)

func (*PluggableClient) ListOrganizations

func (c *PluggableClient) ListOrganizations(ctx context.Context) ([]masherytypes.Organization, error)

ListOrganizations list all organizations defined

func (*PluggableClient) ListOrganizationsFiltered

func (c *PluggableClient) ListOrganizationsFiltered(ctx context.Context, qs map[string]string) ([]masherytypes.Organization, error)

ListOrganizationsFiltered list organizations matching the query string.

func (*PluggableClient) ListPackageKeys

func (c *PluggableClient) ListPackageKeys(ctx context.Context) ([]masherytypes.PackageKey, error)

func (*PluggableClient) ListPackageKeysFiltered

func (c *PluggableClient) ListPackageKeysFiltered(ctx context.Context, params map[string]string) ([]masherytypes.PackageKey, error)

func (*PluggableClient) ListPackages

func (c *PluggableClient) ListPackages(ctx context.Context) ([]masherytypes.Package, error)

func (*PluggableClient) ListPackagesFiltered

func (c *PluggableClient) ListPackagesFiltered(ctx context.Context, params map[string]string) ([]masherytypes.Package, error)

func (*PluggableClient) ListPlanEndpoints

func (*PluggableClient) ListPlanServices

func (*PluggableClient) ListPlans

func (*PluggableClient) ListPlansFiltered

func (c *PluggableClient) ListPlansFiltered(ctx context.Context, packageId masherytypes.PackageIdentifier, params map[string]string) ([]masherytypes.Plan, error)

func (*PluggableClient) ListRoles

func (c *PluggableClient) ListRoles(ctx context.Context) ([]masherytypes.Role, error)

func (*PluggableClient) ListRolesFiltered

func (c *PluggableClient) ListRolesFiltered(ctx context.Context, params map[string]string) ([]masherytypes.Role, error)

func (*PluggableClient) ListServices

func (c *PluggableClient) ListServices(ctx context.Context) ([]masherytypes.Service, error)

func (*PluggableClient) ListServicesFiltered

func (c *PluggableClient) ListServicesFiltered(ctx context.Context, params map[string]string) ([]masherytypes.Service, error)

func (*PluggableClient) ResetPackageOwnership

func (c *PluggableClient) ResetPackageOwnership(ctx context.Context, pack masherytypes.PackageIdentifier) (masherytypes.Package, error)

func (*PluggableClient) SetServiceRoles

func (c *PluggableClient) SetServiceRoles(ctx context.Context, serviceId masherytypes.ServiceIdentifier, perms []masherytypes.RolePermission) error

func (*PluggableClient) UpdateApplication

func (*PluggableClient) UpdateApplicationExtendedAttributes

func (c *PluggableClient) UpdateApplicationExtendedAttributes(ctx context.Context, appId masherytypes.ApplicationIdentifier, params map[string]string) (map[string]string, error)

func (*PluggableClient) UpdateApplicationPackageKey

func (c *PluggableClient) UpdateApplicationPackageKey(ctx context.Context, packageKey masherytypes.ApplicationPackageKey) (masherytypes.ApplicationPackageKey, error)

func (*PluggableClient) UpdateEndpoint

func (*PluggableClient) UpdateEndpointMethod

func (*PluggableClient) UpdateEndpointMethodFilter

func (*PluggableClient) UpdateErrorSet

func (c *PluggableClient) UpdateErrorSet(ctx context.Context, setData masherytypes.ErrorSet) (masherytypes.ErrorSet, error)

func (*PluggableClient) UpdateErrorSetMessage

func (*PluggableClient) UpdateMember

func (c *PluggableClient) UpdateMember(ctx context.Context, member masherytypes.Member) (masherytypes.Member, error)

func (*PluggableClient) UpdatePackage

func (*PluggableClient) UpdatePackageKey

func (c *PluggableClient) UpdatePackageKey(ctx context.Context, packageKey masherytypes.PackageKey) (masherytypes.PackageKey, error)

func (*PluggableClient) UpdatePlan

func (c *PluggableClient) UpdatePlan(ctx context.Context, plan masherytypes.Plan) (masherytypes.Plan, error)

func (*PluggableClient) UpdateService

func (c *PluggableClient) UpdateService(ctx context.Context, service masherytypes.Service) (masherytypes.Service, error)

func (*PluggableClient) UpdateServiceCache

func (c *PluggableClient) UpdateServiceCache(ctx context.Context, service masherytypes.ServiceCache) (masherytypes.ServiceCache, error)

func (*PluggableClient) UpdateServiceOAuthSecurityProfile

func (c *PluggableClient) UpdateServiceOAuthSecurityProfile(ctx context.Context, service masherytypes.MasheryOAuth) (masherytypes.MasheryOAuth, error)

type Supplier

type Supplier[T any] func() T

type SupplierCanErr

type SupplierCanErr[T any] func() (T, error)

type V3AccessTokenProvider

type V3AccessTokenProvider interface {
	transport.Authorizer

	// AccessToken Yields an access token to be used in the next API call to Mashery
	AccessToken(context context.Context) (string, error)
}

V3AccessTokenProvider Access token provider that supplies the access token, depending on the strategy. There are three strategies: - FixedTokenProvider yields a fixed token. This method is useful for short deployments where an access token is obtained by an outside process and would be stored e.g. in-memory. - FileSystemTokenProvider yields a token that that was previously saved in the file system, e.g. using the `mash-login` command - Both these methods have limited applicability time-span of 1 hour, since Mashery V3 token would expire after 1 hour, and repeated logon would be necessary. - ClientCredentialsProvider can support operations of exceeding 1 hour by using Mashery V3 API to retrieve and refresh the access token.

The calling code has to pick an appropriate provider depending on the context.

func NewContextTokenProvider

func NewContextTokenProvider() V3AccessTokenProvider

func NewFileSystemTokenProvider

func NewFileSystemTokenProvider() V3AccessTokenProvider

func NewFileSystemTokenProviderFrom

func NewFileSystemTokenProviderFrom(path string) V3AccessTokenProvider

func NewFixedTokenProvider

func NewFixedTokenProvider(tkn string) V3AccessTokenProvider

type V3OAuthHelper

type V3OAuthHelper struct {
	TokenEndpoint string
	// contains filtered or unexported fields
}

func NewOAuthHelper

func NewOAuthHelper(params OAuthHelperParams) *V3OAuthHelper

NewOAuthHelper creates an instance of a helper that could be used directly

func (*V3OAuthHelper) ExchangeRefreshToken

func (lcp *V3OAuthHelper) ExchangeRefreshToken(creds *MasheryV3Credentials, refreshToken string) (*masherytypes.TimedAccessTokenResponse, error)

func (*V3OAuthHelper) RetrieveAccessTokenFor

func (lcp *V3OAuthHelper) RetrieveAccessTokenFor(creds *MasheryV3Credentials) (*masherytypes.TimedAccessTokenResponse, error)

type WildcardClient

type WildcardClient interface {
	// FetchAny fetch an arbitrary resource from Mashery V3
	FetchAny(ctx context.Context, resource string, qs *url.Values) (*transport.WrappedResponse, error)
	// DeleteAny Delete an arbitrary resource from Mashery V3
	DeleteAny(ctx context.Context, resource string) (*transport.WrappedResponse, error)
	// PostAny post any value to an arbitrary resource
	PostAny(ctx context.Context, resource string, body interface{}) (*transport.WrappedResponse, error)
	// PutAny put any value to an arbitrary resource
	PutAny(ctx context.Context, resource string, body interface{}) (*transport.WrappedResponse, error)

	Close(ctx context.Context)
}

func NewWildcardClient

func NewWildcardClient(params Params) WildcardClient

NewWildcardClient creates a "wildcard" client, which will auto-apply access tokens and will throttle the calls with the specified QPS.

type WildcardClientImpl

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

func (*WildcardClientImpl) Close

func (w *WildcardClientImpl) Close(ctx context.Context)

func (*WildcardClientImpl) DeleteAny

func (w *WildcardClientImpl) DeleteAny(ctx context.Context, resource string) (*transport.WrappedResponse, error)

func (*WildcardClientImpl) FetchAny

func (w *WildcardClientImpl) FetchAny(ctx context.Context, resource string, qs *url.Values) (*transport.WrappedResponse, error)

func (*WildcardClientImpl) PostAny

func (w *WildcardClientImpl) PostAny(ctx context.Context, resource string, body interface{}) (*transport.WrappedResponse, error)

func (*WildcardClientImpl) PutAny

func (w *WildcardClientImpl) PutAny(ctx context.Context, resource string, body interface{}) (*transport.WrappedResponse, error)

Jump to

Keyboard shortcuts

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