Unverified Commit be8200c9 authored by Russell Cohen's avatar Russell Cohen Committed by GitHub
Browse files

Add IAM (#458)

* Add iam support (blocked on endpoints.json resolution)

* Override with static endpoint

* Add iam model

* Rename package
parent a6b129c9
Loading
Loading
Loading
Loading
+13202 −0

File added.

Preview size limit exceeded, changes collapsed.

+13 −0
Original line number Diff line number Diff line
[package]
name = "iam"
version = "0.1.0"
authors = ["Russell Cohen <rcoh@amazon.com>"]
edition = "2018"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
iam = { package = "aws-sdk-iam", path = "../../build/aws-sdk/iam" }
tokio = { version = "1", features = ["full"] }
http = "0.2.4"
tracing-subscriber = "0.2.18"
+24 −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 http::Uri;
use iam::Endpoint;

#[tokio::main]
async fn main() -> Result<(), iam::Error> {
    tracing_subscriber::fmt::init();
    let ep = Endpoint::immutable(Uri::from_static("https://iam.amazonaws.com"));
    let conf = iam::Config::builder().endpoint_resolver(ep).build();
    let client = iam::Client::from_conf(conf);
    let rsp = client.list_policies().send().await?;
    for policy in rsp.policies.unwrap_or_default() {
        println!(
            "arn: {}; description: {}",
            policy.arn.unwrap(),
            policy.description.unwrap_or_default()
        );
    }
    Ok(())
}
+2 −1
Original line number Diff line number Diff line
@@ -44,6 +44,7 @@ import software.amazon.smithy.rust.codegen.smithy.traits.OutputBodyTrait
import software.amazon.smithy.rust.codegen.smithy.traits.SyntheticInputTrait
import software.amazon.smithy.rust.codegen.smithy.traits.SyntheticOutputTrait
import software.amazon.smithy.rust.codegen.util.hasTrait
import software.amazon.smithy.rust.codegen.util.toPascalCase
import software.amazon.smithy.rust.codegen.util.toSnakeCase
import software.amazon.smithy.utils.StringUtils
import kotlin.reflect.KClass
@@ -182,7 +183,7 @@ class SymbolVisitor(
    override fun doubleShape(shape: DoubleShape): Symbol = simpleShape(shape)
    override fun stringShape(shape: StringShape): Symbol {
        return if (shape.hasTrait<EnumTrait>()) {
            symbolBuilder(shape, RustType.Opaque(shape.contextName())).locatedIn(Models).build()
            symbolBuilder(shape, RustType.Opaque(shape.contextName().toPascalCase())).locatedIn(Models).build()
        } else {
            simpleShape(shape)
        }