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 Oct 24, 2023
1 parent 3a8a98c commit 57827bf
Show file tree
Hide file tree
Showing 15 changed files with 746 additions and 3 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 @@ -15161,6 +15238,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 @@ -16020,6 +16107,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 @@ -16333,6 +16421,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 @@ -16637,12 +16731,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 @@ -16694,12 +16790,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 @@ -16713,12 +16811,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 @@ -16741,12 +16841,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 @@ -16761,6 +16863,7 @@ components:
deployedTime: deployedTime
name: default
successDeployedTime: successDeployedTime
status: CREATED
properties:
revisionUuid:
example: c26b2b9b-4632-4ca4-b6f3-521c8863990c
Expand All @@ -16772,6 +16875,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 @@ -16960,6 +17071,7 @@ components:
name: name
value: value
revisionedApiProductId: 01234567-0123-0123-0123-012345678901
apiKeyHeader: apiKey
accessControlRoles: []
lastUpdatedTimestamp: lastUpdatedTimestamp
hasThumbnail: false
Expand Down Expand Up @@ -17142,6 +17254,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 @@ -31,6 +31,7 @@ Name | Type | Description | Notes
**policies** | **List&lt;String&gt;** | | [optional]
**apiThrottlingPolicy** | **String** | The API level throttling policy selected for the particular API | [optional]
**authorizationHeader** | **String** | Name of the Authorization header used for invoking the API. If it is not set, Authorization header name specified in tenant or system level will be used. | [optional]
**apiKeyHeader** | **String** | Name of the API key header used for invoking the API. If it is not set, default value &#x60;apiKey&#x60; will be used. | [optional]
**securityScheme** | **List&lt;String&gt;** | Types of API security, the current API secured with. It can be either OAuth2 or mutual SSL or both. If it is not set OAuth2 will be set as the security for the current API. | [optional]
**maxTps** | [**APIMaxTpsDTO**](APIMaxTpsDTO.md) | | [optional]
**visibility** | [**VisibilityEnum**](#VisibilityEnum) | The visibility level of the API. Accepts one of the following. PUBLIC, PRIVATE, RESTRICTED. | [optional]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ Name | Type | Description | Notes
**policies** | **List&lt;String&gt;** | | [optional]
**apiThrottlingPolicy** | **String** | The API level throttling policy selected for the particular API Product | [optional]
**authorizationHeader** | **String** | Name of the Authorization header used for invoking the API. If it is not set, Authorization header name specified in tenant or system level will be used. | [optional]
**apiKeyHeader** | **String** | Name of the API key header used for invoking the API. If it is not set, default value &#x60;apiKey&#x60; will be used. | [optional]
**securityScheme** | **List&lt;String&gt;** | Types of API security, the current API secured with. It can be either OAuth2 or mutual SSL or both. If it is not set OAuth2 will be set as the security for the current API. | [optional]
**subscriptionAvailability** | [**SubscriptionAvailabilityEnum**](#SubscriptionAvailabilityEnum) | The subscription availability. Accepts one of the following. CURRENT_TENANT, ALL_TENANTS or SPECIFIC_TENANTS. | [optional]
**subscriptionAvailableTenants** | **List&lt;String&gt;** | | [optional]
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 57827bf

Please sign in to comment.