Documentation
¶
Index ¶
- Constants
- Variables
- type API
- type AnalyticsClient
- type AnalyticsEvent
- type AnypointClient
- func (c *AnypointClient) CreateClientApplication(apiInstanceID string, app *AppRequestBody) (*Application, error)
- func (c *AnypointClient) CreateContract(appID int64, contract *Contract) (*Contract, error)
- func (c *AnypointClient) DeleteClientApplication(appID int64) error
- func (c *AnypointClient) DeleteContract(apiID string, contractID string) error
- func (c *AnypointClient) GetAPI(id string) (*API, error)
- func (c *AnypointClient) GetAccessToken() (string, *User, time.Duration, error)
- func (c *AnypointClient) GetAnalyticsWindow(startDate, endDate string) ([]AnalyticsEvent, error)
- func (c *AnypointClient) GetClientApplication(appID string) (*Application, error)
- func (c *AnypointClient) GetContract(apiID string, contractID string) (*Contract, error)
- func (c *AnypointClient) GetEnvironmentByName(name string) (*Environment, error)
- func (c *AnypointClient) GetExchangeAsset(groupID, assetID, assetVersion string) (*ExchangeAsset, error)
- func (c *AnypointClient) GetExchangeAssetIcon(icon string) (string, string, error)
- func (c *AnypointClient) GetExchangeFileContent(link, packaging, mainFile string) (fileContent []byte, err error)
- func (c *AnypointClient) GetPolicies(apiID int64) (Policies, error)
- func (c *AnypointClient) GetSLATiers(apiID int64) (*Tiers, error)
- func (c *AnypointClient) ListAssets(page *Page) ([]Asset, error)
- func (c *AnypointClient) OnConfigChange(mulesoftConfig *config.MulesoftConfig)
- func (c *AnypointClient) ResetAppSecret(appID int64) (*Application, error)
- func (c *AnypointClient) RevokeContract(apiID, contractID string) error
- type AppRequestBody
- type Application
- type Asset
- type AssetSearch
- type Audit
- type AuditEntry
- type Auth
- type AuthClient
- type Client
- type ClientOptions
- type Contract
- type CurrentUser
- type Environment
- type EnvironmentSearch
- type ErrorResponse
- type ExchangeAPIInstance
- type ExchangeAsset
- type ExchangeCategory
- type ExchangeFile
- type Limits
- type ListAssetClient
- type MemberOfOrganizations
- type MockAnypointClient
- func (m *MockAnypointClient) CreateClientApplication(id string, body *AppRequestBody) (*Application, error)
- func (m *MockAnypointClient) CreateContract(id int64, contract *Contract) (*Contract, error)
- func (m *MockAnypointClient) DeleteClientApplication(appID int64) error
- func (m *MockAnypointClient) DeleteContract(apiID string, contractID string) error
- func (m *MockAnypointClient) GetAPI(id string) (*API, error)
- func (m *MockAnypointClient) GetAccessToken() (string, *User, time.Duration, error)
- func (m *MockAnypointClient) GetAnalyticsWindow() ([]AnalyticsEvent, error)
- func (m *MockAnypointClient) GetClientApplication(appID string) (*Application, error)
- func (m *MockAnypointClient) GetEnvironmentByName(string) (*Environment, error)
- func (m *MockAnypointClient) GetExchangeAsset(_, _, _ string) (*ExchangeAsset, error)
- func (m *MockAnypointClient) GetExchangeAssetIcon(_ string) (string, string, error)
- func (m *MockAnypointClient) GetExchangeFileContent(_, _, _ string) ([]byte, error)
- func (m *MockAnypointClient) GetPolicies(int64) (Policies, error)
- func (m *MockAnypointClient) GetSLATiers(int642 int64) (*Tiers, error)
- func (m *MockAnypointClient) ListAssets(*Page) ([]Asset, error)
- func (m *MockAnypointClient) OnConfigChange(*config.MulesoftConfig)
- func (m *MockAnypointClient) ResetAppSecret(appID int64) (*Application, error)
- func (m *MockAnypointClient) RevokeContract(apiID, contractID string) error
- type MockAuth
- type MockClientBase
- type Organization
- type Page
- type Policies
- type Policy
- type SLATier
- type Template
- type Tiers
- type User
Constants ¶
const HealthCheckEndpoint = "mulesoft"
Variables ¶
Functions ¶
This section is empty.
Types ¶
type API ¶
type API struct {
ActiveContractsCount int `json:"activeContractsCount"`
AssetID string `json:"assetId"`
AssetVersion string `json:"assetVersion"`
Audit Audit `json:"audit"`
AutodiscoveryInstanceName string `json:"autodiscoveryInstanceName"`
Deprecated bool `json:"deprecated"`
Description string `json:"description"`
EndpointURI string `json:"endpointUri"`
EnvironmentID string `json:"environmentId"`
GroupID string `json:"groupId"`
ID int64 `json:"id"`
InstanceLabel string `json:"instanceLabel"`
IsPublic bool `json:"isPublic"`
MasterOrganizationID string `json:"masterOrganizationId"`
Order int `json:"order"`
OrganizationID string `json:"organizationId"`
Pinned bool `json:"pinned"`
ProductVersion string `json:"productVersion"`
Tags []string `json:"tags"`
}
API -
type AnalyticsClient ¶
type AnalyticsClient interface {
GetAnalyticsWindow(string, string) ([]AnalyticsEvent, error)
OnConfigChange(mulesoftConfig *config.MulesoftConfig)
GetClientApplication(appId string) (*Application, error)
}
type AnalyticsEvent ¶
type AnalyticsEvent struct {
APIID string `json:"API ID"`
APIName string `json:"API Name"`
APIVersionID string `json:"API Version ID"`
APIVersionName string `json:"API Version Name"`
ApplicationName string `json:"Application Name"`
Application string `json:"Application"`
Browser string `json:"Browser"`
City string `json:"City"`
ClientIP string `json:"Client IP"`
Continent string `json:"Continent"`
Country string `json:"Country"`
HardwarePlatform string `json:"Hardware Platform"`
MessageID string `json:"Message ID"`
OSFamily string `json:"OS Family"`
OSMajorVersion string `json:"OS Major Version"`
OSMinorVersion string `json:"OS Minor Version"`
OSVersion string `json:"OS Version"`
PostalCode string `json:"Postal Code"`
RequestOutcome string `json:"Request Outcome"`
RequestSize int `json:"Request Size"`
ResourcePath string `json:"Resource Path"`
ResponseSize int `json:"Response Size"`
ResponseTime int `json:"Response Time"`
StatusCode int `json:"Status Code"`
Timestamp time.Time `json:"Timestamp"`
Timezone string `json:"Timezone"`
UserAgentName string `json:"User Agent Name"`
UserAgentVersion string `json:"User Agent Version"`
Verb string `json:"Verb"`
ViolatedPolicyName string `json:"Violated Policy Name"`
}
AnalyticsEvent -
type AnypointClient ¶
type AnypointClient struct {
// contains filtered or unexported fields
}
AnypointClient is the client for interacting with Mulesoft Anypoint.
func NewClient ¶
func NewClient(mulesoftConfig *config.MulesoftConfig, options ...ClientOptions) *AnypointClient
NewClient creates a new client for interacting with Mulesoft.
func (*AnypointClient) CreateClientApplication ¶
func (c *AnypointClient) CreateClientApplication(apiInstanceID string, app *AppRequestBody) (*Application, error)
func (*AnypointClient) CreateContract ¶
func (c *AnypointClient) CreateContract(appID int64, contract *Contract) (*Contract, error)
func (*AnypointClient) DeleteClientApplication ¶
func (c *AnypointClient) DeleteClientApplication(appID int64) error
func (*AnypointClient) DeleteContract ¶ added in v1.1.5
func (c *AnypointClient) DeleteContract(apiID string, contractID string) error
func (*AnypointClient) GetAPI ¶ added in v1.1.5
func (c *AnypointClient) GetAPI(id string) (*API, error)
GetAPI gets a single api by id
func (*AnypointClient) GetAccessToken ¶
GetAccessToken retrieves a token
func (*AnypointClient) GetAnalyticsWindow ¶
func (c *AnypointClient) GetAnalyticsWindow(startDate, endDate string) ([]AnalyticsEvent, error)
GetAnalyticsWindow lists the managed assets in Mulesoft: https://docs.qax.mulesoft.com/api-manager/2.x/analytics-event-api
func (*AnypointClient) GetClientApplication ¶
func (c *AnypointClient) GetClientApplication(appID string) (*Application, error)
func (*AnypointClient) GetContract ¶ added in v1.1.5
func (c *AnypointClient) GetContract(apiID string, contractID string) (*Contract, error)
func (*AnypointClient) GetEnvironmentByName ¶
func (c *AnypointClient) GetEnvironmentByName(name string) (*Environment, error)
GetEnvironmentByName gets the Mulesoft environment with the specified name.
func (*AnypointClient) GetExchangeAsset ¶
func (c *AnypointClient) GetExchangeAsset(groupID, assetID, assetVersion string) (*ExchangeAsset, error)
GetExchangeAsset creates the AssetDetail form the Asset API.
func (*AnypointClient) GetExchangeAssetIcon ¶
func (c *AnypointClient) GetExchangeAssetIcon(icon string) (string, string, error)
GetExchangeAssetIcon get the icon as a base64 encoded string from the Exchange Asset files.
func (*AnypointClient) GetExchangeFileContent ¶
func (c *AnypointClient) GetExchangeFileContent(link, packaging, mainFile string) (fileContent []byte, err error)
GetExchangeFileContent download the file from the ExternalLink reference. If the file is a zip file and thre is a MainFile set then the content of the MainFile is returned.
func (*AnypointClient) GetPolicies ¶
func (c *AnypointClient) GetPolicies(apiID int64) (Policies, error)
GetPolicies lists the API policies.
func (*AnypointClient) GetSLATiers ¶
func (c *AnypointClient) GetSLATiers(apiID int64) (*Tiers, error)
func (*AnypointClient) ListAssets ¶
func (c *AnypointClient) ListAssets(page *Page) ([]Asset, error)
ListAssets lists the API Assets.
func (*AnypointClient) OnConfigChange ¶
func (c *AnypointClient) OnConfigChange(mulesoftConfig *config.MulesoftConfig)
func (*AnypointClient) ResetAppSecret ¶ added in v1.1.9
func (c *AnypointClient) ResetAppSecret(appID int64) (*Application, error)
func (*AnypointClient) RevokeContract ¶ added in v1.1.5
func (c *AnypointClient) RevokeContract(apiID, contractID string) error
type AppRequestBody ¶
type Application ¶
type Asset ¶
type Asset struct {
APIs []API `json:"apis"`
AssetID string `json:"assetId"`
Audit Audit `json:"audit"`
AutodiscoveryAPIName string `json:"autodiscoveryApiName"`
ExchangeAssetName string `json:"exchangeAssetName"`
GroupID string `json:"groupId"`
ID int64 `json:"id"`
MasterOrganizationID string `json:"masterOrganizationId"`
Name string `json:"name"`
OrganizationID string `json:"organizationId"`
TotalAPIs int `json:"totalApis"`
}
Asset -
type AssetSearch ¶
AssetSearch -
type Audit ¶
type Audit struct {
Created AuditEntry `json:"created"`
Updated AuditEntry `json:"updated"`
}
Audit -
type Auth ¶
Auth represents the authentication information.
func NewAuth ¶
func NewAuth(client AuthClient) (Auth, error)
NewAuth creates a new authentication token
type AuthClient ¶
type Client ¶
type Client interface {
CreateClientApplication(apiInstanceID string, app *AppRequestBody) (*Application, error)
CreateContract(int64, *Contract) (*Contract, error)
DeleteClientApplication(appID int64) error
GetAccessToken() (string, *User, time.Duration, error)
GetAPI(id string) (*API, error)
GetClientApplication(appID string) (*Application, error)
GetEnvironmentByName(name string) (*Environment, error)
GetExchangeAsset(groupID, assetID, assetVersion string) (*ExchangeAsset, error)
GetExchangeAssetIcon(icon string) (string, string, error)
GetExchangeFileContent(link, packaging, mainFile string) ([]byte, error)
GetPolicies(apiID int64) (Policies, error)
GetSLATiers(int642 int64) (*Tiers, error)
ListAssets(page *Page) ([]Asset, error)
OnConfigChange(mulesoftConfig *config.MulesoftConfig)
DeleteContract(apiID string, contractID string) error
RevokeContract(apiID, contractID string) error
ResetAppSecret(appID int64) (*Application, error)
}
Client interface to gateway
type ClientOptions ¶
type ClientOptions func(*AnypointClient)
func SetClient ¶
func SetClient(c coreapi.Client) ClientOptions
SetClient replaces the default apiClient with anything that implements the Client interface. Can be used for writing tests.
type Contract ¶
type Contract struct {
AcceptedTerms bool `json:"acceptedTerms"`
APIID string `json:"apiId"`
AssetID string `json:"assetId"`
EnvironmentID string `json:"environmentId"`
GroupID string `json:"groupId"`
Id int64 `json:"id"`
OrganizationID string `json:"organizationId"`
RequestedTierID int64 `json:"requestedTierId,omitempty"`
Status string `json:"status"`
Version string `json:"version"`
VersionGroup string `json:"versionGroup"`
}
type Environment ¶
type Environment struct {
ClientID string `json:"clientId"`
EnvironmentType string `json:"type"`
ID string `json:"id"`
IsProduction bool `json:"isProduction"`
Name string `json:"name"`
OrganizationID string `json:"organizationId"`
}
Environment -
type EnvironmentSearch ¶
type EnvironmentSearch struct {
Data []Environment `json:"data"`
Total int `json:"total"`
}
EnvironmentSearch -
type ErrorResponse ¶
ErrorResponse Error response from Mulesoft
func NewErrorResponse ¶
func NewErrorResponse(body string, code int) *ErrorResponse
NewErrorResponse returns an ErrorResponse struct
func (*ErrorResponse) String ¶
func (er *ErrorResponse) String() string
String format the error response
type ExchangeAPIInstance ¶
type ExchangeAPIInstance struct {
AssetID string `json:"assetId"`
AssetName string `json:"assetName"`
CreatedBy string `json:"createdBy"`
CreatedDate time.Time `json:"createdDate"`
EndpointURI string `json:"endpointUri"`
EnvironmentID string `json:"environmentId"`
Fullname string `json:"fullname"`
GroupID string `json:"groupId"`
ID string `json:"id"`
InstanceType string `json:"type"`
IsPublic bool `json:"isPublic"`
Name string `json:"name"`
ProductAPIVersion string `json:"productApiVersion"`
ProviderID string `json:"providerId"`
UpdatedDate time.Time `json:"updatedDate"`
Version string `json:"version"`
}
ExchangeAPIInstance - https://anypoint.mulesoft.com/exchange/portals/anypoint-platform/f1e97bc6-315a-4490-82a7-23abe036327a.anypoint-platform/exchange-experience-api/minor/2.0/console/method/%231972/
type ExchangeAsset ¶
type ExchangeAsset struct {
AssetID string `json:"assetId"`
AssetType string `json:"type"`
Categories []ExchangeCategory `json:"categories"`
CreatedAt time.Time `json:"createdAt"`
Description string `json:"description"`
Files []ExchangeFile `json:"files"`
GroupID string `json:"groupId"`
Icon string `json:"icon"`
ID string `json:"id"`
Instances []ExchangeAPIInstance `json:"instances"`
Labels []string `json:"labels"`
MinorVersion string `json:"minorVersion"`
ModifiedAt time.Time `json:"modifiedAt"`
Name string `json:"name"`
Public bool `json:"isPublic"`
Snapshot bool `json:"isSnapshot"`
Status string `json:"status"`
Version string `json:"version"`
VersionGroup string `json:"versionGroup"`
}
type ExchangeCategory ¶
type ExchangeCategory struct {
DisplayName string `json:"displayName"`
Key string `json:"key"`
Value []string `json:"value"`
}
ExchangeCategory -
type ExchangeFile ¶
type ExchangeFile struct {
Classifier string `json:"classifier"`
CreatedDate time.Time `json:"createdDate"`
DownloadURL string `json:"downloadURL"`
ExternalLink string `json:"externalLink"`
Generated bool `json:"isGenerated"`
MainFile string `json:"mainFile"`
MD5 string `json:"md5"`
Packaging string `json:"packaging"`
SHA1 string `json:"sha1"`
}
ExchangeFile -
type ListAssetClient ¶
type MemberOfOrganizations ¶
MemberOfOrganizations -
type MockAnypointClient ¶
func (*MockAnypointClient) CreateClientApplication ¶
func (m *MockAnypointClient) CreateClientApplication(id string, body *AppRequestBody) (*Application, error)
func (*MockAnypointClient) CreateContract ¶
func (m *MockAnypointClient) CreateContract(id int64, contract *Contract) (*Contract, error)
func (*MockAnypointClient) DeleteClientApplication ¶
func (m *MockAnypointClient) DeleteClientApplication(appID int64) error
func (*MockAnypointClient) DeleteContract ¶ added in v1.1.5
func (m *MockAnypointClient) DeleteContract(apiID string, contractID string) error
func (*MockAnypointClient) GetAPI ¶ added in v1.1.5
func (m *MockAnypointClient) GetAPI(id string) (*API, error)
func (*MockAnypointClient) GetAccessToken ¶
func (*MockAnypointClient) GetAnalyticsWindow ¶
func (m *MockAnypointClient) GetAnalyticsWindow() ([]AnalyticsEvent, error)
func (*MockAnypointClient) GetClientApplication ¶ added in v1.1.5
func (m *MockAnypointClient) GetClientApplication(appID string) (*Application, error)
func (*MockAnypointClient) GetEnvironmentByName ¶
func (m *MockAnypointClient) GetEnvironmentByName(string) (*Environment, error)
func (*MockAnypointClient) GetExchangeAsset ¶
func (m *MockAnypointClient) GetExchangeAsset(_, _, _ string) (*ExchangeAsset, error)
func (*MockAnypointClient) GetExchangeAssetIcon ¶
func (m *MockAnypointClient) GetExchangeAssetIcon(_ string) (string, string, error)
func (*MockAnypointClient) GetExchangeFileContent ¶
func (m *MockAnypointClient) GetExchangeFileContent(_, _, _ string) ([]byte, error)
func (*MockAnypointClient) GetPolicies ¶
func (m *MockAnypointClient) GetPolicies(int64) (Policies, error)
func (*MockAnypointClient) GetSLATiers ¶
func (m *MockAnypointClient) GetSLATiers(int642 int64) (*Tiers, error)
func (*MockAnypointClient) ListAssets ¶
func (m *MockAnypointClient) ListAssets(*Page) ([]Asset, error)
func (*MockAnypointClient) OnConfigChange ¶
func (m *MockAnypointClient) OnConfigChange(*config.MulesoftConfig)
func (*MockAnypointClient) ResetAppSecret ¶ added in v1.1.9
func (m *MockAnypointClient) ResetAppSecret(appID int64) (*Application, error)
func (*MockAnypointClient) RevokeContract ¶ added in v1.1.5
func (m *MockAnypointClient) RevokeContract(apiID, contractID string) error
type MockClientBase ¶
type Organization ¶
type Organization struct {
Domain string `json:"domain"`
ID string `json:"id"`
Name string `json:"name"`
}
Organization -
type Policy ¶
type Policy struct {
APIID int64 `json:"apiId"`
Audit Audit `json:"audit"`
Configuration interface{} `json:"configuration"`
ID int64 `json:"id"`
MasterOrganizationID string `json:"masterOrganizationId"`
Order int `json:"order"`
OrganizationID string `json:"organizationId"`
PointCutData interface{} `json:"pointCutData"`
PolicyID int `json:"policyId"`
PolicyTemplateID string `json:"policyTemplateId"`
Template Template `json:"template"`
Type string `json:"type"`
Version int64 `json:"version"`
}
Policy -
type User ¶
type User struct {
Email string `json:"email"`
FirstName string `json:"firstName"`
ID string `json:"id"`
IdentityType string `json:"identityType"`
LastName string `json:"lastName"`
Organization Organization `json:"organization"`
MemberOfOrganizations []MemberOfOrganizations `json:"memberOfOrganizations"`
Username string `json:"username"`
}
User -