• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# IServiceManagement类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中IServiceManagement的典型用法代码示例。如果您正苦于以下问题:C# IServiceManagement类的具体用法?C# IServiceManagement怎么用?C# IServiceManagement使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



IServiceManagement类属于命名空间,在下文中一共展示了IServiceManagement类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: PublishAzureServiceProjectCommand

        /// <summary>
        /// Initializes a new instance of the PublishAzureServiceCommand class.
        /// </summary>
        /// <param name="channel">
        /// Channel used for communication with Azure's service management APIs.
        /// </param>
        public PublishAzureServiceProjectCommand(IServiceManagement channel)
        {
            // This instantiation will throw if user is running with incompatible Windows Azure SDK version.
            new AzureTools.AzureTool();

            Channel = channel;
        }
开发者ID:jt2073,项目名称:azure-sdk-tools,代码行数:13,代码来源:PublishAzureServiceProject.cs


示例2: RemovePackageFromBlob

        /// <summary>
        /// Removes uploaded package from storage account.
        /// </summary>
        /// <param name="channel">Channel to use for REST calls</param>
        /// <param name="storageName">Store which has the package</param>
        /// <param name="subscriptionId">Subscription which has the store</param>
        public static void RemovePackageFromBlob(IServiceManagement channel, string storageName, string subscriptionId)
        {
            StorageService storageService = channel.GetStorageKeys(subscriptionId, storageName);
            string storageKey = storageService.StorageServiceKeys.Primary;

            RemoveFile(storageName, storageKey);
        }
开发者ID:nicopeelen,项目名称:azure-sdk-tools,代码行数:13,代码来源:AzureBlob.cs


示例3: PublishAzureServiceProjectCommand

        /// <summary>
        /// Initializes a new instance of the PublishAzureServiceCommand class.
        /// </summary>
        /// <param name="channel">
        /// Channel used for communication with Azure's service management APIs.
        /// </param>
        public PublishAzureServiceProjectCommand(IServiceManagement channel)
        {
            Channel = channel;

            _listeners = new List<IPublishListener>();
            _listeners.Add(new CachingStorageConnectionStringUpdater());
        }
开发者ID:bryanhunter,项目名称:azure-sdk-tools,代码行数:13,代码来源:PublishAzureServiceProject.cs


示例4: UploadPackageToBlob

        public static Uri UploadPackageToBlob(IServiceManagement channel, string storageName, string subscriptionId, string packagePath, BlobRequestOptions blobRequestOptions)
        {
            StorageService storageService = channel.GetStorageKeys(subscriptionId, storageName);
            string storageKey = storageService.StorageServiceKeys.Primary;

            return UploadFile(storageName, storageKey, packagePath, blobRequestOptions);
        }
开发者ID:nicopeelen,项目名称:azure-sdk-tools,代码行数:7,代码来源:AzureBlob.cs


示例5: GetCurrentCloudStorageAccount

        public static CloudStorageAccount GetCurrentCloudStorageAccount(IServiceManagement channel, SubscriptionData subscriptionData)
        {
            if (String.IsNullOrEmpty(subscriptionData.CurrentStorageAccount))
            {
                return null;
            }

            if (subscriptionData.CurrentCloudStorageAccount != null)
            {
                return subscriptionData.CurrentCloudStorageAccount;
            }

            CloudStorageAccount currentStorage = null;
            using (new OperationContextScope(channel.ToContextChannel()))
            {
                var storageService = channel.GetStorageService(subscriptionData.SubscriptionId, subscriptionData.CurrentStorageAccount);
                var storageServiceKeys = channel.GetStorageKeys(subscriptionData.SubscriptionId, subscriptionData.CurrentStorageAccount);
                if (storageService != null && storageServiceKeys != null)
                {
                    string connectionString = General.BuildConnectionString("https", storageService.ServiceName, storageServiceKeys.StorageServiceKeys.Primary, storageService.StorageServiceProperties.Endpoints[0].Replace("http://", "https://"), storageService.StorageServiceProperties.Endpoints[2].Replace("http://", "https://"), storageService.StorageServiceProperties.Endpoints[1].Replace("http://", "https://"));
                    currentStorage = CloudStorageAccount.Parse(connectionString);
                }
            }

            subscriptionData.CurrentCloudStorageAccount = currentStorage;
            return currentStorage;
        }
开发者ID:bueti,项目名称:azure-sdk-tools,代码行数:27,代码来源:CloudStorageAccountFactory.cs


示例6: DeletePackageFromBlob

 public static void DeletePackageFromBlob(
     IServiceManagement channel,
     string storageName,
     string subscriptionId,
     Uri packageUri)
 {
     cloudBlobUtility.DeletePackageFromBlob(channel, storageName, subscriptionId, packageUri);
 }
开发者ID:takekazuomi,项目名称:azure-sdk-tools,代码行数:8,代码来源:AzureBlob.cs


示例7: UploadPackageToBlob

		public static Uri UploadPackageToBlob(IServiceManagement channel, string storageName, string subscriptionId, string packagePath)
		{
			StorageService storageKeys = channel.GetStorageKeys(subscriptionId, storageName);
			string primary = storageKeys.StorageServiceKeys.Primary;
			storageKeys = channel.GetStorageService(subscriptionId, storageName);
			EndpointList endpoints = storageKeys.StorageServiceProperties.Endpoints;
			string str = ((List<string>)endpoints).Find((string p) => p.Contains(".blob."));
			return AzureBlob.UploadFile(storageName, primary, str, packagePath);
		}
开发者ID:nickchal,项目名称:pash,代码行数:9,代码来源:AzureBlob.cs


示例8: PerformOperation

 protected override void PerformOperation(IServiceManagement channel)
 {
     var operation = channel.GetOperationStatus(SubscriptionId, OperationId);
     Console.WriteLine("Requested Status={0}", operation.Status);
     if (operation.Error != null)
     {
         Console.WriteLine(operation.Error);
     }
 }
开发者ID:uric,项目名称:cloudify,代码行数:9,代码来源:GetResultCommand.cs


示例9: UploadPackageToBlob

        public static Uri UploadPackageToBlob(IServiceManagement channel, string storageName, string subscriptionId, string packagePath)
        {
            StorageService storageService = null;

            storageService = channel.GetStorageKeys(subscriptionId, storageName);
            string storageKey = storageService.StorageServiceKeys.Primary;

            return AzureBlob.UploadFile(storageName, storageKey, packagePath);
        }
开发者ID:kirillg,项目名称:azure-sdk-tools,代码行数:9,代码来源:AzureBlob.cs


示例10: UploadPackageToBlob

        public static Uri UploadPackageToBlob(IServiceManagement channel, string storageName, string subscriptionId, string packagePath, BlobRequestOptions blobRequestOptions)
        {
            StorageService storageService = channel.GetStorageKeys(subscriptionId, storageName);
            string storageKey = storageService.StorageServiceKeys.Primary;
            storageService = channel.GetStorageService(subscriptionId, storageName);
            string blobEndpointUri = storageService.StorageServiceProperties.Endpoints[0];

            return UploadFile(storageName, CreateHttpsEndpoint(blobEndpointUri), storageKey, packagePath, blobRequestOptions);
        }
开发者ID:bueti,项目名称:azure-sdk-tools,代码行数:9,代码来源:AzureBlob.cs


示例11: PerformOperation

        protected override void PerformOperation(IServiceManagement channel)
        {
            var input = new CertificateFile()
            {
                CertificateFormat = CertificateFormat,
                Password = CertificateFilePassword,
            };

            input.Data = Convert.ToBase64String(File.ReadAllBytes(CertificateFile));
            channel.AddCertificates(SubscriptionId, HostedServiceName, input);
        }
开发者ID:vladif86,项目名称:cloudify,代码行数:11,代码来源:CertificateCommands.cs


示例12: DeletePackageFromBlob

 public static void DeletePackageFromBlob(IServiceManagement channel, string storageName, string subscriptionId, Uri packageUri)
 {
     var storageService = channel.GetStorageKeys(subscriptionId, storageName);
     var storageKey = storageService.StorageServiceKeys.Primary;
     storageService = channel.GetStorageService(subscriptionId, storageName);
     var blobStorageEndpoint = new Uri(storageService.StorageServiceProperties.Endpoints.Find(p => p.Contains(BlobEndpointIdentifier)));
     var credentials = new StorageCredentials(storageName, storageKey);
     var client = new CloudBlobClient(blobStorageEndpoint, credentials);
     ICloudBlob blob = client.GetBlobReferenceFromServer(packageUri);
     blob.DeleteIfExists();
 }
开发者ID:OctopusDeploy,项目名称:azure-sdk-tools,代码行数:11,代码来源:AzureBlob.cs


示例13: DeletePackageFromBlob

		public static void DeletePackageFromBlob(IServiceManagement channel, string storageName, string subscriptionId, Uri packageUri)
		{
			StorageService storageKeys = channel.GetStorageKeys(subscriptionId, storageName);
			string primary = storageKeys.StorageServiceKeys.Primary;
			storageKeys = channel.GetStorageService(subscriptionId, storageName);
			EndpointList endpoints = storageKeys.StorageServiceProperties.Endpoints;
			string str = ((List<string>)endpoints).Find((string p) => p.Contains(".blob."));
			StorageCredentialsAccountAndKey storageCredentialsAccountAndKey = new StorageCredentialsAccountAndKey(storageName, primary);
			CloudBlobClient cloudBlobClient = new CloudBlobClient(str, storageCredentialsAccountAndKey);
			CloudBlob blobReference = cloudBlobClient.GetBlobReference(packageUri.AbsoluteUri);
			blobReference.DeleteIfExists();
		}
开发者ID:nickchal,项目名称:pash,代码行数:12,代码来源:AzureBlob.cs


示例14: UploadPackageToBlob

 public static Uri UploadPackageToBlob(
     IServiceManagement channel,
     string storageName,
     string subscriptionId,
     string packagePath,
     BlobRequestOptions blobRequestOptions)
 {
     return cloudBlobUtility.UploadPackageToBlob(
         channel,
         storageName,
         subscriptionId,
         packagePath,
         blobRequestOptions);
 }
开发者ID:takekazuomi,项目名称:azure-sdk-tools,代码行数:14,代码来源:AzureBlob.cs


示例15: RemoveVHD

		public static void RemoveVHD(IServiceManagement channel, string subscriptionId, Uri mediaLink)
		{
			StorageService storageKeys;
			char[] chrArray = new char[1];
			chrArray[0] = '.';
			string str = mediaLink.Host.Split(chrArray)[0];
			string components = mediaLink.GetComponents(UriComponents.SchemeAndServer, UriFormat.Unescaped);
			using (OperationContextScope operationContextScope = new OperationContextScope((IContextChannel)channel))
			{
				storageKeys = channel.GetStorageKeys(subscriptionId, str);
			}
			StorageCredentialsAccountAndKey storageCredentialsAccountAndKey = new StorageCredentialsAccountAndKey(str, storageKeys.StorageServiceKeys.Primary);
			CloudBlobClient cloudBlobClient = new CloudBlobClient(components, storageCredentialsAccountAndKey);
			CloudBlob blobReference = cloudBlobClient.GetBlobReference(mediaLink.AbsoluteUri);
			blobReference.DeleteIfExists();
		}
开发者ID:nickchal,项目名称:pash,代码行数:16,代码来源:Disks.cs


示例16: RemoveVHD

        public static void RemoveVHD(IServiceManagement channel, string subscriptionId, Uri mediaLink)
        {
            var accountName = mediaLink.Host.Split('.')[0];
            var blobEndpoint = new Uri(mediaLink.GetComponents(UriComponents.SchemeAndServer, UriFormat.Unescaped));

            StorageService storageService;
            using (new OperationContextScope(channel.ToContextChannel()))
            {
                storageService = channel.GetStorageKeys(subscriptionId, accountName);
            }

            var storageAccountCredentials = new StorageCredentials(accountName, storageService.StorageServiceKeys.Primary);
            var client = new CloudBlobClient(blobEndpoint, storageAccountCredentials);
            var blob = client.GetBlobReferenceFromServer(mediaLink);
            blob.DeleteIfExists();
        }
开发者ID:Viachaslau,项目名称:azure-sdk-tools,代码行数:16,代码来源:Disks.cs


示例17: GetCurrentCloudStorageAccount

        public static CloudStorageAccount GetCurrentCloudStorageAccount(
            IServiceManagement channel,
            SubscriptionData subscriptionData)
        {
            if (String.IsNullOrEmpty(subscriptionData.CurrentStorageAccount))
            {
                return null;
            }

            if (subscriptionData.CurrentCloudStorageAccount != null)
            {
                return subscriptionData.CurrentCloudStorageAccount;
            }

            SetCurrentCloudStorageAccount(channel, subscriptionData);

            return subscriptionData.CurrentCloudStorageAccount;
        }
开发者ID:TanaryTai,项目名称:azure-sdk-tools,代码行数:18,代码来源:SubscriptionData.cs


示例18: PerformOperation

        protected override void PerformOperation(IServiceManagement channel)
        {
            CreateHostedServiceInput input = new CreateHostedServiceInput()
            {
                ServiceName = HostedServiceName,
                Label = ServiceManagementHelper.EncodeToBase64String(CSManageCommand.Label),

            };

            if (CSManageCommand.Description != null)
            {
                Description = CSManageCommand.Description;
            }

            if (LocationConstraintName != null)
            {
                input.Location = LocationConstraintName;
            }
            try
            {
                channel.CreateHostedService(SubscriptionId, input);
            }
            catch (ProtocolException e)
            {
                ServiceManagementError error = null;
                System.Net.HttpStatusCode httpStatusCode = 0;
                string operationId;
                ServiceManagementHelper.TryGetExceptionDetails(e, out error, out httpStatusCode, out operationId);
                if (httpStatusCode != HttpStatusCode.Conflict)
                {
                    base.RethrowCommunicationError(e, error);
                }

                var myservices = channel.ListHostedServices(SubscriptionId);
                if ((from s in myservices select s.ServiceName).Contains(HostedServiceName))
                {
                    throw new CSManageException("The hosted service " + HostedServiceName + " already exists.");
                }
                else
                {
                    throw new CSManageException("A hosted service by the name " + HostedServiceName + " is already in use by another Subscription. Please choose a different name.", e);
                }
            }
        }
开发者ID:uric,项目名称:cloudify,代码行数:44,代码来源:HostedServiceCommands.cs


示例19: ExtensionManager

        public ExtensionManager(IServiceManagement channel, string subscriptionId, string serviceName)
        {
            if (channel == null)
            {
                throw new ArgumentNullException("channel");
            }
            Channel = channel;

            if (string.IsNullOrEmpty(subscriptionId))
            {
                throw new ArgumentNullException("subscriptionId");
            }
            SubscriptionId = subscriptionId;

            if (string.IsNullOrEmpty(serviceName))
            {
                throw new ArgumentNullException("serviceName");
            }
            ServiceName = serviceName;
        }
开发者ID:Viachaslau,项目名称:azure-sdk-tools,代码行数:20,代码来源:ExtensionManager.cs


示例20: OnPublish

        public void OnPublish(IServiceManagement channel, AzureService service, ServiceSettings publishSettings, string subscriptionId)
        {
            StorageService storageService = channel.GetStorageKeys(subscriptionId, publishSettings.StorageAccountName);
            string name = publishSettings.StorageAccountName;
            string key = storageService.StorageServiceKeys.Primary;

            ConfigConfigurationSetting connectionStringConfig = new ConfigConfigurationSetting { name = Resources.CachingConfigStoreConnectionStringSettingName, value = string.Empty };
            service.Components.ForEachRoleSettings(
            r => Array.Exists<ConfigConfigurationSetting>(r.ConfigurationSettings, c => c.Equals(connectionStringConfig)),
            delegate(RoleSettings r)
            {
                int index = Array.IndexOf<ConfigConfigurationSetting>(r.ConfigurationSettings, connectionStringConfig);
                r.ConfigurationSettings[index] = new ConfigConfigurationSetting
                {
                    name = Resources.CachingConfigStoreConnectionStringSettingName,
                    value = string.Format(Resources.CachingConfigStoreConnectionStringSettingValue, name, key)
                };
            });

            service.Components.Save(service.Paths);
        }
开发者ID:bielawb,项目名称:azure-sdk-tools,代码行数:21,代码来源:CachingStorageConnectionStringUpdater.cs



注:本文中的IServiceManagement类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# IServiceProvider类代码示例发布时间:2022-05-24
下一篇:
C# IServiceLocator类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap