Package com.sap.cloud.mt.subscription
Class SubscriberImpl
java.lang.Object
com.sap.cloud.mt.subscription.SubscriberImpl
- All Implemented Interfaces:
Subscriber
Class Subscriber provides methods to subscribe new tenants, start DB artifact deployments and unsubscribe tenants.
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionvoidcallSaasRegistry(boolean ok, String message, String applicationUrl, String saasRegistryUrl) Calls the saas registry.voidcheckAuthority(SecurityChecker.Authority authority) createInstanceAndOnBoard(String tenantId, SubscriptionPayload subscriptionPayload, String url, com.sap.xsa.core.instancemanager.client.InstanceCreationOptions instanceCreationOptions, AfterSubscribeMethod exit) Returns the list of microservices the program depends ongetSubscribeUrl(SubscriptionPayload subscriptionPayload) Gets the URL of the saas applicationvoidsetupDbTables(List<String> tenants) Starts hdi deployment for the specified already subscribed tenants.setupDbTablesAsync(List<String> tenants) Starts hdi deployment for the specified already subscribed tenants asynchronously.subscribe(String tenantId, SubscriptionPayload subscriptionPayload, String jwt) Subscribes the specified tenant synchronously.voidunsubscribe(String tenantId, DeletePayload deletePayload, String jwt) Unsubscribes the specified tenant synchronouslyupdateStatus(String jobId) Returns the status of an asynchronous upgrade operation.
-
Field Details
-
ALL_TENANTS
- See Also:
-
-
Method Details
-
unsubscribe
public void unsubscribe(String tenantId, DeletePayload deletePayload, String jwt) throws InternalError, ParameterError, AuthorityError Description copied from interface:SubscriberUnsubscribes the specified tenant synchronously- Specified by:
unsubscribein interfaceSubscriber- Parameters:
tenantId- the tenant identifierdeletePayload- Information provided by CIS about the subscribed applicationjwt- OAuth2 authorization token- Throws:
InternalError- is thrown if instance manager reports an errorParameterError- is thrown if needed configuration parameters aren't setAuthorityError- is thrown in case of missing authority
-
getApplicationDependencies
Description copied from interface:SubscriberReturns the list of microservices the program depends on- Specified by:
getApplicationDependenciesin interfaceSubscriber- Returns:
- list of dependent microservices
- Throws:
AuthorityError
-
subscribe
public String subscribe(String tenantId, SubscriptionPayload subscriptionPayload, String jwt) throws InternalError, ParameterError, AuthorityError Description copied from interface:SubscriberSubscribes the specified tenant synchronously.- Specified by:
subscribein interfaceSubscriber- Parameters:
tenantId- is the tenant identifiersubscriptionPayload- is provided by CIS and describes the subscribing applicationjwt- OAuth2 authorization token- Returns:
- The URL of the application UI
- Throws:
InternalError- is thrown if instance manager or hdi deployment app report an errorParameterError- is thrown if needed configuration parameters aren't setAuthorityError- is thrown in case of missing authority
-
getSubscribeUrl
public String getSubscribeUrl(SubscriptionPayload subscriptionPayload) throws InternalError, ParameterError, AuthorityError Description copied from interface:SubscriberGets the URL of the saas application- Specified by:
getSubscribeUrlin interfaceSubscriber- Parameters:
subscriptionPayload- is provided by CIS and describes the subscribing application- Returns:
- The URL of the application UI
- Throws:
InternalError- is thrown if instance manager or hdi deployment app report an errorParameterError- is thrown if needed configuration parameters aren't setAuthorityError- is thrown in case of missing authority
-
setupDbTables
public void setupDbTables(List<String> tenants) throws InternalError, ParameterError, AuthorityError Description copied from interface:SubscriberStarts hdi deployment for the specified already subscribed tenants.- Specified by:
setupDbTablesin interfaceSubscriber- Parameters:
tenants- is the list of tenant identifiers, if it contains only one entry "all" all tenants are updated- Throws:
InternalError- is thrown if the hdi deployment app reports an errorParameterError- is thrown if needed configuration parameters aren't setAuthorityError- is thrown in case of missing authority
-
setupDbTablesAsync
Description copied from interface:SubscriberStarts hdi deployment for the specified already subscribed tenants asynchronously.- Specified by:
setupDbTablesAsyncin interfaceSubscriber- Parameters:
tenants- is the list of tenant identifiers, if it contains only one entry "all" all tenants are updated- Returns:
- JobId if sidecar is used, otherwise empty
- Throws:
ParameterError- is thrown if needed configuration parameters aren't setAuthorityError- is thrown in case of missing authority
-
updateStatus
Description copied from interface:SubscriberReturns the status of an asynchronous upgrade operation. Only supported for sidecar.- Specified by:
updateStatusin interfaceSubscriber- Parameters:
jobId- returned from sidecar- Returns:
- Returns a sidecar json :{ "error": null, "status": "RUNNING", "result": null }
- Throws:
NotSupported- is thrown if operation is not supported by subscriber implementationInternalError- is thrown if sidecar cannot be accessed.AuthorityError- is thrown in case of missing authority
-
callSaasRegistry
public void callSaasRegistry(boolean ok, String message, String applicationUrl, String saasRegistryUrl) throws InternalError Description copied from interface:SubscriberCalls the saas registry.- Specified by:
callSaasRegistryin interfaceSubscriber- Parameters:
ok- Operation worked.message- Message returned to customers.applicationUrl- Must be filled in case of subscription. The URL under which the UI of the subscribed application can be reached.saasRegistryUrl- The callback URL provided by CIS.- Throws:
InternalError- Thrown in case the saas registry couldn't be called.
-
checkAuthority
- Specified by:
checkAuthorityin interfaceSubscriber- Throws:
AuthorityError- thrown if authority is missing
-
createInstanceAndOnBoard
public String createInstanceAndOnBoard(String tenantId, SubscriptionPayload subscriptionPayload, String url, com.sap.xsa.core.instancemanager.client.InstanceCreationOptions instanceCreationOptions, AfterSubscribeMethod exit) throws InternalError - Throws:
InternalError
-
getDbDeployer
-