-
Notifications
You must be signed in to change notification settings - Fork 597
/
Copy pathAccessAnalyzerClient.ts
337 lines (312 loc) · 12.7 KB
/
AccessAnalyzerClient.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
import { ApplyArchiveRuleCommandInput, ApplyArchiveRuleCommandOutput } from "./commands/ApplyArchiveRuleCommand";
import {
CancelPolicyGenerationCommandInput,
CancelPolicyGenerationCommandOutput,
} from "./commands/CancelPolicyGenerationCommand";
import {
CreateAccessPreviewCommandInput,
CreateAccessPreviewCommandOutput,
} from "./commands/CreateAccessPreviewCommand";
import { CreateAnalyzerCommandInput, CreateAnalyzerCommandOutput } from "./commands/CreateAnalyzerCommand";
import { CreateArchiveRuleCommandInput, CreateArchiveRuleCommandOutput } from "./commands/CreateArchiveRuleCommand";
import { DeleteAnalyzerCommandInput, DeleteAnalyzerCommandOutput } from "./commands/DeleteAnalyzerCommand";
import { DeleteArchiveRuleCommandInput, DeleteArchiveRuleCommandOutput } from "./commands/DeleteArchiveRuleCommand";
import { GetAccessPreviewCommandInput, GetAccessPreviewCommandOutput } from "./commands/GetAccessPreviewCommand";
import {
GetAnalyzedResourceCommandInput,
GetAnalyzedResourceCommandOutput,
} from "./commands/GetAnalyzedResourceCommand";
import { GetAnalyzerCommandInput, GetAnalyzerCommandOutput } from "./commands/GetAnalyzerCommand";
import { GetArchiveRuleCommandInput, GetArchiveRuleCommandOutput } from "./commands/GetArchiveRuleCommand";
import { GetFindingCommandInput, GetFindingCommandOutput } from "./commands/GetFindingCommand";
import { GetGeneratedPolicyCommandInput, GetGeneratedPolicyCommandOutput } from "./commands/GetGeneratedPolicyCommand";
import {
ListAccessPreviewFindingsCommandInput,
ListAccessPreviewFindingsCommandOutput,
} from "./commands/ListAccessPreviewFindingsCommand";
import { ListAccessPreviewsCommandInput, ListAccessPreviewsCommandOutput } from "./commands/ListAccessPreviewsCommand";
import {
ListAnalyzedResourcesCommandInput,
ListAnalyzedResourcesCommandOutput,
} from "./commands/ListAnalyzedResourcesCommand";
import { ListAnalyzersCommandInput, ListAnalyzersCommandOutput } from "./commands/ListAnalyzersCommand";
import { ListArchiveRulesCommandInput, ListArchiveRulesCommandOutput } from "./commands/ListArchiveRulesCommand";
import { ListFindingsCommandInput, ListFindingsCommandOutput } from "./commands/ListFindingsCommand";
import {
ListPolicyGenerationsCommandInput,
ListPolicyGenerationsCommandOutput,
} from "./commands/ListPolicyGenerationsCommand";
import {
ListTagsForResourceCommandInput,
ListTagsForResourceCommandOutput,
} from "./commands/ListTagsForResourceCommand";
import {
StartPolicyGenerationCommandInput,
StartPolicyGenerationCommandOutput,
} from "./commands/StartPolicyGenerationCommand";
import { StartResourceScanCommandInput, StartResourceScanCommandOutput } from "./commands/StartResourceScanCommand";
import { TagResourceCommandInput, TagResourceCommandOutput } from "./commands/TagResourceCommand";
import { UntagResourceCommandInput, UntagResourceCommandOutput } from "./commands/UntagResourceCommand";
import { UpdateArchiveRuleCommandInput, UpdateArchiveRuleCommandOutput } from "./commands/UpdateArchiveRuleCommand";
import { UpdateFindingsCommandInput, UpdateFindingsCommandOutput } from "./commands/UpdateFindingsCommand";
import { ValidatePolicyCommandInput, ValidatePolicyCommandOutput } from "./commands/ValidatePolicyCommand";
import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig";
import {
EndpointsInputConfig,
EndpointsResolvedConfig,
RegionInputConfig,
RegionResolvedConfig,
resolveEndpointsConfig,
resolveRegionConfig,
} from "@aws-sdk/config-resolver";
import { getContentLengthPlugin } from "@aws-sdk/middleware-content-length";
import {
HostHeaderInputConfig,
HostHeaderResolvedConfig,
getHostHeaderPlugin,
resolveHostHeaderConfig,
} from "@aws-sdk/middleware-host-header";
import { getLoggerPlugin } from "@aws-sdk/middleware-logger";
import { RetryInputConfig, RetryResolvedConfig, getRetryPlugin, resolveRetryConfig } from "@aws-sdk/middleware-retry";
import {
AwsAuthInputConfig,
AwsAuthResolvedConfig,
getAwsAuthPlugin,
resolveAwsAuthConfig,
} from "@aws-sdk/middleware-signing";
import {
UserAgentInputConfig,
UserAgentResolvedConfig,
getUserAgentPlugin,
resolveUserAgentConfig,
} from "@aws-sdk/middleware-user-agent";
import { HttpHandler as __HttpHandler } from "@aws-sdk/protocol-http";
import {
Client as __Client,
SmithyConfiguration as __SmithyConfiguration,
SmithyResolvedConfiguration as __SmithyResolvedConfiguration,
} from "@aws-sdk/smithy-client";
import {
Provider,
RegionInfoProvider,
Credentials as __Credentials,
Decoder as __Decoder,
Encoder as __Encoder,
HashConstructor as __HashConstructor,
HttpHandlerOptions as __HttpHandlerOptions,
Logger as __Logger,
Provider as __Provider,
StreamCollector as __StreamCollector,
UrlParser as __UrlParser,
UserAgent as __UserAgent,
} from "@aws-sdk/types";
export type ServiceInputTypes =
| ApplyArchiveRuleCommandInput
| CancelPolicyGenerationCommandInput
| CreateAccessPreviewCommandInput
| CreateAnalyzerCommandInput
| CreateArchiveRuleCommandInput
| DeleteAnalyzerCommandInput
| DeleteArchiveRuleCommandInput
| GetAccessPreviewCommandInput
| GetAnalyzedResourceCommandInput
| GetAnalyzerCommandInput
| GetArchiveRuleCommandInput
| GetFindingCommandInput
| GetGeneratedPolicyCommandInput
| ListAccessPreviewFindingsCommandInput
| ListAccessPreviewsCommandInput
| ListAnalyzedResourcesCommandInput
| ListAnalyzersCommandInput
| ListArchiveRulesCommandInput
| ListFindingsCommandInput
| ListPolicyGenerationsCommandInput
| ListTagsForResourceCommandInput
| StartPolicyGenerationCommandInput
| StartResourceScanCommandInput
| TagResourceCommandInput
| UntagResourceCommandInput
| UpdateArchiveRuleCommandInput
| UpdateFindingsCommandInput
| ValidatePolicyCommandInput;
export type ServiceOutputTypes =
| ApplyArchiveRuleCommandOutput
| CancelPolicyGenerationCommandOutput
| CreateAccessPreviewCommandOutput
| CreateAnalyzerCommandOutput
| CreateArchiveRuleCommandOutput
| DeleteAnalyzerCommandOutput
| DeleteArchiveRuleCommandOutput
| GetAccessPreviewCommandOutput
| GetAnalyzedResourceCommandOutput
| GetAnalyzerCommandOutput
| GetArchiveRuleCommandOutput
| GetFindingCommandOutput
| GetGeneratedPolicyCommandOutput
| ListAccessPreviewFindingsCommandOutput
| ListAccessPreviewsCommandOutput
| ListAnalyzedResourcesCommandOutput
| ListAnalyzersCommandOutput
| ListArchiveRulesCommandOutput
| ListFindingsCommandOutput
| ListPolicyGenerationsCommandOutput
| ListTagsForResourceCommandOutput
| StartPolicyGenerationCommandOutput
| StartResourceScanCommandOutput
| TagResourceCommandOutput
| UntagResourceCommandOutput
| UpdateArchiveRuleCommandOutput
| UpdateFindingsCommandOutput
| ValidatePolicyCommandOutput;
export interface ClientDefaults extends Partial<__SmithyResolvedConfiguration<__HttpHandlerOptions>> {
/**
* The HTTP handler to use. Fetch in browser and Https in Nodejs.
*/
requestHandler?: __HttpHandler;
/**
* A constructor for a class implementing the @aws-sdk/types.Hash interface
* that computes the SHA-256 HMAC or checksum of a string or binary buffer.
*/
sha256?: __HashConstructor;
/**
* The function that will be used to convert strings into HTTP endpoints.
*/
urlParser?: __UrlParser;
/**
* A function that can calculate the length of a request body.
*/
bodyLengthChecker?: (body: any) => number | undefined;
/**
* A function that converts a stream into an array of bytes.
*/
streamCollector?: __StreamCollector;
/**
* The function that will be used to convert a base64-encoded string to a byte array
*/
base64Decoder?: __Decoder;
/**
* The function that will be used to convert binary data to a base64-encoded string
*/
base64Encoder?: __Encoder;
/**
* The function that will be used to convert a UTF8-encoded string to a byte array
*/
utf8Decoder?: __Decoder;
/**
* The function that will be used to convert binary data to a UTF-8 encoded string
*/
utf8Encoder?: __Encoder;
/**
* The runtime environment
*/
runtime?: string;
/**
* Disable dyanamically changing the endpoint of the client based on the hostPrefix
* trait of an operation.
*/
disableHostPrefix?: boolean;
/**
* Unique service identifier.
* @internal
*/
serviceId?: string;
/**
* The AWS region to which this client will send requests
*/
region?: string | __Provider<string>;
/**
* Value for how many times a request will be made at most in case of retry.
*/
maxAttempts?: number | __Provider<number>;
/**
* Optional logger for logging debug/info/warn/error.
*/
logger?: __Logger;
/**
* Default credentials provider; Not available in browser runtime.
*/
credentialDefaultProvider?: (input: any) => __Provider<__Credentials>;
/**
* Fetch related hostname, signing name or signing region with given region.
*/
regionInfoProvider?: RegionInfoProvider;
/**
* The provider populating default tracking information to be sent with `user-agent`, `x-amz-user-agent` header
* @internal
*/
defaultUserAgentProvider?: Provider<__UserAgent>;
}
type AccessAnalyzerClientConfigType = Partial<__SmithyConfiguration<__HttpHandlerOptions>> &
ClientDefaults &
RegionInputConfig &
EndpointsInputConfig &
RetryInputConfig &
HostHeaderInputConfig &
AwsAuthInputConfig &
UserAgentInputConfig;
/**
* The configuration interface of AccessAnalyzerClient class constructor that set the region, credentials and other options.
*/
export interface AccessAnalyzerClientConfig extends AccessAnalyzerClientConfigType {}
type AccessAnalyzerClientResolvedConfigType = __SmithyResolvedConfiguration<__HttpHandlerOptions> &
Required<ClientDefaults> &
RegionResolvedConfig &
EndpointsResolvedConfig &
RetryResolvedConfig &
HostHeaderResolvedConfig &
AwsAuthResolvedConfig &
UserAgentResolvedConfig;
/**
* The resolved configuration interface of AccessAnalyzerClient class. This is resolved and normalized from the {@link AccessAnalyzerClientConfig | constructor configuration interface}.
*/
export interface AccessAnalyzerClientResolvedConfig extends AccessAnalyzerClientResolvedConfigType {}
/**
* <p>AWS IAM Access Analyzer helps identify potential resource-access risks by enabling you to identify
* any policies that grant access to an external principal. It does this by using logic-based
* reasoning to analyze resource-based policies in your AWS environment. An external
* principal can be another AWS account, a root user, an IAM user or role, a federated
* user, an AWS service, or an anonymous user. You can also use Access Analyzer to preview and
* validate public and cross-account access to your resources before deploying permissions
* changes. This guide describes the AWS IAM Access Analyzer operations that you can call
* programmatically. For general information about Access Analyzer, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/what-is-access-analyzer.html">AWS IAM Access Analyzer</a> in the <b>IAM User Guide</b>.</p>
* <p>To start using Access Analyzer, you first need to create an analyzer.</p>
*/
export class AccessAnalyzerClient extends __Client<
__HttpHandlerOptions,
ServiceInputTypes,
ServiceOutputTypes,
AccessAnalyzerClientResolvedConfig
> {
/**
* The resolved configuration of AccessAnalyzerClient class. This is resolved and normalized from the {@link AccessAnalyzerClientConfig | constructor configuration interface}.
*/
readonly config: AccessAnalyzerClientResolvedConfig;
constructor(configuration: AccessAnalyzerClientConfig) {
let _config_0 = {
...__ClientDefaultValues,
...configuration,
};
let _config_1 = resolveRegionConfig(_config_0);
let _config_2 = resolveEndpointsConfig(_config_1);
let _config_3 = resolveRetryConfig(_config_2);
let _config_4 = resolveHostHeaderConfig(_config_3);
let _config_5 = resolveAwsAuthConfig(_config_4);
let _config_6 = resolveUserAgentConfig(_config_5);
super(_config_6);
this.config = _config_6;
this.middlewareStack.use(getRetryPlugin(this.config));
this.middlewareStack.use(getContentLengthPlugin(this.config));
this.middlewareStack.use(getHostHeaderPlugin(this.config));
this.middlewareStack.use(getLoggerPlugin(this.config));
this.middlewareStack.use(getAwsAuthPlugin(this.config));
this.middlewareStack.use(getUserAgentPlugin(this.config));
}
/**
* Destroy underlying resources, like sockets. It's usually not necessary to do this.
* However in Node.js, it's best to explicitly shut down the client's agent when it is no longer needed.
* Otherwise, sockets might stay open for quite a long time before the server terminates them.
*/
destroy(): void {
super.destroy();
}
}