Hay más ejemplos de AWS SDK disponibles en el GitHub repositorio de ejemplos de AWS Doc SDK.
Las traducciones son generadas a través de traducción automática. En caso de conflicto entre la traducción y la version original de inglés, prevalecerá la version en inglés.
ListSchemaMappingsÚselo con un AWS SDK
Los siguientes ejemplos de código muestran cómo utilizar ListSchemaMappings.
Los ejemplos de acciones son extractos de código de programas más grandes y deben ejecutarse en contexto. Puede ver esta acción en contexto en el siguiente ejemplo de código:
- Java
-
- SDK para Java 2.x
-
/**
* 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 para JavaScript (v3)
-
//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;
}
}