本文整理汇总了C#中Amazon.RegionEndpoint类的典型用法代码示例。如果您正苦于以下问题:C# RegionEndpoint类的具体用法?C# RegionEndpoint怎么用?C# RegionEndpoint使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
RegionEndpoint类属于Amazon命名空间,在下文中一共展示了RegionEndpoint类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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: DynamoDBConnection
private DynamoDBConnection(RegionEndpoint endpoint = null)
{
if (endpoint == null) {
endpoint = RegionEndpoint.USEast1;
}
client = new AmazonDynamoDBClient(endpoint);
}
开发者ID:Amichai,项目名称:Annotation,代码行数:7,代码来源:DynamoDBConnection.cs
示例5: 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
示例6: 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
示例7: 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
示例8: 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
示例9: 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
示例10: 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
示例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
示例16: EnsureTopicExists
private SnsTopicByName EnsureTopicExists(RegionEndpoint region, IMessageSerialisationRegister serialisationRegister, SqsReadConfiguration queueConfig)
{
var snsclient = _awsClientFactory.GetAwsClientFactory().GetSnsClient(region);
var eventTopic = _topicCache.TryGetFromCache(region.SystemName, queueConfig.PublishEndpoint);
if (eventTopic != null)
return eventTopic;
eventTopic = new SnsTopicByName(queueConfig.PublishEndpoint, snsclient, serialisationRegister);
_topicCache.AddToCache(region.SystemName, queueConfig.PublishEndpoint, eventTopic);
if (!eventTopic.Exists())
eventTopic.Create();
return eventTopic;
}
开发者ID:denizkocak,项目名称:JustSaying,代码行数:16,代码来源:AmazonQueueCreator.cs
示例17: GetAllRDSInstances
public static List<AWSInstance> GetAllRDSInstances(AWSEnvironment environment, RegionEndpoint region)
{
var dbInstances = new List<AWSInstance>();
try
{
var rdsClient = AWSClientFactory.CreateAmazonRDSClient(environment.AccessKeyID, environment.SecretAccessKey, region);
var rdsInstances = rdsClient.DescribeDBInstances();
foreach (var dbInstance in rdsInstances.DBInstances)
{
var rdsInstance = new AWSInstance
{
Role = dbInstance.Engine.ToUpper(),
Name = dbInstance.DBInstanceIdentifier,
InstanceType = dbInstance.DBInstanceClass,
PubliclyAccessible = dbInstance.PubliclyAccessible,
Encrypted = dbInstance.StorageEncrypted,
Platform = Platforms.Linux,
State = States.Running,
IsRDS = true
};
if (rdsInstance.Role == "MSSQL")
{
rdsInstance.Platform = Platforms.Windows;
}
foreach (var subnet in dbInstance.DBSubnetGroup.Subnets)
{
rdsInstance.SubnetIDs.Add(subnet.SubnetIdentifier);
}
foreach (var vpcSecurityGroup in dbInstance.VpcSecurityGroups)
{
rdsInstance.SecurityGroupIDs.Add(vpcSecurityGroup.VpcSecurityGroupId);
}
dbInstances.Add(rdsInstance);
}
}
catch (AmazonEC2Exception aex)
{
Logger.Log(LogLevel.Error, aex, $"AmazonEC2Exception in GetAllRDSInstances() : {aex.Message}");
}
return dbInstances;
}
开发者ID:Trov,项目名称:Document.AWS,代码行数:47,代码来源:RDS.cs
示例18: AWSS3Helper
public AWSS3Helper(RegionEndpoint regionendpoint, String AWSAccessKey, String AWSSecretKey)
{
// Set configuration info
AmazonS3Config config = new AmazonS3Config ();
config.Timeout = new TimeSpan (1, 0, 0);
config.ReadWriteTimeout = new TimeSpan (1, 0, 0);
config.RegionEndpoint = regionendpoint;
// Create S3 client
S3client = Amazon.AWSClientFactory.CreateAmazonS3Client
(Gadgets.LoadConfigurationSetting ("AWSAccessKey", AWSAccessKey),
Gadgets.LoadConfigurationSetting ("AWSSecretKey", AWSSecretKey),
config);
// Create the file transfer utility class
fileTransferUtility = new TransferUtility (S3client);
}
开发者ID:trista-lg,项目名称:AWSHelpers,代码行数:17,代码来源:AWSS3Helper.cs
示例19: FDGlacier
public FDGlacier(FDUserSettings settings, FDOperationLog oplog, string optype)
{
this.vaultName = settings.AWSGlacierVaultName;
log = oplog;
switch (settings.AWSRegion) {
case FDUserSettings.AWSRegionIndex.USWest1:
region = RegionEndpoint.USWest1;
break;
case FDUserSettings.AWSRegionIndex.USWest2:
region = RegionEndpoint.USWest2;
break;
case FDUserSettings.AWSRegionIndex.USEast1:
region = RegionEndpoint.USEast1;
break;
case FDUserSettings.AWSRegionIndex.EUWest1:
region = RegionEndpoint.EUWest1;
break;
case FDUserSettings.AWSRegionIndex.APNortheast1:
region = RegionEndpoint.APNortheast1;
break;
default:
region = RegionEndpoint.USEast1;
break;
}
//Instantiate the glacier config with our settins (for future move to AmazonGlacierClient)
glacierConfig = new AmazonGlacierConfig();
glacierConfig.RegionEndpoint = region;
//Instantiate AWS Credentials
awsCredentials = new BasicAWSCredentials(settings.AWSAccessKey, settings.AWSSecretKey);
//Instantiate the transfer manager with our settings
//TODO: Switch to glacier client so we can abort this damn thing
//glacierClient = new AmazonGlacierClient(appConfig["AWSAccessKey"], appConfig["AWSSecretKey"], region);
transferManager = new ArchiveTransferManager(awsCredentials, region);
upOptions = new UploadOptions();
downOptions = new DownloadOptions();
progress = 0;
upOptions.StreamTransferProgress = downOptions.StreamTransferProgress = this.onProgress;
OperationType = optype;
}
开发者ID:fardog,项目名称:snowpack,代码行数:45,代码来源:FDGlacier.cs
示例20: PvcS3
public PvcS3(
string accessKey = null,
string secretKey = null,
string bucketName = null,
Amazon.RegionEndpoint regionEndpoint = null)
{
this.accessKey = accessKey != null ? accessKey : PvcS3.AccessKey;
this.secretKey = secretKey != null ? secretKey : PvcS3.SecretKey;
this.bucketName = bucketName != null ? bucketName : PvcS3.BucketName;
this.regionEndpoint = regionEndpoint != null ? regionEndpoint : PvcS3.RegionEndpoint;
// Set up the API client for S3.
AWSCredentials creds = new BasicAWSCredentials(this.accessKey, this.secretKey);
this.s3client = new AmazonS3Client(creds, this.regionEndpoint);
// Initialize some private stuff that we use to track md5 sums
this.keyEtags = new Dictionary<string, string>();
this.keyMD5Sums = new Dictionary<string, string>();
}
开发者ID:pauljz,项目名称:pvc-s3,代码行数:19,代码来源:PvcS3.cs
注:本文中的Amazon.RegionEndpoint类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论