Search in sources :

Example 1 with PutItemRequest

use of com.amazonaws.services.dynamodbv2.model.PutItemRequest in project camel by apache.

the class PutItemCommand method execute.

@Override
public void execute() {
    PutItemResult result = ddbClient.putItem(new PutItemRequest().withTableName(determineTableName()).withItem(determineItem()).withExpected(determineUpdateCondition()).withReturnValues(determineReturnValues()));
    addAttributesToResult(result.getAttributes());
}
Also used : PutItemResult(com.amazonaws.services.dynamodbv2.model.PutItemResult) PutItemRequest(com.amazonaws.services.dynamodbv2.model.PutItemRequest)

Example 2 with PutItemRequest

use of com.amazonaws.services.dynamodbv2.model.PutItemRequest in project cas by apereo.

the class DynamoDbServiceRegistryFacilitator method put.

/**
     * Put.
     *
     * @param service the service
     */
public void put(final RegisteredService service) {
    final Map<String, AttributeValue> values = buildTableAttributeValuesMapFromService(service);
    final PutItemRequest putItemRequest = new PutItemRequest(TABLE_NAME, values);
    LOGGER.debug("Submitting put request [{}] for service id [{}]", putItemRequest, service.getServiceId());
    final PutItemResult putItemResult = amazonDynamoDBClient.putItem(putItemRequest);
    LOGGER.debug("Service added with result [{}]", putItemResult);
}
Also used : AttributeValue(com.amazonaws.services.dynamodbv2.model.AttributeValue) PutItemRequest(com.amazonaws.services.dynamodbv2.model.PutItemRequest) PutItemResult(com.amazonaws.services.dynamodbv2.model.PutItemResult)

Example 3 with PutItemRequest

use of com.amazonaws.services.dynamodbv2.model.PutItemRequest in project cas by apereo.

the class DynamoDbTicketRegistryFacilitator method put.

/**
     * Put ticket.
     *
     * @param ticket        the ticket
     * @param encodedTicket the encoded ticket
     */
public void put(final Ticket ticket, final Ticket encodedTicket) {
    final TicketDefinition metadata = this.ticketCatalog.find(ticket);
    final Map<String, AttributeValue> values = buildTableAttributeValuesMapFromTicket(ticket, encodedTicket);
    LOGGER.debug("Adding ticket id [{}] with attribute values [{}]", encodedTicket.getId(), values);
    final PutItemRequest putItemRequest = new PutItemRequest(metadata.getProperties().getStorageName(), values);
    LOGGER.debug("Submitting put request [{}] for ticket id [{}]", putItemRequest, encodedTicket.getId());
    final PutItemResult putItemResult = amazonDynamoDBClient.putItem(putItemRequest);
    LOGGER.debug("Ticket added with result [{}]", putItemResult);
    getAll();
}
Also used : AttributeValue(com.amazonaws.services.dynamodbv2.model.AttributeValue) PutItemRequest(com.amazonaws.services.dynamodbv2.model.PutItemRequest) PutItemResult(com.amazonaws.services.dynamodbv2.model.PutItemResult) TicketDefinition(org.apereo.cas.ticket.TicketDefinition)

Aggregations

PutItemRequest (com.amazonaws.services.dynamodbv2.model.PutItemRequest)3 PutItemResult (com.amazonaws.services.dynamodbv2.model.PutItemResult)3 AttributeValue (com.amazonaws.services.dynamodbv2.model.AttributeValue)2 TicketDefinition (org.apereo.cas.ticket.TicketDefinition)1