本文整理汇总了Java中com.amazonaws.services.sns.model.CreatePlatformEndpointRequest类的典型用法代码示例。如果您正苦于以下问题:Java CreatePlatformEndpointRequest类的具体用法?Java CreatePlatformEndpointRequest怎么用?Java CreatePlatformEndpointRequest使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CreatePlatformEndpointRequest类属于com.amazonaws.services.sns.model包,在下文中一共展示了CreatePlatformEndpointRequest类的17个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: createPlatformEndpoint
import com.amazonaws.services.sns.model.CreatePlatformEndpointRequest; //导入依赖的package包/类
private CreatePlatformEndpointResult createPlatformEndpoint(
Platform platform, String customData, String platformToken,
String applicationArn) {
CreatePlatformEndpointRequest platformEndpointRequest = new CreatePlatformEndpointRequest();
platformEndpointRequest.setCustomUserData(customData);
String token = platformToken;
String userId = null;
if (platform == Platform.BAIDU) {
String[] tokenBits = platformToken.split("\\|");
token = tokenBits[0];
userId = tokenBits[1];
Map<String, String> endpointAttributes = new HashMap<String, String>();
endpointAttributes.put("UserId", userId);
endpointAttributes.put("ChannelId", token);
platformEndpointRequest.setAttributes(endpointAttributes);
}
platformEndpointRequest.setToken(token);
platformEndpointRequest.setPlatformApplicationArn(applicationArn);
return snsClient.createPlatformEndpoint(platformEndpointRequest);
}
开发者ID:tonchidot,项目名称:aws-java-sns-mobile-push-sample,代码行数:21,代码来源:AmazonSNSClientWrapper.java
示例2: testActions
import com.amazonaws.services.sns.model.CreatePlatformEndpointRequest; //导入依赖的package包/类
@Test
@Ignore
public void testActions() throws InterruptedException {
String topicArn = TopicIntegrationTest.getOrCreateTopic().getArn();
// setAttributes
application.setAttributes(new SetPlatformApplicationAttributesRequest()
.addAttributesEntry("EventEndpointCreated", topicArn)
.addAttributesEntry("EventEndpointDeleted", topicArn)
.addAttributesEntry("EventEndpointUpdated", topicArn)
);
refreshApplication();
Assert.assertEquals(topicArn, application.getAttributes().get("EventEndpointCreated"));
Assert.assertEquals(topicArn, application.getAttributes().get("EventEndpointDeleted"));
Assert.assertEquals(topicArn, application.getAttributes().get("EventEndpointUpdated"));
// createPlatformEndpoint
application.createPlatformEndpoint(new CreatePlatformEndpointRequest()
.withToken(GCM_DEVICE_TOKEN)
.withCustomUserData("My custom user data")
);
}
开发者ID:awslabs,项目名称:aws-sdk-java-resources,代码行数:26,代码来源:PlatformApplicationIntegrationTest.java
示例3: createPlatformArn
import com.amazonaws.services.sns.model.CreatePlatformEndpointRequest; //导入依赖的package包/类
public String createPlatformArn(AmazonSNS snsClient, String platformApplicationArn, String token, User user) {
CreatePlatformEndpointRequest platformEndpointRequest = new CreatePlatformEndpointRequest();
platformEndpointRequest.setPlatformApplicationArn(platformApplicationArn);
platformEndpointRequest.setToken(token);
String customUserData = getCustomUserData(user);
platformEndpointRequest.setCustomUserData(customUserData);
CreatePlatformEndpointResult platformEndpointResult = snsClient.createPlatformEndpoint(platformEndpointRequest);
return platformEndpointResult.getEndpointArn();
}
开发者ID:GluuFederation,项目名称:oxAuth,代码行数:13,代码来源:PushSnsService.java
示例4: createPlatformEndpoint
import com.amazonaws.services.sns.model.CreatePlatformEndpointRequest; //导入依赖的package包/类
@Override
public PlatformEndpoint createPlatformEndpoint(CreatePlatformEndpointRequest
request, ResultCapture<CreatePlatformEndpointResult> extractor) {
ActionResult result = resource.performAction("CreatePlatformEndpoint",
request, extractor);
if (result == null) return null;
return new PlatformEndpointImpl(result.getResource());
}
开发者ID:awslabs,项目名称:aws-sdk-java-resources,代码行数:11,代码来源:PlatformApplicationImpl.java
示例5: testARNAndTokenConstructor
import com.amazonaws.services.sns.model.CreatePlatformEndpointRequest; //导入依赖的package包/类
@Test
public void testARNAndTokenConstructor() throws Exception {
CreatePlatformEndpointRequest r = new CreatePlatformEndpointRequestBuilder(new ApplicationArn("a1"), "t1")
.getRequest();
assertEquals("a1", r.getPlatformApplicationArn());
assertEquals("t1", r.getToken());
}
开发者ID:dglatt,项目名称:aws-sns-builders,代码行数:8,代码来源:CreatePlatformEndpointRequestBuilderTest.java
示例6: testPlatformApplicationArn
import com.amazonaws.services.sns.model.CreatePlatformEndpointRequest; //导入依赖的package包/类
@Test
public void testPlatformApplicationArn() throws Exception {
CreatePlatformEndpointRequest r = new CreatePlatformEndpointRequestBuilder(new ApplicationArn("a1"), "t1")
.platformApplicationArn(new ApplicationArn("a2"))
.getRequest();
assertEquals("a2", r.getPlatformApplicationArn());
}
开发者ID:dglatt,项目名称:aws-sns-builders,代码行数:8,代码来源:CreatePlatformEndpointRequestBuilderTest.java
示例7: testToken
import com.amazonaws.services.sns.model.CreatePlatformEndpointRequest; //导入依赖的package包/类
@Test
public void testToken() throws Exception {
CreatePlatformEndpointRequest r = new CreatePlatformEndpointRequestBuilder(new ApplicationArn("a1"), "t1")
.token("t2")
.getRequest();
assertEquals("t2", r.getToken());
}
开发者ID:dglatt,项目名称:aws-sns-builders,代码行数:8,代码来源:CreatePlatformEndpointRequestBuilderTest.java
示例8: testCustomUserData
import com.amazonaws.services.sns.model.CreatePlatformEndpointRequest; //导入依赖的package包/类
@Test
public void testCustomUserData() throws Exception {
CreatePlatformEndpointRequest r = new CreatePlatformEndpointRequestBuilder(new ApplicationArn("a1"), "t1")
.customUserData("c1")
.getRequest();
assertEquals("c1", r.getCustomUserData());
}
开发者ID:dglatt,项目名称:aws-sns-builders,代码行数:8,代码来源:CreatePlatformEndpointRequestBuilderTest.java
示例9: testAttribute
import com.amazonaws.services.sns.model.CreatePlatformEndpointRequest; //导入依赖的package包/类
@Test
public void testAttribute() throws Exception {
CreatePlatformEndpointRequest r = new CreatePlatformEndpointRequestBuilder(new ApplicationArn("a1"), "t1")
.attribute("ak1", "av1")
.getRequest();
assertEquals("av1", r.getAttributes().get("ak1"));
}
开发者ID:dglatt,项目名称:aws-sns-builders,代码行数:8,代码来源:CreatePlatformEndpointRequestBuilderTest.java
示例10: testGetRequest
import com.amazonaws.services.sns.model.CreatePlatformEndpointRequest; //导入依赖的package包/类
@Test
public void testGetRequest() throws Exception {
CreatePlatformEndpointRequest r = new CreatePlatformEndpointRequestBuilder(new ApplicationArn("a1"), "t1")
.attribute("ak1", "av1")
.customUserData("c1")
.platformApplicationArn(new ApplicationArn("a2"))
.token("t2")
.getRequest();
assertEquals("av1", r.getAttributes().get("ak1"));
assertEquals("a2", r.getPlatformApplicationArn());
assertEquals("c1", r.getCustomUserData());
assertEquals("t2", r.getToken());
}
开发者ID:dglatt,项目名称:aws-sns-builders,代码行数:14,代码来源:CreatePlatformEndpointRequestBuilderTest.java
示例11: createPlatformEndpoint
import com.amazonaws.services.sns.model.CreatePlatformEndpointRequest; //导入依赖的package包/类
private CreatePlatformEndpointResult createPlatformEndpoint(
String customData, String platformToken, String applicationArn) {
CreatePlatformEndpointRequest platformEndpointRequest = new CreatePlatformEndpointRequest();
platformEndpointRequest.setCustomUserData(customData);
platformEndpointRequest.setToken(platformToken);
platformEndpointRequest.setPlatformApplicationArn(applicationArn);
return snsClient.createPlatformEndpoint(platformEndpointRequest);
}
开发者ID:daffodilistic,项目名称:aws-snsmobilepush,代码行数:9,代码来源:SNSMobilePush.java
示例12: testNonInjectableMocks_shouldReturnNormal
import com.amazonaws.services.sns.model.CreatePlatformEndpointRequest; //导入依赖的package包/类
@Test
public void testNonInjectableMocks_shouldReturnNormal() {
mockSns(new MockParameters());
CheckIfPhoneNumberIsOptedOutRequest phoneRequest = new CheckIfPhoneNumberIsOptedOutRequest()
.withPhoneNumber("555123456");
CheckIfPhoneNumberIsOptedOutResult phoneResult = sns.checkIfPhoneNumberIsOptedOut(phoneRequest);
assertNotNull(phoneResult);
CreatePlatformApplicationRequest createPlatformRequest = new CreatePlatformApplicationRequest()
.withAttributes(ImmutableMap.of("os","oreo"))
.withName("android").withPlatform("mobile");
assertNotNull(sns.createPlatformApplication(createPlatformRequest));
CreatePlatformEndpointRequest createPlatformEndpointReq = new CreatePlatformEndpointRequest()
.withAttributes(ImmutableMap.of("os","lollypop"))
.withCustomUserData("something custom")
.withPlatformApplicationArn("mobile")
.withToken("5-euro-token");
assertNotNull(sns.createPlatformEndpoint(createPlatformEndpointReq));
DeleteEndpointRequest deleteEndpointReq = new DeleteEndpointRequest()
.withEndpointArn("arn:aws:sms:us-east-1:123456789012:myc:02034b43-fefa-4e07-a5e");
assertNotNull(sns.deleteEndpoint(deleteEndpointReq));
DeletePlatformApplicationRequest delPlatformAppReq = new DeletePlatformApplicationRequest()
.withPlatformApplicationArn("arn:aws:sms:us-east-1:123456789012:myc:02034b43-fefa-4e07-a5e");
assertNotNull(sns.deletePlatformApplication(delPlatformAppReq));
GetEndpointAttributesRequest getEndpointAttr = new GetEndpointAttributesRequest();
assertNotNull(sns.getEndpointAttributes(getEndpointAttr));
assertNotNull(sns.getPlatformApplicationAttributes(
new GetPlatformApplicationAttributesRequest().withPlatformApplicationArn("some-arn")));
assertNotNull(sns.getSMSAttributes(new GetSMSAttributesRequest().withAttributes("attr1","attr2")));
assertNotNull(sns.listEndpointsByPlatformApplication(new ListEndpointsByPlatformApplicationRequest()
.withNextToken("0-euro-token").withPlatformApplicationArn("cheap-arn")));
assertNotNull(sns.listPhoneNumbersOptedOut(new ListPhoneNumbersOptedOutRequest().withNextToken("plastic-token")));
assertNotNull(sns.listPlatformApplications(new ListPlatformApplicationsRequest().withNextToken("wooden-token")));
assertNotNull(sns.listPlatformApplications());
assertNotNull(sns.optInPhoneNumber(new OptInPhoneNumberRequest().withPhoneNumber("123456789")));
assertNotNull(sns.setEndpointAttributes(new SetEndpointAttributesRequest().withEndpointArn("at the end of the world")
.withAttributes(ImmutableMap.of("some-prop","some-value"))));
assertNotNull(sns.setPlatformApplicationAttributes(new SetPlatformApplicationAttributesRequest().withPlatformApplicationArn("arnn:::")
.withAttributes(ImmutableMap.of("super","mario"))));
assertNotNull(sns.setSMSAttributes(new SetSMSAttributesRequest().withAttributes(ImmutableMap.of("wtf","mfg"))));
assertNotNull(sns.removePermission(new RemovePermissionRequest().withLabel("fashion label").withTopicArn("fancy topic")));
}
开发者ID:daflockinger,项目名称:unitstack,代码行数:59,代码来源:MockSnsTest.java
示例13: createApplicationEndpoint
import com.amazonaws.services.sns.model.CreatePlatformEndpointRequest; //导入依赖的package包/类
String createApplicationEndpoint(String backendId, String appId, PushService service, String token) {
Optional<PlatformApplication> application = getApplication(appId, service);
if (!application.isPresent())
throw Exceptions.illegalArgument(//
"push service [%s] of mobile application [%s] not registered in AWS", //
appId, service);
String applicationArn = application.get().getPlatformApplicationArn();
String endpointArn = null;
try {
endpointArn = getSnsClient()
.createPlatformEndpoint(//
new CreatePlatformEndpointRequest()//
.withPlatformApplicationArn(applicationArn)//
.withToken(token))//
.getEndpointArn();
} catch (InvalidParameterException e) {
String message = e.getErrorMessage();
Utils.info("Exception message: %s", message);
Pattern p = Pattern.compile(".*Endpoint (arn:aws:sns[^ ]+) already exists " + "with the same token.*");
Matcher m = p.matcher(message);
if (m.matches()) {
// The platform endpoint already exists for this token, but with
// additional custom data that
// createEndpoint doesn't want to overwrite. Just use the
// existing platform endpoint.
endpointArn = m.group(1);
} else {
throw e;
}
}
if (endpointArn == null)
throw new RuntimeException("failed to create device notification endpoint: try again later");
boolean updateNeeded = false;
try {
GetEndpointAttributesResult endpointAttributes = getSnsClient()
.getEndpointAttributes(new GetEndpointAttributesRequest().withEndpointArn(endpointArn));
updateNeeded = !endpointAttributes.getAttributes().get("Token").equals(token)
|| !endpointAttributes.getAttributes().get("Enabled").equalsIgnoreCase("true");
} catch (NotFoundException nfe) {
// We had a stored ARN, but the platform endpoint associated with it
// disappeared. Recreate it.
endpointArn = null;
}
if (endpointArn == null)
throw new RuntimeException("failed to create device notification endpoint: try again later");
if (updateNeeded) {
// The platform endpoint is out of sync with the current data;
// update the token and enable it.
Map<String, String> attribs = new HashMap<>();
attribs.put("Token", token);
attribs.put("Enabled", "true");
getSnsClient().setEndpointAttributes(//
new SetEndpointAttributesRequest()//
.withEndpointArn(endpointArn)//
.withAttributes(attribs));
}
return endpointArn;
}
开发者ID:spacedog-io,项目名称:spacedog-server,代码行数:73,代码来源:PushResource.java
示例14: createApplicationEndpoint
import com.amazonaws.services.sns.model.CreatePlatformEndpointRequest; //导入依赖的package包/类
String createApplicationEndpoint(String backendId, String appId, PushServices service, String token) {
PlatformApplication application = getApplication(backendId, appId, service)//
.orElseThrow(//
() -> Exceptions.illegalArgument(//
"push service [%s] not registered for mobile application [%s]", //
appId, service));
String endpointArn = null;
String applicationArn = application.getPlatformApplicationArn();
try {
endpointArn = getSnsClient()
.createPlatformEndpoint(//
new CreatePlatformEndpointRequest()//
.withPlatformApplicationArn(applicationArn)//
.withToken(token))//
.getEndpointArn();
} catch (InvalidParameterException e) {
String message = e.getErrorMessage();
Utils.info("Exception message: %s", message);
Pattern p = Pattern.compile(".*Endpoint (arn:aws:sns[^ ]+) already exists " + "with the same token.*");
Matcher m = p.matcher(message);
if (m.matches()) {
// The platform endpoint already exists for this token, but with
// additional custom data that
// createEndpoint doesn't want to overwrite. Just use the
// existing platform endpoint.
endpointArn = m.group(1);
} else {
throw e;
}
}
if (endpointArn == null)
throw new RuntimeException("failed to create device notification endpoint: try again later");
boolean updateNeeded = false;
try {
GetEndpointAttributesResult endpointAttributes = getSnsClient()
.getEndpointAttributes(new GetEndpointAttributesRequest().withEndpointArn(endpointArn));
updateNeeded = !endpointAttributes.getAttributes().get("Token").equals(token)
|| !endpointAttributes.getAttributes().get("Enabled").equalsIgnoreCase("true");
} catch (NotFoundException nfe) {
// We had a stored ARN, but the platform endpoint associated with it
// disappeared. Recreate it.
endpointArn = null;
}
if (endpointArn == null)
throw new RuntimeException("failed to create device notification endpoint: try again later");
if (updateNeeded) {
// The platform endpoint is out of sync with the current data;
// update the token and enable it.
Map<String, String> attribs = new HashMap<String, String>();
attribs.put("Token", token);
attribs.put("Enabled", "true");
getSnsClient().setEndpointAttributes(//
new SetEndpointAttributesRequest()//
.withEndpointArn(endpointArn)//
.withAttributes(attribs));
}
return endpointArn;
}
开发者ID:spacedog-io,项目名称:spacedog-server,代码行数:71,代码来源:PushResource2.java
示例15: getRequest
import com.amazonaws.services.sns.model.CreatePlatformEndpointRequest; //导入依赖的package包/类
public CreatePlatformEndpointRequest getRequest() {
return request;
}
开发者ID:dglatt,项目名称:aws-sns-builders,代码行数:4,代码来源:CreatePlatformEndpointRequestBuilder.java
示例16: createPlatformEndpoint
import com.amazonaws.services.sns.model.CreatePlatformEndpointRequest; //导入依赖的package包/类
/**
* Performs the <code>CreatePlatformEndpoint</code> action.
*
* <p>
* The following request parameters will be populated from the data of this
* <code>PlatformApplication</code> resource, and any conflicting parameter
* value set in the request will be overridden:
* <ul>
* <li>
* <b><code>PlatformApplicationArn</code></b>
* - mapped from the <code>Arn</code> identifier.
* </li>
* </ul>
*
* <p>
*
* @return The <code>PlatformEndpoint</code> resource object associated with
* the result of this action.
* @see CreatePlatformEndpointRequest
*/
PlatformEndpoint createPlatformEndpoint(CreatePlatformEndpointRequest
request);
开发者ID:awslabs,项目名称:aws-sdk-java-resources,代码行数:23,代码来源:PlatformApplication.java
示例17: createEndpoint
import com.amazonaws.services.sns.model.CreatePlatformEndpointRequest; //导入依赖的package包/类
/**
* Create an Endpoint. This corresponds to an app on a device. Use {@link CreatePlatformEndpointRequestBuilder}.
*
* @param request
* @return The endpoint Arn
*/
public EndpointArn createEndpoint(CreatePlatformEndpointRequest request);
开发者ID:dglatt,项目名称:aws-sns-builders,代码行数:8,代码来源:SNSMobilePush.java
注:本文中的com.amazonaws.services.sns.model.CreatePlatformEndpointRequest类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论