Loading aws/sdk/build.gradle.kts +26 −17 Original line number Diff line number Diff line Loading @@ -53,38 +53,42 @@ val tier1Services = setOf( "apigateway", "batch", "cloudformation", "cloudwatch", "cloudwatch", "cloudwatchlogs", "cognitoidentity", "cognitoidentityprovider", "cognitosync", "config", "dynamodb", "ebs", "ec2", "ecr", "ecs", "eks", "iam", "kinesis", "kms", "lambda", "cloudwatchlogs", "medialive", "mediapackage", "polly", "qldbsession", "qldb", "rdsdata", "qldbsession", "rds", "rdsdata", "route53", "s3", "sagemaker", "sagemakera2iruntime", "sagemakeredge", "sagemakerfeaturestoreruntime", "sagemaker", "secretsmanager", "sesv2", "sns", "sqs", "ssm", "sts", "cloudwatch", "ecr", "ebs", "config", "eks" "sts" ) private val disableServices = setOf("transcribestreaming") Loading Loading @@ -122,13 +126,16 @@ val awsServices: Provider<List<AwsService>> = generateAllServices.zip(generateOn */ fun discoverServices(allServices: Boolean, generateOnly: Set<String>): List<AwsService> { val models = project.file("aws-models") val services = fileTree(models).mapNotNull { file -> val services = fileTree(models) .sortedBy { file -> file.name } .mapNotNull { file -> val model = Model.assembler().addImport(file.absolutePath).assemble().result.get() val services: List<ServiceShape> = model.shapes(ServiceShape::class.java).sorted().toList() if (services.size > 1) { throw Exception("There must be exactly one service in each aws model file") } if (services.isEmpty()) { logger.info("${file.name} has no services") null } else { val service = services[0] Loading @@ -147,11 +154,12 @@ fun discoverServices(allServices: Boolean, generateOnly: Set<String>): List<AwsS } AwsService(service = service.id.toString(), module = sdkId, modelFile = file, extraFiles = extras) } }.filterNot { disableServices.contains(it.module) } .filter { allServices || (generateOnly.isNotEmpty() && generateOnly.contains(it.module)) || (generateOnly.isEmpty() && tier1Services.contains( it.module )) }.filterNot { disableServices.contains(it.module) }.filter { val inGenerateOnly = generateOnly.isNotEmpty() && generateOnly.contains(it.module) val inTier1 = generateOnly.isEmpty() && tier1Services.contains(it.module) allServices || inGenerateOnly || inTier1 } if (generateOnly.isNotEmpty()) { val modules = services.map { it.module }.toSet() Loading Loading @@ -217,6 +225,7 @@ task("relocateServices") { description = "relocate AWS services to their final destination" doLast { awsServices.get().forEach { logger.info("Relocating ${it.module}...") copy { from("$buildDir/smithyprojections/sdk/${it.module}/rust-codegen") into(sdkOutputDir.resolve(it.module)) Loading aws/sdk/examples/cognitoidentity/Cargo.toml 0 → 100644 +14 −0 Original line number Diff line number Diff line [package] name = "cognitoidentity-code-examples" version = "0.1.0" authors = ["John DiSanti <jdisanti@amazon.com>"] edition = "2018" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] cognitoidentity = { package = "aws-sdk-cognitoidentity", path = "../../build/aws-sdk/cognitoidentity" } aws-types = { path = "../../build/aws-sdk/aws-types" } tokio = { version = "1", features = ["full"] } structopt = { version = "0.3", default-features = false } tracing-subscriber = "0.2.18" aws/sdk/examples/cognitoidentity/src/bin/list-identity-pools.rs 0 → 100644 +65 −0 Original line number Diff line number Diff line /* * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0. */ use aws_types::region::{self, ProvideRegion}; use cognitoidentity::{Client, Config, Error, Region}; use structopt::StructOpt; #[derive(Debug, StructOpt)] struct Opt { /// The default region #[structopt(short, long)] default_region: Option<String>, /// Whether to display additional information #[structopt(short, long)] verbose: bool, } /// Lists your Amazon Cognito identities /// # Arguments /// /// * `[-d DEFAULT-REGION]` - The region containing the buckets. /// If not supplied, uses the value of the **AWS_DEFAULT_REGION** environment variable. /// If the environment variable is not set, defaults to **us-west-2**. /// * `[-g]` - Whether to display buckets in all regions. /// * `[-v]` - Whether to display additional information. #[tokio::main] async fn main() -> Result<(), Error> { tracing_subscriber::fmt::init(); let Opt { default_region, verbose, } = Opt::from_args(); let region_provider = region::ChainProvider::first_try(default_region.map(Region::new)) .or_default_provider() .or_else(Region::new("us-west-2")); if verbose { println!("Cognito client version: {}", cognitoidentity::PKG_VERSION); println!("Region: {:?}", region_provider.region()); println!(); } let config = Config::builder().region(region_provider).build(); let client = Client::from_conf(config); let response = client.list_identity_pools().max_results(10).send().await?; if let Some(pools) = response.identity_pools { println!("Identity pools:"); for pool in pools { let id = pool.identity_pool_id.unwrap_or_default(); let name = pool.identity_pool_name.unwrap_or_default(); println!(" Identity pool ID: {}", id); println!(" Identity pool name: {}", name); println!(); } } println!("Next token: {:?}", response.next_token); Ok(()) } aws/sdk/examples/cognitoidentityprovider/Cargo.toml 0 → 100644 +14 −0 Original line number Diff line number Diff line [package] name = "cognitoidentityprovider-code-examples" version = "0.1.0" authors = ["John DiSanti <jdisanti@amazon.com>"] edition = "2018" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] cognitoidentityprovider = { package = "aws-sdk-cognitoidentityprovider", path = "../../build/aws-sdk/cognitoidentityprovider" } aws-types = { path = "../../build/aws-sdk/aws-types" } tokio = { version = "1", features = ["full"] } structopt = { version = "0.3", default-features = false } tracing-subscriber = "0.2.18" aws/sdk/examples/cognitoidentityprovider/src/bin/list-user-pools.rs 0 → 100644 +70 −0 Original line number Diff line number Diff line /* * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0. */ use aws_types::region::{self, ProvideRegion}; use cognitoidentityprovider::{Client, Config, Error, Region}; use structopt::StructOpt; #[derive(Debug, StructOpt)] struct Opt { /// The default region #[structopt(short, long)] default_region: Option<String>, /// Whether to display additional information #[structopt(short, long)] verbose: bool, } /// Lists your Amazon Cognito user pools /// # Arguments /// /// * `[-d DEFAULT-REGION]` - The region containing the buckets. /// If not supplied, uses the value of the **AWS_DEFAULT_REGION** environment variable. /// If the environment variable is not set, defaults to **us-west-2**. /// * `[-g]` - Whether to display buckets in all regions. /// * `[-v]` - Whether to display additional information. #[tokio::main] async fn main() -> Result<(), Error> { tracing_subscriber::fmt::init(); let Opt { default_region, verbose, } = Opt::from_args(); let region_provider = region::ChainProvider::first_try(default_region.map(Region::new)) .or_default_provider() .or_else(Region::new("us-west-2")); if verbose { println!( "Cognito client version: {}", cognitoidentityprovider::PKG_VERSION ); println!("Region: {:?}", region_provider.region()); println!(); } let config = Config::builder().region(region_provider).build(); let client = Client::from_conf(config); let response = client.list_user_pools().max_results(10).send().await?; if let Some(pools) = response.user_pools { println!("User pools:"); for pool in pools { println!(" ID: {}", pool.id.unwrap_or_default()); println!(" Name: {}", pool.name.unwrap_or_default()); println!(" Status: {:?}", pool.status); println!(" Lambda Config: {:?}", pool.lambda_config); println!(" Last modified: {:?}", pool.last_modified_date); println!(" Creation date: {:?}", pool.creation_date); println!(); } } println!("Next token: {:?}", response.next_token); Ok(()) } Loading
aws/sdk/build.gradle.kts +26 −17 Original line number Diff line number Diff line Loading @@ -53,38 +53,42 @@ val tier1Services = setOf( "apigateway", "batch", "cloudformation", "cloudwatch", "cloudwatch", "cloudwatchlogs", "cognitoidentity", "cognitoidentityprovider", "cognitosync", "config", "dynamodb", "ebs", "ec2", "ecr", "ecs", "eks", "iam", "kinesis", "kms", "lambda", "cloudwatchlogs", "medialive", "mediapackage", "polly", "qldbsession", "qldb", "rdsdata", "qldbsession", "rds", "rdsdata", "route53", "s3", "sagemaker", "sagemakera2iruntime", "sagemakeredge", "sagemakerfeaturestoreruntime", "sagemaker", "secretsmanager", "sesv2", "sns", "sqs", "ssm", "sts", "cloudwatch", "ecr", "ebs", "config", "eks" "sts" ) private val disableServices = setOf("transcribestreaming") Loading Loading @@ -122,13 +126,16 @@ val awsServices: Provider<List<AwsService>> = generateAllServices.zip(generateOn */ fun discoverServices(allServices: Boolean, generateOnly: Set<String>): List<AwsService> { val models = project.file("aws-models") val services = fileTree(models).mapNotNull { file -> val services = fileTree(models) .sortedBy { file -> file.name } .mapNotNull { file -> val model = Model.assembler().addImport(file.absolutePath).assemble().result.get() val services: List<ServiceShape> = model.shapes(ServiceShape::class.java).sorted().toList() if (services.size > 1) { throw Exception("There must be exactly one service in each aws model file") } if (services.isEmpty()) { logger.info("${file.name} has no services") null } else { val service = services[0] Loading @@ -147,11 +154,12 @@ fun discoverServices(allServices: Boolean, generateOnly: Set<String>): List<AwsS } AwsService(service = service.id.toString(), module = sdkId, modelFile = file, extraFiles = extras) } }.filterNot { disableServices.contains(it.module) } .filter { allServices || (generateOnly.isNotEmpty() && generateOnly.contains(it.module)) || (generateOnly.isEmpty() && tier1Services.contains( it.module )) }.filterNot { disableServices.contains(it.module) }.filter { val inGenerateOnly = generateOnly.isNotEmpty() && generateOnly.contains(it.module) val inTier1 = generateOnly.isEmpty() && tier1Services.contains(it.module) allServices || inGenerateOnly || inTier1 } if (generateOnly.isNotEmpty()) { val modules = services.map { it.module }.toSet() Loading Loading @@ -217,6 +225,7 @@ task("relocateServices") { description = "relocate AWS services to their final destination" doLast { awsServices.get().forEach { logger.info("Relocating ${it.module}...") copy { from("$buildDir/smithyprojections/sdk/${it.module}/rust-codegen") into(sdkOutputDir.resolve(it.module)) Loading
aws/sdk/examples/cognitoidentity/Cargo.toml 0 → 100644 +14 −0 Original line number Diff line number Diff line [package] name = "cognitoidentity-code-examples" version = "0.1.0" authors = ["John DiSanti <jdisanti@amazon.com>"] edition = "2018" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] cognitoidentity = { package = "aws-sdk-cognitoidentity", path = "../../build/aws-sdk/cognitoidentity" } aws-types = { path = "../../build/aws-sdk/aws-types" } tokio = { version = "1", features = ["full"] } structopt = { version = "0.3", default-features = false } tracing-subscriber = "0.2.18"
aws/sdk/examples/cognitoidentity/src/bin/list-identity-pools.rs 0 → 100644 +65 −0 Original line number Diff line number Diff line /* * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0. */ use aws_types::region::{self, ProvideRegion}; use cognitoidentity::{Client, Config, Error, Region}; use structopt::StructOpt; #[derive(Debug, StructOpt)] struct Opt { /// The default region #[structopt(short, long)] default_region: Option<String>, /// Whether to display additional information #[structopt(short, long)] verbose: bool, } /// Lists your Amazon Cognito identities /// # Arguments /// /// * `[-d DEFAULT-REGION]` - The region containing the buckets. /// If not supplied, uses the value of the **AWS_DEFAULT_REGION** environment variable. /// If the environment variable is not set, defaults to **us-west-2**. /// * `[-g]` - Whether to display buckets in all regions. /// * `[-v]` - Whether to display additional information. #[tokio::main] async fn main() -> Result<(), Error> { tracing_subscriber::fmt::init(); let Opt { default_region, verbose, } = Opt::from_args(); let region_provider = region::ChainProvider::first_try(default_region.map(Region::new)) .or_default_provider() .or_else(Region::new("us-west-2")); if verbose { println!("Cognito client version: {}", cognitoidentity::PKG_VERSION); println!("Region: {:?}", region_provider.region()); println!(); } let config = Config::builder().region(region_provider).build(); let client = Client::from_conf(config); let response = client.list_identity_pools().max_results(10).send().await?; if let Some(pools) = response.identity_pools { println!("Identity pools:"); for pool in pools { let id = pool.identity_pool_id.unwrap_or_default(); let name = pool.identity_pool_name.unwrap_or_default(); println!(" Identity pool ID: {}", id); println!(" Identity pool name: {}", name); println!(); } } println!("Next token: {:?}", response.next_token); Ok(()) }
aws/sdk/examples/cognitoidentityprovider/Cargo.toml 0 → 100644 +14 −0 Original line number Diff line number Diff line [package] name = "cognitoidentityprovider-code-examples" version = "0.1.0" authors = ["John DiSanti <jdisanti@amazon.com>"] edition = "2018" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] cognitoidentityprovider = { package = "aws-sdk-cognitoidentityprovider", path = "../../build/aws-sdk/cognitoidentityprovider" } aws-types = { path = "../../build/aws-sdk/aws-types" } tokio = { version = "1", features = ["full"] } structopt = { version = "0.3", default-features = false } tracing-subscriber = "0.2.18"
aws/sdk/examples/cognitoidentityprovider/src/bin/list-user-pools.rs 0 → 100644 +70 −0 Original line number Diff line number Diff line /* * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0. */ use aws_types::region::{self, ProvideRegion}; use cognitoidentityprovider::{Client, Config, Error, Region}; use structopt::StructOpt; #[derive(Debug, StructOpt)] struct Opt { /// The default region #[structopt(short, long)] default_region: Option<String>, /// Whether to display additional information #[structopt(short, long)] verbose: bool, } /// Lists your Amazon Cognito user pools /// # Arguments /// /// * `[-d DEFAULT-REGION]` - The region containing the buckets. /// If not supplied, uses the value of the **AWS_DEFAULT_REGION** environment variable. /// If the environment variable is not set, defaults to **us-west-2**. /// * `[-g]` - Whether to display buckets in all regions. /// * `[-v]` - Whether to display additional information. #[tokio::main] async fn main() -> Result<(), Error> { tracing_subscriber::fmt::init(); let Opt { default_region, verbose, } = Opt::from_args(); let region_provider = region::ChainProvider::first_try(default_region.map(Region::new)) .or_default_provider() .or_else(Region::new("us-west-2")); if verbose { println!( "Cognito client version: {}", cognitoidentityprovider::PKG_VERSION ); println!("Region: {:?}", region_provider.region()); println!(); } let config = Config::builder().region(region_provider).build(); let client = Client::from_conf(config); let response = client.list_user_pools().max_results(10).send().await?; if let Some(pools) = response.user_pools { println!("User pools:"); for pool in pools { println!(" ID: {}", pool.id.unwrap_or_default()); println!(" Name: {}", pool.name.unwrap_or_default()); println!(" Status: {:?}", pool.status); println!(" Lambda Config: {:?}", pool.lambda_config); println!(" Last modified: {:?}", pool.last_modified_date); println!(" Creation date: {:?}", pool.creation_date); println!(); } } println!("Next token: {:?}", response.next_token); Ok(()) }