Package com.sap.cloud.mt.subscription
Class SubscriberSidecarImpl
java.lang.Object
com.sap.cloud.mt.subscription.SubscriberSidecarImpl
- All Implemented Interfaces:
Subscriber
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final class -
Method Summary
Modifier and TypeMethodDescriptionvoidcallSaasRegistry(boolean ok, String message, String applicationUrl, String saasRegistryUrl) Calls the saas registry.voidcheckAuthority(SecurityChecker.Authority authority) 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.
-
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
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 errorAuthorityError- is thrown in case of missing authorityNotSupported
-
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:
InternalError- is thrown if the hdi deployment app or sidecar reports an errorAuthorityError- is thrown in case of missing authority
-
updateStatus
public String updateStatus(String jobId) throws InternalError, ParameterError, NotFound, AuthorityError 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:
InternalError- is thrown if sidecar cannot be accessed.ParameterError- is thrown if needed configuration parameters aren't setNotFound- is thrown if is jobId not foundAuthorityError- 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
-