Table of Contents

Class AwsRegion

Namespace
DynaSharp
Assembly
DynaSharp.dll

An AWS region, such as eu-central-2, and the DynamoDB and DynamoDB Streams endpoints that serve it.

public sealed record AwsRegion : IEquatable<AwsRegion>
Inheritance
AwsRegion
Implements
Inherited Members

Remarks

The region name ends up in the endpoint host name and in the SigV4 credential scope. It is therefore validated up front: only lowercase ASCII letters, digits and inner hyphens are accepted. This rejects typos early and makes it impossible to inject other hosts through the region name.

Regions in the aws-cn partition (names starting with cn-) resolve to the amazonaws.com.cn domain. All other regions resolve to amazonaws.com.

Properties

DynamoDbEndpoint

Gets the public HTTPS endpoint of DynamoDB in this region, for example https://dynamodb.us-east-1.amazonaws.com/.

public Uri DynamoDbEndpoint { get; }

Property Value

Uri

DynamoDbStreamsEndpoint

Gets the public HTTPS endpoint of DynamoDB Streams in this region, for example https://streams.dynamodb.us-east-1.amazonaws.com/. It is a different host from DynamoDbEndpoint.

public Uri DynamoDbStreamsEndpoint { get; }

Property Value

Uri

Name

Gets the region name, for example us-east-1.

public string Name { get; }

Property Value

string

Methods

Equals(AwsRegion?)

public bool Equals(AwsRegion? other)

Parameters

other AwsRegion

Returns

bool

Equals(object?)

public override bool Equals(object? obj)

Parameters

obj object

Returns

bool

FromName(string)

Creates a region from its name.

public static AwsRegion FromName(string name)

Parameters

name string

The region name, for example eu-central-2. It must be lowercase.

Returns

AwsRegion

The region.

Exceptions

ArgumentNullException

name is null.

ArgumentException

name is empty, contains characters other than lowercase ASCII letters, digits and hyphens, or starts or ends with a hyphen.

GetHashCode()

public override int GetHashCode()

Returns

int

ToString()

Returns the region name.

public override string ToString()

Returns

string

The value of Name.

Operators

operator ==(AwsRegion?, AwsRegion?)

public static bool operator ==(AwsRegion? left, AwsRegion? right)

Parameters

left AwsRegion
right AwsRegion

Returns

bool

operator !=(AwsRegion?, AwsRegion?)

public static bool operator !=(AwsRegion? left, AwsRegion? right)

Parameters

left AwsRegion
right AwsRegion

Returns

bool