Cloudformation SNS template validation error - aws-cloudformation

I am trying to create sns subscription but I am getting template validation error.
'MySNSTopic' is the Logical ID of the cloudformation stack called testsnstopic.
Is this correct. Can anyone explain what value I should give for 'Ref' here
"TopicArn" : {
"Ref": "MySNSTopic"
}
Template validation error:
Template format error: Unresolved resource dependencies [MySNSTopic] in the Resources block of the template
code:
{
"Resources": {
"MySubscription" : {
"Type" : "AWS::SNS::Subscription",
"Properties" : {
"Endpoint" : "test#abc.com",
"Protocol" : "email",
"TopicArn" : {
"Ref": "MySNSTopic"
}
}
}
}
}

To use properties across different stacks, you need to explicitly export the values on the one end and import into the other stack.
In your case you would propably need something like this:
Stack: sns-test
{
"Resources": {
"MySNSTopic": {
"Type": "AWS::SNS::Topic"
}
},
"Outputs": {
"MySNSTopicOutput": {
"Description": "SNS topic arn",
"Value": {
"Ref": "MySNSTopic"
},
"Export": {
"Name": {
"Fn::Sub": "${AWS::StackName}-MySNSTopicExport"
}
}
}
}
}
Stack: sns-subscription
{
"Resources": {
"MySubscription": {
"Type": "AWS::SNS::Subscription",
"Properties": {
"Endpoint": "jens#apimeister.com",
"Protocol": "email",
"TopicArn": {
"Fn::ImportValue" : "sns-test-MySNSTopicExport"
}
}
}
}
}

Related

GitHub GraphQL API Filter on custom text field in Project V2

We are using GitHub Projects (Beta). I created a custom text field called oma-project. I want to use the API to filter on this field, e.g., oma-project: "P0001". This should return all issues with this value in the custom field.
Looking at the Projects (beta) docs, I can list the first n issues but I don't know how I can pass a filter based on the value of the custom field.
This is as far as I have gotten.
{
node(id: "nodeid") {
... on ProjectV2 {
items(first: 2) {
nodes {
fieldValues(first: 8) {
nodes {
... on ProjectV2ItemFieldTextValue {
text
field {
... on ProjectV2FieldCommon {
name
}
}
}
}
}
content {
... on Issue {
id
title
}
}
}
}
}
}
}
returns:
{
"data": {
"node": {
"items": {
"nodes": [
{
"fieldValues": {
"nodes": [
{},
{},
{},
{
"text": "Retrieve Notes via OData",
"field": {
"name": "Title"
}
},
{},
{
"text": "P9999",
"field": {
"name": "OMA Project"
}
}
]
},
"content": {
"id": "I_kwDOFT-pvM5AZNLm",
"title": "Retrieve Notes via OData"
}
},
{
"fieldValues": {
"nodes": [
{},
{},
{
"text": "Capex Approval Type",
"field": {
"name": "Title"
}
},
{},
{},
{
"text": "P0708",
"field": {
"name": "OMA Project"
}
}
]
},
"content": {
"id": "I_kwDOFT-pvM5K85HZ",
"title": "Capex Approval Type"
}
}
]
}
}
}
}
I'm having the same issue when working on a GitHub action to move a list of items from a status to another status, and it seems currently the API doesn't support ProjectV2 item filtering.
My current workaround is to query all the items from the project and then later filter out the results using jq or JavaScript

FAILURE answer from kie-server (using kie-server-showcase and business-central-workbench-showcase)

I am testing business-central with kie-server both running in docker, both are "showcase" versions. I've made project in business-central with "Cow" model (pic) and decision table (pic) for it. Build & Deploy is successful.
After sending json with request body
{
"commands:": [
{
"insert": {
"object": {
"Cow": {
"name": "cow1",
"age": 11
}
},
"out-identifier": "Cow",
"return-object": true
}
},
{
"fire-all-rules": {}
}
]
}
to endpoint
http://localhost:8180/kie-server/services/rest/server/containers/instances/Cow
receiving an error:
{
"type": "FAILURE",
"msg": "Bad request, no commands to be executed - either wrong format or no data",
"result": null
}
Is there anything that I am doing wrong? Why my request doesn't proceed?
I think in your request you need the canonical class name com.axaukraine.Cow, but you are using just the simple name Cow.
{
"commands:": [
{
"insert": {
"object": {
"com.axaukraine.Cow": {
"name": "cow1",
"age": 11
}
},
"out-identifier": "Cow",
"return-object": true
}
},
{
"fire-all-rules": {}
}
]
}

Gentics Mesh - Multilanguage support - Cross language in a list of node - GraphQL query

Gentics Mesh Version : v1.5.1
Intro:
Let suppose we have schema A with a field of type: list and list type: node and allowed schemas: B. (see (1)).
An instance of B node has been created (b1-EN) in language en and (b1-DE) in de.
An instance of B node has been created (b2-EN) in languages en.
An instance of A node has been created (a1-DE) in language de and b1-DE and b2-EN are added in the node list (Bs) of a1.
As result, when selecting de language in the Gentics Mesh CMS, Node a1-DE (de) has a list of 2 nodes b1-DE, b2-EN.
When the following GraphQL query is applied :
{
node(path: "/a1-DE") {
... on A {
path
uuid
availableLanguages
fields {
Bs {
... on B {
path
fields {
id
}
}
}
}
}
}
}
The result is :
{
"data": {
"node": {
"path": "/a1-DE",
"uuid": "30dfd534cdee40dd8551e6322c6b1518",
"availableLanguages": [
"de"
],
"fields": {
"Bs": [
{
"path": "/b1-DE",
"fields": {
"id": "b1-DE"
}
},
{
"path": null,
"fields": null
}
]
}
}
}
}
Question:
Why the result is not showing the b2-EN node in the list of nodes ? Is the query wrong ? What I would like to get as result is the default language version of the node (b2-EN) because the b2-DE is not contributed yet. so the expected result :
{
"data": {
"node": {
"path": "/a1-DE",
"uuid": "30dfd534cdee40dd8551e6322c6b1518",
"availableLanguages": [
"de"
],
"fields": {
"Bs": [
{
"path": "/b1-DE",
"fields": {
"id": "b1-DE"
}
},
{
"path": "/b2-EN",
"fields": {
"id": "b2-EN"
}
}
]
}
}
}
}
In the documentation (2):
The fallback to the configured default language will be applied if no other matching content found be found. Null will be returned if this also fails.
Can someone enlighten me ?
(1): Schema
{
"name": "A",
"container": false,
"autoPurge": false,
"displayField": "id",
"segmentField": "id",
"urlFields": [
"id"
],
"fields": [
{
"name": "Bs",
"type": "list",
"label": "Bs",
"required": false,
"listType": "node",
"allow": [
"B"
]
},
{
"name": "id",
"type": "string",
"label": "id",
"required": true
}
]
}
(2) https://getmesh.io/docs/graphql/#_multilanguage_support
There are some known issues and inconsistent behaviour when loading nodes via GraphQL. See this issue: https://github.com/gentics/mesh/issues/971
In your case, the queried list of nodes will always be in the configured default language (in mesh.yml). In your case this seems to be de. This is why the English-only node yields no result.
Until this is fixed, you can work around this issue by loading all languages of the node list:
{
node(path: "/a1-DE") {
... on A {
path
uuid
availableLanguages
fields {
Bs {
... on B {
languages {
path
language
fields {
id
}
}
}
}
}
}
}
}
You will the contents of all languages of the node list. This means that you will have to filter for the desired language in your code after receiving the response.

How do I add custom queries in GraphQL using Strapi?

I'm using graphQL to query a MongoDB database in React, using Strapi as my CMS. I'm using Apollo to handle the GraphQL queries. I'm able to get my objects by passing an ID argument, but I want to be able to pass different arguments like a name.
This works:
{
course(id: "5eb4821d20c80654609a2e0c") {
name
description
modules {
title
}
}
}
This doesn't work, giving the error "Unknown argument \"name\" on field \"course\" of type \"Query\"
{
course(name: "course1") {
name
description
modules {
title
}
}
}
From what I've read, I need to define a custom query, but I'm not sure how to do this.
The model for Course looks like this currently:
"kind": "collectionType",
"collectionName": "courses",
"info": {
"name": "Course"
},
"options": {
"increments": true,
"timestamps": true
},
"attributes": {
"name": {
"type": "string",
"unique": true
},
"description": {
"type": "richtext"
},
"banner": {
"collection": "file",
"via": "related",
"allowedTypes": [
"images",
"files",
"videos"
],
"plugin": "upload",
"required": false
},
"published": {
"type": "date"
},
"modules": {
"collection": "module"
},
"title": {
"type": "string"
}
}
}
and the
Any help would be appreciated.
Referring to Strapi GraphQL Query API
You can use where with the query courses to filter your fields. You will get a list of courses instead of one course
This should work:
{
courses(where: { name: "course1" }) {
name
description
modules {
title
}
}
}

CloudFormation - Access Output of Parent Stack in Child Nested stack

I have a master Cloudformation template which invokes two child templates. I have my first template run and the Outputs captured in the Outputs section of the resource. I have given lot of tries in using the ChildStack01 Output values in the Second Template which is nested and I am not sure why I get Template format error: Unresolved resource dependencies [XYZ] in the Resources block of the template. Here is my master template.
{
"AWSTemplateFormatVersion": "2010-09-09",
"Resources": {
"LambdaStack": {
"Type": "AWS::CloudFormation::Stack",
"Properties": {
"TemplateURL": "https://s3.amazonaws.com/bucket1/cloudformation/Test1.json",
"TimeoutInMinutes": "60"
}
},
"PermissionsStack": {
"Type": "AWS::CloudFormation::Stack",
"Properties": {
"TemplateURL": "https://s3.amazonaws.com/bucket1/cloudformation/Test2.json",
"Parameters": {
"LambdaTest": {
"Fn::GetAtt": ["LambdaStack", "Outputs.LambdaTest"]
}
},
"TimeoutInMinutes": "60"
}
}
}
}
Here is my Test1.json Template
{
"Resources": {
"LambdaTestRes": {
"Type": "AWS::Lambda::Function",
"Properties": {
"Description": "Testing AWS cloud formation",
"FunctionName": "LambdaTest",
"Handler": "lambda_handler.lambda_handler",
"MemorySize": 128,
"Role": "arn:aws:iam::3423435234235:role/lambda_role",
"Runtime": "python2.7",
"Timeout": 300,
"Code": {
"S3Bucket": "bucket1",
"S3Key": "cloudformation/XYZ.zip"
}
}
}
},
"Outputs": {
"LambdaTest": {
"Value": {
"Fn::GetAtt": ["LambdaTestRes", "Arn"]
}
}
}
}
Here is My Test2.json which has to use the output of Test1.json.
{
"Resources": {
"LambdaPermissionLambdaTest": {
"Type": "AWS::Lambda::Permission",
"Properties": {
"Action": "lambda:invokeFunction",
"FunctionName": {
"Ref": "LambdaTest"
},
"Principal": "apigateway.amazonaws.com",
"SourceArn": {
"Fn::Join": ["", ["arn:aws:execute-api:", {
"Ref": "AWS::Region"
}, ":", {
"Ref": "AWS::AccountId"
}, ":", {
"Ref": "TestAPI"
}, "/*"]]
}
}
}
},
"Parameters": {
"LambdaTest": {
"Type": "String"
}
}
}
It is not enough to just have output, you need to export that output.
Look here: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-stack-exports.html
So you need something like:
"Outputs": {
"LambdaTest": {
"Value": {
"Fn::GetAtt": ["LambdaTestRes", "Arn"]
}
"Export": {
"Name": "LambdaTest"
}
}
}
You have two unresolved Ref resource dependencies in Test2.json, one to LambdaTest and one to TestAPI.
For LambdaTest, it looks like you're trying to pass this as a parameter from the parent stack, but you haven't specified it as an input Parameter in the child Test2.json template. Add an entry in Test2.json's Parameters section, like this:
"Parameters": {
"LambdaTest": {
"Type": "String"
}
},
Regarding TestAPI, this reference doesn't seem to appear anywhere else in your templates, so you should either specify this as a fixed string directly, or add another input Parameter in your Test2.json stack (see above) and then provide it from the parent stack.
The error is coming from test1.json(LambdaStack).
Logical ID
An identifier for the current output. The logical ID must be alphanumeric (a-z, A-Z, 0-9) and unique within the template.
It seems you have two logical ID with the same name "LambdaTest", one in resource section and other in output section.

Categories