@@ -116,7 +116,7 @@ suspend fun getResolvedCase() {
116116 includeResolvedCases = true
117117 }
118118
119- SupportClient { region = " us-west-2" }.use { supportClient ->
119+ SupportClient .fromEnvironment { region = " us-west-2" }.use { supportClient ->
120120 val response = supportClient.describeCases(describeCasesRequest)
121121 response.cases?.forEach { sinCase ->
122122 println (" The case status is ${sinCase.status} " )
@@ -133,7 +133,7 @@ suspend fun resolveSupportCase(caseIdVal: String) {
133133 ResolveCaseRequest {
134134 caseId = caseIdVal
135135 }
136- SupportClient { region = " us-west-2" }.use { supportClient ->
136+ SupportClient .fromEnvironment { region = " us-west-2" }.use { supportClient ->
137137 val response = supportClient.resolveCase(caseRequest)
138138 println (" The status of case $caseIdVal is ${response.finalCaseStatus} " )
139139 }
@@ -147,7 +147,7 @@ suspend fun describeAttachment(attachId: String?) {
147147 attachmentId = attachId
148148 }
149149
150- SupportClient { region = " us-west-2" }.use { supportClient ->
150+ SupportClient .fromEnvironment { region = " us-west-2" }.use { supportClient ->
151151 val response = supportClient.describeAttachment(attachmentRequest)
152152 println (" The name of the file is ${response.attachment?.fileName} " )
153153 }
@@ -162,7 +162,7 @@ suspend fun listCommunications(caseIdVal: String?): String? {
162162 maxResults = 10
163163 }
164164
165- SupportClient { region = " us-west-2" }.use { supportClient ->
165+ SupportClient .fromEnvironment { region = " us-west-2" }.use { supportClient ->
166166 val response = supportClient.describeCommunications(communicationsRequest)
167167 response.communications?.forEach { comm ->
168168 println (" the body is: " + comm.body)
@@ -187,7 +187,7 @@ suspend fun addAttachSupportCase(
187187 communicationBody = " Please refer to attachment for details."
188188 }
189189
190- SupportClient { region = " us-west-2" }.use { supportClient ->
190+ SupportClient .fromEnvironment { region = " us-west-2" }.use { supportClient ->
191191 val response = supportClient.addCommunicationToCase(caseRequest)
192192 if (response.result) {
193193 println (" You have successfully added a communication to an AWS Support case" )
@@ -213,7 +213,7 @@ suspend fun addAttachment(fileAttachment: String): String? {
213213 attachments = listOf (attachmentVal)
214214 }
215215
216- SupportClient { region = " us-west-2" }.use { supportClient ->
216+ SupportClient .fromEnvironment { region = " us-west-2" }.use { supportClient ->
217217 val response = supportClient.addAttachmentsToSet(setRequest)
218218 return response.attachmentSetId
219219 }
@@ -233,7 +233,7 @@ suspend fun getOpenCase() {
233233 beforeTime = now.toString()
234234 }
235235
236- SupportClient { region = " us-west-2" }.use { supportClient ->
236+ SupportClient .fromEnvironment { region = " us-west-2" }.use { supportClient ->
237237 val response = supportClient.describeCases(describeCasesRequest)
238238 response.cases?.forEach { sinCase ->
239239 println (" The case status is ${sinCase.status} " )
@@ -262,7 +262,7 @@ suspend fun createSupportCase(
262262 issueType = " technical"
263263 }
264264
265- SupportClient { region = " us-west-2" }.use { supportClient ->
265+ SupportClient .fromEnvironment { region = " us-west-2" }.use { supportClient ->
266266 val response = supportClient.createCase(caseRequest)
267267 return response.caseId
268268 }
@@ -277,7 +277,7 @@ suspend fun displaySevLevels(): String {
277277 language = " en"
278278 }
279279
280- SupportClient { region = " us-west-2" }.use { supportClient ->
280+ SupportClient .fromEnvironment { region = " us-west-2" }.use { supportClient ->
281281 val response = supportClient.describeSeverityLevels(severityLevelsRequest)
282282 response.severityLevels?.forEach { sevLevel ->
283283 println (" The severity level name is: ${sevLevel.name} " )
@@ -301,7 +301,7 @@ suspend fun displayServices(): List<String> {
301301 language = " en"
302302 }
303303
304- SupportClient { region = " us-west-2" }.use { supportClient ->
304+ SupportClient .fromEnvironment { region = " us-west-2" }.use { supportClient ->
305305 val response = supportClient.describeServices(servicesRequest)
306306 println (" Get the first 10 services" )
307307 var index = 1
0 commit comments