

Le traduzioni sono generate tramite traduzione automatica. In caso di conflitto tra il contenuto di una traduzione e la versione originale in Inglese, quest'ultima prevarrà.

# Effettua richieste
<a name="making-requests"></a>

Utilizza un client di servizio per effettuare richieste a un Servizio AWS. AWS SDK per Kotlin Fornisce Domain Specific Languages (DSLs) seguendo uno schema [type-safe builder](https://kotlinlang.org/docs/type-safe-builders.html) per creare richieste. Le strutture annidate delle richieste sono accessibili anche tramite le loro. DSLs

L'esempio seguente mostra come creare un input operativo CreateTable di Amazon [DynamoDB](https://docs.aws.amazon.com/sdk-for-kotlin/api/latest/dynamodb/aws.sdk.kotlin.services.dynamodb/create-table.html):

```
val ddb = DynamoDbClient.fromEnvironment()

val req = CreateTableRequest {
    tableName = name
    keySchema = listOf(
        KeySchemaElement {
            attributeName = "year"
            keyType = KeyType.Hash
        },
        KeySchemaElement {
            attributeName = "title"
            keyType = KeyType.Range
        }
    )

    attributeDefinitions = listOf(
        AttributeDefinition {
            attributeName = "year"
            attributeType = ScalarAttributeType.N
        },
        AttributeDefinition {
            attributeName = "title"
            attributeType = ScalarAttributeType.S
        }
    )
    
    // You can configure the `provisionedThroughput` member
    // by using the `ProvisionedThroughput.Builder` directly:
    provisionedThroughput {
        readCapacityUnits = 10
        writeCapacityUnits = 10
    }
}

val resp = ddb.createTable(req)
```

## Sovraccarichi DSL dell'interfaccia di servizio
<a name="service-interface-dsl-overloads"></a>

Ogni operazione non di streaming sull'interfaccia client del servizio presenta un sovraccarico DSL, quindi non è necessario creare una richiesta separata.

Esempio di creazione di un bucket Amazon Simple Storage Service (Amazon S3) con la funzione overloaded:

```
s3Client.createBucket {    // this: CreateBucketRequest.Builder
    bucket = newBucketName
}
```

Ciò equivale a:

```
val request = CreateBucketRequest {    // this: CreateBucketRequest.Builder 
    bucket = newBucketName 
}

s3client.createBucket(request)
```

## Richieste senza input richiesti
<a name="requests-no-required-inputs"></a>

Le operazioni che non hanno input richiesti possono essere chiamate senza dover passare un oggetto di richiesta. Ciò è spesso possibile con operazioni di tipo elenco, come l'operazione dell'API Amazon `listBuckets` S3.

 Ad esempio, le tre istruzioni seguenti sono equivalenti: 

```
s3Client.listBuckets(ListBucketsRequest {
  // Construct the request object directly.
})
s3Client.listBuckets {
  // DSL builder without explicitly setting any arguments.
}
s3Client.listBuckets()
```