psm stack delete

Use this command to delete an existing instance.

Syntax

psm stack delete -n|--name stackName 
    [-f|--force true|false]
    [-r|--retain-resources tags]
    [-c|--config-payload path-to-payload]
    [-of|--output-format json|html|short]
    [-wc|--wait-until-complete true|false]

Parameters

All parameters are required unless otherwise noted.

Parameter Description
—n|--name stackName Name of the stack to delete.
—f|--force true|false (Optional) Boolean flag that specifies whether you want to force the removal of all resource instances even when processes are running.

Accepted values: true, false

Default: true

—r|--retain—resources tags (Optional) Comma-separated list of tags. Any resources in the stack that are assigned at least one of these tags will not be deleted.

To delete the stack without deleting any of its resources, set this parameter to the value _all.

-c|--config-payload path-to-payload (Optional) Path to the JSON file that contains the Stack deletion configuration parameters. The format of this file, as shown in Payload Example, is the same as the request body you provide when deleting a Stack instance by using the REST API. For information about this format, open the ”Components” section of the “Body Parameter” section of Deleting a Stack in the REST API for Oracle Cloud Stack Manager.
-of|--output-format json|html|short (Optional) Desired output format.

Accepted values: json, html, short

The default output format is the one you specified when using the psm setup command to configure the psm CLI.

-wc|--wait-until-complete true|false

(Optional) A boolean value that, when set to true, makes the command behave synchronously; that is, it does not return until the submitted job is complete. The following message is displayed until the job is complete:
Waiting for the job to complete... (it cannot be cancelled)
Default: false

Payload Example

Below is a sample payload configuration file for the deletion of a stack containing an Oracle Java Cloud Service instance.

{ 	
  "operationType": "DELETE",
  "jcs": {
    "parameters": {
      "serviceParameters": {
        "dbaName": "yourDBUsername",
        "dbaPaasword": "yourDBPassword"
      },
    }
  }
}

Command Example

$ psm stack delete -n MyStack -f false -c c://myDisk/payloads/deleteConfigs.json

The output will include a job ID number. You can execute a stack operation-status command to periodically check the state of the delete operation, like so:

$ psm stack operation-status -j jobID

Command Example: Retain Resources

Use the -r parameter to identify resources in the stack that should not be deleted. The following example deletes the stack but retains any resources that have been assigned the tag named prod or the tag named shared.

$ psm stack delete -n MyStack -r prod,shared