当前位置: 首页>>代码示例>>C#>>正文


C# Amazon.RegionEndpoint类代码示例

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


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

示例1: AmazonS3Region

 public AmazonS3Region(RegionEndpoint region)
 {
     Name = region.DisplayName;
     Identifier = region.SystemName;
     AmazonRegion = region;
     Hostname = region.GetEndpointForService("s3").Hostname;
 }
开发者ID:BallisticLingonberries,项目名称:ShareX,代码行数:7,代码来源:AmazonS3Region.cs

示例2: AmazonSqsTransport

        /// <summary>
        /// Constructs the transport with the specified settings
        /// </summary>
        public AmazonSqsTransport(string inputQueueAddress, string accessKeyId, string secretAccessKey, RegionEndpoint regionEndpoint, IRebusLoggerFactory rebusLoggerFactory)
        {
            if (accessKeyId == null) throw new ArgumentNullException("accessKeyId");
            if (secretAccessKey == null) throw new ArgumentNullException("secretAccessKey");
            if (regionEndpoint == null) throw new ArgumentNullException("regionEndpoint");
            if (rebusLoggerFactory == null) throw new ArgumentNullException("rebusLoggerFactory");

            _inputQueueAddress = inputQueueAddress;
            _log = rebusLoggerFactory.GetCurrentClassLogger();
            
            if (_inputQueueAddress != null)
            {
                if (_inputQueueAddress.Contains("/") && !Uri.IsWellFormedUriString(_inputQueueAddress, UriKind.Absolute))
                {
                    throw new ArgumentException(
                        "You could either have a simple queue name without slash (eg. \"inputqueue\") - or a complete URL for the queue endpoint. (eg. \"https://sqs.eu-central-1.amazonaws.com/234234234234234/somqueue\")",
                        "inputQueueAddress");
                }
            }

            _accessKeyId = accessKeyId;
            _secretAccessKey = secretAccessKey;
            _regionEndpoint = regionEndpoint;
            _rebusLoggerFactory = rebusLoggerFactory;
        }
开发者ID:ninocrudele,项目名称:Rebus,代码行数:28,代码来源:AmazonSQSTransport.cs

示例3: DeleteStack

        public static void DeleteStack(RegionEndpoint awsEndpoint, string stackName)
        {
            var codeDeployClient = new AmazonCodeDeployClient(awsEndpoint);
            var apps = codeDeployClient.ListApplications().Applications.Where(name => name.StartsWith("HelloWorld"));
            foreach (var app in apps) {
                codeDeployClient.DeleteApplication(new DeleteApplicationRequest {ApplicationName = app});
            }

            var cloudFormationClient = new AmazonCloudFormationClient(awsEndpoint);
            try
            {
                cloudFormationClient.DeleteStack(new DeleteStackRequest { StackName = stackName });
                var testStackStatus = StackStatus.DELETE_IN_PROGRESS;
                while (testStackStatus == StackStatus.DELETE_IN_PROGRESS)
                {
                    Thread.Sleep(TimeSpan.FromSeconds(10));
                    var stacksStatus =
                        cloudFormationClient.DescribeStacks(new DescribeStacksRequest { StackName = stackName });
                    testStackStatus = stacksStatus.Stacks.First(s => s.StackName == stackName).StackStatus;
                }
            }
            catch (AmazonCloudFormationException)
            {
            }
        }
开发者ID:travcorp,项目名称:aws-tools,代码行数:25,代码来源:StackHelper.cs

示例4: UseAmazonSqsAsOneWayClient

        /// <summary>
        /// Configures Rebus to use Amazon Simple Queue Service as the message transport
        /// </summary>
        public static void UseAmazonSqsAsOneWayClient(this StandardConfigurer<ITransport> configurer, string accessKeyId, string secretAccessKey, RegionEndpoint regionEndpoint)
        {
            configurer.Register(c =>
            {
                var rebusLoggerFactory = c.Get<IRebusLoggerFactory>();
                var asyncTaskFactory = c.Get<IAsyncTaskFactory>();

                return new AmazonSqsTransport(null, accessKeyId, secretAccessKey, regionEndpoint, rebusLoggerFactory, asyncTaskFactory);
            });

            OneWayClientBackdoor.ConfigureOneWayClient(configurer);
        }
开发者ID:nls75,项目名称:Rebus,代码行数:15,代码来源:AmazonSQSConfigurationExtensions.cs

示例5: DynamoDBConnection

 private DynamoDBConnection(RegionEndpoint endpoint = null)
 {
     if (endpoint == null) {
         endpoint = RegionEndpoint.USEast1;
     }
     client = new AmazonDynamoDBClient(endpoint);
 }
开发者ID:Amichai,项目名称:Annotation,代码行数:7,代码来源:DynamoDBConnection.cs

示例6: AmazonS3Service

		private const int _bufferSize = 1024 * 1024 * 10; // 10mb

		/// <summary>
		/// Initializes a new instance of the <see cref="AmazonS3Service"/>.
		/// </summary>
		/// <param name="endpoint">Region address.</param>
		/// <param name="bucket">Storage name.</param>
		/// <param name="accessKey">Key.</param>
		/// <param name="secretKey">Secret.</param>
		public AmazonS3Service(RegionEndpoint endpoint, string bucket, string accessKey, string secretKey)
		{
			if (bucket.IsEmpty())
				throw new ArgumentNullException(nameof(bucket));

			_client = new AmazonS3Client(new BasicAWSCredentials(accessKey, secretKey), endpoint);
			_bucket = bucket;
		}
开发者ID:vikewoods,项目名称:StockSharp,代码行数:17,代码来源:AmazonS3Service.cs

示例7: AmazonGlacierService

		/// <summary>
		/// Initializes a new instance of the <see cref="AmazonGlacierService"/>.
		/// </summary>
		/// <param name="endpoint">Region address.</param>
		/// <param name="vaultName">Storage name.</param>
		/// <param name="accessKey">Key.</param>
		/// <param name="secretKey">Secret.</param>
		public AmazonGlacierService(RegionEndpoint endpoint, string vaultName, string accessKey, string secretKey)
		{
			if (vaultName.IsEmpty())
				throw new ArgumentNullException("vaultName");

			_client = new AmazonS3Client(new BasicAWSCredentials(accessKey, secretKey), endpoint);
			_vaultName = vaultName;
		}
开发者ID:hbwjz,项目名称:StockSharp,代码行数:15,代码来源:AmazonGlacierService.cs

示例8: CreateClient

 public static AmazonEC2Client CreateClient(RegionEndpoint region)
 {
     var key = ConfigurationManager.AppSettings["AWSAccessKey"];
     var secretkey = ConfigurationManager.AppSettings["AWSSecretKey"];
     if (!string.IsNullOrEmpty(key))
         return new AmazonEC2Client(key, secretkey, region);
     else
         return new AmazonEC2Client();
 }
开发者ID:Web5design,项目名称:aws-dev-server-manager,代码行数:9,代码来源:AwsUtil.cs

示例9: SetRegion

        /// <summary>
        /// Specifies the endpoints available to AWS clients.
        /// </summary>
        /// <param name="settings">The CloudFront settings.</param>
        /// <param name="region">The endpoints available to AWS clients.</param>
        /// <returns>The same <see cref="CloudFrontSettings"/> instance so that multiple calls can be chained.</returns>
        public static CloudFrontSettings SetRegion(this CloudFrontSettings settings, RegionEndpoint region)
        {
            if (settings == null)
            {
                throw new ArgumentNullException("settings");
            }

            settings.Region = region;
            return settings;
        }
开发者ID:SharpeRAD,项目名称:Cake.AWS.CloudFront,代码行数:16,代码来源:CloudFrontSettingsExtensions.cs

示例10: SetRegion

        /// <summary>
        /// Specifies the endpoints available to AWS clients.
        /// </summary>
        /// <param name="settings">The LoadBalancing settings.</param>
        /// <param name="region">The endpoints available to AWS clients.</param>
        /// <returns>The same <see cref="LoadBalancingSettings"/> instance so that multiple calls can be chained.</returns>
        public static LoadBalancingSettings SetRegion(this LoadBalancingSettings settings, RegionEndpoint region)
        {
            if (settings == null)
            {
                throw new ArgumentNullException("settings");
            }

            settings.Region = region;
            return settings;
        }
开发者ID:SharpeRAD,项目名称:Cake.AWS.ElasticLoadBalancing,代码行数:16,代码来源:LoadBalancingSettingsExtensions.cs

示例11: CreateClassicInstances

        /// <summary>
        /// This function creates a set of instances into EC2 Classic. It returns the Ids of the created instances if successful, or 
        /// sets the error code and message otherwise
        /// </summary>
        /// <param name="regionEndpoint">Region where instances should be created</param>
        /// <param name="AMI_ID">Id of the AMI that will be used as a base for the instances</param>
        /// <param name="SecurityGroupId">The name of the security group to be assigned to the instance(s)</param>
        /// <param name="KeyPairName">The name of the keypair to be assigned to the instance(s)</param>
        /// <param name="InstanceType">The type of the instance(s)</param>
        /// <param name="InstanceCount">The number of instances to be launched</param>
        /// <param name="UserData">The user-data script that will be run as the instance(s) is(are) initialized</param>
        /// <returns>The list of Instance Ids if successful</returns>
        public List<string> CreateClassicInstances(RegionEndpoint regionEndpoint, string AMI_ID, string SecurityGroupId, string KeyPairName, string InstanceType, int InstanceCount = 1, string UserData = "")
        {
            List<string> InstanceIds = new List<string> ();

            // Initialize error values
            ErrorCode    = 0;
            ErrorMessage = "";

            // Create the request object
            List<string> groups = new List<string> () { SecurityGroupId };
            var launchRequest = new RunInstancesRequest ()
            {
                ImageId          = AMI_ID,
                InstanceType     = InstanceType,
                MinCount         = InstanceCount,
                MaxCount         = InstanceCount,
                KeyName          = KeyPairName,
                SecurityGroupIds = groups,
                UserData         = Gadgets.Base64Encode (UserData)
            };

            // Launch the instances
            try
            {
                var launchResponse = EC2client.RunInstances (launchRequest);

                // Check response for errors
                if (launchResponse.HttpStatusCode != HttpStatusCode.OK)
                {
                    ErrorCode = Convert.ToInt32 (launchResponse.HttpStatusCode);
                    ErrorMessage = "Http Error [" + launchResponse.HttpStatusCode.ToString () + "]";
                }
                else
                {
                    List<Instance> createdInstances = launchResponse.Reservation.Instances;
                    foreach (Instance instance in createdInstances)
                    {
                        InstanceIds.Add (instance.InstanceId);
                    }
                }
            }
            catch (Exception ex)
            {
                ErrorCode    = -1;
                ErrorMessage = ex.Message + "::" + ex.InnerException;
            }

            return InstanceIds;
        }
开发者ID:trista-lg,项目名称:AWSHelpers,代码行数:61,代码来源:AWSEC2Helper.cs

示例12: GetAllSecurityGroups

        public static List<SecurityGroup> GetAllSecurityGroups(AWSEnvironment environment, RegionEndpoint region)
        {
            try
            {
                var ec2Client = AWSClientFactory.CreateAmazonEC2Client(environment.AccessKeyID, environment.SecretAccessKey, region);
                var regionSecurityGroups = ec2Client.DescribeSecurityGroups();
                return regionSecurityGroups.SecurityGroups;
            }
            catch (AmazonEC2Exception aex)
            {
                Logger.Log(LogLevel.Error, aex, $"AmazonEC2Exception in GetAllSecurityGroups() : {aex.Message}");
            }

            return null;
        }
开发者ID:Trov,项目名称:Document.AWS,代码行数:15,代码来源:EC2.cs

示例13: Given

        protected override void Given()
        {
            _topicName = "message";
            _queueName = "queue" + DateTime.Now.Ticks;
            _regionEndpoint = RegionEndpoint.SAEast1;

            EnableMockedBus();

            Configuration = new MessagingConfig();

            TestEndpoint = _regionEndpoint;

            DeleteQueueIfItAlreadyExists(_regionEndpoint, _queueName);
            DeleteTopicIfItAlreadyExists(_regionEndpoint, _topicName);
        }
开发者ID:simonness,项目名称:JustSaying,代码行数:15,代码来源:WhenRegisteringASqsTopicSubscriberInANonDefaultRegion.cs

示例14: GetApi

        public static AmazonS3Client GetApi(AWSCredentials credentials, RegionEndpoint region)
        {
            if (credentials == null) throw new ArgumentNullException("credentials");
            if (region == null) throw new ArgumentNullException("region");

            var config = new AmazonS3Config
            {
                RegionEndpoint = region,
            };

            ApplyProxy(config);

            var api = new AmazonS3Client(credentials, config);
            return api;
        }
开发者ID:Kyrodan,项目名称:KeeAnywhere,代码行数:15,代码来源:AmazonS3Helper.cs

示例15: GetSnsClient

        public IAmazonSimpleNotificationService GetSnsClient(RegionEndpoint region)
        {
            var innerClient = CreateMeABus.DefaultClientFactory().GetSnsClient(region);
            var client = Substitute.For<IAmazonSimpleNotificationService>();

            client.CreateTopic(Arg.Any<CreateTopicRequest>())
                .ReturnsForAnyArgs(r => innerClient.CreateTopic(r.Arg<CreateTopicRequest>()))
                .AndDoes(r => Increment("CreateTopic", r.Arg<CreateTopicRequest>().Name, r.Arg<CreateTopicRequest>()));

            client.FindTopic(Arg.Any<string>())
                .ReturnsForAnyArgs(r => innerClient.FindTopic(r.Arg<string>()))
                .AndDoes(r => Increment("FindTopic", r.Arg<string>(), r.Arg<string>()));

            return client;
        }
开发者ID:matt-cochran,项目名称:JustSaying,代码行数:15,代码来源:ProxyAwsClientFactory.cs


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