The <vpc
> element provides setup for creating VPCs. Assuming billing is enabled, a shopping cart item reserves requested resources until the VPC can be created. A VPC is created when funds for an associated project clear. To facilitate various administrative functions, shopping cart metadata can be specified via the <variable
> element in the <cart-item
> parent. Each variable must have both of the following:
key
> (Required) - The name of the variable (accepts any string decider).value
> (Required) - The value of the variable (accepts any string decider).The data in <cart-item
> is not sent to Moab, but instead is saved to the database when a shopping cart item is created. If billing is disabled, this has no effect since no item is created.
The <create
> element corresponds to the process of submitting a Moab mschedctl -c command. The mschedctl -c command is how Moab creates VPCs.
The following are supported attributes during the VPC creation command:
account
> - Maps to the "-a account" attribute of 'mschedctl -c' (accepts any string decider).profile
> - Maps to the "-a profile" attribute of 'mschedctl -c' (accepts any string decider).owner
> - Maps to the "-a user" attribute of 'mschedctl -c' (accepts any string decider).variable
> - There can be 0 or more of these that will all map to the "-a variables" attribute of mschedctl -c. This serves the purpose of providing VPC metadata. It has the same requirements as the variables listed above.The optional <cart-action
> element can be used to update the database. This is only useful if billing is enabled (which creates a shopping cart item). For example, if VPC creation is successful, the database can be updated with a message such as "A new VLAN was created." If unsuccessful, a message such as "Unable to create the VLAN" can be presented to the user. The <cart-action
> element requires a <message
> element that accepts any string decider.
The following is an example of a <cart-action
>:
<cart-action type="update"> <message>A VPC was created!</message> </cart-action>
When a reservation is created in Moab, Moab automatically assigns a name to the reservation using its own internal business rules. The name Moab assigns to the VPC is not necessarily what Viewpoint has to use. Moab allows reservations to have a user-specified label. Viewpoint can automatically assign labels to new reservations and then use these labels as a display name for the various UI pages.
The <rsv-label
> element, which is a child of the <create
> element, does the following:
Setting up the label names may provide greater context to the user as you can include such things in the label as the associated project and account. Use the <calculate
> element to configure the way to label the name. The following are keywords that can be specified in the string decider:
The following is an example of a label that includes the project name (a variable on the parent VPC), the account name, and the Moab-generated reservation name.
<rsv-label use-label-name="true"> <calculate operation="append-in-order"> <value order="1"> <component id="PROJECT_NAME" /> </value> <value order="2">_</value> <value order="3"> <component id="account" /> </value> <value order="4">_</value> <value order="5"> <component id="rsv-id" /> </value> </calculate> </rsv-label>
Configuring VPC names works similar to Configuring Reservation Names with a few exceptions:
vpc-label
> element, which is a child of the <create
> element, instead of <rsv-label
>.The following example implements the vpc label vpc_{user}:
<vpc-label use-label-name="true"> <calculate operation="append-in-order"> <value>vpc_</value> <value> <component id="owner" /> </value> </calculate> </vpc-label>