datacenterHref() public static method

Helper method returns properly formatted datacenter_href
public static datacenterHref ( string cloudID, string objectID ) : string
cloudID string Cloud ID where datacenter can be found
objectID string Datacenter ID
return string
コード例 #1
0
        /// <summary>
        /// Creates a new volume
        /// </summary>
        /// <param name="cloudID">The Cloud ID of the cloud where this volume will be created</param>
        /// <param name="name">The name for the Volume to be created</param>
        /// <param name="datacenterID">The ID of the datacenter that this Volume will be in</param>
        /// <param name="description">The description of the Volume to be created</param>
        /// <param name="iops">The number of IOPS this volume should support</param>
        /// <param name="parentVolumeID">ID of parent volume</param>
        /// <param name="parentVolumeSnapshotID">ID of parent volume snapshot</param>
        /// <param name="size">Size of volume in GB</param>
        /// <param name="volumeTypeID">VolumeType ID</param>
        /// <returns>Volume ID</returns>
        public static string create(string cloudID, string name, string datacenterID, string description, string iops, string parentVolumeID, string parentVolumeSnapshotID, string size, string volumeTypeID)
        {
            Utility.CheckStringHasValue(name);
            List <KeyValuePair <string, string> > postParams = new List <KeyValuePair <string, string> >();

            Utility.addParameter(name, "volume[name]", postParams);
            Utility.addParameter(Utility.datacenterHref(cloudID, datacenterID), "volume[datacenter_href]", postParams);
            Utility.addParameter(description, "volume[description]", postParams);
            Utility.addParameter(iops, "volume[iops]", postParams);
            Utility.addParameter(size, "volume[size]", postParams);
            Utility.addParameter(Utility.volumeSnapshotHref(cloudID, parentVolumeID, parentVolumeSnapshotID), "volume[parent_volume_snapshot_href]", postParams);
            Utility.addParameter(Utility.volumeTypeHrefByID(cloudID, volumeTypeID), "volume[volume_type_href]", postParams);

            string        postString = string.Format(APIHrefs.Volume, cloudID);
            List <string> retVals    = Core.APIClient.Instance.Post(postString, postParams, "location");

            return(retVals.Last <string>().Split('/').Last <string>());
        }