Ada lebih banyak contoh AWS SDK yang tersedia di repo Contoh SDK AWS Doc
Terjemahan disediakan oleh mesin penerjemah. Jika konten terjemahan yang diberikan bertentangan dengan versi bahasa Inggris aslinya, utamakan versi bahasa Inggris.
Gunakan DeleteGroup dengan AWS SDK atau CLI
Contoh kode berikut menunjukkan cara menggunakanDeleteGroup.
- CLI
-
- AWS CLI
-
Untuk menghapus grup
delete-groupContoh berikut menghapus sumber daya grup tertentu.aws xray delete-group \ --group-name"AdminGroup"\ --group-arn"arn:aws:xray:us-east-2:123456789012:group/AdminGroup/123456789"Perintah ini tidak menghasilkan output.
Untuk informasi selengkapnya, lihat Mengonfigurasi Pengaturan Pengambilan Sampel, Grup, dan Enkripsi dengan AWS X-Ray API di Panduan Pengembang AWS X-Ray.
-
Untuk detail API, lihat DeleteGroup
di Referensi AWS CLI Perintah.
-
- Java
-
- SDK untuk Java 2.x
-
catatan
Ada lebih banyak tentang GitHub. Temukan contoh lengkapnya dan pelajari cara mengatur dan menjalankannya di Repositori Contoh Kode AWS
. import software.amazon.awssdk.regions.Region; import software.amazon.awssdk.services.xray.XRayClient; import software.amazon.awssdk.services.xray.model.DeleteGroupRequest; import software.amazon.awssdk.services.xray.model.XRayException; /** * Before running this Java V2 code example, set up your development * environment, including your credentials. * * For more information, see the following documentation topic: * * https://docs.aws.amazon.com/sdk-for-java/latest/developer-guide/get-started.html */ public class DeleteGroup { public static void main(String[] args) { final String usage = """ Usage: <groupName> Where: groupName - The name of the group to delete\s """; if (args.length != 1) { System.out.println(usage); System.exit(1); } String groupName = args[0]; Region region = Region.US_EAST_1; XRayClient xRayClient = XRayClient.builder() .region(region) .build(); deleteSpecificGroup(xRayClient, groupName); } public static void deleteSpecificGroup(XRayClient xRayClient, String groupName) { try { DeleteGroupRequest groupRequest = DeleteGroupRequest.builder() .groupName(groupName) .build(); xRayClient.deleteGroup(groupRequest); System.out.println(groupName + " was deleted!"); } catch (XRayException e) { System.err.println(e.getMessage()); System.exit(1); } } }-
Untuk detail API, lihat DeleteGroupdi Referensi AWS SDK for Java 2.x API.
-
- Kotlin
-
- SDK untuk Kotlin
-
catatan
Ada lebih banyak tentang GitHub. Temukan contoh lengkapnya dan pelajari cara mengatur dan menjalankannya di Repositori Contoh Kode AWS
. suspend fun deleteSpecificGroup(groupNameVal: String) { val groupRequest = DeleteGroupRequest { groupName = groupNameVal } XRayClient.fromEnvironment { region = "us-east-1" }.use { xRayClient -> xRayClient.deleteGroup(groupRequest) println("$groupNameVal was deleted!") } }-
Untuk detail API, lihat DeleteGroup
di AWS SDK untuk referensi API Kotlin.
-