Skip to content

Commit 4d5159e

Browse files
committed
Initial updates
1 parent db53bdc commit 4d5159e

File tree

1,138 files changed

+73958
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,138 files changed

+73958
-0
lines changed
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio Version 16
4+
VisualStudioVersion = 16.0.31019.35
5+
MinimumVisualStudioVersion = 15.0.26124.0
6+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DescribeCertificate", "DescribeCertificate\DescribeCertificate.csproj", "{A84B98F0-2C4F-4C9B-8E1A-47DD4F713F36}"
7+
EndProject
8+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DescribeCertificateTest", "DescribeCertificateTest\DescribeCertificateTest.csproj", "{6AF9CEFB-2341-4CDC-BA6E-EB7ADD38F4D6}"
9+
EndProject
10+
Global
11+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
12+
Debug|Any CPU = Debug|Any CPU
13+
Debug|x64 = Debug|x64
14+
Debug|x86 = Debug|x86
15+
Release|Any CPU = Release|Any CPU
16+
Release|x64 = Release|x64
17+
Release|x86 = Release|x86
18+
EndGlobalSection
19+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
20+
{A84B98F0-2C4F-4C9B-8E1A-47DD4F713F36}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
21+
{A84B98F0-2C4F-4C9B-8E1A-47DD4F713F36}.Debug|Any CPU.Build.0 = Debug|Any CPU
22+
{A84B98F0-2C4F-4C9B-8E1A-47DD4F713F36}.Debug|x64.ActiveCfg = Debug|Any CPU
23+
{A84B98F0-2C4F-4C9B-8E1A-47DD4F713F36}.Debug|x64.Build.0 = Debug|Any CPU
24+
{A84B98F0-2C4F-4C9B-8E1A-47DD4F713F36}.Debug|x86.ActiveCfg = Debug|Any CPU
25+
{A84B98F0-2C4F-4C9B-8E1A-47DD4F713F36}.Debug|x86.Build.0 = Debug|Any CPU
26+
{A84B98F0-2C4F-4C9B-8E1A-47DD4F713F36}.Release|Any CPU.ActiveCfg = Release|Any CPU
27+
{A84B98F0-2C4F-4C9B-8E1A-47DD4F713F36}.Release|Any CPU.Build.0 = Release|Any CPU
28+
{A84B98F0-2C4F-4C9B-8E1A-47DD4F713F36}.Release|x64.ActiveCfg = Release|Any CPU
29+
{A84B98F0-2C4F-4C9B-8E1A-47DD4F713F36}.Release|x64.Build.0 = Release|Any CPU
30+
{A84B98F0-2C4F-4C9B-8E1A-47DD4F713F36}.Release|x86.ActiveCfg = Release|Any CPU
31+
{A84B98F0-2C4F-4C9B-8E1A-47DD4F713F36}.Release|x86.Build.0 = Release|Any CPU
32+
{6AF9CEFB-2341-4CDC-BA6E-EB7ADD38F4D6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
33+
{6AF9CEFB-2341-4CDC-BA6E-EB7ADD38F4D6}.Debug|Any CPU.Build.0 = Debug|Any CPU
34+
{6AF9CEFB-2341-4CDC-BA6E-EB7ADD38F4D6}.Debug|x64.ActiveCfg = Debug|Any CPU
35+
{6AF9CEFB-2341-4CDC-BA6E-EB7ADD38F4D6}.Debug|x64.Build.0 = Debug|Any CPU
36+
{6AF9CEFB-2341-4CDC-BA6E-EB7ADD38F4D6}.Debug|x86.ActiveCfg = Debug|Any CPU
37+
{6AF9CEFB-2341-4CDC-BA6E-EB7ADD38F4D6}.Debug|x86.Build.0 = Debug|Any CPU
38+
{6AF9CEFB-2341-4CDC-BA6E-EB7ADD38F4D6}.Release|Any CPU.ActiveCfg = Release|Any CPU
39+
{6AF9CEFB-2341-4CDC-BA6E-EB7ADD38F4D6}.Release|Any CPU.Build.0 = Release|Any CPU
40+
{6AF9CEFB-2341-4CDC-BA6E-EB7ADD38F4D6}.Release|x64.ActiveCfg = Release|Any CPU
41+
{6AF9CEFB-2341-4CDC-BA6E-EB7ADD38F4D6}.Release|x64.Build.0 = Release|Any CPU
42+
{6AF9CEFB-2341-4CDC-BA6E-EB7ADD38F4D6}.Release|x86.ActiveCfg = Release|Any CPU
43+
{6AF9CEFB-2341-4CDC-BA6E-EB7ADD38F4D6}.Release|x86.Build.0 = Release|Any CPU
44+
EndGlobalSection
45+
GlobalSection(SolutionProperties) = preSolution
46+
HideSolutionNode = FALSE
47+
EndGlobalSection
48+
GlobalSection(ExtensibilityGlobals) = postSolution
49+
SolutionGuid = {102E5422-961C-4622-8127-1E9B0EB7E01B}
50+
EndGlobalSection
51+
EndGlobal
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2+
// SPDX-License-Identifier: Apache-2.0
3+
4+
// snippet-start:[ACM.dotnetv4.DescribeCertificate]
5+
using System;
6+
using System.Threading.Tasks;
7+
using Amazon;
8+
using Amazon.CertificateManager;
9+
using Amazon.CertificateManager.Model;
10+
11+
namespace DescribeCertificate
12+
{
13+
class DescribeCertificate
14+
{
15+
// The following example retrieves and displays the metadata for a
16+
// certificate using the AWS Certificate Manager (ACM) service.
17+
18+
// Specify your AWS Region (an example Region is shown).
19+
private static readonly RegionEndpoint ACMRegion = RegionEndpoint.USEast1;
20+
private static AmazonCertificateManagerClient _client;
21+
22+
static void Main(string[] args)
23+
{
24+
_client = new Amazon.CertificateManager.AmazonCertificateManagerClient(ACMRegion);
25+
26+
var describeCertificateReq = new DescribeCertificateRequest();
27+
// The ARN used here is just an example. Replace it with the ARN of
28+
// a certificate that exists on your account.
29+
describeCertificateReq.CertificateArn =
30+
"arn:aws:acm:us-east-1:123456789012:certificate/8cfd7dae-9b6a-2d07-92bc-1c309EXAMPLE";
31+
32+
var certificateDetailResp =
33+
DescribeCertificateResponseAsync(client: _client, request: describeCertificateReq);
34+
var certificateDetail = certificateDetailResp.Result.Certificate;
35+
36+
if (certificateDetail is not null)
37+
{
38+
DisplayCertificateDetails(certificateDetail);
39+
}
40+
}
41+
42+
/// <summary>
43+
/// Displays detailed metadata about a certificate retrieved
44+
/// using the ACM service.
45+
/// </summary>
46+
/// <param name="certificateDetail">The object that contains details
47+
/// returned from the call to DescribeCertificateAsync.</param>
48+
static void DisplayCertificateDetails(CertificateDetail certificateDetail)
49+
{
50+
Console.WriteLine("\nCertificate Details: ");
51+
Console.WriteLine($"Certificate Domain: {certificateDetail.DomainName}");
52+
Console.WriteLine($"Certificate Arn: {certificateDetail.CertificateArn}");
53+
Console.WriteLine($"Certificate Subject: {certificateDetail.Subject}");
54+
Console.WriteLine($"Certificate Status: {certificateDetail.Status}");
55+
foreach (var san in certificateDetail.SubjectAlternativeNames)
56+
{
57+
Console.WriteLine($"Certificate SubjectAlternativeName: {san}");
58+
}
59+
}
60+
61+
/// <summary>
62+
/// Retrieves the metadata associated with the ACM service certificate.
63+
/// </summary>
64+
/// <param name="client">An AmazonCertificateManagerClient object
65+
/// used to call DescribeCertificateResponse.</param>
66+
/// <param name="request">The DescribeCertificateRequest object that
67+
/// will be passed to the method call.</param>
68+
/// <returns></returns>
69+
static async Task<DescribeCertificateResponse> DescribeCertificateResponseAsync(
70+
AmazonCertificateManagerClient client, DescribeCertificateRequest request)
71+
{
72+
var response = new DescribeCertificateResponse();
73+
74+
try
75+
{
76+
response = await client.DescribeCertificateAsync(request);
77+
}
78+
catch (InvalidArnException)
79+
{
80+
Console.WriteLine($"Error: The ARN specified is invalid.");
81+
}
82+
catch (ResourceNotFoundException)
83+
{
84+
Console.WriteLine($"Error: The specified certificate could not be found.");
85+
}
86+
87+
return response;
88+
}
89+
}
90+
91+
}
92+
93+
// snippet-end:[ACM.dotnetv4.DescribeCertificate]
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<OutputType>Exe</OutputType>
5+
<TargetFramework>net8.0</TargetFramework>
6+
</PropertyGroup>
7+
8+
<ItemGroup>
9+
<PackageReference Include="AWSSDK.CertificateManager" Version="3.5.0.72" />
10+
<PackageReference Include="AWSSDK.Core" Version="3.5.3.2" />
11+
</ItemGroup>
12+
13+
</Project>
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2+
// SPDX-License-Identifier: Apache-2.0
3+
4+
using System.Net;
5+
using System.Threading;
6+
using System.Threading.Tasks;
7+
using Amazon;
8+
using Amazon.CertificateManager;
9+
using Amazon.CertificateManager.Model;
10+
using Moq;
11+
using Xunit;
12+
13+
namespace DescribeCertificateTest
14+
{
15+
public class DescribeCertificateTest
16+
{
17+
private AmazonCertificateManagerClient CreateMockACMClient()
18+
{
19+
var mockCertificateManagerClient = new Mock<AmazonCertificateManagerClient>(RegionEndpoint.USEast1);
20+
mockCertificateManagerClient.Setup(client => client.DescribeCertificateAsync(
21+
It.IsAny<DescribeCertificateRequest>(),
22+
It.IsAny<CancellationToken>()
23+
)).Callback<DescribeCertificateRequest, CancellationToken>((request, token) =>
24+
{
25+
}).Returns((DescribeCertificateRequest r, CancellationToken token) =>
26+
{
27+
return Task.FromResult(new DescribeCertificateResponse()
28+
{
29+
HttpStatusCode = System.Net.HttpStatusCode.OK
30+
});
31+
});
32+
33+
return mockCertificateManagerClient.Object;
34+
}
35+
36+
[Fact]
37+
[Trait("Category", "Unit")]
38+
public async Task ListCertificatesAsyncTest()
39+
{
40+
var client = CreateMockACMClient();
41+
var request = new DescribeCertificateRequest();
42+
request.CertificateArn = "arn:aws:acm:us-east-1:123456789012:certificate/8cfd7dae-9b6a-2d07-92bc-1c3093edb218";
43+
44+
var response = await client.DescribeCertificateAsync(request);
45+
46+
bool gotResult = response != null;
47+
Assert.True(gotResult, "Copy operation failed.");
48+
49+
bool ok = response.HttpStatusCode == HttpStatusCode.OK;
50+
Assert.True(ok, "Describe certificate list.");
51+
}
52+
}
53+
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<TargetFramework>net8.0</TargetFramework>
5+
6+
<IsPackable>false</IsPackable>
7+
</PropertyGroup>
8+
9+
<ItemGroup>
10+
<PackageReference Include="AWSSDK.CertificateManager" Version="3.5.0.72" />
11+
<PackageReference Include="AWSSDK.Core" Version="3.5.3.2" />
12+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.7.1" />
13+
<PackageReference Include="moq" Version="4.16.1" />
14+
<PackageReference Include="xunit" Version="2.4.1" />
15+
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3">
16+
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
17+
<PrivateAssets>all</PrivateAssets>
18+
</PackageReference>
19+
<PackageReference Include="coverlet.collector" Version="1.3.0">
20+
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
21+
<PrivateAssets>all</PrivateAssets>
22+
</PackageReference>
23+
</ItemGroup>
24+
25+
<ItemGroup>
26+
<ProjectReference Include="..\DescribeCertificate\DescribeCertificate.csproj" />
27+
</ItemGroup>
28+
29+
</Project>
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio 15
4+
VisualStudioVersion = 15.0.26124.0
5+
MinimumVisualStudioVersion = 15.0.26124.0
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ListCertificates", "ListCertificates\ListCertificates.csproj", "{2522561E-7B79-4B0A-A75B-9904B5754E1B}"
7+
EndProject
8+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ListCertificatesTest", "ListCertificatesTest\ListCertificatesTest.csproj", "{37921C64-9317-44B2-9A23-0B898F873A3F}"
9+
EndProject
10+
Global
11+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
12+
Debug|Any CPU = Debug|Any CPU
13+
Debug|x64 = Debug|x64
14+
Debug|x86 = Debug|x86
15+
Release|Any CPU = Release|Any CPU
16+
Release|x64 = Release|x64
17+
Release|x86 = Release|x86
18+
EndGlobalSection
19+
GlobalSection(SolutionProperties) = preSolution
20+
HideSolutionNode = FALSE
21+
EndGlobalSection
22+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
23+
{2522561E-7B79-4B0A-A75B-9904B5754E1B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
24+
{2522561E-7B79-4B0A-A75B-9904B5754E1B}.Debug|Any CPU.Build.0 = Debug|Any CPU
25+
{2522561E-7B79-4B0A-A75B-9904B5754E1B}.Debug|x64.ActiveCfg = Debug|Any CPU
26+
{2522561E-7B79-4B0A-A75B-9904B5754E1B}.Debug|x64.Build.0 = Debug|Any CPU
27+
{2522561E-7B79-4B0A-A75B-9904B5754E1B}.Debug|x86.ActiveCfg = Debug|Any CPU
28+
{2522561E-7B79-4B0A-A75B-9904B5754E1B}.Debug|x86.Build.0 = Debug|Any CPU
29+
{2522561E-7B79-4B0A-A75B-9904B5754E1B}.Release|Any CPU.ActiveCfg = Release|Any CPU
30+
{2522561E-7B79-4B0A-A75B-9904B5754E1B}.Release|Any CPU.Build.0 = Release|Any CPU
31+
{2522561E-7B79-4B0A-A75B-9904B5754E1B}.Release|x64.ActiveCfg = Release|Any CPU
32+
{2522561E-7B79-4B0A-A75B-9904B5754E1B}.Release|x64.Build.0 = Release|Any CPU
33+
{2522561E-7B79-4B0A-A75B-9904B5754E1B}.Release|x86.ActiveCfg = Release|Any CPU
34+
{2522561E-7B79-4B0A-A75B-9904B5754E1B}.Release|x86.Build.0 = Release|Any CPU
35+
{37921C64-9317-44B2-9A23-0B898F873A3F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
36+
{37921C64-9317-44B2-9A23-0B898F873A3F}.Debug|Any CPU.Build.0 = Debug|Any CPU
37+
{37921C64-9317-44B2-9A23-0B898F873A3F}.Debug|x64.ActiveCfg = Debug|Any CPU
38+
{37921C64-9317-44B2-9A23-0B898F873A3F}.Debug|x64.Build.0 = Debug|Any CPU
39+
{37921C64-9317-44B2-9A23-0B898F873A3F}.Debug|x86.ActiveCfg = Debug|Any CPU
40+
{37921C64-9317-44B2-9A23-0B898F873A3F}.Debug|x86.Build.0 = Debug|Any CPU
41+
{37921C64-9317-44B2-9A23-0B898F873A3F}.Release|Any CPU.ActiveCfg = Release|Any CPU
42+
{37921C64-9317-44B2-9A23-0B898F873A3F}.Release|Any CPU.Build.0 = Release|Any CPU
43+
{37921C64-9317-44B2-9A23-0B898F873A3F}.Release|x64.ActiveCfg = Release|Any CPU
44+
{37921C64-9317-44B2-9A23-0B898F873A3F}.Release|x64.Build.0 = Release|Any CPU
45+
{37921C64-9317-44B2-9A23-0B898F873A3F}.Release|x86.ActiveCfg = Release|Any CPU
46+
{37921C64-9317-44B2-9A23-0B898F873A3F}.Release|x86.Build.0 = Release|Any CPU
47+
EndGlobalSection
48+
EndGlobal
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2+
// SPDX-License-Identifier: Apache-2.0
3+
4+
// snippet-start:[ACM.dotnetv4.ListCertificates]
5+
6+
using System;
7+
using System.Threading.Tasks;
8+
using Amazon;
9+
using Amazon.CertificateManager;
10+
using Amazon.CertificateManager.Model;
11+
12+
namespace ListCertificates
13+
{
14+
// The following example retrieves and displays a list of the
15+
// certificates defined for the default account using the AWS
16+
// Certificate Manager (ACM) service.
17+
class ListCertificates
18+
{
19+
// Specify your AWS Region (an example Region is shown).
20+
21+
private static readonly RegionEndpoint ACMRegion = RegionEndpoint.USEast1;
22+
private static AmazonCertificateManagerClient _client;
23+
24+
static void Main(string[] args)
25+
{
26+
_client = new AmazonCertificateManagerClient(ACMRegion);
27+
var certificateList = ListCertificatesResponseAsync(client: _client);
28+
29+
Console.WriteLine("Certificate Summary List\n");
30+
31+
foreach (var certificate in certificateList.Result.CertificateSummaryList)
32+
{
33+
Console.WriteLine($"Certificate Domain: {certificate.DomainName}");
34+
Console.WriteLine($"Certificate ARN: {certificate.CertificateArn}\n");
35+
}
36+
}
37+
38+
/// <summary>
39+
/// Retrieves a list of the certificates defined in this Region.
40+
/// </summary>
41+
/// <param name="client">The ACM client object passed to the
42+
/// ListCertificateResAsync method call.</param>
43+
/// <param name="request"></param>
44+
/// <returns>The ListCertificatesResponse.</returns>
45+
static async Task<ListCertificatesResponse> ListCertificatesResponseAsync(
46+
AmazonCertificateManagerClient client)
47+
{
48+
var request = new ListCertificatesRequest();
49+
50+
var response = await client.ListCertificatesAsync(request);
51+
return response;
52+
}
53+
}
54+
}
55+
56+
// snippet-end:[ACM.dotnetv4.ListCertificates]
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<OutputType>Exe</OutputType>
5+
<TargetFramework>net8.0</TargetFramework>
6+
</PropertyGroup>
7+
8+
<ItemGroup>
9+
<PackageReference Include="AWSSDK.CertificateManager" Version="3.5.0.70" />
10+
<PackageReference Include="AWSSDK.Core" Version="3.5.2.10" />
11+
</ItemGroup>
12+
13+
</Project>

0 commit comments

Comments
 (0)