-
Notifications
You must be signed in to change notification settings - Fork 5.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Kotlin add lintered files and remove Android app (#6561)
--------- Co-authored-by: Jason Quesenberry <[email protected]>
- Loading branch information
1 parent
64433f5
commit 3232280
Showing
277 changed files
with
3,519 additions
and
4,421 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,17 @@ | ||
root = true | ||
|
||
[*] | ||
charset = utf-8 | ||
insert_final_newline = true | ||
trim_trailing_whitespace = true | ||
|
||
[*.{kt,kts}] | ||
ktlint_code_style = ktlint_official | ||
indent_size = 4 | ||
ij_kotlin_packages_to_use_import_on_demand = unset | ||
ij_kotlin_name_count_to_use_star_import = 999 | ||
ij_kotlin_name_count_to_use_star_import_for_members = 999 | ||
ktlint_code_style=intellij_idea | ||
ktlint_standard_no-consecutive-comments = disabled | ||
|
||
[*.{yml,yaml}] | ||
indent_size = 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
94 changes: 46 additions & 48 deletions
94
kotlin/services/apigateway/src/main/kotlin/com/kotlin/gateway/CreateDeployment.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,48 +1,46 @@ | ||
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
package com.kotlin.gateway | ||
|
||
// snippet-start:[apigateway.kotlin.create_deployment.import] | ||
import aws.sdk.kotlin.services.apigateway.ApiGatewayClient | ||
import aws.sdk.kotlin.services.apigateway.model.CreateDeploymentRequest | ||
import kotlin.system.exitProcess | ||
// snippet-end:[apigateway.kotlin.create_deployment.import] | ||
|
||
suspend fun main(args:Array<String>) { | ||
|
||
val usage = """ | ||
Usage: | ||
<restApiId> <stageName> | ||
Where: | ||
restApiId - The string identifier of the associated RestApi. (for example, xxxx99ewyg). | ||
stageName - The name of the stage. | ||
""" | ||
|
||
if (args.size != 2) { | ||
println(usage) | ||
exitProcess(0) | ||
} | ||
|
||
val restApiId = args[0] | ||
val stageName = args[1] | ||
createNewDeployment(restApiId, stageName) | ||
} | ||
|
||
// snippet-start:[apigateway.kotlin.create_deployment.main] | ||
suspend fun createNewDeployment(restApiIdVal: String?, stageNameVal: String?): String? { | ||
|
||
val request = CreateDeploymentRequest { | ||
restApiId = restApiIdVal | ||
description = "Created using the AWS API Gateway Kotlin API" | ||
stageName = stageNameVal | ||
} | ||
|
||
ApiGatewayClient { region = "us-east-1" }.use { apiGateway -> | ||
val response = apiGateway.createDeployment(request) | ||
println("The id of the deployment is " + response.id) | ||
return response.id | ||
} | ||
} | ||
// snippet-end:[apigateway.kotlin.create_deployment.main] | ||
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
package com.kotlin.gateway | ||
|
||
// snippet-start:[apigateway.kotlin.create_deployment.import] | ||
import aws.sdk.kotlin.services.apigateway.ApiGatewayClient | ||
import aws.sdk.kotlin.services.apigateway.model.CreateDeploymentRequest | ||
import kotlin.system.exitProcess | ||
// snippet-end:[apigateway.kotlin.create_deployment.import] | ||
|
||
suspend fun main(args: Array<String>) { | ||
val usage = """ | ||
Usage: | ||
<restApiId> <stageName> | ||
Where: | ||
restApiId - The string identifier of the associated RestApi. (for example, xxxx99ewyg). | ||
stageName - The name of the stage. | ||
""" | ||
|
||
if (args.size != 2) { | ||
println(usage) | ||
exitProcess(0) | ||
} | ||
|
||
val restApiId = args[0] | ||
val stageName = args[1] | ||
createNewDeployment(restApiId, stageName) | ||
} | ||
|
||
// snippet-start:[apigateway.kotlin.create_deployment.main] | ||
suspend fun createNewDeployment(restApiIdVal: String?, stageNameVal: String?): String? { | ||
val request = CreateDeploymentRequest { | ||
restApiId = restApiIdVal | ||
description = "Created using the AWS API Gateway Kotlin API" | ||
stageName = stageNameVal | ||
} | ||
|
||
ApiGatewayClient { region = "us-east-1" }.use { apiGateway -> | ||
val response = apiGateway.createDeployment(request) | ||
println("The id of the deployment is " + response.id) | ||
return response.id | ||
} | ||
} | ||
// snippet-end:[apigateway.kotlin.create_deployment.main] |
90 changes: 44 additions & 46 deletions
90
kotlin/services/apigateway/src/main/kotlin/com/kotlin/gateway/CreateRestApi.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,46 +1,44 @@ | ||
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
package com.kotlin.gateway | ||
|
||
// snippet-start:[apigateway.kotlin.create_api.import] | ||
import aws.sdk.kotlin.services.apigateway.ApiGatewayClient | ||
import aws.sdk.kotlin.services.apigateway.model.CreateRestApiRequest | ||
import kotlin.system.exitProcess | ||
// snippet-end:[apigateway.kotlin.create_api.import] | ||
|
||
suspend fun main(args:Array<String>) { | ||
|
||
val usage = """ | ||
Usage: | ||
<restApiId> | ||
Where: | ||
restApiId - The string identifier of an existing RestApi. (for example, xxxx99ewyg). | ||
""" | ||
|
||
if (args.size != 1) { | ||
println(usage) | ||
exitProcess(0) | ||
} | ||
|
||
val restApiId = args[0] | ||
createAPI(restApiId) | ||
} | ||
|
||
// snippet-start:[apigateway.kotlin.create_api.main] | ||
suspend fun createAPI(restApiName: String?): String? { | ||
|
||
val request = CreateRestApiRequest { | ||
description = "Created using the Gateway Kotlin API" | ||
name = restApiName | ||
} | ||
|
||
ApiGatewayClient { region = "us-east-1" }.use { apiGateway -> | ||
val response = apiGateway.createRestApi(request) | ||
println("The id of the new api is ${response.id}") | ||
return response.id | ||
} | ||
} | ||
// snippet-end:[apigateway.kotlin.create_api.main] | ||
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
package com.kotlin.gateway | ||
|
||
// snippet-start:[apigateway.kotlin.create_api.import] | ||
import aws.sdk.kotlin.services.apigateway.ApiGatewayClient | ||
import aws.sdk.kotlin.services.apigateway.model.CreateRestApiRequest | ||
import kotlin.system.exitProcess | ||
// snippet-end:[apigateway.kotlin.create_api.import] | ||
|
||
suspend fun main(args: Array<String>) { | ||
val usage = """ | ||
Usage: | ||
<restApiId> | ||
Where: | ||
restApiId - The string identifier of an existing RestApi. (for example, xxxx99ewyg). | ||
""" | ||
|
||
if (args.size != 1) { | ||
println(usage) | ||
exitProcess(0) | ||
} | ||
|
||
val restApiId = args[0] | ||
createAPI(restApiId) | ||
} | ||
|
||
// snippet-start:[apigateway.kotlin.create_api.main] | ||
suspend fun createAPI(restApiName: String?): String? { | ||
val request = CreateRestApiRequest { | ||
description = "Created using the Gateway Kotlin API" | ||
name = restApiName | ||
} | ||
|
||
ApiGatewayClient { region = "us-east-1" }.use { apiGateway -> | ||
val response = apiGateway.createRestApi(request) | ||
println("The id of the new api is ${response.id}") | ||
return response.id | ||
} | ||
} | ||
// snippet-end:[apigateway.kotlin.create_api.main] |
85 changes: 41 additions & 44 deletions
85
kotlin/services/apigateway/src/main/kotlin/com/kotlin/gateway/DeleteRestApi.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,41 @@ | ||
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
package com.kotlin.gateway | ||
|
||
// snippet-start:[apigateway.kotlin.delete_api.import] | ||
import aws.sdk.kotlin.services.apigateway.ApiGatewayClient | ||
import aws.sdk.kotlin.services.apigateway.model.DeleteRestApiRequest | ||
import kotlin.system.exitProcess | ||
// snippet-end:[apigateway.kotlin.delete_api.import] | ||
|
||
|
||
suspend fun main(args:Array<String>) { | ||
|
||
val usage = """ | ||
Usage: | ||
<restApiId> | ||
Where: | ||
restApiId - The string identifier of an existing RestApi. (for example, xxxx99ewyg). | ||
""" | ||
|
||
if (args.size != 1) { | ||
println(usage) | ||
exitProcess(1) | ||
} | ||
|
||
val restApiId = args[0] | ||
deleteAPI(restApiId) | ||
} | ||
|
||
// snippet-start:[apigateway.kotlin.delete_api.main] | ||
suspend fun deleteAPI(restApiIdVal: String?) { | ||
|
||
val request = DeleteRestApiRequest { | ||
restApiId = restApiIdVal | ||
} | ||
|
||
ApiGatewayClient { region = "us-east-1" }.use { apiGateway -> | ||
apiGateway.deleteRestApi(request) | ||
println("The API was successfully deleted") | ||
} | ||
} | ||
// snippet-end:[apigateway.kotlin.delete_api.main] | ||
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
package com.kotlin.gateway | ||
|
||
// snippet-start:[apigateway.kotlin.delete_api.import] | ||
import aws.sdk.kotlin.services.apigateway.ApiGatewayClient | ||
import aws.sdk.kotlin.services.apigateway.model.DeleteRestApiRequest | ||
import kotlin.system.exitProcess | ||
// snippet-end:[apigateway.kotlin.delete_api.import] | ||
|
||
suspend fun main(args: Array<String>) { | ||
val usage = """ | ||
Usage: | ||
<restApiId> | ||
Where: | ||
restApiId - The string identifier of an existing RestApi. (for example, xxxx99ewyg). | ||
""" | ||
|
||
if (args.size != 1) { | ||
println(usage) | ||
exitProcess(1) | ||
} | ||
|
||
val restApiId = args[0] | ||
deleteAPI(restApiId) | ||
} | ||
|
||
// snippet-start:[apigateway.kotlin.delete_api.main] | ||
suspend fun deleteAPI(restApiIdVal: String?) { | ||
val request = DeleteRestApiRequest { | ||
restApiId = restApiIdVal | ||
} | ||
|
||
ApiGatewayClient { region = "us-east-1" }.use { apiGateway -> | ||
apiGateway.deleteRestApi(request) | ||
println("The API was successfully deleted") | ||
} | ||
} | ||
// snippet-end:[apigateway.kotlin.delete_api.main] |
49 changes: 24 additions & 25 deletions
49
kotlin/services/apigateway/src/main/kotlin/com/kotlin/gateway/GetAPIKeys.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,24 @@ | ||
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
package com.kotlin.gateway | ||
|
||
// snippet-start:[apigateway.kotlin.get_apikeys.import] | ||
import aws.sdk.kotlin.services.apigateway.ApiGatewayClient | ||
import aws.sdk.kotlin.services.apigateway.model.GetApiKeysRequest | ||
// snippet-end:[apigateway.kotlin.get_apikeys.import] | ||
|
||
suspend fun main() { | ||
getKeys() | ||
} | ||
|
||
// snippet-start:[apigateway.kotlin.get_apikeys.main] | ||
suspend fun getKeys() { | ||
|
||
ApiGatewayClient { region = "us-east-1" }.use { apiGateway -> | ||
val response = apiGateway.getApiKeys(GetApiKeysRequest { }) | ||
response.items?.forEach { key -> | ||
println("Key is $key") | ||
} | ||
} | ||
} | ||
// snippet-end:[apigateway.kotlin.get_apikeys.main] | ||
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
package com.kotlin.gateway | ||
|
||
// snippet-start:[apigateway.kotlin.get_apikeys.import] | ||
import aws.sdk.kotlin.services.apigateway.ApiGatewayClient | ||
import aws.sdk.kotlin.services.apigateway.model.GetApiKeysRequest | ||
// snippet-end:[apigateway.kotlin.get_apikeys.import] | ||
|
||
suspend fun main() { | ||
getKeys() | ||
} | ||
|
||
// snippet-start:[apigateway.kotlin.get_apikeys.main] | ||
suspend fun getKeys() { | ||
ApiGatewayClient { region = "us-east-1" }.use { apiGateway -> | ||
val response = apiGateway.getApiKeys(GetApiKeysRequest { }) | ||
response.items?.forEach { key -> | ||
println("Key is $key") | ||
} | ||
} | ||
} | ||
// snippet-end:[apigateway.kotlin.get_apikeys.main] |
Oops, something went wrong.