Google Cloud Platform · Arazzo Workflow

Google Cloud Platform Delete and Restore Project

Version 1.0.0

Mark a project for deletion, confirm DELETE_REQUESTED, then undelete it back to active.

1 workflow 1 source API 1 provider
View Spec View on GitHub API ManagementCloud ComputingInfrastructurePlatform as a ServiceArazzoWorkflows

Provider

google-cloud-platform

Workflows

delete-and-restore-project
Delete a project then restore it within the grace period.
Marks a project for deletion, waits for the delete operation, then undeletes it and waits for the restore operation.
5 steps inputs: projectId outputs: deleteOperation, undeleteOperation
1
getProject
cloudresourcemanager.projects.get
Read the project to confirm it exists and capture its starting state.
2
deleteProject
cloudresourcemanager.projects.delete
Mark the project for deletion. Returns a long-running Operation whose name is used to poll for completion.
3
pollDelete
cloudresourcemanager.operations.get
Poll the delete operation by name until the done flag is true.
4
undeleteProject
cloudresourcemanager.projects.undelete
Restore the project from DELETE_REQUESTED within the grace period. Returns a long-running Operation whose name is used to poll.
5
pollUndelete
cloudresourcemanager.operations.get
Poll the undelete operation by name until the done flag is true.

Source API Descriptions

Arazzo Workflow Specification

google-cloud-platform-delete-and-restore-project-workflow.yml Raw ↑
arazzo: 1.0.1
info:
  title: Google Cloud Platform Delete and Restore Project
  summary: Mark a project for deletion, confirm DELETE_REQUESTED, then undelete it back to active.
  description: >-
    Exercises the project deletion grace period. The workflow reads the project,
    marks it for deletion (which moves it to DELETE_REQUESTED), polls the delete
    operation until done, and then restores the project with undelete before
    polling that operation to completion. Every step spells out its request
    inline so the flow can be read and executed without opening the underlying
    OpenAPI description.
  version: 1.0.0
sourceDescriptions:
- name: cloudResourceManagerApi
  url: ../openapi/cloud-resource-manager-openapi.yml
  type: openapi
workflows:
- workflowId: delete-and-restore-project
  summary: Delete a project then restore it within the grace period.
  description: >-
    Marks a project for deletion, waits for the delete operation, then undeletes
    it and waits for the restore operation.
  inputs:
    type: object
    required:
    - projectId
    properties:
      projectId:
        type: string
        description: The project id to delete and restore (e.g. my-app-prod-123).
  steps:
  - stepId: getProject
    description: >-
      Read the project to confirm it exists and capture its starting state.
    operationId: cloudresourcemanager.projects.get
    parameters:
    - name: projectId
      in: path
      value: $inputs.projectId
    successCriteria:
    - condition: $statusCode == 200
    outputs:
      startingState: $response.body#/state
  - stepId: deleteProject
    description: >-
      Mark the project for deletion. Returns a long-running Operation whose
      name is used to poll for completion.
    operationId: cloudresourcemanager.projects.delete
    parameters:
    - name: projectId
      in: path
      value: $inputs.projectId
    successCriteria:
    - condition: $statusCode == 200
    outputs:
      operationName: $response.body#/name
  - stepId: pollDelete
    description: >-
      Poll the delete operation by name until the done flag is true.
    operationId: cloudresourcemanager.operations.get
    parameters:
    - name: name
      in: path
      value: $steps.deleteProject.outputs.operationName
    successCriteria:
    - condition: $statusCode == 200
    outputs:
      done: $response.body#/done
    onSuccess:
    - name: deleteComplete
      type: goto
      stepId: undeleteProject
      criteria:
      - context: $response.body
        condition: $.done == true
        type: jsonpath
    - name: deleteRunning
      type: goto
      stepId: pollDelete
      criteria:
      - context: $response.body
        condition: $.done == false
        type: jsonpath
  - stepId: undeleteProject
    description: >-
      Restore the project from DELETE_REQUESTED within the grace period.
      Returns a long-running Operation whose name is used to poll.
    operationId: cloudresourcemanager.projects.undelete
    parameters:
    - name: projectId
      in: path
      value: $inputs.projectId
    requestBody:
      contentType: application/json
      payload: {}
    successCriteria:
    - condition: $statusCode == 200
    outputs:
      operationName: $response.body#/name
  - stepId: pollUndelete
    description: >-
      Poll the undelete operation by name until the done flag is true.
    operationId: cloudresourcemanager.operations.get
    parameters:
    - name: name
      in: path
      value: $steps.undeleteProject.outputs.operationName
    successCriteria:
    - condition: $statusCode == 200
    outputs:
      done: $response.body#/done
    onSuccess:
    - name: undeleteComplete
      type: end
      criteria:
      - context: $response.body
        condition: $.done == true
        type: jsonpath
    - name: undeleteRunning
      type: goto
      stepId: pollUndelete
      criteria:
      - context: $response.body
        condition: $.done == false
        type: jsonpath
  outputs:
    deleteOperation: $steps.deleteProject.outputs.operationName
    undeleteOperation: $steps.undeleteProject.outputs.operationName