AWS code-library documentation change
Summary
Removed the entire 'Get started' section containing code examples for listing foundation models across multiple languages (.NET, Go, JavaScript, Python, Swift).
Security assessment
The change removes general API usage examples without any security context. There's no evidence of vulnerability fixes, security weaknesses, or incident response. The removed content demonstrated basic SDK usage for listing available models, which doesn't involve security-sensitive operations like authentication, data handling, or access control.
Diff
diff --git a/code-library/latest/ug/bedrock_code_examples.md b/code-library/latest/ug/bedrock_code_examples.md index b16edf549..e568eba7b 100644 --- a//code-library/latest/ug/bedrock_code_examples.md +++ b//code-library/latest/ug/bedrock_code_examples.md @@ -28,444 +27,0 @@ _Scenarios_ are code examples that show you how to accomplish specific tasks by -**Get started** - -The following code examples show how to get started using Amazon Bedrock. - -.NET - - -**SDK for .NET (v4)** - - -###### Note - -There's more on GitHub. Find the complete example and learn how to set up and run in the [AWS Code Examples Repository](https://github.com/awsdocs/aws-doc-sdk-examples/tree/main/dotnetv4/Bedrock#code-examples). - - - using Amazon; - using Amazon.Bedrock; - using Amazon.Bedrock.Model; - - namespace BedrockActions; - - /// <summary> - /// This example shows how to list foundation models. - /// </summary> - internal class HelloBedrock - { - /// <summary> - /// Main method to call the ListFoundationModelsAsync method. - /// </summary> - /// <param name="args"> The command line arguments. </param> - static async Task Main(string[] args) - { - // Specify a region endpoint where Amazon Bedrock is available. For a list of supported region see https://docs.aws.amazon.com/bedrock/latest/userguide/what-is-bedrock.html#bedrock-regions - AmazonBedrockClient bedrockClient = new(RegionEndpoint.USWest2); - - await ListFoundationModelsAsync(bedrockClient); - - } - - - /// <summary> - /// List foundation models. - /// </summary> - /// <param name="bedrockClient"> The Amazon Bedrock client. </param> - private static async Task ListFoundationModelsAsync(AmazonBedrockClient bedrockClient) - { - Console.WriteLine("List foundation models with no filter."); - - try - { - var response = await bedrockClient.ListFoundationModelsAsync(new ListFoundationModelsRequest() - { - }); - - if (response?.HttpStatusCode == System.Net.HttpStatusCode.OK) - { - foreach (var fm in response.ModelSummaries) - { - WriteToConsole(fm); - } - } - else - { - Console.WriteLine("Something wrong happened"); - } - } - catch (AmazonBedrockException e) - { - Console.WriteLine(e.Message); - } - } - - - /// <summary> - /// Write the foundation model summary to console. - /// </summary> - /// <param name="foundationModel"> The foundation model summary to write to console. </param> - private static void WriteToConsole(FoundationModelSummary foundationModel) - { - Console.WriteLine($"{foundationModel.ModelId}, Customization: {string.Join(", ", foundationModel.CustomizationsSupported)}, Stream: {foundationModel.ResponseStreamingSupported}, Input: {string.Join(", ", foundationModel.InputModalities)}, Output: {string.Join(", ", foundationModel.OutputModalities)}"); - } - } - - - - * For API details, see [ListFoundationModels](https://docs.aws.amazon.com/goto/DotNetSDKV4/bedrock-2023-04-20/ListFoundationModels) in _AWS SDK for .NET API Reference_. - - - - -Go - - -**SDK for Go V2** - - -###### Note - -There's more on GitHub. Find the complete example and learn how to set up and run in the [AWS Code Examples Repository](https://github.com/awsdocs/aws-doc-sdk-examples/tree/main/gov2/bedrock#code-examples). - - - package main - - import ( - "context" - "fmt" - - "github.com/aws/aws-sdk-go-v2/config" - "github.com/aws/aws-sdk-go-v2/service/bedrock" - ) - - const region = "us-east-1" - - // main uses the AWS SDK for Go (v2) to create an Amazon Bedrock client and - // list the available foundation models in your account and the chosen region. - // This example uses the default settings specified in your shared credentials - // and config files. - func main() { - ctx := context.Background() - sdkConfig, err := config.LoadDefaultConfig(ctx, config.WithRegion(region)) - if err != nil { - fmt.Println("Couldn't load default configuration. Have you set up your AWS account?") - fmt.Println(err) - return - } - bedrockClient := bedrock.NewFromConfig(sdkConfig) - result, err := bedrockClient.ListFoundationModels(ctx, &bedrock.ListFoundationModelsInput{}) - if err != nil { - fmt.Printf("Couldn't list foundation models. Here's why: %v\n", err) - return - } - if len(result.ModelSummaries) == 0 { - fmt.Println("There are no foundation models.") - } - for _, modelSummary := range result.ModelSummaries { - fmt.Println(*modelSummary.ModelId) - } - } - - - - - * For API details, see [ListFoundationModels](https://pkg.go.dev/github.com/aws/aws-sdk-go-v2/service/bedrock#Client.ListFoundationModels) in _AWS SDK for Go API Reference_. - - - - -JavaScript - - -**SDK for JavaScript (v3)** - - -###### Note - -There's more on GitHub. Find the complete example and learn how to set up and run in the [AWS Code Examples Repository](https://github.com/awsdocs/aws-doc-sdk-examples/tree/main/javascriptv3/example_code/bedrock#code-examples). - - - import { fileURLToPath } from "node:url"; - - import { - BedrockClient, - ListFoundationModelsCommand, - } from "@aws-sdk/client-bedrock"; - - const REGION = "us-east-1"; - const client = new BedrockClient({ region: REGION }); - - export const main = async () => { - const command = new ListFoundationModelsCommand({}); - - const response = await client.send(command); - const models = response.modelSummaries; - - console.log("Listing the available Bedrock foundation models:"); - - for (const model of models) { - console.log("=".repeat(42)); - console.log(` Model: ${model.modelId}`); - console.log("-".repeat(42)); - console.log(` Name: ${model.modelName}`); - console.log(` Provider: ${model.providerName}`); - console.log(` Model ARN: ${model.modelArn}`); - console.log(` Input modalities: ${model.inputModalities}`); - console.log(` Output modalities: ${model.outputModalities}`); - console.log(` Supported customizations: ${model.customizationsSupported}`); - console.log(` Supported inference types: ${model.inferenceTypesSupported}`); - console.log(` Lifecycle status: ${model.modelLifecycle.status}`); - console.log(`${"=".repeat(42)}\n`); - } - - const active = models.filter( - (m) => m.modelLifecycle.status === "ACTIVE", - ).length; - const legacy = models.filter(