// removed jquery ui css and js

Upload File

Details

API Details
Name

Upload File

This API replaces the Upload Logo API which is deprecated in CloudCenter 4.8.2.

Description

The generic controller introduced in CloudCenter 4.8.2 allows you to upload files, like a logo file or a SSH Key file, that can be embedded in CloudCenter resources.

  • Logo files used by certain CloudCenter resources (create/update tenant, create/update service, create/update apps).
  • SSH public key used during the application deployment process and which enables users to login to VMs using the private key made available through the provided file. This key is stored for a minimum of 5 minutes and a maximum of 15 minutes.
MethodPOST
URI
  • /v1/file?type=ssh

  • /v1/file?type=logo

CloudCenter ReleaseIntroduced in CloudCenter 4.8.2.
Notes
  • For additional context on <PORT> usage in the following example(s), see Base URI Format.
  • Upload the logo image before creating a service. If you do not upload a logo and provide the existing logo path prior to Creating a Service, then the logo image from the currently-provided path is deleted and this logo image is moved to another location after the service is created.
  • You can upload the following types of files using this API:
    • .png
    • .jpeg
    • SSH public keys
ESB Header
  • action: create.upload.file
    actionparam: type=ssh

  • action: create.upload.file
    actionparam: type=logo

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

Example 1: Upload a SSH File

curl -k -X POST -H "Accept: application/json" -u cliqradmin:8B3EB1379BC9F2B0 "https://<HOST>:<PORT>/v1/file?type=ssh" --form "file=@/Users/spjayara/Documents/keys/cliqrdev.pub

Response

{
   "params":[
      {
         "name":"SSHKeyFile",
         "value":"104225"
      }
   ]
}

This API returns a value that you must provide as a key:value pair in the cloud properties attributes when submitting a v2 job.

 Sample use cases when submitting v2 jobs

The following request reuses the key:value properties provided in response to the Upload File API (the Response above):

POST:https://v2/jobs[Amazon]

{
   "appId":"38",
   "appVersion":"1",
   "name":"Jen_s_key_last3",
   "environmentId":2,
   "parameters":{
      "cloudParams":{
         "cloudRegionId":1,
         "instance":"m1.small"
      }
   },
   "jobs":[
      {
         "tierId":"39",
         "appParams":[

         ],
         "parameters":{
            "cloudParams":{
               "cloud":"Amazon-us-west-1",
               "instance":"m1.small",
               "cloudProperties":[
                  {
                     "key":"vpcId",
                     "values":[
                        "vpc-480ae22d"
                     ]
                  },
                  {
                     "key":"SSHPublicKey",
                     "values":[
                        "104225"
                     ]
                  },
                  {
                     "key":"SSHKeyName",
                     "values":[
                        "myKey"
                     ]
                  }
               ],
               "nics":[
                  {
                     "id":"subnet-ccdc27a9",
                     "allocationMode":"DHCP",
                     "allocatePublicIp":true,
                     "order":1
                  }
               ]
            }
         }
      }
   ]
}

The following request allows you to upload the public SSH key provided in response to the Upload File API as text

POST:https://v2/jobs [Amazon]

{
   "appId":"3",
   "appVersion":"1",
   "name":"Jen_s_key_last_text3",
   "environmentId":2,
   "parameters":{
      "cloudParams":{
         "cloudRegionId":1,
         "instance":"m1.small"
      }
   },
   "jobs":[
      {
         "tierId":"39",
         "appParams":[

         ],
         "parameters":{
            "cloudParams":{
               "cloud":"Amazon-us-west-2",
               "instance":"m1.small",
               "cloudProperties":[
                  {
                     "key":"vpcId",
                     "values":[
                        "vpc-370ae11d"
                     ]
                  },
                  {
                     "key":"SSHPublicKey",
                     "values":[
                        "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDTrQLvICTxJ9aRmNaYjH3RfOspgMbWx0u/sv2tW0t.......K8Ng6NF dharph@cliqr.com"
                     ]
                  },
                  {
                     "key":"SSHKeyName",
                     "values":[
                        "mykey"
                     ]
                  }
               ],
               "nics":[
                  {
                     "id":"subnet-ccdc27a9",
                     "allocationMode":"DHCP",
                     "allocatePublicIp":true,
                     "order":1
                  }
               ]
            }
         }
      }
   ]
} 

Example 2: Upload a Logo File

curl -k -X POST -H "Accept: application/json" -u cliqradmin:8B3EB1379BC9F2B0 "https://172.16.40.162/v1/file?type=logo" --form "file=@/Users/spjayara/Downloads/Tiff1.png

Response

{
   "params":[
      {
         "name":"logoPath",
         "value":"/custom/assets/temp/img/a230007d-c6a9-4f64-833f-470930887d82.png"
      }
   ]
}

Request Attributes

file
  • Description: The path inclusive of the name of the logo image file to upload in the local file system:

    • The supported image formats are PNG and JPG.

    • The image must be a square (W x H), not larger than 1MB.

    • If not included, the logo space remains empty.

  • Type: String

Required

params
  • Description: Information about the associated files.

  • 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


Required

Response Attributes

params
  • Description: Information about the associated files.

  • 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

path
  • Description: The relative path of the uploaded image logo file. Copy the value of this attribute (as is) and paste it in the loginLogo/homePageLogo attribute when creating or updating the tenant and logoPath attribute during the service create/update process.

  • Type: String

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