/// <summary>
 /// Creates or updates the Gallery Item
 /// </summary>
 /// <param name='operations'>
 /// Reference to the
 /// Microsoft.AzureStack.Management.IGalleryItemOperations.
 /// </param>
 /// <param name='parameters'>
 /// Required. Gallery item Upload parameters.
 /// </param>
 /// <returns>
 /// A standard service response including an HTTP status code and
 /// request ID.
 /// </returns>
 public static AzureOperationResponse CreateOrUpdate(this IGalleryItemOperations operations, GalleryItemCreateOrUpdateParameters parameters)
 {
     return Task.Factory.StartNew((object s) => 
     {
         return ((IGalleryItemOperations)s).CreateOrUpdateAsync(parameters);
     }
     , operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult();
 }
Пример #2
0
        /// <summary>
        /// Executes the API call(s) against Azure Resource Management API(s).
        /// </summary>
        protected override object ExecuteCore()
        {
            this.WriteVerbose(Resources.AddingGalleryItem.FormatArgs(this.Name));

            using (var client = this.GetAzureStackClient(this.SubscriptionId))
            using (var filestream = File.Open(this.Path, FileMode.Open, FileAccess.Read))
            {
                var manifest = client.Package.CreateOrUpdate(this.ResourceGroup, Guid.NewGuid().ToString(), filestream);
                var uploadParameters = new GalleryItemCreateOrUpdateParameters() { Manifest = manifest.Manifest };
                return client.GalleryItem.CreateOrUpdate(this.ResourceGroup, this.Name, uploadParameters);
            }
        }
 /// <summary>
 /// Creates or updates the Gallery Item
 /// </summary>
 /// <param name='operations'>
 /// Reference to the
 /// Microsoft.AzureStack.Management.IGalleryItemOperations.
 /// </param>
 /// <param name='parameters'>
 /// Required. Gallery item Upload parameters.
 /// </param>
 /// <returns>
 /// A standard service response including an HTTP status code and
 /// request ID.
 /// </returns>
 public static Task<AzureOperationResponse> CreateOrUpdateAsync(this IGalleryItemOperations operations, GalleryItemCreateOrUpdateParameters parameters)
 {
     return operations.CreateOrUpdateAsync(parameters, CancellationToken.None);
 }
 /// <summary>
 /// Your documentation here.  (see
 /// http://msdn.microsoft.com/en-us/library/windowsazure/XXXXX.aspx
 /// for more information)
 /// </summary>
 /// <param name='operations'>
 /// Reference to the
 /// Microsoft.AzureStack.Management.IGalleryItemOperations.
 /// </param>
 /// <param name='resourceGroupName'>
 /// Required. Your documentation here.
 /// </param>
 /// <param name='galleryItemId'>
 /// Required. Your documentation here.
 /// </param>
 /// <param name='parameters'>
 /// Required. Your documentation here.
 /// </param>
 /// <returns>
 /// A standard service response including an HTTP status code and
 /// request ID.
 /// </returns>
 public static Task<AzureOperationResponse> CreateOrUpdateAsync(this IGalleryItemOperations operations, string resourceGroupName, string galleryItemId, GalleryItemCreateOrUpdateParameters parameters)
 {
     return operations.CreateOrUpdateAsync(resourceGroupName, galleryItemId, parameters, CancellationToken.None);
 }