Skip to content

Commit

Permalink
Writeme not finding line numbers
Browse files Browse the repository at this point in the history
Fixed github metadata field
  • Loading branch information
DavidSouther committed Sep 29, 2023
1 parent b8d7daf commit 36024f9
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 47 deletions.
38 changes: 19 additions & 19 deletions .doc_gen/metadata/auto-scaling_metadata.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ auto-scaling_Hello:
Rust:
versions:
- sdk_version: 1
github: rust_dev_preview/examples/autoscaling
github: rust_dev_preview/examples/auto-scaling
excerpts:
- description:
snippet_tags:
Expand Down Expand Up @@ -101,7 +101,7 @@ auto-scaling_CreateAutoScalingGroup:
Rust:
versions:
- sdk_version: 1
github: rust_dev_preview/examples/autoscaling
github: rust_dev_preview/examples/auto-scaling
excerpts:
- description:
snippet_tags:
Expand Down Expand Up @@ -171,7 +171,7 @@ auto-scaling_DeleteAutoScalingGroup:
Rust:
versions:
- sdk_version: 1
github: rust_dev_preview/examples/autoscaling
github: rust_dev_preview/examples/auto-scaling
excerpts:
- description:
snippet_tags:
Expand Down Expand Up @@ -238,7 +238,7 @@ auto-scaling_DescribeAutoScalingGroups:
Rust:
versions:
- sdk_version: 1
github: rust_dev_preview/examples/autoscaling
github: rust_dev_preview/examples/auto-scaling
excerpts:
- description:
snippet_tags:
Expand Down Expand Up @@ -305,7 +305,7 @@ auto-scaling_UpdateAutoScalingGroup:
Rust:
versions:
- sdk_version: 1
github: rust_dev_preview/examples/autoscaling
github: rust_dev_preview/examples/auto-scaling
excerpts:
- description:
snippet_tags:
Expand Down Expand Up @@ -386,12 +386,12 @@ auto-scaling_TerminateInstanceInAutoScalingGroup:
Rust:
versions:
- sdk_version: 1
github: rust_dev_preview/examples/autoscaling
github: rust_dev_preview/examples/auto-scaling
excerpts:
- description:
snippet_tags:
- rust.autoscaling.scenario.terminate_some_instance
- rust.autoscaling.scenario.get_group
- rust.auto-scaling.scenario.terminate_some_instance
- rust.auto-scaling.scenario.get_group
services:
auto-scaling: {TerminateInstanceInAutoScalingGroup}
auto-scaling_SetDesiredCapacity:
Expand Down Expand Up @@ -457,11 +457,11 @@ auto-scaling_SetDesiredCapacity:
Rust:
versions:
- sdk_version: 1
github: rust_dev_preview/examples/autoscaling
github: rust_dev_preview/examples/auto-scaling
excerpts:
- description:
snippet_tags:
- rust.autoscaling.scenario.scale_desired_capacity
- rust.auto-scaling.scenario.scale_desired_capacity
services:
auto-scaling: {SetDesiredCapacity}
auto-scaling_DescribeAutoScalingInstances:
Expand Down Expand Up @@ -527,11 +527,11 @@ auto-scaling_DescribeAutoScalingInstances:
Rust:
versions:
- sdk_version: 1
github: rust_dev_preview/examples/autoscaling
github: rust_dev_preview/examples/auto-scaling
excerpts:
- description:
snippet_tags:
- rust.autoscaling.scenario.list_instances
- rust.auto-scaling.scenario.list_instances
services:
auto-scaling: {DescribeAutoScalingInstances}
auto-scaling_DescribeScalingActivities:
Expand Down Expand Up @@ -597,11 +597,11 @@ auto-scaling_DescribeScalingActivities:
Rust:
versions:
- sdk_version: 1
github: rust_dev_preview/examples/autoscaling
github: rust_dev_preview/examples/auto-scaling
excerpts:
- description:
snippet_tags:
- rust.autoscaling.scenario.describe_scenario
- rust.auto-scaling.scenario.describe_scenario
services:
auto-scaling: {DescribeScalingActivities}
auto-scaling_EnableMetricsCollection:
Expand Down Expand Up @@ -667,11 +667,11 @@ auto-scaling_EnableMetricsCollection:
Rust:
versions:
- sdk_version: 1
github: rust_dev_preview/examples/autoscaling
github: rust_dev_preview/examples/auto-scaling
excerpts:
- description:
snippet_tags:
- rust.autoscaling.scenario.enable_metrics_collection
- rust.auto-scaling.scenario.enable_metrics_collection
services:
auto-scaling: {EnableMetricsCollection}
auto-scaling_DisableMetricsCollection:
Expand Down Expand Up @@ -737,11 +737,11 @@ auto-scaling_DisableMetricsCollection:
Rust:
versions:
- sdk_version: 1
github: rust_dev_preview/examples/autoscaling
github: rust_dev_preview/examples/auto-scaling
excerpts:
- description:
snippet_tags:
- rust.autoscaling.scenario.disable_metrics_collection
- rust.auto-scaling.scenario.disable_metrics_collection
services:
auto-scaling: {DisableMetricsCollection}
auto-scaling_AttachLoadBalancerTargetGroups:
Expand Down Expand Up @@ -845,7 +845,7 @@ auto-scaling_Scenario_GroupsAndInstances:
Rust:
versions:
- sdk_version: 1
github: rust_dev_preview/examples/autoscaling
github: rust_dev_preview/examples/auto-scaling
excerpts:
- description:
snippet_files:
Expand Down
28 changes: 14 additions & 14 deletions rust_dev_preview/examples/auto-scaling/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!--Generated by WRITEME on 2023-09-08 16:28:06.995125 (UTC)-->
<!--Generated by WRITEME on 2023-09-20 20:49:21.334873 (UTC)-->
# Auto Scaling code examples for the SDK for Rust

## Overview
Expand All @@ -12,7 +12,7 @@ Shows how to use the AWS SDK for Rust to work with Amazon EC2 Auto Scaling.

## ⚠ Important

* Running this code might result in charges to your AWS account.
* Running this code might result in charges to your AWS account. For more details, see [AWS Pricing](https://aws.amazon.com/pricing/?aws-products-pricing.sort-by=item.additionalFields.productNameLowercase&aws-products-pricing.sort-order=asc&awsf.Free%20Tier%20Type=*all&awsf.tech-category=*all) and [Free Tier](https://aws.amazon.com/free/?all-free-tier.sort-by=item.additionalFields.SortRank&all-free-tier.sort-order=asc&awsf.Free%20Tier%20Types=*all&awsf.Free%20Tier%20Categories=*all).
* Running the tests might result in charges to your AWS account.
* We recommend that you grant your code least privilege. At most, grant only the minimum permissions required to perform the task. For more information, see [Grant least privilege](https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html#grant-least-privilege).
* This code is not tested in every AWS Region. For more information, see [AWS Regional Services](https://aws.amazon.com/about-aws/global-infrastructure/regional-product-services).
Expand All @@ -33,29 +33,29 @@ For prerequisites, see the [README](../../README.md#Prerequisites) in the `rust_

### Get started

* [Hello Auto Scaling](None) (`DescribeAutoScalingGroups`)
* [Hello Auto Scaling](src/bin/list-autoscaling-groups.rs#L24) (`DescribeAutoScalingGroups`)

### Single actions

Code excerpts that show you how to call individual service functions.

* [Create a group](None) (`CreateAutoScalingGroup`)
* [Delete a group](None) (`DeleteAutoScalingGroup`)
* [Disable metrics collection for a group](None) (`DisableMetricsCollection`)
* [Enable metrics collection for a group](None) (`EnableMetricsCollection`)
* [Get information about groups](None) (`DescribeAutoScalingGroups`)
* [Get information about instances](None) (`DescribeAutoScalingInstances`)
* [Get information about scaling activities](None) (`DescribeScalingActivities`)
* [Set the desired capacity of a group](None) (`SetDesiredCapacity`)
* [Terminate an instance in a group](None) (`TerminateInstanceInAutoScalingGroup`)
* [Update a group](None) (`UpdateAutoScalingGroup`)
* [Create a group](src/bin/create-autoscaling-group.rs#L32) (`CreateAutoScalingGroup`)
* [Delete a group](src/bin/delete-autoscaling-group.rs#L32) (`DeleteAutoScalingGroup`)
* [Disable metrics collection for a group](src/scenario.rs#L608) (`DisableMetricsCollection`)
* [Enable metrics collection for a group](src/scenario.rs#L288) (`EnableMetricsCollection`)
* [Get information about groups](src/bin/list-autoscaling-groups.rs#L24) (`DescribeAutoScalingGroups`)
* [Get information about instances](src/scenario.rs#L529) (`DescribeAutoScalingInstances`)
* [Get information about scaling activities](src/scenario.rs#L393) (`DescribeScalingActivities`)
* [Set the desired capacity of a group](src/scenario.rs#L586) (`SetDesiredCapacity`)
* [Terminate an instance in a group](src/scenario.rs#L645) (`TerminateInstanceInAutoScalingGroup`)
* [Update a group](src/bin/update-autoscaling-group.rs#L32) (`UpdateAutoScalingGroup`)

### Scenarios

Code examples that show you how to accomplish a specific task by calling multiple
functions within the same service.

* [Manage groups and instances](rust_dev_preview/examples/auto-scaling/Cargo.toml)
* [Manage groups and instances](README.md)

## Run the examples

Expand Down
28 changes: 14 additions & 14 deletions rust_dev_preview/examples/auto-scaling/src/scenario.rs
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ impl AutoScalingScenario {
launch_template_arn,
};

// snippet-start:[rust.autoscaling.scenario.enable_metrics_collection]
// snippet-start:[rust.auto-scaling.scenario.enable_metrics_collection]
let enable_metrics_collection = autoscaling
.enable_metrics_collection()
.auto_scaling_group_name(auto_scaling_group_name.as_str())
Expand All @@ -299,7 +299,7 @@ impl AutoScalingScenario {
]))
.send()
.await;
// snippet-end:[rust.autoscaling.scenario.enable_metrics_collection]
// snippet-end:[rust.auto-scaling.scenario.enable_metrics_collection]

match enable_metrics_collection {
Ok(_) => Ok(scenario),
Expand Down Expand Up @@ -390,7 +390,7 @@ impl AutoScalingScenario {
}
}

// snippet-start:[rust.autoscaling.scenario.describe_scenario]
// snippet-start:[rust.auto-scaling.scenario.describe_scenario]
pub async fn describe_scenario(&self) -> AutoScalingScenarioDescription {
let group = self
.autoscaling
Expand Down Expand Up @@ -446,9 +446,9 @@ impl AutoScalingScenario {
activities,
}
}
// snippet-end:[rust.autoscaling.scenario.describe_scenario]
// snippet-end:[rust.auto-scaling.scenario.describe_scenario]

// snippet-start:[rust.autoscaling.scenario.get_group]
// snippet-start:[rust.auto-scaling.scenario.get_group]
async fn get_group(&self) -> Result<AutoScalingGroup, ScenarioError> {
let describe_auto_scaling_groups = self
.autoscaling
Expand Down Expand Up @@ -483,7 +483,7 @@ impl AutoScalingScenario {

Ok(auto_scaling_group.unwrap().clone())
}
// snippet-end:[rust.autoscaling.scenario.get_group]
// snippet-end:[rust.auto-scaling.scenario.get_group]

pub async fn wait_for_no_scaling(&self) -> Result<(), ScenarioError> {
let waiter = Waiter::new();
Expand Down Expand Up @@ -526,7 +526,7 @@ impl AutoScalingScenario {
Ok(())
}

// snippet-start:[rust.autoscaling.scenario.list_instances]
// snippet-start:[rust.auto-scaling.scenario.list_instances]
pub async fn list_instances(&self) -> Result<Vec<String>, ScenarioError> {
// The direct way to list instances is by using DescribeAutoScalingGroup's instances property. However, this returns a Vec<Instance>, as opposed to a Vec<AutoScalingInstanceDetails>.
// Ok(self.get_group().await?.instances.unwrap_or_default().map(|i| i.instance_id.clone().unwrap_or_default()).filter(|id| !id.is_empty()).collect())
Expand All @@ -546,7 +546,7 @@ impl AutoScalingScenario {
.collect::<Vec<String>>()
.await)
}
// snippet-end:[rust.autoscaling.scenario.list_instances]
// snippet-end:[rust.auto-scaling.scenario.list_instances]

pub async fn scale_min_size(&self, size: i32) -> Result<(), ScenarioError> {
let update_group = self
Expand Down Expand Up @@ -583,7 +583,7 @@ impl AutoScalingScenario {
Ok(())
}

// snippet-start:[rust.autoscaling.scenario.scale_desired_capacity]
// snippet-start:[rust.auto-scaling.scenario.scale_desired_capacity]
pub async fn scale_desired_capacity(&self, capacity: i32) -> Result<(), ScenarioError> {
// 7. SetDesiredCapacity: set desired capacity to 2.
// Wait for a second instance to launch.
Expand All @@ -602,18 +602,18 @@ impl AutoScalingScenario {
}
Ok(())
}
// snippet-end:[rust.autoscaling.scenario.scale_desired_capacity]
// snippet-end:[rust.auto-scaling.scenario.scale_desired_capacity]

pub async fn scale_group_to_zero(&self) -> Result<(), ScenarioError> {
// snippet-start:[rust.autoscaling.scenario.disable_metrics_collection]
// snippet-start:[rust.auto-scaling.scenario.disable_metrics_collection]
// If this fails it's fine, just means there are extra cloudwatch metrics events for the scale-down.
let _ = self
.autoscaling
.disable_metrics_collection()
.auto_scaling_group_name(self.auto_scaling_group_name.clone())
.send()
.await;
// snippet-end:[rust.autoscaling.scenario.disable_metrics_collection]
// snippet-end:[rust.auto-scaling.scenario.disable_metrics_collection]

// 12. DeleteAutoScalingGroup (to delete the group you must stop all instances):
// UpdateAutoScalingGroup with MinSize=0
Expand Down Expand Up @@ -642,7 +642,7 @@ impl AutoScalingScenario {
Ok(())
}

// snippet-start:[rust.autoscaling.scenario.terminate_some_instance]
// snippet-start:[rust.auto-scaling.scenario.terminate_some_instance]
pub async fn terminate_some_instance(&self) -> Result<(), ScenarioError> {
// Retrieve a list of instances in the auto scaling group.
let instances = self.get_group().await?.instances.unwrap_or_default();
Expand All @@ -667,7 +667,7 @@ impl AutoScalingScenario {
Err(ScenarioError::with("There was no instance to terminate"))
}
}
// snippet-end:[rust.autoscaling.scenario.terminate_some_instance]
// snippet-end:[rust.auto-scaling.scenario.terminate_some_instance]
}

fn count_group_instances(group: &AutoScalingGroup) -> usize {
Expand Down

0 comments on commit 36024f9

Please sign in to comment.