Hi,
I am using the cognitect-labs/aws-api to deploy my resources on my AWS account.
However, I have issue with the :Tags. The resource is created but without the tags.
(aws/invoke ec2-client {:op :CreateVpc
:request {:CidrBlock "192.168.0.0/16"
:Tags [{:Key "Name" :Value "my-vpc"}]}})
I tried with CreateSubnet, CreateInternetGateway etc, still the same result.
Am I missing something?According to the docs the CreateVPC API operation doesn't have a "Tags" option. You can check it in the docs site: https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_CreateVpc.html It has something called "TagSpecification" which maybe is what you need? (never used it myself)
You can also run (aws/doc ec2-client :CreateVpc) to see the exact Clojure data structure that the aws-api client expects
The aws/doc or aws/op both show a Tags param:
{:Vpc
{:Tags [:seq-of {:Key string, :Value string}],
:IsDefault boolean,
:InstanceTenancy [:one-of ["default" "dedicated" "host"]],
:CidrBlock string,
...
:VpcId string}}
And when I :DescribeVpcs with Name tag I manually added via the Console, they do show in a :Tags param with same syntax as I tried above.
The aws/doc command shows both the Request and the Response. I can only see Tags in the Response section.
Oh got it:
(aws/invoke ec2-client {:op :CreateVpc
:request {:CidrBlock "192.168.0.0/16"
:TagSpecifications [{:ResourceType "vpc"
:Tags [{:Key "Name" :Value "my-vpc"}]}]}})
You were right, TagSpecification is what I needed. I just had to add the mandatory ResourceType
Thank youGreat!
Is there already a way to easily convert a dynamoDB response map with types to one without?
Which API are you using? There should be methods to marshall and unmarshall dynamodb JSON
https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/modules/_aws_sdk_util_dynamodb.html
Cognitect's api, don't see support for marhsalling
I was looking if something like this https://github.com/ctorrisi/franklin/blob/master/src/franklin/core.clj#L56-L72 was already available
@kouvas I'm not sure what you're after here. What response are you getting and what do you want it to be?
I see amazonica's ddb client supports marhalling
or if you use interop with JS or Java
Hmm this doesnβt look too hard: https://github.com/aws/aws-sdk-js-v3/blob/6d48f1be73d63eeddef4cf10f1b05d313f9e1495/packages/util-dynamodb/src/convertToNative.ts#L12