From 3ff1dd5d076a625691d93faf44a82829c1f0ab23 Mon Sep 17 00:00:00 2001 From: souf Date: Mon, 22 Jan 2024 13:26:26 +0100 Subject: [PATCH 01/10] adds apim_policy --- spec/apim_policy.yml | 788 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 788 insertions(+) create mode 100644 spec/apim_policy.yml diff --git a/spec/apim_policy.yml b/spec/apim_policy.yml new file mode 100644 index 0000000..87d2e74 --- /dev/null +++ b/spec/apim_policy.yml @@ -0,0 +1,788 @@ +openapi: 3.0.0 +info: + title: API Manager Policy API + description: API Manager Policy API + version: 1.0.0 + +servers: + - url: https://anypoint.mulesoft.com/apimanager/ + description: Anypoint Cloudhub + - url: https://eu1.anypoint.mulesoft.com/apimanager/ + description: Anypoint Cloudhub EU + - url: https://gov.anypoint.mulesoft.com/apimanager/ + description: Anypoint Cloudhub GOV + +security: + - bearerAuth: [] + +paths: + /api/v1/organizations/{orgId}/automated-policies: + parameters: + - in: path + name: orgId + description: The organization Id + required: true + schema: + type: string + get: + operationId: GetOrgAutomatedPolicies + parameters: + - name: environmentId + in: query + description: A environment id + required: false + schema: + type: string + summary: Retrieve all automated policies of a given organization + description: Retrieves all automated policies of a given organization and optionally environment. + responses: + '401': + $ref: '#/components/responses/UnauthorizedError' + '404': + $ref: '#/components/responses/NotFoundError' + '200': # status code + $ref: '#/components/responses/SuccessGetOrgAutomatedPolicies' + + /apimanager/api/v1/organizations/{orgId}/custom-policy-templates: + parameters: + - in: path + name: orgId + description: The organization Id + required: true + schema: + type: string + get: + operationId: GetOrgCustomPolicyTemplates + parameters: + - name: query + in: query + description: Search criteria. + required: false + schema: + type: string + - name: offset + in: query + description: Skip over a number of elements by specifying an offset value for the query. + required: false + schema: + type: integer + - name: ascending + in: query + description: Order for sorting. + required: false + schema: + type: boolean + - name: sort + in: query + description: Property to sort by. + required: false + schema: + type: string + - name: limit + in: query + description: Limit the number of elements on the response. + required: false + schema: + type: integer + summary: Retrieve all or part of custom policy templates of a given organization + description: Retrieves all or part of custom policy templates of a given organization. + responses: + '401': + $ref: '#/components/responses/UnauthorizedError' + '404': + $ref: '#/components/responses/NotFoundError' + '200': # status code + $ref: '#/components/responses/SuccessGetOrgCustomPolicyTemplates' + + /apimanager/xapi/v1/organizations/{orgId}/exchange-policy-templates: + parameters: + - in: path + name: orgId + description: The organization Id + required: true + schema: + type: string + get: + operationId: GetOrgExchangePolicyTemplates + parameters: + - name: environmentId + in: query + description: The environment id. + required: false + schema: + type: string + - name: splitModel + in: query + description: Whether to include asset split model. + required: false + schema: + type: boolean + - name: latest + in: query + description: include only latest versions. + required: false + schema: + type: boolean + - name: apiInstanceId + in: query + description: include only templates used for api instance id. + required: false + schema: + type: string + - name: includeConfiguration + in: query + description: whether to include configuration. + required: false + schema: + type: boolean + - name: automatedOnly + in: query + description: whether to include automated policies only. + required: false + schema: + type: boolean + summary: Retrieve all or part of exchange policy templates of a given organization + description: Retrieves all or part of exchange policy templates of a given organization. + responses: + '401': + $ref: '#/components/responses/UnauthorizedError' + '404': + $ref: '#/components/responses/NotFoundError' + '200': # status code + $ref: '#/components/responses/SuccessGetOrgExchangePolicyTemplates' + + /apimanager/xapi/v1/organizations/{orgId}/exchange-policy-templates/{groupId}/{assetId}/{assetVersion}: + parameters: + - in: path + name: orgId + description: The organization Id + required: true + schema: + type: string + - in: path + name: groupId + description: The group Id + required: true + schema: + type: string + - in: path + name: assetId + description: The asset Id + required: true + schema: + type: string + - in: path + name: assetVersion + description: The asset version + required: true + schema: + type: string + get: + operationId: GetOrgExchangePolicyTemplateDetails + parameters: + - name: includeAllVersions + in: query + description: Whether to include all versions of the asset. + required: false + schema: + type: string + - name: splitModel + in: query + description: Whether to include asset split model. + required: false + schema: + type: boolean + summary: Retrieve details of exchange policy template of a given organization + description: Retrieve details of exchange policy template of a given organization. + responses: + '401': + $ref: '#/components/responses/UnauthorizedError' + '404': + $ref: '#/components/responses/NotFoundError' + '200': # status code + $ref: '#/components/responses/SuccessGetOrgExchangePolicyTemplateDetails' + + /apimanager/api/v1/organizations/{orgId}/environments/{envId}/apis/{apiId}/policies: + parameters: + - in: path + name: orgId + description: The organization Id + required: true + schema: + type: string + - in: path + name: envId + description: The environment Id + required: true + schema: + type: string + - in: path + name: apiId + description: The api manager instance Id + required: true + schema: + type: string + get: + operationId: GetApimPolicies + summary: Retrieve all of api manager instance policies. + description: Retrieve all of api manager instance policies in a given organization and environment. + responses: + '401': + $ref: '#/components/responses/UnauthorizedError' + '404': + $ref: '#/components/responses/NotFoundError' + '200': # status code + $ref: '#/components/responses/SuccessGetApimPolicies' + post: + operationId: PostApimPolicy + summary: Create an api manager instance policy. + description: Create an api manager instance policy in a given organization and environment. + requestBody: + description: policy content + content: + application/json: + schema: + $ref: "#/components/schemas/ApimPolicyBody" + responses: + '401': + $ref: '#/components/responses/UnauthorizedError' + '404': + $ref: '#/components/responses/NotFoundError' + '201': # status code + $ref: '#/components/responses/SuccessPostApimPolicy' + + /apimanager/api/v1/organizations/{orgId}/environments/{envId}/apis/{apiId}/policies/{apiPolicyId}: + parameters: + - in: path + name: orgId + description: The organization Id + required: true + schema: + type: string + - in: path + name: envId + description: The environment Id + required: true + schema: + type: string + - in: path + name: apiId + description: The api manager instance Id + required: true + schema: + type: string + - in: path + name: apiPolicyId + description: The api manager instance policy Id + required: true + schema: + type: string + get: + operationId: GetApimPolicy + summary: Retrieve a specific api manager instance policy. + description: Retrieve a specific api manager instance policy in a given organization and environment. + responses: + '401': + $ref: '#/components/responses/UnauthorizedError' + '404': + $ref: '#/components/responses/NotFoundError' + '200': # status code + $ref: '#/components/responses/SuccessGetApimPolicy' + patch: + operationId: PatchApimPolicy + summary: Update a specific api manager instance policy. + description: Update a specific api manager instance policy in a given organization and environment. + requestBody: + description: policy content + content: + application/json: + schema: + $ref: "#/components/schemas/ApimPolicyBody" + responses: + '401': + $ref: '#/components/responses/UnauthorizedError' + '404': + $ref: '#/components/responses/NotFoundError' + '200': # status code + $ref: '#/components/responses/SuccessPatchApimPolicy' + delete: + operationId: DeleteApimPolicy + summary: Delete a specific api manager instance policy. + description: Delete a specific api manager instance policy in a given organization and environment. + responses: + '401': + $ref: '#/components/responses/UnauthorizedError' + '404': + $ref: '#/components/responses/NotFoundError' + '200': # status code + $ref: '#/components/responses/SuccessDeleteApimPolicy' + +components: + securitySchemes: + bearerAuth: + type: http + scheme: bearer + bearerFormat: JWT + + responses: + UnauthorizedError: + description: Access token is missing or invalid + BadRequestError: + description: Bad request response + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorsResponse" + NotFoundError: + description: resource not found + content: + application/json: + schema: + type: object + properties: + name: + type: string + message: + type: string + SuccessGetOrgAutomatedPolicies: + description: collection of automated policies + content: + application/json: + schema: + $ref: "#/components/schemas/AutomatedPolicyCollection" + SuccessGetOrgCustomPolicyTemplates: + description: list of custom policy templates + # TODO: finish schema + SuccessGetOrgExchangePolicyTemplates: + description: list of exchange policy templates + content: + application/json: + schema: + $ref: "#/components/schemas/ExchangePolicyTemplateCollection" + SuccessGetOrgExchangePolicyTemplateDetails: + description: exchange policy template details + content: + application/json: + schema: + $ref: "#/components/schemas/ExchangePolicyTemplateDetails" + SuccessGetApimPolicies: + description: list api manager policies + content: + application/json: + schema: + $ref: "#/components/schemas/ApimPolicyCollection" + SuccessPostApimPolicy: + description: create api manager policy + content: + application/json: + schema: + $ref: "#/components/schemas/ApimPolicy" + SuccessGetApimPolicy: + description: get specific api manager policy + content: + application/json: + schema: + $ref: "#/components/schemas/ApimPolicy" + SuccessPatchApimPolicy: + description: patch specific api manager policy + content: + application/json: + schema: + $ref: "#/components/schemas/ApimPolicy" + SuccessDeleteApimPolicy: + description: delete specific api manager policy + + schemas: + ErrorsResponse: + type: object + title: errorsResponse + properties: + errors: + type: array + items: + type: object + properties: + type: + type: string + title: type + dataPath: + type: string + title: dataPath + keyword: + type: string + title: keyword + schema: + type: string + title: schema + data: + type: string + title: data + message: + type: string + title: message + + AutomatedPolicyCollection: + type: object + properties: + automatedPolicies: + type: array + items: + $ref: "#/components/schemas/AutomatedPolicy" + total: + type: integer + + AutomatedPolicy: + type: object + properties: + audit: + $ref: "#/components/schemas/Audit" + id: + type: integer + ruleOfApplication: + type: object + properties: + environmentId: + type: string + organizationId: + type: string + groupId: + type: string + assetId: + type: string + assetVersion: + type: string + configurationData: + type: object + pointcutData: + nullable: true + order: + type: integer + disabled: + type: boolean + implementationAssets: + type: array + items: + $ref: "#/components/schemas/ImplementationAsset" + + ExchangePolicyTemplateCollection: + type: array + items: + $ref: "#/components/schemas/ExchangePolicyTemplate" + + ExchangePolicyTemplate: + type: object + properties: + audit: + $ref: "#/components/schemas/Audit" + id: + type: integer + groupId: + type: string + assetId: + type: string + version: + type: string + name: + type: string + description: + type: string + type: + type: string + isOOTB: + type: boolean + stage: + type: string + status: + type: string + yamlMd5: + type: string + jarMd5: + type: string + orgId: + type: string + minMuleVersion: + type: string + supportedPoliciesVersions: + type: string + category: + type: string + violationCategory: + type: string + resourceLevelSupported: + type: boolean + encryptionSupported: + type: boolean + standalone: + type: boolean + requiredCharacteristics: + type: array + items: + type: string + identityManagement: + type: object + required: + - type + properties: + type: + type: string + providedCharacteristics: + type: array + items: + type: string + ramlSnippet: + type: string + ramlV1Snippet: + type: string + oasV2Snippet: + type: string + oasV3Snippet: + type: string + applicable: + type: boolean + configuration: + type: array + items: + $ref: "#/components/schemas/PolicyConfiguration" + + ExchangePolicyTemplateDetails: + type: object + properties: + audit: + $ref: "#/components/schemas/Audit" + id: + type: integer + groupId: + type: string + assetId: + type: string + version: + type: string + name: + type: string + description: + type: string + type: + type: string + isOOTB: + type: boolean + stage: + type: string + status: + type: string + yamlMd5: + type: string + jarMd5: + nullable: true + type: string + orgId: + type: string + minMuleVersion: + nullable: true + type: string + schemaId: + type: string + configuration: + type: object + properties: + title: + type: string + type: + type: string + description: + type: string + properties: + type: object + required: + type: array + items: + type: string + unevaluatedProperties: + type: boolean + '@context': + type: object + properties: + config: + type: string + '$id': + type: string + '$schema': + type: string + category: + type: string + providedCharacteristics: + type: array + items: + type: string + requiredCharacteristics: + type: array + items: + type: string + interfaceScope: + type: array + items: + type: string + violationCategory: + type: string + interfaceTransformation: + type: array + items: + type: string + allVersions: + type: array + items: + type: object + properties: + groupId: + type: string + assetId: + type: string + version: + type: string + splitAssetModel: + type: boolean + supportedJavaVersions: + type: array + items: + nullable: true + type: string + + ApimPolicyCollection: + type: array + items: + $ref: "#/components/schemas/ApimPolicy" + + ApimPolicy: + type: object + properties: + audit: + $ref: "#/components/schemas/Audit" + masterOrganizationId: + type: string + organizationId: + type: string + id: + type: integer + policyTemplateId: + type: string + configurationData: + type: object + order: + type: integer + disabled: + type: boolean + pointcutData: + nullable: true + type: string + groupId: + type: string + assetId: + type: string + assetVersion: + type: string + type: + type: string + apiId: + type: integer + + ApimPolicyBody: + type: object + properties: + configurationData: + type: object + apiVersionId: + type: integer + pointcutData: + nullable: true + type: string + policyTemplateId: + type: integer + groupId: + type: string + assetId: + type: string + assetVersion: + type: string + + PolicyConfiguration: + type: object + properties: + propertyName: + type: string + name: + type: string + description: + type: string + type: + type: string + options: + type: array + items: + type: object + properties: + name: + type: string + value: + oneOf: + - type: string + - type: boolean + - type: integer + optional: + type: boolean + defaultValue: + oneOf: + - type: string + - type: boolean + - type: integer + sensitive: + type: boolean + allowMultiple: + type: boolean + configuration: + type: array + items: + type: object + properties: + propertyName: + type: string + type: + type: string + + ImplementationAsset: + type: object + properties: + name: + type: string + assetId: + type: string + groupId: + type: string + version: + type: string + technology: + type: string + releaseNotes: + type: string + organizationId: + type: string + minRuntimeVersion: + type: string + + Audit: + type: object + properties: + created: + type: object + properties: + date: + type: string + updated: + type: object + properties: + date: + type: string + + + + + + From d5d032d635e604bb70f2e42687248791cc508290 Mon Sep 17 00:00:00 2001 From: souf Date: Mon, 22 Jan 2024 13:27:27 +0100 Subject: [PATCH 02/10] apim_policy: fixes issue on the path --- spec/apim_policy.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/spec/apim_policy.yml b/spec/apim_policy.yml index 87d2e74..381d9ed 100644 --- a/spec/apim_policy.yml +++ b/spec/apim_policy.yml @@ -43,7 +43,7 @@ paths: '200': # status code $ref: '#/components/responses/SuccessGetOrgAutomatedPolicies' - /apimanager/api/v1/organizations/{orgId}/custom-policy-templates: + /api/v1/organizations/{orgId}/custom-policy-templates: parameters: - in: path name: orgId @@ -94,7 +94,7 @@ paths: '200': # status code $ref: '#/components/responses/SuccessGetOrgCustomPolicyTemplates' - /apimanager/xapi/v1/organizations/{orgId}/exchange-policy-templates: + /xapi/v1/organizations/{orgId}/exchange-policy-templates: parameters: - in: path name: orgId @@ -151,7 +151,7 @@ paths: '200': # status code $ref: '#/components/responses/SuccessGetOrgExchangePolicyTemplates' - /apimanager/xapi/v1/organizations/{orgId}/exchange-policy-templates/{groupId}/{assetId}/{assetVersion}: + /xapi/v1/organizations/{orgId}/exchange-policy-templates/{groupId}/{assetId}/{assetVersion}: parameters: - in: path name: orgId @@ -202,7 +202,7 @@ paths: '200': # status code $ref: '#/components/responses/SuccessGetOrgExchangePolicyTemplateDetails' - /apimanager/api/v1/organizations/{orgId}/environments/{envId}/apis/{apiId}/policies: + /api/v1/organizations/{orgId}/environments/{envId}/apis/{apiId}/policies: parameters: - in: path name: orgId @@ -251,7 +251,7 @@ paths: '201': # status code $ref: '#/components/responses/SuccessPostApimPolicy' - /apimanager/api/v1/organizations/{orgId}/environments/{envId}/apis/{apiId}/policies/{apiPolicyId}: + /api/v1/organizations/{orgId}/environments/{envId}/apis/{apiId}/policies/{apiPolicyId}: parameters: - in: path name: orgId From e99b67e740de3b3f2852b8523ca7d6e4cc4f396e Mon Sep 17 00:00:00 2001 From: souf Date: Mon, 22 Jan 2024 13:28:27 +0100 Subject: [PATCH 03/10] apim_policy: updates delete status response --- spec/apim_policy.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/apim_policy.yml b/spec/apim_policy.yml index 381d9ed..830646f 100644 --- a/spec/apim_policy.yml +++ b/spec/apim_policy.yml @@ -314,7 +314,7 @@ paths: $ref: '#/components/responses/UnauthorizedError' '404': $ref: '#/components/responses/NotFoundError' - '200': # status code + '204': # status code $ref: '#/components/responses/SuccessDeleteApimPolicy' components: From ca21dbd4f2f2480804bcf576cc988f2234a7d287 Mon Sep 17 00:00:00 2001 From: souf Date: Mon, 22 Jan 2024 14:01:09 +0100 Subject: [PATCH 04/10] apim_policy: update post and patch post body --- spec/apim_policy.yml | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/spec/apim_policy.yml b/spec/apim_policy.yml index 830646f..18e284d 100644 --- a/spec/apim_policy.yml +++ b/spec/apim_policy.yml @@ -689,19 +689,14 @@ components: properties: configurationData: type: object - apiVersionId: - type: integer - pointcutData: - nullable: true - type: string - policyTemplateId: - type: integer groupId: type: string assetId: type: string assetVersion: type: string + order: + type: integer PolicyConfiguration: type: object From 92029e446ab8b0b178d18a382213eb4bbf0c6d2b Mon Sep 17 00:00:00 2001 From: souf Date: Mon, 22 Jan 2024 14:10:50 +0100 Subject: [PATCH 05/10] apim_policy: adds enable/disable policy --- spec/apim_policy.yml | 88 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 88 insertions(+) diff --git a/spec/apim_policy.yml b/spec/apim_policy.yml index 18e284d..60c525f 100644 --- a/spec/apim_policy.yml +++ b/spec/apim_policy.yml @@ -317,6 +317,82 @@ paths: '204': # status code $ref: '#/components/responses/SuccessDeleteApimPolicy' + /xapi/v1/organizations/{orgId}/environments/{envId}/apis/{apiId}/policies/{apiPolicyId}/disable: + parameters: + - in: path + name: orgId + description: The organization Id + required: true + schema: + type: string + - in: path + name: envId + description: The environment Id + required: true + schema: + type: string + - in: path + name: apiId + description: The api manager instance Id + required: true + schema: + type: string + - in: path + name: apiPolicyId + description: The api manager instance policy Id + required: true + schema: + type: string + post: + operationId: DisableApimPolicy + summary: Disable a specific api manager instance policy. + description: Disable a specific api manager instance policy in a given organization and environment. + responses: + '401': + $ref: '#/components/responses/UnauthorizedError' + '404': + $ref: '#/components/responses/NotFoundError' + '201': # status code + $ref: '#/components/responses/SuccessDisableApimPolicy' + + /xapi/v1/organizations/{orgId}/environments/{envId}/apis/{apiId}/policies/{apiPolicyId}/enable: + parameters: + - in: path + name: orgId + description: The organization Id + required: true + schema: + type: string + - in: path + name: envId + description: The environment Id + required: true + schema: + type: string + - in: path + name: apiId + description: The api manager instance Id + required: true + schema: + type: string + - in: path + name: apiPolicyId + description: The api manager instance policy Id + required: true + schema: + type: string + post: + operationId: EnableApimPolicy + summary: Enable a specific api manager instance policy. + description: Enable a specific api manager instance policy in a given organization and environment. + responses: + '401': + $ref: '#/components/responses/UnauthorizedError' + '404': + $ref: '#/components/responses/NotFoundError' + '201': # status code + $ref: '#/components/responses/SuccessEnableApimPolicy' + components: securitySchemes: bearerAuth: @@ -391,6 +467,18 @@ components: $ref: "#/components/schemas/ApimPolicy" SuccessDeleteApimPolicy: description: delete specific api manager policy + SuccessDisableApimPolicy: + description: disable specific api manager policy + content: + application/json: + schema: + $ref: "#/components/schemas/ApimPolicy" + SuccessEnableApimPolicy: + description: enable specific api manager policy + content: + application/json: + schema: + $ref: "#/components/schemas/ApimPolicy" schemas: ErrorsResponse: From 89522ce7b91620cfde4306e2d74d3049b69b0431 Mon Sep 17 00:00:00 2001 From: souf Date: Tue, 23 Jan 2024 09:23:22 +0100 Subject: [PATCH 06/10] apim_policy: updates --- spec/apim_policy.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/spec/apim_policy.yml b/spec/apim_policy.yml index 60c525f..0b39961 100644 --- a/spec/apim_policy.yml +++ b/spec/apim_policy.yml @@ -608,8 +608,6 @@ components: type: string identityManagement: type: object - required: - - type properties: type: type: string From 96501e21944fa1f12238061874901caf470ff559 Mon Sep 17 00:00:00 2001 From: souf Date: Tue, 23 Jan 2024 10:25:35 +0100 Subject: [PATCH 07/10] apim_policy: updates --- spec/apim_policy.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/apim_policy.yml b/spec/apim_policy.yml index 0b39961..5f51187 100644 --- a/spec/apim_policy.yml +++ b/spec/apim_policy.yml @@ -185,7 +185,7 @@ paths: description: Whether to include all versions of the asset. required: false schema: - type: string + type: boolean - name: splitModel in: query description: Whether to include asset split model. From d2762f5af6d117a102d12bedb2c55fb92349be6b Mon Sep 17 00:00:00 2001 From: souf Date: Tue, 23 Jan 2024 18:18:05 +0100 Subject: [PATCH 08/10] apim_policies: updates the pointcutData format --- spec/apim_policy.yml | 173 ++++++++++++++++--------------------------- 1 file changed, 62 insertions(+), 111 deletions(-) diff --git a/spec/apim_policy.yml b/spec/apim_policy.yml index 5f51187..f23d575 100644 --- a/spec/apim_policy.yml +++ b/spec/apim_policy.yml @@ -226,6 +226,13 @@ paths: operationId: GetApimPolicies summary: Retrieve all of api manager instance policies. description: Retrieve all of api manager instance policies in a given organization and environment. + parameters: + - in: query + name: fullInfo + required: false + schema: + type: boolean + default: false responses: '401': $ref: '#/components/responses/UnauthorizedError' @@ -440,7 +447,7 @@ components: content: application/json: schema: - $ref: "#/components/schemas/ExchangePolicyTemplateDetails" + $ref: "#/components/schemas/ExchangePolicyTemplate" SuccessGetApimPolicies: description: list api manager policies content: @@ -542,7 +549,7 @@ components: configurationData: type: object pointcutData: - nullable: true + $ref: "#/components/schemas/PointcutData" order: type: integer disabled: @@ -629,90 +636,6 @@ components: type: array items: $ref: "#/components/schemas/PolicyConfiguration" - - ExchangePolicyTemplateDetails: - type: object - properties: - audit: - $ref: "#/components/schemas/Audit" - id: - type: integer - groupId: - type: string - assetId: - type: string - version: - type: string - name: - type: string - description: - type: string - type: - type: string - isOOTB: - type: boolean - stage: - type: string - status: - type: string - yamlMd5: - type: string - jarMd5: - nullable: true - type: string - orgId: - type: string - minMuleVersion: - nullable: true - type: string - schemaId: - type: string - configuration: - type: object - properties: - title: - type: string - type: - type: string - description: - type: string - properties: - type: object - required: - type: array - items: - type: string - unevaluatedProperties: - type: boolean - '@context': - type: object - properties: - config: - type: string - '$id': - type: string - '$schema': - type: string - category: - type: string - providedCharacteristics: - type: array - items: - type: string - requiredCharacteristics: - type: array - items: - type: string - interfaceScope: - type: array - items: - type: string - violationCategory: - type: string - interfaceTransformation: - type: array - items: - type: string allVersions: type: array items: @@ -724,18 +647,20 @@ components: type: string version: type: string - splitAssetModel: - type: boolean - supportedJavaVersions: - type: array - items: - nullable: true - type: string ApimPolicyCollection: - type: array - items: - $ref: "#/components/schemas/ApimPolicy" + oneOf: + - type: array + title: "ApimPolicyCollecion" + items: + $ref: "#/components/schemas/ApimPolicy" + - type: object + title: "ApimPolicyFullCollecion" + properties: + policies: + type: array + items: + $ref: "#/components/schemas/ApimPolicyFull" ApimPolicy: type: object @@ -757,8 +682,7 @@ components: disabled: type: boolean pointcutData: - nullable: true - type: string + $ref: "#/components/schemas/PointcutData" groupId: type: string assetId: @@ -770,6 +694,33 @@ components: apiId: type: integer + ApimPolicyFull: + type: object + properties: + policyTemplateId: + type: string + type: + type: string + policyId: + type: integer + version: + type: integer + order: + type: integer + pointcutData: + $ref: "#/components/schemas/PointcutData" + configuration: + type: object + template: + type: object + properties: + groupId: + type: string + assetId: + type: string + assetVersion: + type: string + ApimPolicyBody: type: object properties: @@ -783,6 +734,19 @@ components: type: string order: type: integer + pointcutData: + $ref: "#/components/schemas/PointcutData" + + PointcutData: + nullable: true + type: array + items: + type: object + properties: + methodRegex: + type: string + uriTemplateRegex: + type: string PolicyConfiguration: type: object @@ -799,21 +763,8 @@ components: type: array items: type: object - properties: - name: - type: string - value: - oneOf: - - type: string - - type: boolean - - type: integer optional: type: boolean - defaultValue: - oneOf: - - type: string - - type: boolean - - type: integer sensitive: type: boolean allowMultiple: From a389e6205e0e9eafd1f7336e6d24a5289be27959 Mon Sep 17 00:00:00 2001 From: souf Date: Wed, 24 Jan 2024 10:04:14 +0100 Subject: [PATCH 09/10] apim_policy: updates pointcutDate schema --- spec/apim_policy.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/spec/apim_policy.yml b/spec/apim_policy.yml index f23d575..93136a6 100644 --- a/spec/apim_policy.yml +++ b/spec/apim_policy.yml @@ -742,6 +742,7 @@ components: type: array items: type: object + title: PointcutDataItem properties: methodRegex: type: string From 0fd4d79b030f0f67544098808e7dce38d3479725 Mon Sep 17 00:00:00 2001 From: souf Date: Thu, 25 Jan 2024 08:38:45 +0100 Subject: [PATCH 10/10] apim_policy: updates patch body to use open schema. --- spec/apim_policy.yml | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/spec/apim_policy.yml b/spec/apim_policy.yml index 93136a6..cd44df3 100644 --- a/spec/apim_policy.yml +++ b/spec/apim_policy.yml @@ -1,4 +1,4 @@ -openapi: 3.0.0 +openapi: 3.0.3 info: title: API Manager Policy API description: API Manager Policy API @@ -304,7 +304,7 @@ paths: content: application/json: schema: - $ref: "#/components/schemas/ApimPolicyBody" + $ref: "#/components/schemas/ApimPolicyPatchBody" responses: '401': $ref: '#/components/responses/UnauthorizedError' @@ -737,8 +737,15 @@ components: pointcutData: $ref: "#/components/schemas/PointcutData" + ApimPolicyPatchBody: + type: object + description: > + is the same as ApimPolicyBody, but since we had some issue generating a struct that puts nil to pointcutData. + We chose to leave this unspecified for an optimum coverage. + PointcutData: nullable: true + title: PointcutDataArray type: array items: type: object