arazzo: 1.0.1 info: title: Adobe Launch Build a Library and Poll for Completion summary: Create a library, add a rule to it, kick off a build, and poll the build until it finishes. description: >- The core publishing flow for Adobe Experience Platform Launch (Tags). This workflow creates a library under a property, adds a rule resource to the library, sets the library's target environment, compiles the library into a build, and then polls the build by id until its status leaves the pending state. Because build compilation is asynchronous, the poll step retries on the pending status and branches on success or failure. Every request is written inline using the JSON:API shapes these endpoints require. version: 1.0.0 sourceDescriptions: - name: reactorApi url: ../openapi/reactor-api.yml type: openapi workflows: - workflowId: library-build-and-poll summary: Assemble a library, build it, and wait for the asynchronous build to complete. description: >- Creates a library, attaches a rule, assigns an environment, triggers a build, and polls the build status until it is succeeded or failed. inputs: type: object required: - accessToken - apiKey - imsOrgId - propertyId - libraryName - ruleId - environmentId properties: accessToken: type: string description: OAuth 2.0 Server-to-Server bearer access token from Adobe Developer Console. apiKey: type: string description: Client ID credential sent as the x-api-key header. imsOrgId: type: string description: Adobe Organization ID sent as the x-gw-ims-org-id header. propertyId: type: string description: The property the library is created under. libraryName: type: string description: Human-readable name for the new library. ruleId: type: string description: Id of an existing rule to add to the library. environmentId: type: string description: Id of the environment to publish the library into. steps: - stepId: createLibrary description: Create a new library under the property. operationId: createLibrary parameters: - name: Authorization in: header value: "Bearer $inputs.accessToken" - name: x-api-key in: header value: $inputs.apiKey - name: x-gw-ims-org-id in: header value: $inputs.imsOrgId - name: propertyId in: path value: $inputs.propertyId requestBody: contentType: application/vnd.api+json payload: data: type: libraries attributes: name: $inputs.libraryName successCriteria: - condition: $statusCode == 201 outputs: libraryId: $response.body#/data/id - stepId: addRuleToLibrary description: Add the supplied rule to the library's set of rule resources. operationId: addResourcesToLibrary parameters: - name: Authorization in: header value: "Bearer $inputs.accessToken" - name: x-api-key in: header value: $inputs.apiKey - name: x-gw-ims-org-id in: header value: $inputs.imsOrgId - name: libraryId in: path value: $steps.createLibrary.outputs.libraryId - name: resourceType in: path value: rules requestBody: contentType: application/vnd.api+json payload: data: - id: $inputs.ruleId type: rules successCriteria: - condition: $statusCode == 200 - stepId: setEnvironment description: Assign the library to an environment so it can be built and published. operationId: setEnvironmentForLibrary parameters: - name: Authorization in: header value: "Bearer $inputs.accessToken" - name: x-api-key in: header value: $inputs.apiKey - name: x-gw-ims-org-id in: header value: $inputs.imsOrgId - name: libraryId in: path value: $steps.createLibrary.outputs.libraryId requestBody: contentType: application/vnd.api+json payload: data: id: $inputs.environmentId type: environments successCriteria: - condition: $statusCode == 200 - stepId: createBuild description: Compile the assembled library into a build. operationId: createBuild parameters: - name: Authorization in: header value: "Bearer $inputs.accessToken" - name: x-api-key in: header value: $inputs.apiKey - name: x-gw-ims-org-id in: header value: $inputs.imsOrgId - name: libraryId in: path value: $steps.createLibrary.outputs.libraryId successCriteria: - condition: $statusCode == 201 outputs: buildId: $response.body#/data/id - stepId: pollBuild description: >- Retrieve the build by id and retry while it is still pending; branch to success or failure once the build settles. operationId: getBuild parameters: - name: Authorization in: header value: "Bearer $inputs.accessToken" - name: x-api-key in: header value: $inputs.apiKey - name: x-gw-ims-org-id in: header value: $inputs.imsOrgId - name: buildId in: path value: $steps.createBuild.outputs.buildId successCriteria: - condition: $statusCode == 200 outputs: buildStatus: $response.body#/data/attributes/status onSuccess: - name: stillBuilding type: retry retryAfter: 5 retryLimit: 30 criteria: - context: $response.body condition: $.data.attributes.status == "pending" type: jsonpath - name: buildSucceeded type: end criteria: - context: $response.body condition: $.data.attributes.status == "succeeded" type: jsonpath outputs: libraryId: $steps.createLibrary.outputs.libraryId buildId: $steps.createBuild.outputs.buildId buildStatus: $steps.pollBuild.outputs.buildStatus