Submit Job

Details

API

 Details

Name

Submit Job (Asynchronous API)

Description

Provides a HTTP Location URL that you can use to query the system until this call returns a success or failure HTTP Status Codes.

Method

POST

URI

/v1/jobs 

CloudCenter Release

  • CloudCenter 3.x and 4.0.
  • Enhanced in CloudCenter 3.2.6 to include the policies attribute.

  • Enhanced in CloudCenter 3.2.6.5 to include the volumeInfos and preventTermination attributes.
  • Enhanced in CloudCenter 4.0 to include the following attributes:
    • The nics{nicID}, allocationMode, and order attributes (see IP Allocation Mode for additional context).
    • The SSHKeyName, SSHPublicKeySSHPrivateKey, and SSHPersistPrivateKey attributes (see SSH Options for additional context).
  • Enhanced in CloudCenter 4.1.1 to include the following attributes:
    • TenantName and TenantId attributes (see OpenStack Configurations for additional context).
    • The SSHCloudKeyName attribute for OpenStack clouds (see SSH Options for additional context). This attribute is available in the cloudParams section of the request entity for each app tier.
  • Enhanced in CloudCenter 4.2 to include the phaseId and projectId attributes.
  • Enhanced in CloudCenter 4.4 to include the metadatas attribute.
  • Enhanced in CloudCenter 4.5.0 to include the deploymentIsolationTag attribute.

Notes

  • For additional context on <PORT> usage in the following example(s), see Base URI Format.
  • Continue to query the Location URL until this call returns a success or failure HTTP Status Codes.
  • See Asynchronous APIs for additional context.

    SaaS application-based job submissions are independent of deployment environments and do not require the following attributes:

    • parameters.cloudParams.*
    • environment (deployment environment)
ESB Headeraction: create.jobs

Example 1 – Non-Governance Mode

curl -k -X POST -H "Accept: application/json" -H "Content-Type: application/json" -u cloudcenteradmin:40E45DBE57E35ECB "https://<HOST>:<PORT>/v1/jobs" 

Request Body

{
    "serviceTierId": "PHPWebApp-64",
    "name": "MyDrupalRun-0530-5",
    "parameters": {
        "cloudParams": {
            "cloud": "Amazon-us-east-1",
            "instance": "m1.small"
        }
    },
    "jobs": [
        {
            "serviceTierId": "Database-65",
            "parameters": {
                "cloudParams": {
                    "cloud": "Amazon-us-east-1",
                    "instance": "m1.small"
                }
            },
            "volumeInfos": [
                {
                    "size": "10",
                    "type": "io1",
                    "iops": "300"
                },
                {
                    "size": "20",
                    "type": "standard"
                },
                {
                    "size": "30"
                }
            ],
            "nics": [
                {
                    "id": "72eea417-4686-49de-a57c-af4c49a44636",
                    "allocationMode": "PREALLOCATE_IP",
                    "order": 1
                },
                {
                    "id": "95845aef-995e-42d9-8d63-f2572e3cff9f",
                    "allocationMode": "PREALLOCATE_IP",
                    "order": 2
                }
            ],
           "metadatas": [{
                    "name": "jobname",
                    "value": "%JOB_NAME%"
    }],
        },
        {
            "serviceTierId": "WebServer-66",
            "parameters": {
                "cloudParams": {
                    "cloud": "Amazon-us-east-1",
                    "instance": "m1.small"
                }
            },
            "volumeInfos": [
                {
                    "size": "20"
                }
            ],
            "nics": [
                {
                    "id": "72eea417-4686-49de-a57c-af4c49a44737",
                    "allocationMode": "PREALLOCATE_IP",
                    "order": 1
                },
                {
                    "id": "95845aef-995e-42d9-8d63-f2572e3cff89",
                    "allocationMode": "PREALLOCATE_IP",
                    "order": 2
                }
            ],,
            "metadatas": [
                {
                    "name": "jobname",
                    "value": "%JOB_NAME%"
                }
            ]
        }
    ]
}

Response

Example 2 – Web App Job with a Policy attached to the Parent and Tier

curl -k -v -u admin@cliqrtech.com,1:cliqr -H "Accept:application/json" -H "Content-Type:application/json" -X POST "https://<HOST>:<PORT>/v1/jobs"
{
    "serviceTierId": "petclinic-app-44",
    "appVersion": "1",
    "name": "petclinic-job-feb23-1",
    "environment": "V-Deploy-Env",
    "parameters": {
        "cloudParams": {
            "cloud": "OpenStack-Cloud-Region",
            "instance": "1da5bcf0-0c52-476e-b841-394eea73a903"
        }
    },
    "policies": [
        "1"
    ]
} 

Example 3 – Web App Job with a Policy Attached to the Parent

{
    "serviceTierId": "petclinic-app-44",
    "appVersion": "1",
    "name": "petclinic-job-feb23-1",
    "environment": "V-Deploy-Env",
    "parameters": {
        "cloudParams": {
            "cloud": "OpenStack-Cloud-Region",
            "instance": "1da5bcf0-0c52-476e-b841-394eea73a903"
        }
    },
    "policies": [
        "1"
    ],
    "jobs": [
        {
            "serviceTierId": "mysql-45"
        },
        {
            "serviceTierId": "tomcat7-46",
            "policies": [
                "2"
            ]
        }
    ]
}

Example 4 – Batch Job in Governance Mode

{
    "serviceTierId": "BatchExecute-29",
    "name": "Batch_Feb24_1",
    "tags": [
        "DevEnv1"
    ],
    "parameters": {
        "cloudParams": {
            "cloud": "OpenStack-regionOne",
            "instance": "1da5bcf0-0c52-476e-b841-394eea73a903"
        }
    }
}

Example 5 – Batch Job in Non-Governance Mode

 {
    "serviceTierId": "BatchExecute-29",
    "name": "Batch_Jan17_1",
    "environment": "DepEnvLocalOpenStack",
    "parameters": {
        "cloudParams": {
            "cloud": "OpenStack-regionOne",
            "instance": "1da5bcf0-0c52-476e-b841-394eea73a903"
        }
    }
}

Example 6 – Web App Jenkins Job, Single Tomcat Tier in Governance Mode

When Governance mode is enabled, you must specify the system tag in the request body.

 {
    "serviceTierId": "JenkinsHttp1-85",
    "appVersion": "1.0",
    "name": "JenkinsHttp_Mar4_2",
    "tags": [
        "DevEnv1"
    ],
    "parameters": {
        "appParams": [
            {
                "name": "GREET",
                "value": "HELLOWORLD"
            }
        ],
        "cloudParams": {
            "cloud": "OpenStack-regionOne",
            "instance": "1da5bcf0-0c52-476e-b841-394eea73a903"
        }
    },
    "jobs": [
        {
            "serviceTierId": "tomcat6-40",
            "appVersion": "1.0",
            "name": "tomcat6_1",
            "parameters": {
                "cloudParams": {
                    "cloud": "OpenStack-regionOne",
                    "instance": "1da5bcf0-0c52-476e-b841-394eea73a903",
                    "cloudProperties": [
                        {
                            "name": "attachPublicIP",
                            "value": "true"
                        }
                    ]
                }
            }
        }
    ]
}

Example 7 – Web App Jenkins Job, Single Tomcat Tier in Non-Governance Mode

 {
    "serviceTierId": "JenkinsHttp1-85",
    "appVersion": "1.0",
    "name": "JenkinsHttp_Mar4_2",
    "environment": "DepEnvLocalOpenStack",
    "parameters": {
        "appParams": [
            {
                "name": "GREET",
                "value": "HELLOWORLD"
            }
        ],
        "cloudParams": {
            "cloud": "OpenStack-regionOne",
            "instance": "1da5bcf0-0c52-476e-b841-394eea73a903"
        }
    },
    "jobs": [
        {
            "serviceTierId": "tomcat6-40",
            "appVersion": "1.0",
            "name": "tomcat6_1",
            "parameters": {
                "cloudParams": {
                    "cloud": "OpenStack-regionOne",
                    "instance": "1da5bcf0-0c52-476e-b841-394eea73a903",
                    "cloudProperties": [
                        {
                            "name": "attachPublicIP",
                            "value": "true"
                        }
                    ]
                }
            }
        }
    ]
}

Example 8 – TenantName as Input

{
    "serviceTierId": "jenkins-149",
    "name": "jenkins-api_256",
    "environment": "DepEnv",
    "parameters": {
        "cloudParams": {
            "cloud": "OpenStack-regionOne",
            "instance": "1da5bcf0-0c52-476e-b841-394eea73a903",
            "cloudProperties": [
                {
                    "name": "TenantName",
                    "value": "ven"
                }
            ]
        }
    },
    "jobs": [
        {
            "serviceTierId": "WebServer-150",
            "parameters": {
                "cloudParams": {
                    "cloud": "OpenStack-regionOne",
                    "instance": "1da5bcf0-0c52-476e-b841-394eea73a903"
                }
            }
        }
    ]
}

Example 9 – TenantId as Input

{
    "serviceTierId": "jenkins-149",
    "name": "jenkins-api_256",
    "environment": "DepEnv",
    "parameters": {
        "cloudParams": {
            "cloud": "OpenStack-regionOne",
            "instance": "1da5bcf0-0c52-476e-b841-394eea73a903",
            "cloudProperties": [
                {
                    "name": "TenantId",
                    "value": "6f573db187a645738b13f5e516d48fbb"
                }
            ]
        }
    },
    "jobs": [
        {
            "serviceTierId": "WebServer-150",
            "parameters": {
                "cloudParams": {
                    "cloud": "OpenStack-regionOne",
                    "instance": "1da5bcf0-0c52-476e-b841-394eea73a903"
                }
            }
        }
    ]
}

Example 10 – Key Name as Input

{
    "serviceTierId": "jenkins-149",
    "name": "jenkins-api_256",
    "environment": "DepEnv",
    "parameters": {
        "cloudParams": {
            "cloud": "OpenStack-regionOne",
            "instance": "1da5bcf0-0c52-476e-b841-394eea73a903",
            "cloudProperties": [
                {
                    "name": "TenantId",
                    "value": "6f573db187a645738b13f5e516d48fbb"
                }
            ]
        }
    },
    "jobs": [
        {
            "serviceTierId": "WebServer-150",
            "parameters": {
                "cloudParams": {
                    "cloud": "OpenStack-regionOne",
                    "instance": "1da5bcf0-0c52-476e-b841-394eea73a903"
                }
            }
        }
    ]
}

Example 11 – Private Key

{
  "serviceTierId": "Petclinic Local-52",
  "appVersion": "1.0",
  "name": "PetRest02",
  "environment": "DEV",
  "parameters": {
    "cloudParams": {
      "cloud": "Openstack-regionOne",
      "instance": "1da5bcf0-0c52-476e-b841-394eea73a903",
      "cloudProperties": []
    }
  },
  "jobs": [
    {
      "serviceTierId": "Database-53",
      "parameters": {
        "appParams": [
          {
            "name": "SSHKeyName",
            "value": "myPubKey"
          },{
            "name": "SSHPublicKey",
            "value":
 "ssh-rsa 
AAA...P1o3I/iYAF
 prat@prat"
          },{
            "name": "SSHPersistPrivateKey",
            "value": "false"
          },{
            "name": "cliqrNoOfVolumes",
            "value": "1"
          }
        ]
      },
      "volumeInfos": [
        {
          "size": "5"
        }
      ],
      "nics": [
        {
          "id": "fc83c571-228b-4f3c-a385-3bb94aae1315",
          "allocationMode": "PREALLOCATE_IP",
          "allocatePublicIp": "true",
          "order": 1,
          "properties": []
        }
      ], 
      "metadatas": [
       {
          "name": "jobname",
          "value": "%JOB_NAME%"
       }
      ]
    },
    {
      "serviceTierId": "AppServer-54",
      "parameters": {
        "appParams": [
          {
            "name": "SSHKeyName",
            "value": "myPrivateKey"
          },{
            "name": "SSHPrivateKey",
            "value":
 "-----BEGIN RSA PRIVATE 
KEY-----\nMI...1etd2Y\n-----END
 RSA PRIVATE KEY-----"
          },{
            "name": "SSHPersistPrivateKey",
            "value": "true"
          }
        ]
      },
      "nics": [
        {
          "id": "fc83c571-228b-4f3c-a385-3bb94aae1315",
          "allocationMode": "PREALLOCATE_IP",
          "allocatePublicIp": "true",
          "order": 1,
          "properties": []
        }
      ], 
      "metadatas": [
       {
          "name": "jobname",
          "value": "%JOB_NAME%"
       }
      ]
    }
  ]
}

Example 12 – Access Key Pairs

A sample payload to submit the job using the Key name (fetched using v1/cloudProperties/cloudType?propertyType=AccessKeyPairs&depEnv=depEnvId&TenantId=tenantId) as input.

The value of SSHCloudKeyName is set to "dd" in the below JSON payload.

{
    "serviceTierId": "Jenkins-29",
    "name": "jenkins-key-rest5",
    "environment": "DE-Openstack",
    "parameters": {
        "cloudParams": {
            "cloud": "OpenStack-regionOne",
            "instance": "1da5bcf0-0c52-476e-b841-394eea73a903",
            "cloudProperties": [
                {
                    "name": "TenantId",
                    "value": "08AE71819ABD"
                }
            ]
        }
    },
    "jobs": [
        {
            "serviceTierId": "WebServer-30",
            "parameters": {
                "cloudParams": {
                    "cloud": "OpenStack-regionOne",
                    "instance": "1da5bcf0-0c52-476e-b841-394eea73a903",
                    "cloudProperties": [
                        {
                            "name": "SSHCloudKeyName",
                            "value": "dd"
                        }
                    ],
                "appParams": []
        },
                "nics": [
                    {
                        "id": "8cceb0fe-7684-4042-9784-b16187e2bf3c",
                        "allocationMode": "DHCP",
                        "allocatePublicIp": "true",
                        "order": 1
                    }
                ]
            }
        }
    ]
}

Example 13 – Project and Phase Association

To tie a job to the project phase, provide  the projectId and phaseId attributes. The following example depicts an OpenStack setup.

{
    "serviceTierId": "JenkinSingleNIC-566",
    "name": "jenkins-sumit-aug5-rest-1",
    "environment": "Vet-Deploy-Env",
    "projectId": 1,
    "phaseId": 1,
    "parameters": {
        "cloudParams": {
            "cloud": "OpenStack-Vet-Cloud-Region",
            "instance": "1da5bcf0-0c52-476e-b841-394eea73a903",
            "cloudProperties": [
                {
                    "name": "TenantName",
                    "value": "veti"
                }
            ]
        }
    },
    "jobs": [
        {
            "serviceTierId": "WebServer-568",
            "parameters": {
                "cloudParams": {
                    "cloud": "OpenStack-Vet-Cloud-Region",
                    "instance": "1da5bcf0-0c52-476e-b841-394eea73a903"
                }
            }
        }
    ]
}

Example 14 – Isolation Tags

Isolation tags enable you to create the security group and attach the group with all the VMs that need to communicate with each other. See Security and Firewall Rules > Isolation Tags for addditional context.

The following example depicts an AWS setup.

{
    "name": "TNAME",
    "serviceTierId": "nginx-219",
    "environment": "amazon",
    "deploymentIsolationTag": "group1",
    "parameters": {
        "cloudParams": {
            "cloud": "amazonnew-us-west-2",
            "instance": "m1.small"
        }
    },
    "jobs": [{
        "serviceTierId": "nginx_0-220",
        "parameters": {
            "cloudParams": {
                "cloud": "amazonnew-us-west-2",
                "instance": "m1.small",
                "cloudProperties": [{
                        "name": "vpcId",
                        "value": "vpc-4c63f829"
                    }
                    , {
                        "name": "subnetId",
                        "value": "subnet-575bcc20"
                    }
                ]
            }
        }
    }]
}

Example 15 – Federated CCMs

You can now use this API to launch deployments from the Child CCM. See Federated CCMs for additional context.

curl -k -X POST -H "Accept: application/json" -H "Content-Type: application/json" -H "x-cliqr-ccid: ccm4" -u cloudcenteradmin:40E45DBE57E35ECB "https://<HOST>:<PORT>/v1/jobs" 

When submitting jobs from a linked Child CCM in a Federated CCM environment, use the additional target CCID parameter, -H "x-cliqr-ccid: ccm4", in the HTTP header. In place of ccm4, use your remote deployment identifier, CloudCenter ID (CCID) – remoteCloudCenterId, that is included in the response to the View Child CCM Details API call.

The API Authentication remains the same.

{
    "serviceTierId": "Jenkins-T01UA-CCM4-29",
    "appVersion": "1.54",
    "name": "Jenkins_r_CCM4_T01UA_20160528_002",
    "environment": "Dev - T01 - CCM4",
    "parameters": {
        "appParams": [
            {
                "name": "cliqrIgnoreAppFailure",
                "value": "false"
            }
        ],
        "cloudParams": {
            "cloud": "Amazon-us-east-1"
        }
    },
    "jobs": [
        {
            "serviceTierId": "tomcat6-30",
            "parameters": {
                "cloudParams": {
                    "cloud": "Amazon-us-east-1",
                    "instance": "m1.small",
                    "subnetId": "subnet-efd3f9a9",
                    "attachPublicIp": "true",
                    "cloudProperties": [
                        {
                            "name": "vpcId",
                            "value": "vpc-2d827248"
                        },
                        {
                            "name": "subnetId",
                            "value": "subnet-efd3f9a9"
                        },
                        {
                            "name": "attachPublicIP",
                            "value": "true"
                        }
                    ]
                },
                "appParams": [
                    {
                        "name": "GREET",
                        "value": "HELLOWORLD"
                    }
                ],
                "nics": [
                    {
                        "id": "subnet-efd3f9a9",
                        "allocationMode": "DHCP",
                        "allocatePublicIp": "false",
                        "order": 1
                    }
                ]
            }
        }
    ]
}

Request Attributes

appVersion
  • Description: Version of the application
  • Type: String

Required

serviceTierId
  • Description: Type of application tier (for example, Loadbalancer, database, AppCluster, or other tiers). This value is a concatenation of the Application Profile Type Name and the App ID.
    • First job serviceTierId = appName + "-" +appId

    • Child tier serviceTierId = tierName + "-" +appId

  • Type: String

Required

name
  • Description: The name assigned for this resource (tenant, group, role, contract, bundle, plan, activation profile, cloud family, import region, cloud representation, image, cloud instance type, job)
  • Type: String

Required

environment
  • Description: Name of the deployment environment (not required for SaaS deployments)
  • Type: String

Required

desc
  • Description: Description of the job
  • Type: String
parameters
  • Description: Job parameters
  • Type: Object
parameters.cloudParams
  • Description: Cloud specific job parameters (not required for SaaS deployments)
  • Type: Object

Required

parameters.cloudParams.cloud
  • Description: Cloud where the application needs to be provisioned
  • Type: String

Required

parameters.cloudParams.instance
  • Description: Cloud Instance type that will be used for launching VM
  • Type: String

Required

parameters.cloudParams.storage
  • Description: Storage type to be used (supported on VMware-based private clouds only)
  • Type: String

Required (VMware)

 parameters.cloudParams.rootVolumeSize
  • Description: Root volume size (in GB) if need to expand root disk when launch VM (only supported in OpenStack). The size must be bigger than the size defined by the instance type.
  • Type: String

Required (OpenStack)

parameters.appParams
  • Description: Application specific runtime parameters
  • Type: List

Required (if configured in your application profile)

parameters.appParams[].name
  • Description: Parameter name
  • Type: String

Required (if configured in your application profile)

parameters.appParams[].value
  • Description: Parameter value
  • Type: String

Required (if configured in your application profile)

parameters.envParams
  • Description: Parameters specific to the job execution environment
  • Type: String

Required (if configured in your application profile)

parameters.envParams[].name
  • Description: Parameter name
  • Type: String

Required (if configured in your application profile)

parameters.envParams[].value
  • Description: Parameter value
  • Type: String

Required (if configured in your application profile)

policies
  • Description: Use the Submit Job API to get the Policy IDs (not required if the governance mode is enabled, policies will be picked based on tags in that case). Pass the policy ids based on the context. Aging policy can be passed as top-level policy, while scaling policy IDs can be passed at the child job level.
  • Type: List

Required (if configured in your application profile)

tags
  • Description: List of tags to be passed (In governance mode it will map to corresponding policy or environment or a security profile). In non governance mode they will be used for tagging the instances in the cloud.
  • Type: String (array)

Required (if configured in your application profile)

jobs
  • Description: For multi-tier applications (Web Apps), provide a list of child jobs where each child job represents a service tier. The child job structure is similar to any other job, except that attributes like tags, cloud and other attributes are ignored for a child job.
  • Type: List

Required (if configured in your application profile)

volumeInfos
  • Description: A list of volumes to be attached to a particular tier. See Attach Multiple Volumes to Tiers.
    For each volume:
    • size is a mandatory attribute,
    • type and iops are optional attributes.
  • Type: List

Required (if configured in your application profile)

preventTermination
  • Description: When set for a deployment/job, this attribute ensures that the deployment/job cannot be suspended, stopped, removed, or deleted.
  • Type: Boolean
nics
  • Description: For batch jobs, the nics attribute is displayed at the top job level.
  • Type: String

Required (if configured in your application profile)

nics.id
  • Description: The network identifier for each required tier (web application jobs). Get these identifiers using the availableNetworks attribute.
  • Type: String

Required (if configured in your application profile)

nics.allocationMode
  • Description: See IP Allocation Mode for additional information on allocation modes
    • If the application profile has NIC Size 1 and there is a preferred (or) default network defined, the nic attribute does not need to be specified in the job submission.
    • Default = DHCP. The default does not allow parameter substitution in the configuration file.
  • Type: String

Required (if configured in your application profile)

nics.order
  • Description: The order in which the NICs must be used.
  • Type: Integer

Required (if configured in your application profile)

metadatas
  • Description: Information about the metadata associated with the job. This attribute is the same as the metadata (NVPair) attribute.
  • Type: Array of name-value pairs

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

    • Type: String

    value
    • Description: Indicates the set value for this property
    • Type: Float

phaseId
  • DescriptionUnique, system-generated identifier for the phase.
  • Type: String
projectId
  • DescriptionUnique, system-generated identifier for the project
  • Type: Long (path variable in the URL)
deploymentIsolationTag
  • Description: Creates the security group when you attach this tag to the group with all the VMs that need to communicate with each other. See Security and Firewall Rules for additional context.
  • Type: String

Response Attributes

None