Skip to content

Commit 4e2c1c9

Browse files
authored
Merge pull request #110 from amazon-ospo/smithyModelChange
feat: Adding smithy model for installations API
2 parents 488e571 + d065dce commit 4e2c1c9

File tree

19 files changed

+903
-3
lines changed

19 files changed

+903
-3
lines changed

src/packages/smithy/build/smithy/source/build-info/smithy-build-info.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"operationShapeIds": [
44
"framework.api#GetAppToken",
55
"framework.api#GetInstallationData",
6+
"framework.api#GetInstallations",
67
"framework.api#GetInstallationToken",
78
"framework.api#RefreshCachedData"
89
],
@@ -177,6 +178,7 @@
177178
"smithy.api#length",
178179
"smithy.api#mixin",
179180
"smithy.api#notProperty",
181+
"smithy.api#paginated",
180182
"smithy.api#pattern",
181183
"smithy.api#private",
182184
"smithy.api#protocolDefinition",

src/packages/smithy/build/smithy/source/model/model.json

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1891,6 +1891,9 @@
18911891
{
18921892
"target": "framework.api#GetInstallationData"
18931893
},
1894+
{
1895+
"target": "framework.api#GetInstallations"
1896+
},
18941897
{
18951898
"target": "framework.api#GetInstallationToken"
18961899
},
@@ -2075,6 +2078,60 @@
20752078
}
20762079
}
20772080
},
2081+
"framework.api#GetInstallations": {
2082+
"type": "operation",
2083+
"input": {
2084+
"target": "framework.api#GetInstallationsInput"
2085+
},
2086+
"output": {
2087+
"target": "framework.api#GetInstallationsOutput"
2088+
},
2089+
"errors": [
2090+
{
2091+
"target": "framework.api#ClientSideError"
2092+
},
2093+
{
2094+
"target": "framework.api#ServerSideError"
2095+
}
2096+
],
2097+
"traits": {
2098+
"smithy.api#http": {
2099+
"method": "POST",
2100+
"uri": "/installations"
2101+
},
2102+
"smithy.api#paginated": {
2103+
"inputToken": "nextToken",
2104+
"outputToken": "nextToken",
2105+
"pageSize": "maxResults",
2106+
"items": "installations"
2107+
}
2108+
}
2109+
},
2110+
"framework.api#GetInstallationsInput": {
2111+
"type": "structure",
2112+
"members": {
2113+
"maxResults": {
2114+
"target": "smithy.api#Integer"
2115+
},
2116+
"nextToken": {
2117+
"target": "smithy.api#String"
2118+
}
2119+
}
2120+
},
2121+
"framework.api#GetInstallationsOutput": {
2122+
"type": "structure",
2123+
"members": {
2124+
"nextToken": {
2125+
"target": "smithy.api#String"
2126+
},
2127+
"installations": {
2128+
"target": "framework.api#InstallationRecordList",
2129+
"traits": {
2130+
"smithy.api#required": {}
2131+
}
2132+
}
2133+
}
2134+
},
20782135
"framework.api#InstallationData": {
20792136
"type": "structure",
20802137
"members": {
@@ -2095,6 +2152,41 @@
20952152
"target": "framework.api#InstallationData"
20962153
}
20972154
},
2155+
"framework.api#InstallationRecord": {
2156+
"type": "structure",
2157+
"members": {
2158+
"appId": {
2159+
"target": "smithy.api#Integer",
2160+
"traits": {
2161+
"smithy.api#required": {}
2162+
}
2163+
},
2164+
"installationId": {
2165+
"target": "smithy.api#Integer",
2166+
"traits": {
2167+
"smithy.api#required": {}
2168+
}
2169+
},
2170+
"nodeId": {
2171+
"target": "smithy.api#String",
2172+
"traits": {
2173+
"smithy.api#required": {}
2174+
}
2175+
},
2176+
"targetType": {
2177+
"target": "smithy.api#String",
2178+
"traits": {
2179+
"smithy.api#required": {}
2180+
}
2181+
}
2182+
}
2183+
},
2184+
"framework.api#InstallationRecordList": {
2185+
"type": "list",
2186+
"member": {
2187+
"target": "framework.api#InstallationRecord"
2188+
}
2189+
},
20982190
"framework.api#Permissions": {
20992191
"type": "map",
21002192
"key": {

src/packages/smithy/build/smithy/source/sources/credential_management.smithy

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ $version: "2.0"
22
namespace framework.api
33

44
resource CredentialManagementService{
5-
operations: [GetInstallationToken, GetAppToken, RefreshCachedData, GetInstallationData]
5+
operations: [GetInstallationToken, GetAppToken, RefreshCachedData, GetInstallationData, GetInstallations]
66
}
77

88
// Placeholder API endpoints
@@ -35,6 +35,15 @@ operation GetInstallationData {
3535
errors: [ServerSideError, ClientSideError]
3636
}
3737

38+
@paginated(inputToken: "nextToken", outputToken: "nextToken",
39+
pageSize: "maxResults", items: "installations")
40+
@http(method: "POST", uri: "/installations")
41+
operation GetInstallations {
42+
input: GetInstallationsInput,
43+
output: GetInstallationsOutput,
44+
errors: [ServerSideError, ClientSideError]
45+
}
46+
3847
list RepositoryIds {
3948
member: Integer
4049
}
@@ -115,6 +124,32 @@ structure GetInstallationDataOutput {
115124
installations: InstallationDataList
116125
}
117126

127+
structure GetInstallationsInput {
128+
maxResults: Integer
129+
nextToken: String
130+
}
131+
132+
structure InstallationRecord {
133+
@required
134+
appId: Integer
135+
@required
136+
installationId: Integer
137+
@required
138+
nodeId: String
139+
@required
140+
targetType: String
141+
}
142+
143+
list InstallationRecordList {
144+
member: InstallationRecord
145+
}
146+
147+
structure GetInstallationsOutput {
148+
nextToken: String
149+
@required
150+
installations: InstallationRecordList
151+
}
152+
118153
@httpError(500)
119154
@error("server")
120155
structure ServerSideError {

src/packages/smithy/build/smithy/source/typescript-client-codegen/src/AppFramework.ts

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,11 @@ import {
1919
GetInstallationTokenCommandInput,
2020
GetInstallationTokenCommandOutput,
2121
} from "./commands/GetInstallationTokenCommand";
22+
import {
23+
GetInstallationsCommand,
24+
GetInstallationsCommandInput,
25+
GetInstallationsCommandOutput,
26+
} from "./commands/GetInstallationsCommand";
2227
import {
2328
RefreshCachedDataCommand,
2429
RefreshCachedDataCommandInput,
@@ -30,6 +35,7 @@ import { HttpHandlerOptions as __HttpHandlerOptions } from "@smithy/types";
3035
const commands = {
3136
GetAppTokenCommand,
3237
GetInstallationDataCommand,
38+
GetInstallationsCommand,
3339
GetInstallationTokenCommand,
3440
RefreshCachedDataCommand,
3541
}
@@ -69,6 +75,24 @@ export interface AppFramework {
6975
cb: (err: any, data?: GetInstallationDataCommandOutput) => void
7076
): void;
7177

78+
/**
79+
* @see {@link GetInstallationsCommand}
80+
*/
81+
getInstallations(): Promise<GetInstallationsCommandOutput>;
82+
getInstallations(
83+
args: GetInstallationsCommandInput,
84+
options?: __HttpHandlerOptions,
85+
): Promise<GetInstallationsCommandOutput>;
86+
getInstallations(
87+
args: GetInstallationsCommandInput,
88+
cb: (err: any, data?: GetInstallationsCommandOutput) => void
89+
): void;
90+
getInstallations(
91+
args: GetInstallationsCommandInput,
92+
options: __HttpHandlerOptions,
93+
cb: (err: any, data?: GetInstallationsCommandOutput) => void
94+
): void;
95+
7296
/**
7397
* @see {@link GetInstallationTokenCommand}
7498
*/

src/packages/smithy/build/smithy/source/typescript-client-codegen/src/AppFrameworkClient.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ import {
1818
GetInstallationTokenCommandInput,
1919
GetInstallationTokenCommandOutput,
2020
} from "./commands/GetInstallationTokenCommand";
21+
import {
22+
GetInstallationsCommandInput,
23+
GetInstallationsCommandOutput,
24+
} from "./commands/GetInstallationsCommand";
2125
import {
2226
RefreshCachedDataCommandInput,
2327
RefreshCachedDataCommandOutput,
@@ -94,6 +98,7 @@ export type ServiceInputTypes =
9498
| GetAppTokenCommandInput
9599
| GetInstallationDataCommandInput
96100
| GetInstallationTokenCommandInput
101+
| GetInstallationsCommandInput
97102
| RefreshCachedDataCommandInput;
98103

99104
/**
@@ -103,6 +108,7 @@ export type ServiceOutputTypes =
103108
| GetAppTokenCommandOutput
104109
| GetInstallationDataCommandOutput
105110
| GetInstallationTokenCommandOutput
111+
| GetInstallationsCommandOutput
106112
| RefreshCachedDataCommandOutput;
107113

108114
/**
Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
// @ts-nocheck
2+
// smithy-typescript generated code
3+
import {
4+
AppFrameworkClientResolvedConfig,
5+
ServiceInputTypes,
6+
ServiceOutputTypes,
7+
} from "../AppFrameworkClient";
8+
import {
9+
GetInstallationsInput,
10+
GetInstallationsOutput,
11+
} from "../models/models_0";
12+
import {
13+
de_GetInstallationsCommand,
14+
se_GetInstallationsCommand,
15+
} from "../protocols/Aws_restJson1";
16+
import { getSerdePlugin } from "@smithy/middleware-serde";
17+
import { Command as $Command } from "@smithy/smithy-client";
18+
import { MetadataBearer as __MetadataBearer } from "@smithy/types";
19+
20+
/**
21+
* @public
22+
*/
23+
export type { __MetadataBearer };
24+
export { $Command };
25+
/**
26+
* @public
27+
*
28+
* The input for {@link GetInstallationsCommand}.
29+
*/
30+
export interface GetInstallationsCommandInput extends GetInstallationsInput {}
31+
/**
32+
* @public
33+
*
34+
* The output of {@link GetInstallationsCommand}.
35+
*/
36+
export interface GetInstallationsCommandOutput extends GetInstallationsOutput, __MetadataBearer {}
37+
38+
/**
39+
* @public
40+
*
41+
* @example
42+
* Use a bare-bones client and the command you need to make an API call.
43+
* ```javascript
44+
* import { AppFrameworkClient, GetInstallationsCommand } from "@aws/app-framework-for-github-apps-on-aws-client"; // ES Modules import
45+
* // const { AppFrameworkClient, GetInstallationsCommand } = require("@aws/app-framework-for-github-apps-on-aws-client"); // CommonJS import
46+
* const client = new AppFrameworkClient(config);
47+
* const input = { // GetInstallationsInput
48+
* maxResults: Number("int"),
49+
* nextToken: "STRING_VALUE",
50+
* };
51+
* const command = new GetInstallationsCommand(input);
52+
* const response = await client.send(command);
53+
* // { // GetInstallationsOutput
54+
* // nextToken: "STRING_VALUE",
55+
* // installations: [ // InstallationRecordList // required
56+
* // { // InstallationRecord
57+
* // appId: Number("int"), // required
58+
* // installationId: Number("int"), // required
59+
* // nodeId: "STRING_VALUE", // required
60+
* // targetType: "STRING_VALUE", // required
61+
* // },
62+
* // ],
63+
* // };
64+
*
65+
* ```
66+
*
67+
* @param GetInstallationsCommandInput - {@link GetInstallationsCommandInput}
68+
* @returns {@link GetInstallationsCommandOutput}
69+
* @see {@link GetInstallationsCommandInput} for command's `input` shape.
70+
* @see {@link GetInstallationsCommandOutput} for command's `response` shape.
71+
* @see {@link AppFrameworkClientResolvedConfig | config} for AppFrameworkClient's `config` shape.
72+
*
73+
* @throws {@link ServerSideError} (server fault)
74+
*
75+
* @throws {@link ClientSideError} (client fault)
76+
*
77+
* @throws {@link ValidationException} (client fault)
78+
* A standard error for input validation failures.
79+
* This should be thrown by services when a member of the input structure
80+
* falls outside of the modeled or documented constraints.
81+
*
82+
* @throws {@link AppFrameworkServiceException}
83+
* <p>Base exception class for all service exceptions from AppFramework service.</p>
84+
*
85+
*
86+
*/
87+
export class GetInstallationsCommand extends $Command.classBuilder<GetInstallationsCommandInput, GetInstallationsCommandOutput, AppFrameworkClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes>()
88+
.m(function (this: any, Command: any, cs: any, config: AppFrameworkClientResolvedConfig, o: any) {
89+
return [
90+
91+
getSerdePlugin(config, this.serialize, this.deserialize),
92+
];
93+
})
94+
.s("AppFramework", "GetInstallations", {
95+
96+
})
97+
.n("AppFrameworkClient", "GetInstallationsCommand")
98+
.f(void 0, void 0)
99+
.ser(se_GetInstallationsCommand)
100+
.de(de_GetInstallationsCommand)
101+
.build() {
102+
/** @internal type navigation helper, not in runtime. */
103+
declare protected static __types: {
104+
api: {
105+
input: GetInstallationsInput;
106+
output: GetInstallationsOutput;
107+
};
108+
sdk: {
109+
input: GetInstallationsCommandInput;
110+
output: GetInstallationsCommandOutput;
111+
};
112+
};
113+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// smithy-typescript generated code
22
export * from "./GetAppTokenCommand";
33
export * from "./GetInstallationDataCommand";
4+
export * from "./GetInstallationsCommand";
45
export * from "./GetInstallationTokenCommand";
56
export * from "./RefreshCachedDataCommand";

src/packages/smithy/build/smithy/source/typescript-client-codegen/src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ export * from "./AppFramework";
55
export type { RuntimeExtension } from "./runtimeExtensions";
66
export type { AppFrameworkExtensionConfiguration } from "./extensionConfiguration";
77
export * from "./commands";
8+
export * from "./pagination";
89
export * from "./models";
910

1011
export { AppFrameworkServiceException } from "./models/AppFrameworkServiceException";

0 commit comments

Comments
 (0)