I am using the TapKey SDK in combination with a FlinkeyBox.
So far (SDK 2.12.7), I used to be able to set the BleServiceUuid in the TapkeyEnvironmentConfigBuilder.
Now I've upgraded to the newest SDK version and the method TapkeyEnvironmentConfigBuilder.setBleServiceUuid is simply gone. I can't find it in any migration guide either.
Can someone help?
Indeed this information is missing. We will cover this in the migration guide.
To change the BLE Service UUID you have now to use the TapkeyBleAdvertisingFormatBuilder.
TapkeyBleAdvertisingFormat advertisingFormat = new TapkeyBleAdvertisingFormatBuilder()
.addV1Format("[serviceUUID]")
//.addV2Format([domainID])
.build();
TapkeyServiceFactory tapkeyServiceFactory = new TapkeyServiceFactoryBuilder(this)
.setBluetoothAdvertisingFormat(advertisingFormat)
...
.build();
New hardware generations will use a new Bluetooth Advertising, which has then to be configured with the V2 format. But for now it will be sufficient just to configure the V1 format. For more informations about how to configure the TapkeyBleAdvertisingFormat please contact your service provider.
Related
I am creating a method that needs a S3 client as a parameter. I do not know what type should I declare it to be.
this is the doc for S3Client https://sdk.amazonaws.com/java/api/latest/software/amazon/awssdk/services/s3/S3Client.html
Ignore since answered (this is the doc for AmazonS3Client
https://docs.aws.amazon.com/AWSJavaSDK/latest/javadoc/com/amazonaws/services/s3/AmazonS3Client.html My question is which type is recommended and what are difference between them? Thank you! )
Update:
I find another S3 Client here: AmazonS3 interface.
https://docs.aws.amazon.com/AWSJavaSDK/latest/javadoc/com/amazonaws/services/s3/AmazonS3.html
However, setObjectTagging is supported in type AmazonS3 not but in type S3Client .
Does AmazonS3 provide more functionality than S3Client?
What if I need some function in AmazonS3 not in S3Client, or some in S3Client not in AmazonS3?
The AWS SDK for Java has two versions: V1 and V2. AmazonS3Client is the older V1 version while S3Client is the newer V2 version.
Amazon recommends using V2:
The AWS SDK for Java 2.x is a major rewrite of the version 1.x code base. It’s built on top of Java 8+ and adds several frequently requested features. These include support for non-blocking I/O and the ability to plug in a different HTTP implementation at run time.
You can find Amazon S3 V2 code examples in the Java Developer V2 DEV Guide here:
Developer guide - AWS SDK for Java 2.x
(At this point, the Amazon S3 Service guide does not have V2 examples in it.)
In addition, you can find all Amazon S3 V2 code examples in AWS Github here:
https://github.com/awsdocs/aws-doc-sdk-examples/tree/master/javav2/example_code/s3
If you are not familiar developing apps by using the AWS SDK for Java V2, it's recommended that you start here:
Get started with the AWS SDK for Java 2.x
(This getting started topic happens to use the Amazon S3 Java V2 API to help get you up and running with using the AWS SDK for Java V2)
Update:
You stated: However, setObjectTagging is supported in type AmazonS3 not but in type S3Client .
The way to tag an Object in an Amazon S3 bucket by using Java V2 API is to use this code:
// First need to get existing tag set; otherwise the existing tags are overwritten.
GetObjectTaggingRequest getObjectTaggingRequest = GetObjectTaggingRequest.builder()
.bucket(bucketName)
.key(key)
.build();
GetObjectTaggingResponse response = s3.getObjectTagging(getObjectTaggingRequest);
// Get the existing immutable list - cannot modify this list.
List<Tag> existingList = response.tagSet();
ArrayList<Tag> newTagList = new ArrayList(new ArrayList<>(existingList));
// Create a new tag.
Tag myTag = Tag.builder()
.key(label)
.value(LabelValue)
.build();
// push new tag to list.
newTagList.add(myTag);
Tagging tagging = Tagging.builder()
.tagSet(newTagList)
.build();
PutObjectTaggingRequest taggingRequest = PutObjectTaggingRequest.builder()
.key(key)
.bucket(bucketName)
.tagging(tagging)
.build();
s3.putObjectTagging(taggingRequest);
I am using JDBC to connect to Athena for a specific Workgroup. But it is by default redirecting to the primary workgroup
Below is the code snippet
Properties info = new Properties();
info.put("user", "access-key");
info.put("password", "secrect-access-key");
info.put("WorkGroup","test");
info.put("schema", "testschema");
info.put("s3_staging_dir", "s3://bucket/athena/temp");
info.put("aws_credentials_provider_class","com.amazonaws.auth.DefaultAWSCredentialsProviderChain");
Class.forName("com.simba.athena.jdbc.Driver");
Connection connection = DriverManager.getConnection("jdbc:awsathena://athena.<region>.amazonaws.com:443/", info);
As you can see I am using "Workgroup" as the key for the properties. I also tried "workgroup", "work-group", "WorkGroup". It is not able to redirect to the specified Workgroup. Always going to the default one i.e primary workgroup.
Kindly help. Thanks
If you look at the release notes of Athena JDBC, the workgroup support is from v2.0.7.
If you jar is below this version, it will not work. Try to upgrade the library to 2.0.7 or above
You need to Override Client-Side Settings in workgroup.Enable below setting and rerun the query via JDBC.
Check this doc for more information.
I have successfully sent text message using AWS - Amazon Simple Notification Service NuGet package in my sample Application. (In this Package, it will automatically install AWSSDK- Core runtime)
But, when I was trying to merge code in my current Project where We have already used AWS SDK for other Amazon Services, I am not getting one of the Property required for sending text message.
For Sending text message, We need to Create Publish Request object and pass that Object to AmazonSimpleNotificationServiceClient.
Please find below code
AmazonSimpleNotificationServiceClient smsClient = new AmazonSimpleNotificationServiceClient("Access Key", "Secret Access Key", Region);
PublishRequest publishRequest = new PublishRequest();
publishRequest.Message = message;
publishRequest.MessageAttributes = smsAttributes;
publishRequest.PhoneNumber = "Phone number to which need to send text message";
Then, we need to pass this object to SNS
PublishResponse result = smsClient.Publish(publishRequest);
But I am not getting "PhoneNumber" property in my current Project which refers latest updated AWS SDK (Installed NuGEt Package in my Project - AWS SDK for .NET with latest version).
If I have tried to install earlier NuGEt package with which I have successfully run the code, I am getting conflicts as I am getting class "AmazonSimpleNotificationServiceClient" in both dlls viz. Core and AWSSDK.
Please suggest.
PhoneNumber is still in the latest version of the SDK. Somehow after your merged in your other code it is tricking your build system into including an older version. PhoneNumber was added in version 3.1.1 of the AWSSDK.SimpleNotificationService package.
Did you add a new dependency to your project which already had a dependency on the SDK?
Typically emrfs consistency is enabled via emrfs-site.xml
http://docs.aws.amazon.com/ElasticMapReduce/latest/DeveloperGuide/emrfs-configure-consistent-view.html
Does anyone know if these setting can be accessed via the SDK?
To enable EMRFS with the Java SDK, an "emrfs-site" configuration needs to be added to the RunJobFlowRequest and the fs.s3.consistent property must be set to true. Like this:
Map<String, String> emrfsProperties = new HashMap<>();
emrfsProperties.put("fs.s3.consistent", "true");
RunJobFlowRequest request = new RunJobFlowRequest()
....
.withServiceRole(SERVICE_ROLE)
.withJobFlowRole(JOB_FLOW_ROLE)
.withConfigurations(
new Configuration().withClassification("yarn-site").withProperties(yarnProperties),
new Configuration().withClassification("emrfs-site").withProperties(emrfsProperties)
)
.withInstances(new JobFlowInstancesConfig()
.withEc2KeyName(EC2_KEYPAIR)
....
A full list of EMRFS configuration parameters can be found here
Yes, you have a full documentation here:
http://docs.aws.amazon.com/ElasticMapReduce/latest/API/Welcome.html
You need to authorize connection to your AWS first, than you can configure you application to your needs, using API.
Look also here:
http://docs.aws.amazon.com/ElasticMapReduce/latest/API/CommonParameters.html
http://docs.aws.amazon.com/ElasticMapReduce/latest/API/EmrConfigurations.html
I'm using AWS SDK and Product Advertising support available on getcloudfusion.com. I copied pas.class.php in "services" directory as instructed.
For the following code:
$pas = new AmazonPAS(array(
"key" => "AKIAJ.........",
"secret_key"=> "LFof.................",
"assoc_id" => "736...."
));
I continue to get the error:
PAS_Exception [ 0 ]: No account secret was passed into the constructor, nor was it set in the AWS_SECRET_KEY constant.
But the above works for "AmazonEC2", i.e. I get appropriate XML response or error message.
I'm using ver 1.5 of the SDK.
CloudFusion no longer exists. However, if you still have the old code lying around, it's only compatible with versions of the AWS SDK for PHP before 1.5.
I hope this helps! :)