wso2.apim.catalog
Module wso2.apim.catalog
API
Declarations
ballerinax/wso2.apim.catalog Ballerina library
Ballerina WSO2 APIM Catalog Publisher
Overview
The Ballerina WSO2 APIM catalog publisher module includes ballerina service management tools for publishing service data to WSO2 API manager service catalogs.
Quickstart
- Add
import ballerinax/wso2.apim.catalog as _;
to the default module. - Add
remoteManagement=true
to[build-options]
section of the Ballerina.toml file. - Create Config.toml file if it does not exist, and add the following configurations.
Modify the configurations to match your WSO2 APIM manager.[ballerinax.wso2.apim.catalog] serviceUrl="<Url of the service catalog endpoint>" tokenUrl="<Url of the token endpoint>" username="<username>" password="<password>" clientId="<clientId>" clientSecret="<Client secret>"
- Run the project with the following command.
$ bal run
Examples
import ballerina/http; import ballerinax/wso2.apim.catalog as _; service /sales0 on new http:Listener(9000) { // implementation }
Useful links
- Chat live with us via our Discord server.
- Post all technical questions on Stack Overflow with the #ballerina tag.
Clients
wso2.apim.catalog: Client
This specifies a RESTful API for Service Catalog.
Constructor
Gets invoked to initialize the connector
.
init (ConnectionConfig config, string serviceUrl)
- config ConnectionConfig - The configurations to be used when initializing the
connector
- serviceUrl string "https://apis.wso2.com/api/service-catalog/v1" - URL of the target service
get services
function get services(string? name, string? version, "OAS"|"WSDL1"|"WSDL2"|"GRAPHQL_SDL"|"ASYNC_API"? definitionType, string? 'key, boolean shrink, "name"|"definitionType"? sortBy, "asc"|"desc"? sortOrder, int 'limit, int offset) returns ServiceList|error
Retrieve/search services
Parameters
- name string? (default ()) - Filter services by the name of the service
- version string? (default ()) - Filter services by version of the service
- definitionType "OAS"|"WSDL1"|"WSDL2"|"GRAPHQL_SDL"|"ASYNC_API"? (default ()) - Filter services by definitionType
- 'key string? (default ()) - Comma seperated keys of the services to check
- shrink boolean (default false) - If this set to true, a minimal set of fields will be provided for each service including the md5
- sortBy "name"|"definitionType"? (default ()) -
- sortOrder "asc"|"desc"? (default ()) -
- 'limit int (default 25) - Maximum limit of items to return.
- offset int (default 0) - Starting point within the complete list of items qualified.
Return Type
- ServiceList|error - Paginated matched list of services returned.
post services
function post services(ServiceSchema payload) returns Service|error
Add a new service to Service Catalog
Parameters
- payload ServiceSchema -
Return Type
get services/[string serviceId]
Get details of a service
put services/[string serviceId]
function put services/[string serviceId](ServiceSchema payload) returns Service|error
Update a service
Parameters
- payload ServiceSchema -
Return Type
delete services/[string serviceId]
Delete a service
get services/[string serviceId]/definition
Retrieve a service definition
get services/[string serviceId]/usage
Retrieve the API Info that use the given service
post services/'import
function post services/'import(Services_import_body payload, boolean overwrite) returns ServiceInfoList|error
Import a service
Parameters
- payload Services_import_body -
- overwrite boolean (default false) - Whether to overwrite if there is any existing service with the same name and version.
Return Type
- ServiceInfoList|error - Successful response with the imported service metadata.
get services/export
Export a service
Parameters
- name string - Name of the service to export
- version string - Version of the service to export
Return Type
- byte[]|error - Successful response as the exported service as a zipped archive.
get settings
Retrieve service catalog API settings
Authentication
Our REST APIs are protected using OAuth2 and access control is achieved through scopes. Before you start invoking the the API you need to obtain an access token with the required scopes. This guide will walk you through the steps that you will need to follow to obtain an access token. First you need to obtain the consumer key/secret key pair by calling the dynamic client registration (DCR) endpoint. You can add your preferred grant types in the payload. A Sample payload is shown below.
Enums
wso2.apim.catalog: DefinitionType
Members
wso2.apim.catalog: SecurityType
Members
Listeners
wso2.apim.catalog: Listener
attach
'start
function 'start() returns error?
gracefulStop
function gracefulStop() returns error?
immediateStop
function immediateStop() returns error?
detach
function detach(service object {} s) returns error?
Parameters
- s service object {} -
Annotations
wso2.apim.catalog: ServiceCatalogConfig
Configurables
wso2.apim.catalog: serviceUrl
wso2.apim.catalog: username
wso2.apim.catalog: password
wso2.apim.catalog: clientId
wso2.apim.catalog: clientSecret
wso2.apim.catalog: tokenUrl
wso2.apim.catalog: port
wso2.apim.catalog: clientSecureSocketpath
wso2.apim.catalog: clientSecureSocketpassword
wso2.apim.catalog: serverCert
wso2.apim.catalog: scopes
Records
wso2.apim.catalog: APIInfo
Fields
- id? string -
- name? string -
- context? string -
- version? string -
- provider? string -
wso2.apim.catalog: APIList
Fields
- count? int - Number of APIs returned.
- list? APIInfo[] -
wso2.apim.catalog: ClientHttp1Settings
Provides settings related to HTTP/1.x protocol.
Fields
- keepAlive KeepAlive(default http:KEEPALIVE_AUTO) - Specifies whether to reuse a connection for multiple requests
- chunking Chunking(default http:CHUNKING_AUTO) - The chunking behaviour of the request
- proxy? ProxyConfig - Proxy server related options
wso2.apim.catalog: ConnectionConfig
Provides a set of configurations for controlling the behaviours when communicating with a remote HTTP endpoint.
Fields
- auth OAuth2PasswordGrantConfig - Configurations related to client authentication
- httpVersion HttpVersion(default http:HTTP_2_0) - The HTTP version understood by the client
- http1Settings? ClientHttp1Settings - Configurations related to HTTP/1.x protocol
- http2Settings? ClientHttp2Settings - Configurations related to HTTP/2 protocol
- timeout decimal(default 60) - The maximum time to wait (in seconds) for a response before closing the connection
- forwarded string(default "disable") - The choice of setting
forwarded
/x-forwarded
header
- poolConfig? PoolConfiguration - Configurations associated with request pooling
- cache? CacheConfig - HTTP caching related configurations
- compression Compression(default http:COMPRESSION_AUTO) - Specifies the way of handling compression (
accept-encoding
) header
- circuitBreaker? CircuitBreakerConfig - Configurations associated with the behaviour of the Circuit Breaker
- retryConfig? RetryConfig - Configurations associated with retrying
- responseLimits? ResponseLimitConfigs - Configurations associated with inbound response size limits
- secureSocket? ClientSecureSocket - SSL/TLS-related options
- proxy? ProxyConfig - Proxy server related options
- validation boolean(default true) - Enables the inbound payload validation functionality which provided by the constraint package. Enabled by default
wso2.apim.catalog: Error
Fields
- code int -
- message string - Error message.
- description? string - A detail description about the error message.
- moreInfo? string - Preferably an url with more details about the error.
- 'error? ErrorListItem[] - If there are more than one error list them out. For example, list out validation errors by each field.
wso2.apim.catalog: ErrorListItem
Fields
- code string -
- message string - Description about individual errors occurred
- description? string - A detail description about the error message.
wso2.apim.catalog: OAuth2PasswordGrantConfig
OAuth2 Password Grant Configs
Fields
- Fields Included from *OAuth2PasswordGrantConfig
- tokenUrl string
- username string
- password string
- clientId string
- clientSecret string
- scopes string|string[]
- refreshConfig RefreshConfig|"INFER_REFRESH_CONFIG"
- defaultTokenExpTime decimal
- clockSkew decimal
- optionalParams map<string>
- credentialBearer CredentialBearer
- clientConfig ClientConfiguration
- tokenUrl string(default "https://localhost:9443/oauth2/token") - Token URL
wso2.apim.catalog: Pagination
Fields
- offset? int -
- 'limit? int -
- total? int -
- next? string - Link to the next subset of resources qualified. Empty if no more resources are to be returned.
- previous? string - Link to the previous subset of resources qualified. Empty if current subset is the first subset returned.
wso2.apim.catalog: ProxyConfig
Proxy server configurations to be used with the HTTP client endpoint.
Fields
- host string(default "") - Host name of the proxy server
- port int(default 0) - Proxy server port
- userName string(default "") - Proxy server username
- password string(default "") - Proxy server password
wso2.apim.catalog: Service
Fields
- id? string -
- name string -
- description? string -
- version string -
- serviceKey? string -
- serviceUrl string -
- definitionType "OAS2"|"OAS3"|"WSDL1"|"WSDL2"|"GRAPHQL_SDL"|"ASYNC_API" - The type of the provided API definition
- securityType "BASIC"|"DIGEST"|"OAUTH2"|"X509"|"API_KEY"|"NONE" (default "NONE") - The security type of the endpoint
- mutualSSLEnabled boolean(default false) - Whether Mutual SSL is enabled for the endpoint
- usage? int - Number of usages of the service in APIs
- createdTime? string -
- lastUpdatedTime? string -
- md5? string -
- definitionUrl? string -
wso2.apim.catalog: ServiceArtifact
Fields
- name string -
- description string(default "") -
- version string(default "_") -
- serviceKey string -
- serviceUrl string -
- definitionType DefinitionType -
- securityType SecurityType(default "BASIC") -
- mutualSSLEnabled boolean(default false) -
- usage int(default 1) -
- createdTime string -
- lastUpdatedTime string -
- md5 string -
- definitionUrl string -
- definitionFileContent string(default "") -
wso2.apim.catalog: ServiceCatalogMetaData
Fields
- openApiDefinition byte[](default []) -
wso2.apim.catalog: ServiceInfo
Fields
- id? string -
- name? string -
- 'key? string -
- version? string -
- md5? string -
wso2.apim.catalog: ServiceInfoList
Fields
- count? int - MD5 hashes of services returned.
- list? ServiceInfo[] -
wso2.apim.catalog: ServiceList
Fields
- list? Service[] -
- pagination? Pagination -
wso2.apim.catalog: ServiceListExpanded
Fields
- count? int - MD5 hashes of services returned.
- list? Service[] -
- pagination? Pagination -
wso2.apim.catalog: Services_import_body
Fields
- file record { fileContent byte[], fileName string } - Zip archive consisting of exported Application Configuration.
- verifier? string -
wso2.apim.catalog: ServiceSchema
Fields
- serviceMetadata Service -
- definitionFile? record { fileContent byte[], fileName string } -
- inlineContent? string - Inline content of the document
wso2.apim.catalog: Settings
Fields
- scopes? string[] -
wso2.apim.catalog: Verifier
Fields
- 'key string -
- md5 string -
Import
import ballerinax/wso2.apim.catalog;
Metadata
Released date: about 2 months ago
Version: 1.0.0
Compatibility
Platform: java17
Ballerina version: 2201.10.0
GraalVM compatible: Yes
Pull count
Total: 3
Current verison: 3
Weekly downloads
Other versions
1.0.0