Cloud Cruiser became HPE Consumption Analytics on Nov. 1st. You'll still see the old name in places while we update this site.

 

 

Consumption Analytics Documentation

Home > Cloud Cruiser 3 > REST API reference > Resources > Create a resource

Create a resource

Creates a new resource by providing detailed information including revisions.

URL syntax

http://<ccServerURL
>/rest/v1/resources/resource

HTTP method

POST

Request

Content-Type
application/xml
Request body

XML text with root element resourceInfo , without id attribute. The detailed resource and its revisions configuration is included in the XML text.

JAXB type
com.cloudcruiser.server.webservices.v1.dto.resource.ResourceInfo

Response

Content-Type
application/xml
Response body

XML text with root element resourceInfo , with the created resource and its revisions details.

JAXB type
com.cloudcruiser.server.webservices.v1.dto.resource.ResourceInfo

Example

URL
http://localhost:8080/rest/v1/resources/resource
Request body
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<resourceInfo xmlns="http://www.cloudcruiser.com/webservices/v1/Resource">
  <name>test-6</name>
  <group>
    <name>Miscellaneous222</name>
  </group>
  <active>true</active>
  <allocated>true</allocated>
  <unitsDecimals>2</unitsDecimals>
  <rateDecimals>2</rateDecimals>
  <alternativeCode>code2</alternativeCode>
  <numericType>INTEGER</numericType>
  <unitDesc>operations</unitDesc>
  <ratePlan>
    <name>default</name>
    <description>default rate plan</description>
    <revision>
      <ratePlanName>default</ratePlanName>
      <startDate year="2000" month="1" day="1"/>
      <endDate year="2016" month="12" day="31"/>
      <chargeInterval>MONTHLY</chargeInterval>
      <detailType>BASIC</detailType>
      <detail>
        <rate currencyCode="usd">
          <fixedCharge>5.0</fixedCharge>
          <variableCharge>100.0</variableCharge>
        </rate>
      </detail>
    </revision>
  </ratePlan>
  <ratePlan>
    <name>statesPlan</name>
    <description>states rate plan</description>
    <revision>
      <ratePlanName>statesPlan</ratePlanName>
      <startDate year="2010" month="1" day="1"/>
      <endDate year="2020" month="12" day="31"/>
      <chargeInterval>MONTHLY</chargeInterval>
      <detailType>STATE</detailType>
      <detail>
        <rate currencyCode="usd">
          <fixedCharge>1.0</fixedCharge>
        </rate>
        <resourceState>UNKNOWN</resourceState>
      </detail>
      <detail>
        <rate currencyCode="usd">
          <variableCharge>3.2</variableCharge>
        </rate>
        <resourceState>ONLINE</resourceState>
      </detail>
    </revision>
  </ratePlan>
</resourceInfo>
Response body
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<resourceInfo xmlns="http://www.cloudcruiser.com/webservices/v1/Resource" id="12300">
  <name>test-6</name>
  <group id="10300">
    <name>Miscellaneous222</name>
  </group>
  <active>true</active>
  <hidden>false</hidden>
  <allocated>true</allocated>
  <resourceType>STANDARD</resourceType>
  <rateType>PRICE</rateType>
  <unitsDecimals>2</unitsDecimals>
  <rateDecimals>2</rateDecimals>
  <alternativeCode>code2</alternativeCode>
  <numericType>INTEGER</numericType>
  <unitDesc>operations</unitDesc>
  <ratePlan id="1">
    <name>default</name>
    <description>default rate plan</description>
    <revision id="12500">
      <ratePlanName>default</ratePlanName>
      <startDate year="2000" month="1" day="1"/>
      <endDate year="2999" month="12" day="31"/>
      <chargeInterval>MONTHLY</chargeInterval>
      <detailType>BASIC</detailType>
      <detail id="12600">
        <rate id="12600" currencyCode="usd">
          <fixedCharge>5.0</fixedCharge>
          <variableCharge>100.0</variableCharge>
        </rate>
      </detail>
    </revision>
  </ratePlan>
  <ratePlan id="10300">
    <name>statesPlan</name>
    <description>states rate plan</description>
    <revision id="12501">
      <ratePlanName>statesPlan</ratePlanName>
      <startDate year="2010" month="1" day="1"/>
      <endDate year="2999" month="12" day="31"/>
      <chargeInterval>MONTHLY</chargeInterval>
      <detailType>STATE</detailType>
      <detail id="12602">
        <rate id="12601" currencyCode="usd">
          <fixedCharge>1.0</fixedCharge>
        </rate>
        <resourceState>UNKNOWN</resourceState>
      </detail>
      <detail id="12603">
        <rate id="12602" currencyCode="usd">
          <variableCharge>3.2</variableCharge>
        </rate>
        <resourceState>ONLINE</resourceState>
      </detail>
    </revision>
  </ratePlan>
</resourceInfo>
Java
ResourceInfo createdResource = resourceServiceProxy.createResource();
Last modified

Tags

This page has no custom tags.

Classifications

This page has no classifications.
© Copyright 2018 Hewlett Packard Enterprise Development LP