Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
75 changes: 75 additions & 0 deletions .doc_gen/metadata/redshift_metadata.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,14 @@ redshift_Hello:
synopsis: get started using &RS;.
category: Hello
languages:
.NET:
versions:
- sdk_version: 4
github: dotnetv4/Redshift
excerpts:
- description:
snippet_tags:
- Redshift.dotnetv4.Hello
Go:
versions:
- sdk_version: 2
Expand Down Expand Up @@ -35,6 +43,14 @@ redshift_Hello:
redshift: {DescribeClusters}
redshift_ListDatabases:
languages:
.NET:
versions:
- sdk_version: 4
github: dotnetv4/Redshift
excerpts:
- description:
snippet_tags:
- Redshift.dotnetv4.ListDatabases
Java:
versions:
- sdk_version: 2
Expand All @@ -48,6 +64,14 @@ redshift_ListDatabases:
redshift: {ListDatabases}
redshift_CreateCluster:
languages:
.NET:
versions:
- sdk_version: 4
github: dotnetv4/Redshift
excerpts:
- description:
snippet_tags:
- Redshift.dotnetv4.CreateCluster
Go:
versions:
- sdk_version: 2
Expand Down Expand Up @@ -105,6 +129,14 @@ redshift_CreateCluster:
redshift: {CreateCluster}
redshift_DeleteCluster:
languages:
.NET:
versions:
- sdk_version: 4
github: dotnetv4/Redshift
excerpts:
- description:
snippet_tags:
- Redshift.dotnetv4.DeleteCluster
Go:
versions:
- sdk_version: 2
Expand Down Expand Up @@ -162,6 +194,14 @@ redshift_DeleteCluster:
redshift: {DeleteCluster}
redshift_DescribeClusters:
languages:
.NET:
versions:
- sdk_version: 4
github: dotnetv4/Redshift
excerpts:
- description:
snippet_tags:
- Redshift.dotnetv4.DescribeClusters
Go:
versions:
- sdk_version: 2
Expand Down Expand Up @@ -219,6 +259,14 @@ redshift_DescribeClusters:
redshift: {DescribeClusters}
redshift_ModifyCluster:
languages:
.NET:
versions:
- sdk_version: 4
github: dotnetv4/Redshift
excerpts:
- description:
snippet_tags:
- Redshift.dotnetv4.ModifyCluster
Go:
versions:
- sdk_version: 2
Expand Down Expand Up @@ -276,6 +324,14 @@ redshift_ModifyCluster:
redshift: {ModifyCluster}
redshift_DescribeStatement:
languages:
.NET:
versions:
- sdk_version: 4
github: dotnetv4/Redshift
excerpts:
- description:
snippet_tags:
- Redshift.dotnetv4.DescribeStatement
Java:
versions:
- sdk_version: 2
Expand All @@ -302,6 +358,14 @@ redshift_DescribeStatement:
redshift: {DescribeStatement}
redshift_GetStatementResult:
languages:
.NET:
versions:
- sdk_version: 4
github: dotnetv4/Redshift
excerpts:
- description:
snippet_tags:
- Redshift.dotnetv4.GetStatementResult
Java:
versions:
- sdk_version: 2
Expand Down Expand Up @@ -356,6 +420,17 @@ redshift_Scenario:
- Delete the Amazon Redshift cluster.
category: Basics
languages:
.NET:
versions:
- sdk_version: 4
github: dotnetv4/Redshift
excerpts:
- description: Create a Redshift wrapper class to manage operations.
snippet_tags:
- Redshift.dotnetv4.RedshiftWrapper
- description: Run an interactive scenario demonstrating Redshift basics.
snippet_tags:
- Redshift.dotnetv4.RedshiftScenario
Go:
versions:
- sdk_version: 2
Expand Down
441 changes: 435 additions & 6 deletions dotnetv4/DotNetV4Examples.sln

Large diffs are not rendered by default.

61 changes: 61 additions & 0 deletions dotnetv4/Redshift/Actions/HelloRedshift.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0

using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Amazon.Redshift;
using Amazon.Redshift.Model;
using Microsoft.Extensions.Logging;

namespace RedshiftActions;

/// <summary>
/// Hello Amazon Redshift example.
/// </summary>
public class HelloRedshift
{
private static ILogger logger = null!;

// snippet-start:[Redshift.dotnetv4.Hello]
/// <summary>
/// Main method to run the Hello Amazon Redshift example.
/// </summary>
/// <param name="args">Command line arguments (not used).</param>
public static async Task Main(string[] args)
{
var redshiftClient = new AmazonRedshiftClient();

Console.WriteLine("Hello, Amazon Redshift! Let's list available clusters:");

var clusters = new List<Cluster>();

try
{
// Use pagination to retrieve all clusters.
var clustersPaginator = redshiftClient.Paginators.DescribeClusters(new DescribeClustersRequest());

await foreach (var response in clustersPaginator.Responses)
{
if (response.Clusters != null)
clusters.AddRange(response.Clusters);
}

Console.WriteLine($"{clusters.Count} cluster(s) retrieved.");

foreach (var cluster in clusters)
{
Console.WriteLine($"\t{cluster.ClusterIdentifier} (Status: {cluster.ClusterStatus})");
}
}
catch (AmazonRedshiftException ex)
{
Console.WriteLine($"Couldn't list clusters. Here's why: {ex.Message}");
}
catch (Exception ex)
{
Console.WriteLine($"An error occurred: {ex.Message}");
}
}
// snippet-end:[Redshift.dotnetv4.Hello]
}
28 changes: 28 additions & 0 deletions dotnetv4/Redshift/Actions/RedshiftActions.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<LangVersion>latest</LangVersion>
<AssemblyName>RedshiftActions</AssemblyName>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="AWSSDK.Extensions.NETCore.Setup" Version="4.0.3.13" />
<PackageReference Include="AWSSDK.Redshift" Version="4.0.4.1" />
<PackageReference Include="AWSSDK.RedshiftDataAPIService" Version="4.0.3" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="10.0.0" />
<PackageReference Include="Microsoft.Extensions.Hosting" Version="10.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="10.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="10.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="10.0.0" />
</ItemGroup>

<ItemGroup>
<Content Include="settings.*.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<DependentUpon>settings.json</DependentUpon>
</Content>
</ItemGroup>
</Project>
Loading
Loading