Skip to content

Commit

Permalink
Integration test for revision deployment
Browse files Browse the repository at this point in the history
approval workflow
  • Loading branch information
GihanAyesh committed Dec 20, 2023
1 parent d938dfe commit c969ff6
Show file tree
Hide file tree
Showing 13 changed files with 736 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5195,6 +5195,7 @@ paths:
- AM_APPLICATION_DELETION
- AM_API_STATE
- AM_API_PRODUCT_STATE
- AM_REVISION_DEPLOYMENT
type: string
style: form
responses:
Expand Down Expand Up @@ -9442,6 +9443,7 @@ components:
- SUBSCRIPTION_DELETION
- SUBSCRIPTION_UPDATE
- API_PRODUCT_STATE
- REVISION_DEPLOYMENT
example: APPLICATION_CREATION
type: string
workflowStatus:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,9 @@ public enum WorkflowTypeEnum {

SUBSCRIPTION_UPDATE("SUBSCRIPTION_UPDATE"),

API_PRODUCT_STATE("API_PRODUCT_STATE");
API_PRODUCT_STATE("API_PRODUCT_STATE"),

REVISION_DEPLOYMENT("REVISION_DEPLOYMENT");

private String value;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3031,6 +3031,7 @@ paths:
- AM_APPLICATION_DELETION
- AM_API_STATE
- AM_API_PRODUCT_STATE
- AM_REVISION_DEPLOYMENT
responses:
200:
description: |
Expand Down Expand Up @@ -5815,6 +5816,7 @@ components:
- SUBSCRIPTION_DELETION
- SUBSCRIPTION_UPDATE
- API_PRODUCT_STATE
- REVISION_DEPLOYMENT
workflowStatus:
type: string
description: |
Expand Down
118 changes: 118 additions & 0 deletions modules/integration/tests-common/clients/publisher/api/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3129,6 +3129,83 @@ paths:
source: 'curl -k -X POST -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8"
"https://127.0.0.1:9443/api/am/publisher/v4/apis/890a4f4d-09eb-4877-a323-57f6ce2ed79b/restore-revision?revisionId=e0824883-3e86-403a-aec1-22bbc454eb7c"'
x-accepts: application/json
/apis/{apiId}/cancel-revision-workflow/{revisionId}/{envName}:
delete:
description: |
This operation can be used to remove pending revision deployment requests that are in pending state
operationId: deleteAPIRevisionDeploymentPendingTask
parameters:
- description: |
**API ID** consisting of the **UUID** of the API.
explode: false
in: path
name: apiId
required: true
schema:
type: string
style: simple
- description: |
Revision ID of an API
explode: false
in: path
name: revisionId
required: true
schema:
type: string
style: simple
- description: |
Environment name of an Revision
explode: false
in: path
name: envName
required: true
schema:
type: string
style: simple
responses:
"200":
content: {}
description: |
OK.
Revision deployment pending task removed successfully.
"404":
content:
application/json:
example:
code: 404
message: Not Found
description: The specified resource does not exist
moreInfo: ""
error: []
schema:
$ref: '#/components/schemas/Error'
description: Not Found. The specified resource does not exist.
"412":
content:
application/json:
example:
code: 412
message: Precondition Failed
description: The request has not been performed because one of the
preconditions is not met
moreInfo: ""
error: []
schema:
$ref: '#/components/schemas/Error'
description: Precondition Failed. The request has not been performed because
one of the preconditions is not met.
security:
- OAuth2Security:
- apim:api_publish
- apim:api_manage
summary: Delete Pending Revision Deployment Workflow Tasks
tags:
- API Revisions
x-code-samples:
- lang: Curl
source: 'curl -k -X DELETE -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8"
"https://127.0.0.1:9443/api/am/publisher/v4/apis/890a4f4d-09eb-4877-a323-57f6ce2ed79b/cancel-revision-workflow/e0824883-3e86-403a-aec1-22bbc454eb7c/Default"'
x-accepts: application/json
/apis/import-service:
post:
description: This operation can be used to create an API from a Service from
Expand Down Expand Up @@ -15164,6 +15241,16 @@ components:
schema:
type: string
style: simple
envName:
description: |
Environment name of an Revision
explode: false
in: path
name: envName
required: true
schema:
type: string
style: simple
revisionId-Q:
description: |
Revision ID of an API
Expand Down Expand Up @@ -16023,6 +16110,7 @@ components:
createdTime: createdTime
id: 01234567-0123-0123-0123-012345678901
wsdlUrl: /apimgt/applicationdata/wsdls/admin--soap1.wsdl
apiKeyHeader: apiKey
accessControlRoles: []
audience: PUBLIC
visibility: PUBLIC
Expand Down Expand Up @@ -16336,6 +16424,12 @@ components:
example: Authorization
pattern: (^[^~!@#;:%^*()+={}|\\<>"',&$\s+]*$)
type: string
apiKeyHeader:
description: |
Name of the API key header used for invoking the API. If it is not set, default value `apiKey` will be used.
example: apiKey
pattern: (^[^~!@#;:%^*()+={}|\\<>"',&$\s+]*$)
type: string
securityScheme:
description: |
Types of API security, the current API secured with. It can be either OAuth2 or mutual SSL or both. If
Expand Down Expand Up @@ -16640,12 +16734,14 @@ components:
deployedTime: deployedTime
name: default
successDeployedTime: successDeployedTime
status: CREATED
- revisionUuid: c26b2b9b-4632-4ca4-b6f3-521c8863990c
vhost: mg.wso2.com
displayOnDevportal: true
deployedTime: deployedTime
name: default
successDeployedTime: successDeployedTime
status: CREATED
apiInfo:
id: 01234567-0123-0123-0123-012345678901
properties:
Expand Down Expand Up @@ -16697,12 +16793,14 @@ components:
deployedTime: deployedTime
name: default
successDeployedTime: successDeployedTime
status: CREATED
- revisionUuid: c26b2b9b-4632-4ca4-b6f3-521c8863990c
vhost: mg.wso2.com
displayOnDevportal: true
deployedTime: deployedTime
name: default
successDeployedTime: successDeployedTime
status: CREATED
apiInfo:
id: 01234567-0123-0123-0123-012345678901
- displayName: REVISION 1
Expand All @@ -16716,12 +16814,14 @@ components:
deployedTime: deployedTime
name: default
successDeployedTime: successDeployedTime
status: CREATED
- revisionUuid: c26b2b9b-4632-4ca4-b6f3-521c8863990c
vhost: mg.wso2.com
displayOnDevportal: true
deployedTime: deployedTime
name: default
successDeployedTime: successDeployedTime
status: CREATED
apiInfo:
id: 01234567-0123-0123-0123-012345678901
properties:
Expand All @@ -16744,12 +16844,14 @@ components:
deployedTime: deployedTime
name: default
successDeployedTime: successDeployedTime
status: CREATED
- revisionUuid: c26b2b9b-4632-4ca4-b6f3-521c8863990c
vhost: mg.wso2.com
displayOnDevportal: true
deployedTime: deployedTime
name: default
successDeployedTime: successDeployedTime
status: CREATED
properties:
list:
items:
Expand All @@ -16764,6 +16866,7 @@ components:
deployedTime: deployedTime
name: default
successDeployedTime: successDeployedTime
status: CREATED
properties:
revisionUuid:
example: c26b2b9b-4632-4ca4-b6f3-521c8863990c
Expand All @@ -16775,6 +16878,14 @@ components:
maxLength: 255
minLength: 1
type: string
status:
default: CREATED
enum:
- CREATED
- APPROVED
- REJECTED
example: CREATED
type: string
vhost:
example: mg.wso2.com
maxLength: 255
Expand Down Expand Up @@ -16963,6 +17074,7 @@ components:
name: name
value: value
revisionedApiProductId: 01234567-0123-0123-0123-012345678901
apiKeyHeader: apiKey
accessControlRoles: []
lastUpdatedTimestamp: lastUpdatedTimestamp
hasThumbnail: false
Expand Down Expand Up @@ -17145,6 +17257,12 @@ components:
in tenant or system level will be used.
example: Authorization
type: string
apiKeyHeader:
description: |
Name of the API key header used for invoking the API. If it is not set, default value `apiKey` will be used.
example: apiKey
pattern: (^[^~!@#;:%^*()+={}|\\<>"',&$\s+]*$)
type: string
securityScheme:
description: |
Types of API security, the current API secured with. It can be either OAuth2 or mutual SSL or both. If
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,21 @@ Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**revisionUuid** | **String** | | [optional]
**name** | **String** | | [optional]
**status** | [**StatusEnum**](#StatusEnum) | | [optional]
**vhost** | **String** | | [optional]
**displayOnDevportal** | **Boolean** | | [optional]
**deployedTime** | **String** | | [optional] [readonly]
**successDeployedTime** | **String** | | [optional] [readonly]



## Enum: StatusEnum

Name | Value
---- | -----
CREATED | &quot;CREATED&quot;
APPROVED | &quot;APPROVED&quot;
REJECTED | &quot;REJECTED&quot;



Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ Method | HTTP request | Description
------------- | ------------- | -------------
[**createAPIRevision**](ApiRevisionsApi.md#createAPIRevision) | **POST** /apis/{apiId}/revisions | Create API Revision
[**deleteAPIRevision**](ApiRevisionsApi.md#deleteAPIRevision) | **DELETE** /apis/{apiId}/revisions/{revisionId} | Delete Revision
[**deleteAPIRevisionDeploymentPendingTask**](ApiRevisionsApi.md#deleteAPIRevisionDeploymentPendingTask) | **DELETE** /apis/{apiId}/cancel-revision-workflow/{revisionId}/{envName} | Delete Pending Revision Deployment Workflow Tasks
[**deployAPIRevision**](ApiRevisionsApi.md#deployAPIRevision) | **POST** /apis/{apiId}/deploy-revision | Deploy Revision
[**getAPIRevision**](ApiRevisionsApi.md#getAPIRevision) | **GET** /apis/{apiId}/revisions/{revisionId} | Retrieve Revision
[**getAPIRevisionDeployments**](ApiRevisionsApi.md#getAPIRevisionDeployments) | **GET** /apis/{apiId}/deployments | List Deployments
Expand Down Expand Up @@ -157,6 +158,78 @@ Name | Type | Description | Notes
**204** | No Content. Successfully deleted the revision | - |
**404** | Not Found. The specified resource does not exist. | - |

<a name="deleteAPIRevisionDeploymentPendingTask"></a>
# **deleteAPIRevisionDeploymentPendingTask**
> deleteAPIRevisionDeploymentPendingTask(apiId, revisionId, envName)
Delete Pending Revision Deployment Workflow Tasks

This operation can be used to remove pending revision deployment requests that are in pending state

### Example
```java
// Import classes:
import org.wso2.am.integration.clients.publisher.api.ApiClient;
import org.wso2.am.integration.clients.publisher.api.ApiException;
import org.wso2.am.integration.clients.publisher.api.Configuration;
import org.wso2.am.integration.clients.publisher.api.auth.*;
import org.wso2.am.integration.clients.publisher.api.models.*;
import org.wso2.am.integration.clients.publisher.api.v1.ApiRevisionsApi;

public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://apis.wso2.com/api/am/publisher/v4");

// Configure OAuth2 access token for authorization: OAuth2Security
OAuth OAuth2Security = (OAuth) defaultClient.getAuthentication("OAuth2Security");
OAuth2Security.setAccessToken("YOUR ACCESS TOKEN");

ApiRevisionsApi apiInstance = new ApiRevisionsApi(defaultClient);
String apiId = "apiId_example"; // String | **API ID** consisting of the **UUID** of the API.
String revisionId = "revisionId_example"; // String | Revision ID of an API
String envName = "envName_example"; // String | Environment name of an Revision
try {
apiInstance.deleteAPIRevisionDeploymentPendingTask(apiId, revisionId, envName);
} catch (ApiException e) {
System.err.println("Exception when calling ApiRevisionsApi#deleteAPIRevisionDeploymentPendingTask");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
```

### Parameters

Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**apiId** | **String**| **API ID** consisting of the **UUID** of the API. |
**revisionId** | **String**| Revision ID of an API |
**envName** | **String**| Environment name of an Revision |

### Return type

null (empty response body)

### Authorization

[OAuth2Security](../README.md#OAuth2Security)

### HTTP request headers

- **Content-Type**: Not defined
- **Accept**: application/json

### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
**200** | OK. Revision deployment pending task removed successfully. | - |
**404** | Not Found. The specified resource does not exist. | - |
**412** | Precondition Failed. The request has not been performed because one of the preconditions is not met. | - |

<a name="deployAPIRevision"></a>
# **deployAPIRevision**
> List&lt;APIRevisionDeploymentDTO&gt; deployAPIRevision(apiId, revisionId, apIRevisionDeploymentDTO)
Expand Down
Loading

0 comments on commit c969ff6

Please sign in to comment.