Create Action Policy

Details

API DetailsRelease-Specific Information
CloudCenter Platform 4xCloudCenter Suite 5x
NameCreate Action Policy
Description

Creates a new action policy to send an email message, invoke a web service, execute a command or script, or perform any number and combination of these activities when one or more user-defined actions are triggered by the user

Allowed Role(s)WM_USER
MethodPOST
URI

v1/actionpolicies

cloudcenter-ccm-backend/api/v1/actionpolicies

Sample Request
curl -k -X POST -H "Accept: application/json" -H "Content-Type: application/json" -u cliqradmin:40E45DBE57E35ECB "https://<HOST>:<PORT>//v1/actionpolicies"
curl -k -X POST -H "Accept: application/json" -H "Content-Type: application/json" -u cliqradmin:40E45DBE57E35ECB "https://<HOST>:<PORT>/cloudcenter-ccm-backend/api/v1/actionpolicies"
Release

Introduced in CloudCenter 4.5

Modified in CloudCenter Suite 5.0.0

Notes
  • Only resource owners and users with WRITE perms can view all the fields for this resource.
  • Other users can only view common fields like name, description, and so forth. See Permission Control for additional context.
Back To LinksCloudCenter Platform 4x APIWorkload Manager API

ESB Header

action: create.actionpolicies

See the Enterprise Service Bus (ESB) section for additional context.

Not applicable

Sample Request Body

{
     "name": "SamplePolicy",
     "description": "Sample Action Policy",
     "entityType": "Application Deployment",
     "eventName": "max_cluster_size_reached",
     "actions": [{
         "actionType": "EMAIL",
         "actionInputs": [{
             "name": "toAddr",
             "value": "%myEmail%"
         }, {
             "name": "bcc",
             "value": ""
         }, {
             "name": "subject",
             "value": "Deployment %jobName% for the application %appName% has reached maximum cluster size limit"
         }, {
             "name": "body",
             "value": "Hello %firstName%\nDeployment %jobName% for the application %appName% has reached the maximum cluster size limit of %maxAppClusterSize% on %MaxClusterSizeReachedAt%. Click here %jobUrl% to view the status of the deployment.\nYour %vendorName% Team"
         }],
         "associatedParams": []
     }],
     "autoEnable": true,
     "forceEnable": false,
 }

Response

{
     "id": "49",
     "resource": "https://<HOST>:<PORT>/v1/actionpolicies/49",
     "perms": [
         "write",
         "delete",
         "administration",
         "read"],
     "name": "SamplePolicy",
     "description": "Sample Action Policy",
     "entityType": "Application Deployment",
     "eventName": "max_cluster_size_reached",
     "actions": [{
         "actionType": "EMAIL",
         "actionInputs": [{
             "name": "toAddr",
             "value": "%myEmail%"
         }, {
             "name": "bcc",
             "value": ""
         }, {
             "name": "subject",
             "value": "Deployment %jobName% for the application %appName% has reached maximum cluster size limit"
         }, {
             "name": "body",
             "value": "Hello %firstName%\nDeployment %jobName% for the application %appName% has reached the maximum cluster size limit of %maxAppClusterSize% on %MaxClusterSizeReachedAt%. Click here %jobUrl% to view the status of the deployment.\nYour %vendorName% Team"
         }],
         "associatedParams": []
     }],
     "userId": "2",
     "enabled": true,
     "autoEnable": true,
     "forceEnable": false,
     "global": false
 }

Request Attributes

name
  • DescriptionThe name assigned for this CloudCenter ResourceValid characters are letters, numbers, underscores, and spaces.

  • Type: String

description
  • DescriptionA brief description for this CloudCenter Resource.

  • Type: String
 
 entityType 
  • Description: Identifies the resource type for this action.
  • Type: Sequence of type and display name

    typeName
    displayName
    • DescriptionA descriptive name for this CloudCenter resource.
    • Type: String

eventName
  • Description: Identifies the event that, when it affects the configured resource, causes a policy to execute. 

  • Type: Enumeration

    API Event Name

    UI Display - Description

    Supported Policy actionType(s)
     submitted 

    Submitted – The configured application is submitted for deployment.

    • EMAIL 
    • INVOKE_WEB_SERVICE 
    status_change

    Status Changed   Status of the specified deployment for the configured application has changed.

    • EMAIL 
    • INVOKE_WEB_SERVICE
    • OS_COMMAND 
     Deployed 

     Deployed  –  The specified deployment for the configured application was successfully deployed.

    • EMAIL
    •  INVOKE_WEB_SERVICE
    • OS_COMMAND 
     rerun Rerun  –  The specified deployment for the configured application is submitted for a rerun 
    • EMAIL
    •  INVOKE_WEB_SERVICE
    scale_upScale Out  –  The specified deployment for the configured application was scaled out based on your scaling policy.
    • EMAIL
    •  INVOKE_WEB_SERVICE
    • OS_COMMAND 
    scale_down

    Scale In  –  The specified deployment for the configured application was scaled in based on your scaling policy.

    • EMAIL
    •  INVOKE_WEB_SERVICE
    • OS_COMMAND 
    ScheduledScalingScheduled Scaling  –  The specified deployment for the configured application was scaled based on your scheduled scaling policy.
    • EMAIL
    •  INVOKE_WEB_SERVICE
    • OS_COMMAND

    max_cluster_size_reached

    Maximum cluster size limit reached  – The specified deployment for the configured application has reached the configured maximum cluster size limit.

    • EMAIL 
    •  INVOKE_WEB_SERVICE 
    • OS_COMMAND 
    • LAUNCH_NEW_DEPLOYMENT 
    min_cluster_size_reached Minimum cluster size limit reached – The specified deployment for the configured application has reached the configured minimum cluster size limit.
    • EMAIL
    •  INVOKE_WEB_SERVICE
    • OS_COMMAND 
     cancelled  Cancelled  – The specified deployment for the configured application has been cacelled by the owner.
    • EMAIL
    •  INVOKE_WEB_SERVICE

 

actions
  • Description: Identifies details for the configured action policy See the Policy Management section for the relevant release for additional context.

  • Type: Array of action types

    actionType
    • Description: The value of this attribute is interpreted based on the value of the actionName attribute for this Service Lifecycle Action. See the Service Lifecycle Action section for the relevant release for additional context.
    • Type: Enumeration

      EnumerationDescription
      SCRIPT

      Indicates the script (baked into the image that is used to launch the VM) name and parameters (if any) to be executed on the VM during the corresponding actionName step.

      The entity to be run for this Service Lifecycle Action is a script located at a path relative to where the service bundle zip file is extracted:
      - Linux VMs = /usr/local/osmosix/service/serviceName
      - Windows VMs = C:\program files\osmosix\service\$SERVICE_NAME

      See the Service Lifecycle Action section for the relevant release for additional context.

       This option is not available for Container Service.

      URLIndicates the location from where the script is to be downloaded and executed on the VM during the corresponding actionName step.

      The entity to be run for this Service Lifecycle Action is a HTTP URL pointing to a script that is downloaded (the HTTP URL must be accessible from this VM). See the Service Lifecycle Action section for the relevant release for additional context.
      CMD

      Indicates the command that is be executed on the VM during actionName step.

      The entity to be run for this Service Lifecycle Action is a command that is accessible in the PATH for the user (built into the image that is used to launch the VMs):

      - Linux VMs = cliqruser

      - WindowsVMs = cliqr

      See the Service Lifecycle Action section for the relevant release for additional context.

      Effective CloudCenter 4.1.1, admins can configure the local user on application VMs. The CCO configuration file (/usr/local/osmosix/etc/gateway_config.properties) has an optional property called agent.username to specify the local user. If no user name is specified then cliqruser is the default user.

     
    actionInputs
    • Description: Identifies the parameter for an configured activity. See Policy Management > Action Policy for additional context.
    • Type: Name-Value Pair
     associatedParams 
    • Description: The parameters associated with the selected action typeName
    • Type: Name-Value Pair
autoEnable
  • Description: Identifies if this policy must be automatically enabled for all shared users and sub-tenants:
    • true = this policy is automatically enable 
    • false = this policy is not enabled  
  • Type: Enumeration
forceEnable
  • Description: If this flag is true, the policy is enforced for all shared users and sub-tenants. This attribute can be set to true only if autoEnable is also set to true. 
    • true = this policy is enforced
    • false = this policy is not enforced   
  • Type: Enumeration

Response Attributes

id
  • DescriptionUnique, system-generated identifier for this CloudCenter Resource.

  • Type: String
resource
  • Description: Unique URL to access this resource.
  • Type: String
perms (click for additional information)
name
  • DescriptionThe name assigned for this CloudCenter ResourceValid characters are letters, numbers, underscores, and spaces.

  • Type: String

description
  • DescriptionA brief description for this CloudCenter Resource.

  • Type: String
 entityType 
  • Description: Identifies the resource type for this action.
  • Type: Sequence of type and display name

    typeName
    displayName
    • DescriptionA descriptive name for this CloudCenter resource.
    • Type: String
eventName
  • Description: Identifies the event that, when it affects the configured resource, causes a policy to execute. 

  • Type: Enumeration

    API Event Name

    UI Display - Description

    Supported Policy actionType(s)
     submitted 

    Submitted – The configured application is submitted for deployment.

    • EMAIL 
    • INVOKE_WEB_SERVICE 
    status_change

    Status Changed   Status of the specified deployment for the configured application has changed.

    • EMAIL 
    • INVOKE_WEB_SERVICE
    • OS_COMMAND 
     Deployed 

     Deployed  –  The specified deployment for the configured application was successfully deployed.

    • EMAIL
    •  INVOKE_WEB_SERVICE
    • OS_COMMAND 
     rerun Rerun  –  The specified deployment for the configured application is submitted for a rerun 
    • EMAIL
    •  INVOKE_WEB_SERVICE
    scale_upScale Out  –  The specified deployment for the configured application was scaled out based on your scaling policy.
    • EMAIL
    •  INVOKE_WEB_SERVICE
    • OS_COMMAND 
    scale_down

    Scale In  –  The specified deployment for the configured application was scaled in based on your scaling policy.

    • EMAIL
    •  INVOKE_WEB_SERVICE
    • OS_COMMAND 
    ScheduledScalingScheduled Scaling  –  The specified deployment for the configured application was scaled based on your scheduled scaling policy.
    • EMAIL
    •  INVOKE_WEB_SERVICE
    • OS_COMMAND

    max_cluster_size_reached

    Maximum cluster size limit reached  – The specified deployment for the configured application has reached the configured maximum cluster size limit.

    • EMAIL 
    •  INVOKE_WEB_SERVICE 
    • OS_COMMAND 
    • LAUNCH_NEW_DEPLOYMENT 
    min_cluster_size_reached Minimum cluster size limit reached – The specified deployment for the configured application has reached the configured minimum cluster size limit.
    • EMAIL
    •  INVOKE_WEB_SERVICE
    • OS_COMMAND 
     cancelled  Cancelled  – The specified deployment for the configured application has been cacelled by the owner.
    • EMAIL
    •  INVOKE_WEB_SERVICE

 

actions
  • Description: Identifies details for the configured action policy See the Policy Management section for the relevant release for additional context.

  • Type: Array of action types

    actionType
    • Description: The value of this attribute is interpreted based on the value of the actionName attribute for this Service Lifecycle Action. See the Service Lifecycle Action section for the relevant release for additional context.
    • Type: Enumeration

      EnumerationDescription
      SCRIPT

      Indicates the script (baked into the image that is used to launch the VM) name and parameters (if any) to be executed on the VM during the corresponding actionName step.

      The entity to be run for this Service Lifecycle Action is a script located at a path relative to where the service bundle zip file is extracted:
      - Linux VMs = /usr/local/osmosix/service/serviceName
      - Windows VMs = C:\program files\osmosix\service\$SERVICE_NAME

      See the Service Lifecycle Action section for the relevant release for additional context.

       This option is not available for Container Service.

      URLIndicates the location from where the script is to be downloaded and executed on the VM during the corresponding actionName step.

      The entity to be run for this Service Lifecycle Action is a HTTP URL pointing to a script that is downloaded (the HTTP URL must be accessible from this VM). See the Service Lifecycle Action section for the relevant release for additional context.
      CMD

      Indicates the command that is be executed on the VM during actionName step.

      The entity to be run for this Service Lifecycle Action is a command that is accessible in the PATH for the user (built into the image that is used to launch the VMs):

      - Linux VMs = cliqruser

      - WindowsVMs = cliqr

      See the Service Lifecycle Action section for the relevant release for additional context.

      Effective CloudCenter 4.1.1, admins can configure the local user on application VMs. The CCO configuration file (/usr/local/osmosix/etc/gateway_config.properties) has an optional property called agent.username to specify the local user. If no user name is specified then cliqruser is the default user.

     
    actionInputs
    • Description: Identifies the parameter for an configured activity. See Policy Management > Action Policy for additional context.
    • Type: Name-Value Pair
     associatedParams 
    • Description: The parameters associated with the selected action typeName
    • Type: Name-Value Pair
userId
  • Description: Unique, system-generated identifier for a user
  • Type: String
enabled
  • Description: Indicates that this resource has been enabled. The default differs based on the resource.

    • true = The resource has been enabled (v2 aging and suspension policies are enabled by default).

    • false = The resource has not been enabled.

  • Type: Boolean

autoEnable
  • Description: Identifies if this policy must be automatically enabled for all shared users and sub-tenants:
    • true = this policy is automatically enable 
    • false = this policy is not enabled  
  • Type: Enumeration
forceEnable
  • Description: If this flag is true, the policy is enforced for all shared users and sub-tenants. This attribute can be set to true only if autoEnable is also set to true. 
    • true = this policy is enforced
    • false = this policy is not enforced   
  • Type: Enumeration
global
  • Description: Identifies if this is a global policy. Some policies like a Job Status Change - Email Policy are global policies and are available by default to all users. If a policy created by a user, it is not global policy. This system-defined attribute cannot be configured.

    • true = this is a global policy
    • false = this is not a global policy
  • Type: Boolean

© 2017-2019 Cisco Systems, Inc. All rights reserved