Documentation
¶
Index ¶
- Constants
- Variables
- func ToPointer[K comparable](val K) *K
- type API
- type APIMonitoringMetric
- type APISummaryMetricEvent
- type AnalyticsClient
- type AnypointClient
- func (c *AnypointClient) CreateClientApplication(apiID string, app *AppRequestBody) (*Application, error)
- func (c *AnypointClient) CreateContract(appID string, contract *Contract) (*Contract, error)
- func (c *AnypointClient) CreateSLATier(apiID string) (int, error)
- func (c *AnypointClient) DeleteClientApplication(appID string) error
- func (c *AnypointClient) DeleteContract(apiID, contractID string) error
- func (c *AnypointClient) GetAPI(apiID string) (*API, error)
- func (c *AnypointClient) GetAccessToken() (string, *User, time.Duration, error)
- func (c *AnypointClient) GetClientApplication(appID string) (*Application, error)
- func (c *AnypointClient) GetContract(apiID, 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, useOriginalRaml bool) ([]byte, bool, error)
- func (c *AnypointClient) GetMonitoringArchive(apiID string, startDate time.Time) ([]APIMonitoringMetric, error)
- func (c *AnypointClient) GetMonitoringBootstrap() (*MonitoringBootInfo, error)
- func (c *AnypointClient) GetMonitoringMetrics(dataSourceName string, dataSourceID int, apiID, apiVersionID string, ...) ([]APIMonitoringMetric, error)
- func (c *AnypointClient) GetPolicies(apiID string) ([]Policy, error)
- func (c *AnypointClient) GetSLATiers(apiID string, tierName string) (*Tiers, error)
- func (c *AnypointClient) ListAssets(page *Page) ([]Asset, error)
- func (c *AnypointClient) OnConfigChange(mulesoftConfig *config.MulesoftConfig)
- func (c *AnypointClient) ResetAppSecret(appID string) (*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 DataFile
- type DataFileResources
- type Endpoint
- type Environment
- type EnvironmentSearch
- type ErrorResponse
- type ExchangeAPIInstance
- type ExchangeAsset
- type ExchangeCategory
- type ExchangeFile
- type InfluxDB
- type Limits
- type ListAssetClient
- type MemberOfOrganizations
- type MetricData
- type MetricResponse
- type MetricResult
- type MetricSeries
- type MetricTag
- type MockAnypointClient
- func (m *MockAnypointClient) CreateClientApplication(apiID string, body *AppRequestBody) (*Application, error)
- func (m *MockAnypointClient) CreateContract(appID string, contract *Contract) (*Contract, error)
- func (m *MockAnypointClient) CreateSLATier(apiID string) (int, error)
- func (m *MockAnypointClient) DeleteClientApplication(appID string) error
- func (m *MockAnypointClient) DeleteContract(apiID, contractID string) error
- func (m *MockAnypointClient) GetAPI(apiID string) (*API, error)
- func (m *MockAnypointClient) GetAccessToken() (string, *User, time.Duration, 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, shouldConvert bool) ([]byte, bool, error)
- func (m *MockAnypointClient) GetMonitoringArchive(apiID string, startDate time.Time) ([]APIMonitoringMetric, error)
- func (m *MockAnypointClient) GetPolicies(string) ([]Policy, error)
- func (m *MockAnypointClient) GetSLATiers(apiID, tierName string) (*Tiers, error)
- func (m *MockAnypointClient) ListAssets(*Page) ([]Asset, error)
- func (m *MockAnypointClient) OnConfigChange(*config.MulesoftConfig)
- func (m *MockAnypointClient) ResetAppSecret(appID string) (*Application, error)
- func (m *MockAnypointClient) RevokeContract(apiID, contractID string) error
- type MockAuth
- type MockClientBase
- type MonitoringBootInfo
- type MonitoringBootSetting
- type MonitoringDataSource
- type Organization
- type Page
- type Policies
- type Policy
- type SLATier
- type Tiers
- type User
Constants ¶
const (
HealthCheckEndpoint = "mulesoft"
)
Variables ¶
Functions ¶
func ToPointer ¶ added in v1.1.47
func ToPointer[K comparable](val K) *K
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"` Endpoint *Endpoint `json:"endpoint,omitempty"` EnvironmentID string `json:"environmentId"` GroupID string `json:"groupId"` ID int `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 APIMonitoringMetric ¶ added in v1.2.5
type APIMonitoringMetric struct { Time time.Time Events []APISummaryMetricEvent }
Monitoring Archive API metrics data definitions
type APISummaryMetricEvent ¶ added in v1.2.5
type APISummaryMetricEvent struct { APIName string `json:"api_name"` APIVersion string `json:"api_version"` APIVersionID string `json:"api_version_id"` ClientID string `json:"client_id"` Method string `json:"method"` StatusCode string `json:"status_code"` ResponseSizeCount int `json:"response_size.count"` ResponseSizeMax int `json:"response_size.max"` ResponseSizeMin int `json:"response_size.min"` ResponseSizeSos int `json:"response_size.sos"` ResponseSizeSum int `json:"response_size.sum"` ResponseTimeCount int `json:"response_time.count"` ResponseTimeMax int `json:"response_time.max"` ResponseTimeMin int `json:"response_time.min"` ResponseTimeSos int `json:"response_time.sos"` ResponseTimeSum int `json:"response_time.sum"` RequestSizeCount int `json:"request_size.count"` RequestSizeMax int `json:"request_size.max"` RequestSizeMin int `json:"request_size.min"` RequestSizeSos int `json:"request_size.sos"` RequestSizeSum int `json:"request_size.sum"` RequestDisposition string `json:"request_disposition"` }
type AnalyticsClient ¶
type AnalyticsClient interface { GetMonitoringBootstrap() (*MonitoringBootInfo, error) GetMonitoringMetrics(dataSourceName string, dataSourceID int, apiID, apiVersionID string, startDate, endTime time.Time) ([]APIMonitoringMetric, error) GetMonitoringArchive(apiID string, startDate time.Time) ([]APIMonitoringMetric, error) OnConfigChange(mulesoftConfig *config.MulesoftConfig) GetClientApplication(appID string) (*Application, error) GetAPI(apiID string) (*API, error) }
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(apiID string, app *AppRequestBody) (*Application, error)
func (*AnypointClient) CreateContract ¶
func (c *AnypointClient) CreateContract(appID string, contract *Contract) (*Contract, error)
func (*AnypointClient) CreateSLATier ¶ added in v1.1.47
func (c *AnypointClient) CreateSLATier(apiID string) (int, error)
func (*AnypointClient) DeleteClientApplication ¶
func (c *AnypointClient) DeleteClientApplication(appID string) error
func (*AnypointClient) DeleteContract ¶ added in v1.1.5
func (c *AnypointClient) DeleteContract(apiID, contractID string) error
func (*AnypointClient) GetAPI ¶ added in v1.1.5
func (c *AnypointClient) GetAPI(apiID string) (*API, error)
GetAPI gets a single api by id
func (*AnypointClient) GetAccessToken ¶
GetAccessToken retrieves a token
func (*AnypointClient) GetClientApplication ¶
func (c *AnypointClient) GetClientApplication(appID string) (*Application, error)
func (*AnypointClient) GetContract ¶ added in v1.1.5
func (c *AnypointClient) GetContract(apiID, 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, useOriginalRaml bool) ([]byte, bool, error)
GetExchangeFileContent download the file from the ExternalLink reference. If the file is a zip file and there is a MainFile set then the content of the MainFile is returned.
func (*AnypointClient) GetMonitoringArchive ¶ added in v1.2.5
func (c *AnypointClient) GetMonitoringArchive(apiID string, startDate time.Time) ([]APIMonitoringMetric, error)
GetMonitoringArchive returns archived monitoring data Mulesoft: https://anypoint.mulesoft.com/exchange/portals/anypoint-platform/f1e97bc6-315a-4490-82a7-23abe036327a.anypoint-platform/anypoint-monitoring-archive-api/minor/1.0/pages/home/
func (*AnypointClient) GetMonitoringBootstrap ¶ added in v1.2.5
func (c *AnypointClient) GetMonitoringBootstrap() (*MonitoringBootInfo, error)
func (*AnypointClient) GetMonitoringMetrics ¶ added in v1.2.5
func (c *AnypointClient) GetMonitoringMetrics(dataSourceName string, dataSourceID int, apiID, apiVersionID string, startTime, endTime time.Time) ([]APIMonitoringMetric, error)
GetMonitoringMetrics returns monitoring data from InfluxDb
func (*AnypointClient) GetPolicies ¶
func (c *AnypointClient) GetPolicies(apiID string) ([]Policy, error)
GetPolicies lists the API policies.
func (*AnypointClient) GetSLATiers ¶
func (c *AnypointClient) GetSLATiers(apiID string, tierName string) (*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 string) (*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(apiID string, app *AppRequestBody) (*Application, error) CreateContract(appID string, contract *Contract) (*Contract, error) DeleteClientApplication(appID string) error GetAccessToken() (string, *User, time.Duration, error) GetAPI(apiID 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, useOriginalRaml bool) ([]byte, bool, error) GetPolicies(apiID string) ([]Policy, error) GetSLATiers(apiID string, tierName string) (*Tiers, error) CreateSLATier(apiID string) (int, error) ListAssets(page *Page) ([]Asset, error) OnConfigChange(mulesoftConfig *config.MulesoftConfig) DeleteContract(apiID, contractID string) error RevokeContract(apiID, contractID string) error ResetAppSecret(appID string) (*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 int `json:"id"` OrganizationID string `json:"organizationId"` RequestedTierID int `json:"requestedTierId,omitempty"` Status string `json:"status"` Version string `json:"version"` VersionGroup string `json:"versionGroup"` }
type DataFileResources ¶ added in v1.2.5
type DataFileResources struct {
Resources []DataFile `json:"resources"`
}
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 MetricData ¶ added in v1.2.5
type MetricResponse ¶ added in v1.2.5
type MetricResponse struct {
Results []*MetricResult `json:"results"`
}
type MetricResult ¶ added in v1.2.5
type MetricResult struct { StatementID int `json:"statement_id"` Series []*MetricSeries `json:"series"` }
type MetricSeries ¶ added in v1.2.5
type MetricSeries struct { Name string `json:"name"` Tags *MetricTag `json:"tags"` Columns []string `json:"columns"` Values [][]float64 `json:"values"` Time time.Time `json:"-"` Count int64 `json:"-"` ResponseMax int64 `json:"-"` ResponseMin int64 `json:"-"` }
func (*MetricSeries) UnmarshalJSON ¶ added in v1.2.5
func (ms *MetricSeries) UnmarshalJSON(data []byte) error
type MockAnypointClient ¶
func (*MockAnypointClient) CreateClientApplication ¶
func (m *MockAnypointClient) CreateClientApplication(apiID string, body *AppRequestBody) (*Application, error)
func (*MockAnypointClient) CreateContract ¶
func (m *MockAnypointClient) CreateContract(appID string, contract *Contract) (*Contract, error)
func (*MockAnypointClient) CreateSLATier ¶ added in v1.1.47
func (m *MockAnypointClient) CreateSLATier(apiID string) (int, error)
func (*MockAnypointClient) DeleteClientApplication ¶
func (m *MockAnypointClient) DeleteClientApplication(appID string) error
func (*MockAnypointClient) DeleteContract ¶ added in v1.1.5
func (m *MockAnypointClient) DeleteContract(apiID, contractID string) error
func (*MockAnypointClient) GetAPI ¶ added in v1.1.5
func (m *MockAnypointClient) GetAPI(apiID string) (*API, error)
func (*MockAnypointClient) GetAccessToken ¶
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 (*MockAnypointClient) GetMonitoringArchive ¶ added in v1.2.5
func (m *MockAnypointClient) GetMonitoringArchive(apiID string, startDate time.Time) ([]APIMonitoringMetric, error)
func (*MockAnypointClient) GetPolicies ¶
func (m *MockAnypointClient) GetPolicies(string) ([]Policy, error)
func (*MockAnypointClient) GetSLATiers ¶
func (m *MockAnypointClient) GetSLATiers(apiID, tierName string) (*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 string) (*Application, error)
func (*MockAnypointClient) RevokeContract ¶ added in v1.1.5
func (m *MockAnypointClient) RevokeContract(apiID, contractID string) error
type MockClientBase ¶
type MonitoringBootInfo ¶ added in v1.2.5
type MonitoringBootInfo struct {
Settings MonitoringBootSetting `json:"Settings"`
}
Influx DB based metric data definitions
type MonitoringBootSetting ¶ added in v1.2.5
type MonitoringBootSetting struct {
DataSource MonitoringDataSource `json:"datasources"`
}
type MonitoringDataSource ¶ added in v1.2.5
type MonitoringDataSource struct {
InfluxDB InfluxDB `json:"influxdb"`
}
type Organization ¶
type Organization struct { Domain string `json:"domain"` ID string `json:"id"` Name string `json:"name"` }
Organization -
type Policy ¶
type Policy struct { Configuration interface{} `json:"configuration,omitempty"` ConfigurationData interface{} `json:"configurationData,omitempty"` PolicyTemplateID string `json:"policyTemplateId,omitempty"` }
Policy -
type SLATier ¶
type SLATier struct { Audit *Audit `json:"audit,omitempty"` MasterOrganizationID *string `json:"masterOrganizationId,omitempty"` OrganizationID *string `json:"organizationId,omitempty"` Description *string `json:"description,omitempty"` ID *int `json:"id,omitempty"` Limits []Limits `json:"limits"` Name string `json:"name"` Status string `json:"status"` AutoApprove bool `json:"autoApprove"` ApplicationCount *int `json:"applicationCount,omitempty"` }
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 -