Unverified Commit 0e582882 authored by John DiSanti's avatar John DiSanti Committed by GitHub
Browse files

Add SSM model and Get/PutParameter examples (#393)

* Add SSM model

* Add SSM PutParameter example

* Fix clippy errors on SSM generated code

* CR feedback

* Fix rustfmt
parent 9e05d1f0
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
[package]
name = "ssm-put-parameter"
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]
ssm = { package = "aws-sdk-ssm", path = "../../build/aws-sdk/ssm" }
tokio = { version = "1", features = ["full"] }
aws-types = { path = "../../build/aws-sdk/aws-types" }
+43 −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 std::process;

use ssm::model::ParameterType;
use ssm::{Client, Config, Region};

use aws_types::region::{self, ProvideRegion};

#[tokio::main]
async fn main() {
    // Determine the region from environment variables or default to us-east-1
    let region = region::default_provider()
        .region()
        .unwrap_or_else(|| Region::new("us-east-1"));

    // Construct a client
    let config = Config::builder().region(region).build();
    let client = Client::from_conf(config);

    // Put an SSM application parameter named `test_parameter_name`
    match client
        .put_parameter()
        .overwrite(true)
        .r#type(ParameterType::String)
        .name("test_parameter_name")
        .value("some_value")
        .description("some description")
        .send()
        .await
    {
        Ok(response) => {
            println!("Success! Parameter now has version: {}", response.version)
        }
        Err(error) => {
            println!("Got an error putting the parameter: {}", error);
            process::exit(1);
        }
    }
}
+25418 −0

File added.

Preview size limit exceeded, changes collapsed.

+3 −1
Original line number Diff line number Diff line
@@ -16,7 +16,9 @@ val ClippyAllowLints = listOf(
    // Currently, we don't recase acronyms in models, eg. SSEVersion
    "upper_case_acronyms",
    // Large errors trigger this warning, we are unlikely to optimize this case currently
    "large_enum_variant"
    "large_enum_variant",
    // Some models have members with `is` in the name, which leads to builder functions with the wrong self convention
    "wrong_self_convention",
)

class AllowClippyLints() : LibRsCustomization() {