Usar DeleteActivity com um SDK da AWS - Exemplos de código do AWS SDK

Há mais exemplos do AWS SDK disponíveis no repositório do GitHub Documento de Exemplos do AWS SDK.

Usar DeleteActivity com um SDK da AWS

Os exemplos de código a seguir mostram como usar o DeleteActivity.

Exemplos de ações são trechos de código de programas maiores e devem ser executados em contexto. É possível ver essa ação no contexto no seguinte exemplo de código:

.NET
SDK para .NET
nota

Há mais no GitHub. Encontre o exemplo completo e veja como configurar e executar no AWS Code Examples Repository.

/// <summary> /// Delete a Step Machine activity. /// </summary> /// <param name="activityArn">The Amazon Resource Name (ARN) of /// the activity.</param> /// <returns>A Boolean value indicating the success of the action.</returns> public async Task<bool> DeleteActivity(string activityArn) { var response = await _amazonStepFunctions.DeleteActivityAsync(new DeleteActivityRequest { ActivityArn = activityArn }); return response.HttpStatusCode == System.Net.HttpStatusCode.OK; }
  • Consulte detalhes da API em DeleteActivity na Referência da API AWS SDK para .NET.

Java
SDK para Java 2.x
nota

Há mais no GitHub. Encontre o exemplo completo e veja como configurar e executar no AWS Code Examples Repository.

public static void deleteActivity(SfnClient sfnClient, String actArn) { try { DeleteActivityRequest activityRequest = DeleteActivityRequest.builder() .activityArn(actArn) .build(); sfnClient.deleteActivity(activityRequest); System.out.println("You have deleted " + actArn); } catch (SfnException e) { System.err.println(e.awsErrorDetails().errorMessage()); System.exit(1); } }
  • Consulte detalhes da API em DeleteActivity na Referência da API AWS SDK for Java 2.x.

Kotlin
SDK para Kotlin
nota

Há mais no GitHub. Encontre o exemplo completo e veja como configurar e executar no AWS Code Examples Repository.

suspend fun deleteActivity(actArn: String?) { val activityRequest = DeleteActivityRequest { activityArn = actArn } SfnClient.fromEnvironment { region = "us-east-1" }.use { sfnClient -> sfnClient.deleteActivity(activityRequest) println("You have deleted $actArn") } }
  • Consulte detalhes da API em DeleteActivity na Referência da API AWS SDK para Kotlin.

Python
SDK para Python (Boto3).
nota

Há mais no GitHub. Encontre o exemplo completo e veja como configurar e executar no AWS Code Examples Repository.

class Activity: """Encapsulates Step Function activity actions.""" def __init__(self, stepfunctions_client): """ :param stepfunctions_client: A Boto3 Step Functions client. """ self.stepfunctions_client = stepfunctions_client def delete(self, activity_arn): """ Delete an activity. :param activity_arn: The ARN of the activity to delete. """ try: response = self.stepfunctions_client.delete_activity( activityArn=activity_arn ) except ClientError as err: logger.error( "Couldn't delete activity %s. Here's why: %s: %s", activity_arn, err.response["Error"]["Code"], err.response["Error"]["Message"], ) raise else: return response
  • Consulte detalhes da API em DeleteActivity na Referência da API AWS SDK para Python (Boto3).