This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"RoleName": "MyReadWriteRole", | |
"Type": "CustomRole", | |
"AssignableScopes": ["/"], | |
"Permissions": [{ | |
"DataActions": [ | |
"Microsoft.DocumentDB/databaseAccounts/readMetadata", | |
"Microsoft.DocumentDB/databaseAccounts/sqlDatabases/containers/items/*", | |
"Microsoft.DocumentDB/databaseAccounts/sqlDatabases/containers/*" | |
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"RoleName": "MyReadOnlyRole", | |
"Type": "CustomRole", | |
"AssignableScopes": ["/"], | |
"Permissions": [{ | |
"DataActions": [ | |
"Microsoft.DocumentDB/databaseAccounts/readMetadata", | |
"Microsoft.DocumentDB/databaseAccounts/sqlDatabases/containers/items/read", | |
"Microsoft.DocumentDB/databaseAccounts/sqlDatabases/containers/executeQuery", | |
"Microsoft.DocumentDB/databaseAccounts/sqlDatabases/containers/readChangeFeed" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
{ | |
"id": "4321", | |
"type": "Hino", | |
"purchaseDate": "2020/10/20", | |
"remarks": "4t" | |
}, | |
{ | |
"id": "1234", | |
"type": "Isuzu", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Get data from HTTP body of request | |
Track track = request.getBody().get(); | |
// Update or insert data | |
CosmosItemResponse<Track> cosmosItemResponse = cosmosContainer.upsertItem(track); | |
// HTTP status code is used with response code from Cosmos DB | |
HttpResponseMessage responseMessage | |
= request.createResponseBuilder(HttpStatusType.custom(cosmosItemResponse.getStatusCode())) | |
.header("Content-Type", "application/json") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
TokenCredential tokenCredential = new DefaultAzureCredentialBuilder().build(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[{ | |
"specversion": "1.0", | |
"id": "A234-1234-1234", | |
"source": "io/logico-jp/source", | |
"type": "io.logico-jp.ExampleEventType", | |
"datacontenttype": "application/json", | |
"time": "2020-10-31T13:54:34.308619Z", | |
"data": { | |
"message": "Using CloudEvents.io API to send CloudEvents!!" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Path("/updates") | |
@OPTIONS | |
public Response isWebhookEnabled() { | |
return Response.ok() | |
.allow("GET", "POST", "OPTIONS") | |
.header("Webhook-Allowed-Origin","eventgrid.azure.net") | |
.build(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Path("/updates") | |
@POST | |
public Response receiveEvent(Optional<JsonObject> obj) { | |
if(obj.isEmpty()) return Response.noContent().status(Response.Status.OK).build(); | |
EventFormat format = EventFormatProvider | |
.getInstance() | |
.resolveFormat(JsonFormat.CONTENT_TYPE); | |
CloudEvent ce = format.deserialize(obj.get().toString().getBytes(StandardCharsets.UTF_8)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- for Cloud Event --> | |
<dependency> | |
<groupId>io.cloudevents</groupId> | |
<artifactId>cloudevents-http-restful-ws</artifactId> | |
<version>2.0.0-milestone3</version> | |
</dependency> | |
<dependency> | |
<groupId>io.cloudevents</groupId> | |
<artifactId>cloudevents-json-jackson</artifactId> | |
<version>2.0.0-milestone3</version> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
MultivaluedMap<String, Object> headers = new MultivaluedHashMap<>(); | |
headers.add("aeg-sas-key", AEG_KEY); | |
Response response = ClientBuilder.newClient().target(AEG_ENDPOINT) | |
.path("/api/events") | |
.queryParam("api-version", "2018-01-01") | |
.request("application/cloudevents+json") | |
.headers(headers) | |
.post(Entity.entity(serialized, "application/cloudevents+json")); |