Adding Lambda#edge includebody field in cloudfront using cloudformation template? - aws-cloudformation

I am trying to add Lambda#Edge association in cloudfront using cloudformation. As per aws docs they had only two fields like EventType and LambdaFunctionARN . But i want to add IncludeBody in cloudformation so that my Lambda#Edge will read the body of the request . When i try to add IncludeBody in cloudformation it is saying error like invalid property.
"LambdaFunctionAssociations":
[
{
"EventType": "origin-response",
"IncludeBody":"true" -- Invalid property error
"LambdaFunctionARN": "arn:aws:lambda:us-east-1:134952096518:function:LambdaEdge:1"
}
]
So, can't i add this through cloudformation . Or i need to do it manually from console ?
Any help is appreciated
Thanks

According to AWS docs, there is an IncludeBody property for LambdaFunctionAssociations. But they also say that it can only be used for "viewer-request" and "origin-request" EventTypes. It looks like you have an "origin-response" EventType, so IncludeBody shouldn't be applicable here. Yet, in the official CloudFormation reference, there is no mention of IncludeBody. So I can only guess that CloudFormation is missing this feature right now and you may only be able to set IncludeBody via the API.

Related

Azure Data Factory Webhook body problems

So I'm experiencing some issues in Azure Data Factory.
I have a standard pipeline where I'm trying to implement a webhook for later callbacks, but the body for the webhook post does not seem to be behaving.
(In advance: sorry for the image URLs -> I'm not reputable enough to post images)
So here is what I've typed into the "Body" of the Webhook service: https://imagizer.imageshack.com/img922/3765/ApbiRN.jpg
Then I verify that the template looks correct:
https://imagizer.imageshack.com/img924/5448/vN82Vp.jpg
And finally I debug the pipeline only to find this as output from the webhook: https://imagizer.imageshack.com/img923/3697/AEDzOT.jpg
As you can see it's grabbing a {"Key":"Value"} from somewhere.
Now I've saved the pipeline; I've published the pipeline; I've restarted ADF.. Still.
So the first issue is that I'm not able to send the body that I want.
The second issue is that I'd like to parameterize the body (when this is cleared up):
{
"key1":"#{pipeline().parameters.param1}",
"key2":"#{pipeline().parameters.param2}",
"key3":"#{pipeline().parameters.param3}"
}
I've not been able to solve that last one either, so if any kind souls would be so kind.. much obliged!
Edit: In addition I've not been able to spot the "callBackUri" that the documentation promises: https://learn.microsoft.com/en-us/azure/data-factory/control-flow-webhook-activity
Any insights into that issue as well?
I tried many times and finally succeeded.
In your case, you can use the expression as follow:
#json(concat(concat('{"key1":"',pipeline().parameters.param1,'",'),concat('"key2":"',pipeline().parameters.param2,'",'),concat('"key3":"',pipeline().parameters.param3,'"}')))
The result is as follow:
First, we need to concatenate the query string.
Then we need to use #json() to convert the string type to json type.

Azure DataFactory V2: Use SecureString Parameter in dynamic content

I have a secure string parameter in data fatory
According to another post this is the way to access said parameter
#{pipeline().parameters.ChassisSqlUsername.value}
This use to and still give a validation error within the dynamic content window:
However the pipeline worked like this without issue. This validation error did not block publishing.
Asof today I can no longer publish if that validation error is present
How do I get around this?
Refer it in this way:
#{pipeline().parameters.ChassisSqlUsername}
It will work.
I don't know why the syntax of ADF is so terrible.
#{json(string(pipeline().parameters.ChassisSqlUsername)).value}

How to add Message Attributes to SNS Publish from API Gateway Integration Request

I can find formats for this using the CLI
aws sns publish --topic-arn arn:aws:sns:us-west-2:111111111111:test
--message "Testing the CLI"
--subject "From the CLI" --message-attributes "{\"somename\":
{\"DataType\":\"String\",\"StringValue\":\"somevalue\"}}"
But what I can't find (or figure out) is how to do this from the Integration Request on an API Gateway.
I believe it needs to be done as Query Parameters of the Integration Request, but the syntax is not the same as adding Message Attributes for SQS. I tested that by using a parameter naming notation along the lines of this example:
MessageBody=This+is+a+test+message
MessageAttribute.1.Name=test_attribute_name_1
MessageAttribute.1.Value.StringValue=test_attribute_value_1
MessageAttribute.1.Value.DataType=String
I also tried:
MessageAttributes '{"store":{"DataType":"String","StringValue":"example_corp"}}'
So far can't get it working, any help is much appreciated.
After thorough research into the AWS docs, I found that there is no accurate documentation of setting up SNS Publish MessageAttributes in an API Gateway Resource Method as URL Query String Parameters.
Based on the partial syntax example they give here: https://docs.aws.amazon.com/sns/latest/api/API_Publish.html, I was then able to throw things at it until something stuck.
This is the proper dot notation syntax and parameters you need to use:
MessageAttributes.entry.1.Name = "Attribute1"
MessageAttributes.entry.1.Value.DataType = 'String'
MessageAttributes.entry.1.Value.StringValue = 'Test'
Where "Name" and "DataType" are required.
Cheers!

Invoking JIRA Rest API to create an issue containing a locked custom fields like Epic Name

I'm trying to create an Epic Issue in JIRA using the REST API.
There is a field called "Epic Name", which is required and locked.
When I submit the following JSON
URL: https://jira:443/jira/rest/api/latest/issue
{"fields":{"project":{"key":"TEST"},"issuetype":{"name":"Epic"},"summary":"TestSummary","Epic Name":"TestName"}}
The Response is:
Http Error : 400{"errorMessages":[],"errors":{"Epic Name":"Field 'Epic Name' cannot be set. It is not on the appropriate screen, or unknown."}}
What is wrong, since in the screen Epic Name is there and required (obviously, since it is a required attribute). What could be the problem?
Thanks
The problem is not that the field is not on the screen but that for JIRA API, the field name Epic Name is invalid/unknown. The actual ID of that field is customfield_10016 which you have to put in the query. The value should be the Issue Key for that specific Epic instead of just a name.
{
"fields": {
//other data
"customfield_10016": "PROJECTKEY-69"
}
}
I tried with customfield_10016 but it didn't work for me.
I have researched more about the same and got to know the custom field may differ for JIRA instance.
We can get custom field for our JIRA insatnce and project using below API and use it - http://<JIRA_URL>/rest/api/2/issue/createmeta?projectKeys=<ProjectKey>&issuetypeNames=<IssueType>&expand=projects.issuetypes.fields

Apigility content validator - enable to fetch service validator

I was following the tutorials on https://apigility.org/documentation/content-validation/basic-usage. But, when I tried to inject the input filter service AddressBook\V1\Rest\Contact\Validator in the ContactResource, I get the following error:
Zend\ServiceManager\Exception\ServiceNotFoundException
File:
/Users/.../src/apigility-tutorials/vendor/zendframework/zendframework/library/Zend/ServiceManager/ServiceManager.php:529
Message:
Zend\ServiceManager\ServiceManager::get was unable to fetch or create an instance for AddressBook\V1\Rest\Contact\Validator
I am not sure if it's an issue with apigility itself, this is why i'm asking if the example shown in the link above actually works when using dependency injection. Thanks
Got it. According to the zf-content-validation doc, the input filter is registered through Zend\InputFilter\InputFilterPluginManager which means I have to get the InputFilterManager service first then get the Contact input filter service as follows:
$inputFilter =
$serviceLocator->get('InputFilterManager')
->get('AddressBook\V1\Rest\Contact\Validator');
Thanks for looking into it.