Ada lebih banyak contoh AWS SDK yang tersedia di repo Contoh SDK AWS Doc. GitHub
Terjemahan disediakan oleh mesin penerjemah. Jika konten terjemahan yang diberikan bertentangan dengan versi bahasa Inggris aslinya, utamakan versi bahasa Inggris.
Gunakan ListSchemaMappings dengan AWS SDK
Contoh kode berikut menunjukkan cara menggunakanListSchemaMappings.
Contoh tindakan adalah kutipan kode dari program yang lebih besar dan harus dijalankan dalam konteks. Anda dapat melihat tindakan ini dalam konteks dalam contoh kode berikut:
- Java
-
- SDK untuk Java 2.x
-
Ada lebih banyak tentang GitHub. Temukan contoh lengkapnya dan pelajari cara mengatur dan menjalankannya di Repositori Contoh Kode AWS.
/**
* Lists the schema mappings associated with the current AWS account. This method uses an asynchronous paginator to
* retrieve the schema mappings, and prints the name of each schema mapping to the console.
*/
public void ListSchemaMappings() {
ListSchemaMappingsRequest mappingsRequest = ListSchemaMappingsRequest.builder()
.build();
ListSchemaMappingsPublisher paginator = getResolutionAsyncClient().listSchemaMappingsPaginator(mappingsRequest);
// Iterate through the pages of results
CompletableFuture<Void> future = paginator.subscribe(response -> {
response.schemaList().forEach(schemaMapping ->
logger.info("Schema Mapping Name: " + schemaMapping.schemaName())
);
});
// Wait for the asynchronous operation to complete
future.join();
}
- JavaScript
-
- SDK untuk JavaScript (v3)
-
Ada lebih banyak tentang GitHub. Temukan contoh lengkapnya dan pelajari cara mengatur dan menjalankannya di Repositori Contoh Kode AWS.
//The default inputs for this demo are read from the ../inputs.json.
import { fileURLToPath } from "node:url";
import {
ListSchemaMappingsCommand,
EntityResolutionClient,
} from "@aws-sdk/client-entityresolution";
import data from "../inputs.json" with { type: "json" };
const region = "eu-west-1";
const erClient = new EntityResolutionClient({ region: region });
export const main = async () => {
async function getInfo() {
const listSchemaMappingsParams = {
workflowName: `${data.inputs.workflowName}`,
jobId: `${data.inputs.jobId}`,
};
try {
const command = new ListSchemaMappingsCommand(listSchemaMappingsParams);
const response = await erClient.send(command);
const noOfSchemas = response.schemaList.length;
for (let i = 0; i < noOfSchemas; i++) {
console.log(
`Schema Mapping Name: ${response.schemaList[i].schemaName} `,
);
}
} catch (caught) {
console.error(caught.message);
throw caught;
}
}