Beispiel #1
0
        private Uri GetTemplateUri(string templateFile, string galleryTemplateName, string storageAccountName)
        {
            Uri templateFileUri;

            if (!string.IsNullOrEmpty(templateFile))
            {
                if (Uri.IsWellFormedUriString(templateFile, UriKind.Absolute))
                {
                    templateFileUri = new Uri(templateFile);
                }
                else
                {
                    storageAccountName = GetStorageAccountName(storageAccountName);
                    templateFileUri    = StorageClientWrapper.UploadFileToBlob(new BlobUploadParameters
                    {
                        StorageName      = storageAccountName,
                        FileLocalPath    = templateFile,
                        OverrideIfExists = true,
                        ContainerPublic  = false,
                        ContainerName    = DeploymentTemplateStorageContainerName
                    });
                    WriteVerbose(string.Format(
                                     "Uploading template '{0}' to {1}.",
                                     Path.GetFileName(templateFile), templateFileUri));
                }
            }
            else
            {
                templateFileUri = new Uri(GalleryTemplatesClient.GetGalleryTemplateFile(galleryTemplateName));
            }

            return(templateFileUri);
        }
Beispiel #2
0
 /// <summary>
 /// Creates new ResourcesClient instance
 /// </summary>
 /// <param name="resourceManagementClient">The IResourceManagementClient instance</param>
 /// <param name="storageClientWrapper">The IStorageClientWrapper instance</param>
 /// <param name="galleryTemplatesClient">The IGalleryClient instance</param>
 /// <param name="eventsClient">The IEventsClient instance</param>
 public ResourcesClient(
     IResourceManagementClient resourceManagementClient,
     IStorageClientWrapper storageClientWrapper,
     GalleryTemplatesClient galleryTemplatesClient,
     IEventsClient eventsClient)
 {
     ResourceManagementClient = resourceManagementClient;
     StorageClientWrapper     = storageClientWrapper;
     GalleryTemplatesClient   = galleryTemplatesClient;
     EventsClient             = eventsClient;
 }
 /// <summary>
 /// Creates new ResourcesClient instance
 /// </summary>
 /// <param name="resourceManagementClient">The IResourceManagementClient instance</param>
 /// <param name="storageClientWrapper">The IStorageClientWrapper instance</param>
 /// <param name="galleryTemplatesClient">The IGalleryClient instance</param>
 /// <param name="eventsClient">The IEventsClient instance</param>
 public ResourcesClient(
     IResourceManagementClient resourceManagementClient,
     IStorageClientWrapper storageClientWrapper,
     GalleryTemplatesClient galleryTemplatesClient,
     IEventsClient eventsClient)
 {
     ResourceManagementClient = resourceManagementClient;
     StorageClientWrapper = storageClientWrapper;
     GalleryTemplatesClient = galleryTemplatesClient;
     EventsClient = eventsClient;
 }
 public GalleryTemplatesClientTests()
 {
     galleryClientMock = new Mock<IGalleryClient>();
     galleryTemplatesClient = new GalleryTemplatesClient(galleryClientMock.Object);
 }