Skip to content

Commit

Permalink
feat(client-amp): Add support for sending metrics to cross account an…
Browse files Browse the repository at this point in the history
…d CMCK AMP workspaces through RoleConfiguration on Create/Update Scraper.
  • Loading branch information
awstools committed Jan 31, 2025
1 parent d98e8ff commit cc1cbaf
Show file tree
Hide file tree
Showing 7 changed files with 109 additions and 3 deletions.
4 changes: 4 additions & 0 deletions clients/client-amp/src/commands/CreateScraperCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,10 @@ export interface CreateScraperCommandOutput extends CreateScraperResponse, __Met
* workspaceArn: "STRING_VALUE", // required
* },
* },
* roleConfiguration: { // RoleConfiguration
* sourceRoleArn: "STRING_VALUE",
* targetRoleArn: "STRING_VALUE",
* },
* clientToken: "STRING_VALUE",
* tags: { // TagMap
* "<keys>": "STRING_VALUE",
Expand Down
4 changes: 4 additions & 0 deletions clients/client-amp/src/commands/DescribeScraperCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,10 @@ export interface DescribeScraperCommandOutput extends DescribeScraperResponse, _
* // workspaceArn: "STRING_VALUE", // required
* // },
* // },
* // roleConfiguration: { // RoleConfiguration
* // sourceRoleArn: "STRING_VALUE",
* // targetRoleArn: "STRING_VALUE",
* // },
* // },
* // };
*
Expand Down
4 changes: 4 additions & 0 deletions clients/client-amp/src/commands/ListScrapersCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,10 @@ export interface ListScrapersCommandOutput extends ListScrapersResponse, __Metad
* // workspaceArn: "STRING_VALUE", // required
* // },
* // },
* // roleConfiguration: { // RoleConfiguration
* // sourceRoleArn: "STRING_VALUE",
* // targetRoleArn: "STRING_VALUE",
* // },
* // },
* // ],
* // nextToken: "STRING_VALUE",
Expand Down
4 changes: 4 additions & 0 deletions clients/client-amp/src/commands/UpdateScraperCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ export interface UpdateScraperCommandOutput extends UpdateScraperResponse, __Met
* workspaceArn: "STRING_VALUE", // required
* },
* },
* roleConfiguration: { // RoleConfiguration
* sourceRoleArn: "STRING_VALUE",
* targetRoleArn: "STRING_VALUE",
* },
* clientToken: "STRING_VALUE",
* };
* const command = new UpdateScraperCommand(input);
Expand Down
42 changes: 42 additions & 0 deletions clients/client-amp/src/models/models_0.ts
Original file line number Diff line number Diff line change
Expand Up @@ -580,6 +580,24 @@ export namespace Destination {
};
}

/**
* <p>To configure roles that allows users to write to an Amazon Managed Service for Prometheus workspace in a different account.</p>
* @public
*/
export interface RoleConfiguration {
/**
* <p>A ARN identifying the source role configuration.</p>
* @public
*/
sourceRoleArn?: string | undefined;

/**
* <p>A ARN identifying the target role configuration.</p>
* @public
*/
targetRoleArn?: string | undefined;
}

/**
* <p>A scrape configuration for a scraper, base 64 encoded. For more information, see <a href="https://docs.aws.amazon.com/prometheus/latest/userguide/AMP-collector-how-to.html#AMP-collector-configuration">Scraper configuration</a> in the <i>Amazon Managed Service for Prometheus User
* Guide</i>.</p>
Expand Down Expand Up @@ -713,6 +731,12 @@ export interface CreateScraperRequest {
*/
destination: Destination | undefined;

/**
* <p>The scraper role configuration for the workspace.</p>
* @public
*/
roleConfiguration?: RoleConfiguration | undefined;

/**
* <p>(Optional) A unique, case-sensitive identifier that you can provide to ensure the
* idempotency of the request.</p>
Expand Down Expand Up @@ -939,6 +963,12 @@ export interface ScraperDescription {
* @public
*/
destination: Destination | undefined;

/**
* <p>To configure roles that allows users to write to an Amazon Managed Service for Prometheus workspace in a different account.</p>
* @public
*/
roleConfiguration?: RoleConfiguration | undefined;
}

/**
Expand Down Expand Up @@ -1066,6 +1096,12 @@ export interface ScraperSummary {
* @public
*/
destination: Destination | undefined;

/**
* <p>To configure roles that allows users to write to an Amazon Managed Service for Prometheus workspace in a different account.</p>
* @public
*/
roleConfiguration?: RoleConfiguration | undefined;
}

/**
Expand Down Expand Up @@ -1122,6 +1158,12 @@ export interface UpdateScraperRequest {
*/
destination?: Destination | undefined;

/**
* <p>The scraper role configuration for the workspace.</p>
* @public
*/
roleConfiguration?: RoleConfiguration | undefined;

/**
* <p>A unique identifier that you can provide to ensure the idempotency of the request.
* Case-sensitive.</p>
Expand Down
9 changes: 9 additions & 0 deletions clients/client-amp/src/protocols/Aws_restJson1.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ import {
InternalServerException,
LoggingConfigurationMetadata,
ResourceNotFoundException,
RoleConfiguration,
RuleGroupsNamespaceDescription,
RuleGroupsNamespaceSummary,
ScrapeConfiguration,
Expand Down Expand Up @@ -222,6 +223,7 @@ export const se_CreateScraperCommand = async (
alias: [],
clientToken: [true, (_) => _ ?? generateIdempotencyToken()],
destination: (_) => _json(_),
roleConfiguration: (_) => _json(_),
scrapeConfiguration: (_) => se_ScrapeConfiguration(_, context),
source: (_) => _json(_),
tags: (_) => _json(_),
Expand Down Expand Up @@ -659,6 +661,7 @@ export const se_UpdateScraperCommand = async (
alias: [],
clientToken: [true, (_) => _ ?? generateIdempotencyToken()],
destination: (_) => _json(_),
roleConfiguration: (_) => _json(_),
scrapeConfiguration: (_) => se_ScrapeConfiguration(_, context),
})
);
Expand Down Expand Up @@ -1444,6 +1447,8 @@ const de_ValidationExceptionRes = async (parsedOutput: any, context: __SerdeCont

// se_EksConfiguration omitted.

// se_RoleConfiguration omitted.

/**
* serializeAws_restJson1ScrapeConfiguration
*/
Expand Down Expand Up @@ -1500,6 +1505,8 @@ const de_LoggingConfigurationMetadata = (output: any, context: __SerdeContext):

// de_LoggingConfigurationStatus omitted.

// de_RoleConfiguration omitted.

/**
* deserializeAws_restJson1RuleGroupsNamespaceDescription
*/
Expand Down Expand Up @@ -1566,6 +1573,7 @@ const de_ScraperDescription = (output: any, context: __SerdeContext): ScraperDes
destination: (_: any) => _json(__expectUnion(_)),
lastModifiedAt: (_: any) => __expectNonNull(__parseEpochTimestamp(__expectNumber(_))),
roleArn: __expectString,
roleConfiguration: _json,
scrapeConfiguration: (_: any) => de_ScrapeConfiguration(__expectUnion(_), context),
scraperId: __expectString,
source: (_: any) => _json(__expectUnion(_)),
Expand All @@ -1588,6 +1596,7 @@ const de_ScraperSummary = (output: any, context: __SerdeContext): ScraperSummary
destination: (_: any) => _json(__expectUnion(_)),
lastModifiedAt: (_: any) => __expectNonNull(__parseEpochTimestamp(__expectNumber(_))),
roleArn: __expectString,
roleConfiguration: _json,
scraperId: __expectString,
source: (_: any) => _json(__expectUnion(_)),
status: _json,
Expand Down
45 changes: 42 additions & 3 deletions codegen/sdk-codegen/aws-models/amp.json
Original file line number Diff line number Diff line change
Expand Up @@ -1398,6 +1398,12 @@
"smithy.api#required": {}
}
},
"roleConfiguration": {
"target": "com.amazonaws.amp#RoleConfiguration",
"traits": {
"smithy.api#documentation": "<p>The scraper role configuration for the workspace.</p>"
}
},
"clientToken": {
"target": "com.amazonaws.amp#IdempotencyToken",
"traits": {
Expand Down Expand Up @@ -2544,7 +2550,8 @@
"aws.api#arnReference": {
"type": "AWS::IAM::Role"
},
"smithy.api#documentation": "<p>An ARN identifying an IAM role used by the scraper.</p>"
"smithy.api#documentation": "<p>An ARN identifying an IAM role used by the scraper.</p>",
"smithy.api#pattern": "^arn:aws[-a-z]*:iam::[0-9]{12}:role/.+$"
}
},
"com.amazonaws.amp#IdempotencyToken": {
Expand Down Expand Up @@ -2594,7 +2601,7 @@
"min": 20,
"max": 2048
},
"smithy.api#pattern": "^arn:aws:kms:[a-z0-9\\-]+:\\d+:key/[a-f0-9\\-]+$"
"smithy.api#pattern": "^arn:aws[-a-z]*:kms:[-a-z0-9]+:[0-9]{12}:key/[-a-f0-9]+$"
}
},
"com.amazonaws.amp#ListRuleGroupsNamespaces": {
Expand Down Expand Up @@ -3055,7 +3062,7 @@
"aws.api#arnReference": {
"type": "AWS::Logs::LogGroup"
},
"smithy.api#pattern": "^arn:aws[a-z0-9-]*:logs:[a-z0-9-]+:\\d{12}:log-group:[A-Za-z0-9\\.\\-\\_\\#/]{1,512}\\:\\*$"
"smithy.api#pattern": "^arn:aws[-a-z]*:logs:[-a-z0-9]+:[0-9]{12}:log-group:[A-Za-z0-9\\.\\-\\_\\#/]{1,512}\\:\\*$"
}
},
"com.amazonaws.amp#LoggingConfiguration": {
Expand Down Expand Up @@ -3426,6 +3433,26 @@
"smithy.api#httpError": 404
}
},
"com.amazonaws.amp#RoleConfiguration": {
"type": "structure",
"members": {
"sourceRoleArn": {
"target": "com.amazonaws.amp#IamRoleArn",
"traits": {
"smithy.api#documentation": "<p>A ARN identifying the source role configuration.</p>"
}
},
"targetRoleArn": {
"target": "com.amazonaws.amp#IamRoleArn",
"traits": {
"smithy.api#documentation": "<p>A ARN identifying the target role configuration.</p>"
}
}
},
"traits": {
"smithy.api#documentation": "<p>To configure roles that allows users to write to an Amazon Managed Service for Prometheus workspace in a different account.</p>"
}
},
"com.amazonaws.amp#RuleGroupsNamespace": {
"type": "resource",
"identifiers": {
Expand Down Expand Up @@ -3807,6 +3834,9 @@
"smithy.api#documentation": "<p>The Amazon Managed Service for Prometheus workspace the scraper sends metrics to.</p>",
"smithy.api#required": {}
}
},
"roleConfiguration": {
"target": "com.amazonaws.amp#RoleConfiguration"
}
},
"traits": {
Expand Down Expand Up @@ -3985,6 +4015,9 @@
"smithy.api#documentation": "<p>The Amazon Managed Service for Prometheus workspace the scraper sends metrics to.</p>",
"smithy.api#required": {}
}
},
"roleConfiguration": {
"target": "com.amazonaws.amp#RoleConfiguration"
}
},
"traits": {
Expand Down Expand Up @@ -4500,6 +4533,12 @@
"smithy.api#documentation": "<p>The new Amazon Managed Service for Prometheus workspace to send metrics to.</p>"
}
},
"roleConfiguration": {
"target": "com.amazonaws.amp#RoleConfiguration",
"traits": {
"smithy.api#documentation": "<p>The scraper role configuration for the workspace.</p>"
}
},
"clientToken": {
"target": "com.amazonaws.amp#IdempotencyToken",
"traits": {
Expand Down

0 comments on commit cc1cbaf

Please sign in to comment.