is there is a way to update/ add a new widget CloudWatch dashboard using CloudFormation template? - aws-cloudformation

I​ am trying to add lambda function stats to my dashboard using cloudformation but the problem is that the lambda function is created in a different stack than my dashboard which is created after the stack that has the dashboard. so is there is a way to update the dashboard after it was created using cloudformation

Could you try updating the other cloudformation stack just in case right after and see if it helps. Btw you want to try creating cloudformation templates, there's an online tool available called cloudkast. It is an online aws cloudformation template generator.

In CloudFormation, when referencing a resource in another stack, you use the intrinsic function:
Fn::ImportValue in your Dashboard CloudFormation. See the documentation.
A good example of this can be found on the AWS blog - https://aws.amazon.com/premiumsupport/knowledge-center/cloudformation-reference-resource/
{
"Parameters":{
"NetworkStackNameParameter":{
"Type":"String"
}
},
"Resources" : {
"WebServerInstance" : {
"Type" : "AWS::EC2::Instance",
"Properties" : {
"InstanceType" : "t2.micro",
"ImageId" : "ami-a1b23456",
"NetworkInterfaces" : [{
"GroupSet" : [{"Fn::ImportValue" : {"Fn::Sub" :
"${NetworkStackNameParameter}-SecurityGroupID"}}],
"AssociatePublicIpAddress" : "true",
"DeviceIndex" : "0",
"DeleteOnTermination" : "true",
"SubnetId" : {"Fn::ImportValue" : {"Fn::Sub" : "${NetworkStackNameParameter}- SubnetID"}}
}]
}
}
}
The SubnetId above is pulled in from another stack using the ImportValue.
The same can be done for the Lambda when building a dashboard using CloudFormation.

Related

Pre-populated list of availability zone options as parameter for cloudformation template

I would like to present a list of availability zones for a parameters options in a CloudFormation template for the region in the console. Preferably using the Troposphere Python mod.
I see that I would be calling Fn::GetAZs to create a list of availableValues to use as options to the parameter but wondering if there is an example of this already or if it is possible.
So something like this:
template.add_parameter('AZs', AllowedValues= call Fn::GetAZs here some how ... )
I ended up picking the AZs with this instead of using a parameter for user to choose.
AvailabilityZone=Select(0, GetAZs(Ref("AWS::Region"))), ...
It is in the docs - https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/intrinsic-function-reference-getavailabilityzones.html
Equivalent template object looks like this:
"mySubnet" : {
"Type" : "AWS::EC2::Subnet",
"Properties" : {
"VpcId" : {
"Ref" : "VPC"
},
"CidrBlock" : "10.0.0.0/24",
"AvailabilityZone" : {
"Fn::Select" : [
"0",
{
"Fn::GetAZs" : ""
}
]
}
}
}

I want to add custom tag defined in docisign on my document through REST API call in Apex

I want to add AccountName custom tag defined in docusign on my document through REST API call in Apex. Here is my REST API request body
{
"status" : "sent",
"customFields" : {
"textCustomFields" : [ {
"name" : "AccountName",
"show" : "true",
"required" : "False",
"value" : "Test Account",
"customFieldType" : "text"
} ]
}
}
The URL is https://demo.docusign.net/restapi/v2/accounts/'accountId'/envelopes
I use anchor string /txtAccountName1/ which I have added on my document but it does not map to any value of the custom field AccountName related to salesforce object. For the tabs it works fine it successfully maps the signer tag to s1 and date to the d1 but for this custom field it does not map the AccountName custom tag to the anchor string /txtAccountName1/. I have created the custom tag AccountName related to salesforce object and used anchor string as /txtAccountName{r}/. I am writing the code in sandbox and using Docusign Demo Account for the integration.I am not sure about the name used in textCustomField and value I used is the reason for not getting the required result. Though the Rest API request is returning the sucess.
How can I map the AccountName value to the anchorString defined in my document?
You are mixing two things customtab and customfields. CustomFields is the metadata on an envelope, there is no tab for this and you can send text type of list type custom fields, these type of fields are not visible to a signer/recipient and is sent as metadata in an envelope, For details related to CustomFields are available at https://docs.docusign.com/esign/restapi/Envelopes/EnvelopeCustomFields/create/
Now customTab, if you have already defined an account level customTab as "AccountName" then you can add them using REST API using below call like:
{
"textTabs": [{
"tabLabel": "AccountName",
"documentId": "83644555",
"recipientId": "84066562",
"pageNumber": 1,
"value": "AccountName",
"anchorString": "/txtAccountName1/"
}]
}
So before using the Accountlevel custom tab, you need to create it in your DocuSign account from webapp or using API - https://docs.docusign.com/esign/restapi/CustomTabs/CustomTabs/create/, Once it is created then only you can use it in an envelope.
As far as I can tell, you can't pull in the custom tag definition. You need to define the entire tag every time you use it, which means you'll need to use something like this:
"textCustomFields" : [ {
"name" : "AccountName",
"show" : "true",
"required" : "False",
"value" : "Test Account",
"anchorString": "/txtAccountName1/"
"customFieldType" : "text"
} ]

Component reuse in manifest.json file

We are currently building a set of apps, where there is a lot of reuse.
Currently we got it working by using
jQuery.sap.registerModulePath and jQuery.sap.require.
But according to
Using and Nesting Components you should be able to declare your reuse components in the manifest.json file.
I had a look in the SAPUI5 Developer Guide, but couldn't really make it work. As far as i can see I need to add the following:
"sap.App" :{
"embeddedBy" : "../.."
},
"sap.ui5": {
"componentUsages" :{
"<string for my reuse component>" : {
"name" : "<name of the component>"
}
"dependencies" :{
"components" : {
"<namespace of my component>"
}}
Anyone got a working example?
Here is a working example with nested components: https://embed.plnkr.co/e7KS48/
The descriptor attribute componentUsages is available since 1.47.0. Once defined, UI5 takes care of resolving the Component and its module path before rendering the owning ComponentContainer.
ComponentContainer is needed because a Component cannot be placed into the UI without a container. In my example above, the Container is defined declaratively in Home.view.xml with the respective usage property.
<core:ComponentContainer id="containerForChildComponent"
autoPrefixId="true"
settings="{id: 'childComponent'}"
usage="reuseAnotherComponent"
manifest="true"
height="100%"
async="true"
/>
"sap.ui5": {
"componentUsages": {
"reuseAnotherComponent": {
"name": "anotherComponent",
"lazy": false
}
},
"resourceRoots": {
"anotherComponent": "./component_B"
},
// ...
}
As you can see, the resourceRoots can be also defined in the descriptor which could point to other component / app locations.
Example for UI5 apps w/ version below 1.47: https://embed.plnkr.co/ytXZJ9

Creating JWT custom claims in DataPower

Running on DataPower 7.5.2.0
I created a JWT Generator as part of a AAA Policy and it is working fine, I am able to generate, sign and then externally verify the JWT with no issues.
Now I want to add a custom claim to the JWT, so I ticked the box for Custom and then uploaded this Gateway script file:
var claim = {
"result" : {
"user" : "hardcode"
}
};
session.output.write(claim);
and it generates the correct JWT with the user attribute. However when I try to add a second value to it like so:
var claim = {
"result" : {
"user" : "hardcode",
"name" : "myname"
}
};
session.output.write(claim);
I now get this error:
[Error: Required CustomClaim Name or Value field missing] errorMessage: 'Required CustomClaim Name or Value field missing', errorCode: '0x8580005c', errorDescription: 'GatewayScript console log message.', errorSuggestion: 'GatewayScript console log message. Refer to the message for more information.'
Which is the same message I got before I realized I had to set the output to result from the InfoCenter's vague documentation.
How do I add multiple custom claims in the JWT Generator Gateway script??
It would appear that DataPower only allows you to add a single custom claim, so you just need to make that a complex object like so:
var claim = {
"result" : {
"claim" : {
"user" : "hardcode",
"one" : true,
"clientId" : "asdf-asdf-asdf",
"endpoint" : "http://192.168.142:8080/member/ws"
}
}
};
session.output.write(claim);
This then generates the correct JWT with a nest claim.
eyJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJhcGljIiwic3ViIjoiYWRtaW4iLCJleHAiOjE0ODIyNjU5ODQsImlhdCI6MTQ4MjI2MjM4NCwianRpIjoiZDhjNTE1ZDEtZmVjMS00ZGVmLThiNDctZmYzY2E2OWVjOWRiIiwibm9uY2UiOiJtN2lVZlBqTCIsImF1ZCI6ImlkMSIsImNsYWltIjp7InVzZXIiOiJmcmVkIiwib25lIjp0cnVlLCJjbGllbnRJZCI6ImFzZGYtYXNkZi1hc2RmIiwiZW5kcG9pbnQiOiJodHRwOi8vMTkyLjE2OC4xNDI6ODA4MC9tZW1iZXIvd3MifX0.viakwnM5bhhmGIn0QmDJTmsWCuIciO2BOdUVyxYpsFA

SAPUI5 list is not auto-growing

I have a UI5 List which has the following attributes
growing="true"
growingTreshold="50"
growingScrollToLoad="true"
This list is inside a fragment which I include into my view. It used to work pretty well with my old project but unfortunatly since I refactored everything and included SAPUI5 Routing it doesn´t work anymore.
Now if I scroll down it shows me a [More] list item which shows the next 50 entries. Funny about that is, that I get an console error when I click on more stating
Uncaught Error: The segment {id} is required.
I guess this means the inhability of the list to auto-grow is somehow related to my new routing. The components I use look like this
{
pattern : "",
name : navigation.Constants.MyEvents,
view : navigation.Constants.MyEvents,
viewId : navigation.Constants.MyEvents,
targetAggregation : "pages",
targetControl : "idAppControl",
subroutes : [
{
pattern : "{id}",
name : navigation.Constants.EventDetailFragment,
view : navigation.Constants.EventDetailFragment
}
]
}
Does anyone now how to solve this problem? So far I couldn´t find anything related to my problem.
When navigating to the new page in your routing pass in the {id} parameter. i.e
this.getRouter().navTo("yourNewPage", {
from: currentView,
id: passedinHere
}, false);
Not having that is whats tripping up your code.