Exemplo n.º 1
0
        /// <summary>
        /// Creates new instance from AddOn
        /// </summary>
        /// <param name="resource">The add on details</param>
        /// <param name="geoRegion">The add on region</param>
        public WindowsAzureAddOn(Resource resource, string geoRegion, string cloudService)
        {
            Type = resource.ResourceProviderNamespace == DataSetType ? DataType : AppServiceType;

            AddOn = resource.Type;

            Name = resource.Name;

            Plan = resource.Plan;

            SchemaVersion = resource.SchemaVersion;

            ETag = resource.ETag;

            State = resource.State;

            UsageMeters = resource.UsageMeters;

            OutputItems = (Type == AppServiceType) ? resource.OutputItems : new OutputItemList();

            LastOperationStatus = resource.OperationStatus;

            Location = geoRegion;

            CloudService = cloudService;
        }
 public static void CreateResource(
     this IStoreManagement proxy,
     string subscriptionId,
     string cloudServiceName,
     string resourceProviderNamespace,
     string resourceType,
     string resourceName,
     Resource resource)
 {
     proxy.EndCreateResource(proxy.BeginCreateResource(
         subscriptionId,
         cloudServiceName,
         resourceProviderNamespace,
         resourceType,
         resourceName,
         resource,
         null,
         null));
 }
Exemplo n.º 3
0
        public virtual void NewAddOn(
            string name,
            string addon,
            string plan,
            string location,
            string promotionCode)
        {
            string type;
            string cloudService;
            addon = GetResourceInformation(addon, location, out type, out cloudService);

            Resource resource = new Resource()
            {
                Plan = plan,
                Type = type,
                PromotionCode = promotionCode
            };

            try
            {
                storeChannel.CreateResource(subscriptionId, cloudService, type, addon, name, resource);
            }
            catch (Exception ex)
            {
                if (ex.Message.Equals(Resources.FirstPurchaseErrorMessage, StringComparison.OrdinalIgnoreCase))
                {
                    throw new Exception(Resources.FirstPurchaseMessage);
                }
            }

            WaitForOperation(headersInspector.ResponseHeaders[ServiceManagementConstants.OperationTrackingIdHeader]);
        }