Ansible - Create JSON output by merging facts - ansible

I am trying to create a JSON output from an Ansible playbook that will be sent to a 3rd party system via file or RabbitMQ. The issue I am having is creating the JSON file/body to send as output.
Environment:
Ansible: 2.10.17
JSON input file: 'Cannot change the format of the input file'
Logical process:
Receive a JSON input file => working
Convert JSON input file to a fact (JSON_input) => working
Search through the a directory and find any folder (bucket) not already
listed (var_client_buckets_diff_state_current)=> working
Create new fact which consist of [input file + var_client_buckets_diff_state_current] (create json file structure for new fact) => not
working
Send the new fact to 3rd party => not attempted yet
What has been attempted:
Tried to use the 'update_fact' with indicies => this seemed not to
work and was intended for updating an existing variable within the
fact
Tried to use the 'set_fact' + [item] => not what I expected
Input_file:
{
"siteIdentifier": "site1",
"configurations": [
{
"tenantName": "patcorp",
"keypairConfigurations": [
{
"accessKey": "key1",
"secretKey": "kjjhgghfdgf765ghdf",
"port": "60008",
"mountPath": "/tmp/mnt/scoutfs/patcorp",
"buckets": [
{
"bucketName": "bucket1",
"settings": {
"status": "OK"
}
},
{
"bucketName": "bucket2",
"settings": {
"status": "PENDING-DELETION"
}
}
]
}
]
},
{
"tenantName": "mattcorp",
"keypairConfigurations": [
{
"accessKey": "key3",
"secretKey": "jhgf785tkjjhg",
"port": "60010",
"mountPath": "/tmp/mnt/scoutfs/mattcorp",
"buckets": [
{
"bucketName": "bucket10",
"settings": {
"status": "OK"
}
},
{
"bucketName": "bucket11",
"settings": {
"status": "PENDING-DELETION"
}
}
]
}
]
}
]
}
Playbook:
---
- name: debug_playbook
hosts:
- localhost
gather_facts: true
vars:
var_client_buckets_diff_state_current: ['/tmp/mnt/scoutfs/mattcorp/bucket12', '/tmp/mnt/scoutfs/mattcorp/bucket22', '/tmp/mnt/scoutfs/patcorp/bucket07']
fact_json_updated: []
tasks:
## Find collections path via ansible.cfg
- name: debug_read_collections_path
ansible.builtin.debug:
msg: "{{ lookup('config', 'COLLECTIONS_PATHS') }}"
run_once: true
register: reg_debug_read_collections_path
## Read JSON file to create stdout
- name: cat_scoutam_client_master_assignments_raw
ansible.builtin.shell:
cmd: cat ./files/scoutam_client_master_assignments_2.json
run_once: true
delegate_to: localhost
register: reg_scoutam_client_master_assignments_raw
## Convert JSON input file into fact
- name: fact_scoutam_client_master_assignments
ansible.builtin.set_fact:
fact_scoutam_client_master_assignments: "{{ reg_scoutam_client_master_assignments_raw.stdout | from_json }}"
run_once: true
delegate_to: localhost
# - name: debug_scoutam_client_tenant_ids
# debug:
# msg: "{{ fact_scoutam_client_master_assignments | json_query(jmesquery) }}"
# vars:
# jmesquery: 'configurations[*].tenantName'
# run_once: true
# delegate_to: localhost
# register: reg_debug_scoutam_client_tenant_ids
## Create duplicate fact file with only diffs found from 'var_client_buckets_diff_state_current'
- name: create json file structure for new fact
ansible.builtin.set_fact:
fact_json_new:
siteIdentifier:
configurations:
- {tenantName: "{{ var_tenantName }}", keypairConfigurations: [{accessKey: , secretKey: , port: , mountPath: , buckets: [{bucketName: "{{ var_bucketName }}", settings: {status: }}] }]}
vars:
var_tenantName: "{{ item.split('/')[4] }}" ## take 'item' and find tenant name
var_bucketName: "{{ item.split('/')[5] }}" ## take 'item' and find bucket name
loop: "{{ var_client_buckets_diff_state_current }}" ## loop through buckets not within input file
register: reg_fact_json_new
## Create new JSON file (input file + any new buckets found )
- name: combine fact
ansible.builtin.set_fact:
fact_json_updated: "{{ fact_json_updated + item }}"
loop: "{{ reg_fact_json_new.results | json_query('[*].ansible_facts.fact_json_new') }}"
- name: debug fact - fact_json_updated
debug:
var: fact_json_updated
## End of playbook message
- name: "debug_playbook_{{ ansible_play_name }}_completion"
ansible.builtin.debug:
msg: "Playbook {{ playbook_dir }}/{{ ansible_play_name }} has finished."
...
Output from [create json file structure for new fact, combine fact]
TASK [combine fact] ************************************************************************************************************************************************************************************************************
task path: /app/ansible/ansible_linux_playbooks/playbooks/TEST_debug_facts_playbook/debug_playbook.yml:70
Thursday 28 October 2021 10:06:50 -0400 (0:00:00.078) 0:00:01.417 ******
ok: [localhost] => (item={'siteIdentifier': None, 'configurations': [{'tenantName': 'mattcorp', 'keypairConfigurations': [{'accessKey': None, 'secretKey': None, 'port': None, 'mountPath': None, 'buckets': [{'bucketName': 'bucket12', 'settings': {'status': None}}]}]}]}) => {
"ansible_facts": {
"fact_json_updated": [
{
"configurations": [
{
"keypairConfigurations": [
{
"accessKey": null,
"buckets": [
{
"bucketName": "bucket12",
"settings": {
"status": null
}
}
],
"mountPath": null,
"port": null,
"secretKey": null
}
],
"tenantName": "mattcorp"
}
],
"siteIdentifier": null
}
]
},
"ansible_loop_var": "item",
"changed": false,
"item": {
"configurations": [
{
"keypairConfigurations": [
{
"accessKey": null,
"buckets": [
{
"bucketName": "bucket12",
"settings": {
"status": null
}
}
],
"mountPath": null,
"port": null,
"secretKey": null
}
],
"tenantName": "mattcorp"
}
],
"siteIdentifier": null
}
}
ok: [localhost] => (item={'siteIdentifier': None, 'configurations': [{'tenantName': 'mattcorp', 'keypairConfigurations': [{'accessKey': None, 'secretKey': None, 'port': None, 'mountPath': None, 'buckets': [{'bucketName': 'bucket22', 'settings': {'status': None}}]}]}]}) => {
"ansible_facts": {
"fact_json_updated": [
{
"configurations": [
{
"keypairConfigurations": [
{
"accessKey": null,
"buckets": [
{
"bucketName": "bucket12",
"settings": {
"status": null
}
}
],
"mountPath": null,
"port": null,
"secretKey": null
}
],
"tenantName": "mattcorp"
}
],
"siteIdentifier": null
},
{
"configurations": [
{
"keypairConfigurations": [
{
"accessKey": null,
"buckets": [
{
"bucketName": "bucket22",
"settings": {
"status": null
}
}
],
"mountPath": null,
"port": null,
"secretKey": null
}
],
"tenantName": "mattcorp"
}
],
"siteIdentifier": null
}
]
},
"ansible_loop_var": "item",
"changed": false,
"item": {
"configurations": [
{
"keypairConfigurations": [
{
"accessKey": null,
"buckets": [
{
"bucketName": "bucket22",
"settings": {
"status": null
}
}
],
"mountPath": null,
"port": null,
"secretKey": null
}
],
"tenantName": "mattcorp"
}
],
"siteIdentifier": null
}
}
ok: [localhost] => (item={'siteIdentifier': None, 'configurations': [{'tenantName': 'patcorp', 'keypairConfigurations': [{'accessKey': None, 'secretKey': None, 'port': None, 'mountPath': None, 'buckets': [{'bucketName': 'bucket07', 'settings': {'status': None}}]}]}]}) => {
"ansible_facts": {
"fact_json_updated": [
{
"configurations": [
{
"keypairConfigurations": [
{
"accessKey": null,
"buckets": [
{
"bucketName": "bucket12",
"settings": {
"status": null
}
}
],
"mountPath": null,
"port": null,
"secretKey": null
}
],
"tenantName": "mattcorp"
}
],
"siteIdentifier": null
},
{
"configurations": [
{
"keypairConfigurations": [
{
"accessKey": null,
"buckets": [
{
"bucketName": "bucket22",
"settings": {
"status": null
}
}
],
"mountPath": null,
"port": null,
"secretKey": null
}
],
"tenantName": "mattcorp"
}
],
"siteIdentifier": null
},
{
"configurations": [
{
"keypairConfigurations": [
{
"accessKey": null,
"buckets": [
{
"bucketName": "bucket07",
"settings": {
"status": null
}
}
],
"mountPath": null,
"port": null,
"secretKey": null
}
],
"tenantName": "patcorp"
}
],
"siteIdentifier": null
}
]
},
"ansible_loop_var": "item",
"changed": false,
"item": {
"configurations": [
{
"keypairConfigurations": [
{
"accessKey": null,
"buckets": [
{
"bucketName": "bucket07",
"settings": {
"status": null
}
}
],
"mountPath": null,
"port": null,
"secretKey": null
}
],
"tenantName": "patcorp"
}
],
"siteIdentifier": null
}
}
TASK [debug fact - reg_fact_json_updated] **************************************************************************************************************************************************************************************
task path: /app/ansible/ansible_linux_playbooks/playbooks/TEST_debug_facts_playbook/debug_playbook.yml:77
Thursday 28 October 2021 10:06:50 -0400 (0:00:00.100) 0:00:01.518 ******
ok: [localhost] => {
"fact_json_updated": [
{
"configurations": [
{
"keypairConfigurations": [
{
"accessKey": null,
"buckets": [
{
"bucketName": "bucket12",
"settings": {
"status": null
}
}
],
"mountPath": null,
"port": null,
"secretKey": null
}
],
"tenantName": "mattcorp"
}
],
"siteIdentifier": null
},
{
"configurations": [
{
"keypairConfigurations": [
{
"accessKey": null,
"buckets": [
{
"bucketName": "bucket22",
"settings": {
"status": null
}
}
],
"mountPath": null,
"port": null,
"secretKey": null
}
],
"tenantName": "mattcorp"
}
],
"siteIdentifier": null
},
{
"configurations": [
{
"keypairConfigurations": [
{
"accessKey": null,
"buckets": [
{
"bucketName": "bucket07",
"settings": {
"status": null
}
}
],
"mountPath": null,
"port": null,
"secretKey": null
}
],
"tenantName": "patcorp"
}
],
"siteIdentifier": null
}
]
}
Expected output JSON:
{
"siteIdentifier": "mas1-sos07",
"configurations": [
{
"tenantName": "patcorp",
"keypairConfigurations": [
{
"accessKey": "key1",
"secretKey": "kjjhgghfdgf765ghdf",
"port": "60008",
"mountPath": "/tmp/mnt/scoutfs/patcorp",
"buckets": [
{
"bucketName": "bucket1",
"settings": {
"status": "OK"
}
},
{
"bucketName": "bucket2",
"settings": {
"status": "PENDING-DELETION"
}
},
{
"bucketName": "bucket07",
"settings": {
"status": null
}
}
]
}
]
},
{
"tenantName": "mattcorp",
"keypairConfigurations": [
{
"accessKey": "key3",
"secretKey": "jhgf785tkjjhg",
"port": "60010",
"mountPath": "/tmp/mnt/scoutfs/mattcorp",
"buckets": [
{
"bucketName": "bucket10",
"settings": {
"status": "OK"
}
},
{
"bucketName": "bucket11",
"settings": {
"status": "PENDING-DELETION"
}
},
{
"bucketName": "bucket12",
"settings": {
"status": null
}
},
{
"bucketName": "bucket22",
"settings": {
"status": null
}
}
]
}
]
}
]
}

Related

Laravel groupBy when date does not exist

I'm running the code:
DowntimeHistoryMonitoring::whereDate('created_at', '<=', now())->get(['id', 'created_at'])->groupBy(function ($item){
return $item->created_at->format('Y-m-d');
});
Which returns:
{
"2022-11-30": [
{
"id": "507a3832-c9d3-4baf-b6a8-ff8100c59897",
"created_at": "2022-11-30T13:06:42.000000Z"
},
{
"id": "507a3832-c9d3-4baf-b6a8-ff8100c59897",
"created_at": "2022-11-30T14:06:42.000000Z"
}
],
"2022-11-29": [
{
"id": "507a3832-c9d3-4baf-b6a8-ff8100c59897",
"created_at": "2022-11-29T13:06:42.000000Z"
}
]
}
How can I do so that I get an empty result if I don't find records, and defined by a limit within the groupBy. Example with a limit of 5:
{
"2022-11-30": [
{
"id": "507a3832-c9d3-4baf-b6a8-ff8100c59897",
"created_at": "2022-11-30T13:06:42.000000Z"
},
{
"id": "507a3832-c9d3-4baf-b6a8-ff8100c59897",
"created_at": "2022-11-30T14:06:42.000000Z"
}
],
"2022-11-29": [
{
"id": "507a3832-c9d3-4baf-b6a8-ff8100c59897",
"created_at": "2022-11-29T13:06:42.000000Z"
}
],
"2022-11-28": [
],
"2022-11-27": [
],
"2022-11-26": [
],
}
What should I do?

Google GA4 batchRunReports when API doesn't have records throw 500 (Internal Server Error)

https://developers.google.com/analytics/devguides/reporting/data/v1/rest/v1alpha/TopLevel/batchRunReports
Request :
{
"entity": {
"propertyId": "XXXXXXXX"
},
"requests": [
{
"entity": {
"propertyId": "XXXXXXXX"
},
"dimensions": [
{
"name": "date"
},
{
"name": "dateHour"
},
{
"name": "firstUserCampaignName"
}
],
"metrics": [
{
"name": "sessions"
}
],
"dateRanges": [
{
"startDate": "2021-04-06",
"endDate": "2021-04-07"
}
],
"metricAggregations": [
"TOTAL"
],
"dimensionFilter": {
"andGroup": {
"expressions": [
{
"filter": {
"fieldName": "medium",
"stringFilter": {
"matchType": "EXACT",
"value": "Test"
}
}
}
]
}
},
"orderBys": [
{
"desc": true,
"metric": {
"metricName": "sessions"
}
},
{
"desc": false,
"dimension": {
"dimensionName": "dateHour"
}
}
],
"keepEmptyRows": true
}
]
}
Response:
{
"error": {
"code": 500,
"message": "Internal error encountered.",
"status": "INTERNAL"
}
}
But if remove following property from request:
"metricAggregations": [
"TOTAL"
],
I am able to see following response where there is not rows :
{
"reports": [
{
"metricHeaders": [
{
"name": "sessions",
"type": "TYPE_INTEGER"
}
],
"metadata": {},
"dimensionHeaders": [
{
"name": "date"
},
{
"name": "dateHour"
},
{
"name": "firstUserCampaignName"
}
],
"kind": "analyticsData#runReport"
}
],
"kind": "analyticsData#batchRunReports"
}
Any idea how to prevent 500 internal server error in this case ?
This error block google API call for an hour.
Furqan, there seems to be an issue with the Data API where a call using metricAggregations is failing in case the generated report is empty. In the meantime, to workaround this error, you can modify a query so that the resulting report contains more than 0 rows.

Move a key to a value into a list of dict in Ansible

I'm trying to transform keys of the items "datacenter_clusters" to a key/value pair in itself.
This will also to loop through the following list of dict :
"list_of_dict": [
{
"datacenter": "DC_A",
"datacenter_clusters": {
"CLUSTER_ALPHA": {
"datacenter": "DC_A",
"cluster_info_1": "xxxxxx",
"cluster_info_2": true,
"hosts": [
{
"folder": "/path/to/host-1",
"name": "hostname-1"
},
{
"folder": "/path/to/host-2",
"name": "hostname-2"
}
},
"CLUSTER_BETA": {
"datacenter": "DC_A",
"cluster_info_1": "yyyyyyy",
"cluster_info_2": false,
}
}
"vcenter": "vcenter-1"
},
{
"datacenter": "DC_B",
"datacenter_clusters": {
"CLUSTER_OMEGA": {
"datacenter": "DC_B",
"cluster_info_1": "aaaaaaaa",
"cluster_info_2": true,
},
"CLUSTER_ZETA": {
"datacenter": "DC_A",
"cluster_info_1": "bbbbbbbbbb",
"cluster_info_2": false,
}
}
"vcenter": "vcenter-2"
}
]
and add the new key/value pair "cluster_name":"<KEY_OF_PARENT_ELEMENT>" thus transforming the dict "datacenter_clusters" to a list.
The expected result should look like :
"list_of_dict": [
{
"datacenter": "DC_A",
"datacenter_clusters": [
{
"cluster_name": "CLUSTER_ALPHA",
"datacenter": "DC_A",
"cluster_info_1": "xxxxxx",
"cluster_info_2": true,
"hosts": [
{
"folder": "/path/to/host-1",
"name": "hostname-1"
},
{
"folder": "/path/to/host-2",
"name": "hostname-2"
}
]
},
{
"cluster_name": "CLUSTER_ALPHA",
"datacenter": "DC_A",
"cluster_info_1": "yyyyyyy",
"cluster_info_2": false,
}
]
"vcenter": "vcenter-1"
},
{
"datacenter": "DC_B",
"datacenter_clusters": [
{
"cluster_name": "CLUSTER_OMEGA"
"datacenter": "DC_B",
"cluster_info_1": "aaaaaaaa",
"cluster_info_2": true,
},
{
"cluster_name": "CLUSTER_ZETA"
"datacenter": "DC_A",
"cluster_info_1": "bbbbbbbbbb",
"cluster_info_2": false,
}
]
"vcenter": "vcenter-2"
}
]
I tried to combine what I found in this link with "with_subelements" but I couldn't loop through a list of dicts, I could only loop through a simple dict or a simple list or a list of lists.
Any help would be much appreciated

not able to parse the ansible output

I am not able to parse ansible folwing output. trying to get the ip address.
I am trying to get ip address of azure vm, to get the ip. I am using the azure_rm_networkinterface_facts module, in this module I am feeding the nic name, which stored in used the diet.
Here is my output, which i want to parse.
ok: [
localhost
]=>(item={
'value': [
u'datamover-nic10'
],
'key': u'data-mover'
})=>{
"ansible_facts": {
"azure_networkinterfaces": [
{
"etag": "W/\"08842209-be15-1144f26\"",
"id": "/subscriptions/1cf78a5c-5a30--c52c2d3d21b6/resourceGroups/DEVT/providers/Microsoft.Network/networkInterfaces/datamover-nic10",
"location": "westus",
"name": "datamover-nic10",
"properties": {
"dnsSettings": {
"appliedDnsServers": [
],
"dnsServers": [
],
"internalDomainNameSuffix": "3endvnfzb.dx.internal.cloudapp.net"
},
"enableAcceleratedNetworking": false,
"enableIPForwarding": false,
"ipConfigurations": [
{
"etag": "W/\"088421144f26\"",
"id": "/subscriptions/1cf78a52c2d3d21b6/resourceGroups/DEVT/providers/Microsoft.Network/networkInterfaces/datamover-nic10/ipConfigurations/ip1",
"name": "ip1",
"properties": {
"primary": true,
"privateIPAddress": "10.172.240.11",
"privateIPAddressVersion": "IPv4",
"privateIPAllocationMethod": "Static",
"provisioningState": "Succeeded",
"subnet": {
"id": "/subscriptions/1cf78a5c-5ac2d3d21b6/resourceGroups/DEVT/providers/Microsoft.Network/virtualNetworks/vNetOne/subnets/vmsubnet"
}
}
}
],
"macAddress": "00-0D-3A-36-B3-5C",
"networkSecurityGroup": {
"id": "/subscriptions/1cf78ad3d21b6/resourceGroups/DEVT/providers/Microsoft.Network/networkSecurityGroups/datamover-nsg"
},
"primary": true,
"provisioningState": "Succeeded",
"resourceGuid": "03114",
"virtualMachine": {
"id": "/subscriptions/1cf7d3d21b6/resourceGroups/DEVT/providers/Microsoft.Compute/virtualMachines/datamover"
}
},
"tags": {
"component": "datamover",
"provider": "B50E5F"
},
"type": "Microsoft.Network/networkInterfaces"
}
]
},
"changed": false,
"item": {
"key": "data-mover",
"value": [
"datamover-nic10"
]
}
}ok: [
localhost
]=>(item={
'value': [
u'database-nic00'
],
'key': u'database'
})=>{
"ansible_facts": {
"azure_networkinterfaces": [
{
"etag": "W/\"60bfd8c17323612\"",
"id": "/subscriptions/1cf72d3d21b6/resourceGroups/DEVT/providers/Microsoft.Network/networkInterfaces/database-nic00",
"location": "westus",
"name": "database-nic00",
"properties": {
"dnsSettings": {
"appliedDnsServers": [
],
"dnsServers": [
],
"internalDomainNameSuffix": "3wjfzb.dx.internal.cloudapp.net"
},
"enableAcceleratedNetworking": false,
"enableIPForwarding": false,
"ipConfigurations": [
{
"etag": "W/\"603612\"",
"id": "/subscriptions/1c2d3d21b6/resourceGroups/DEVT/providers/Microsoft.Network/networkInterfaces/database-nic00/ipConfigurations/ip1",
"name": "ip1",
"properties": {
"primary": true,
"privateIPAddress": "10.172.240.4",
"privateIPAddressVersion": "IPv4",
"privateIPAllocationMethod": "Static",
"provisioningState": "Succeeded",
"subnet": {
"id": "/subscriptions/1c3d21b6/resourceGroups/DEVT/providers/Microsoft.Network/virtualNetworks/vNetOne/subnets/vmsubnet"
}
}
},
{
"etag": "W/\"60b3612\"",
"id": "/subscriptions/1cfd3d21b6/resourceGroups/DEVT/providers/Microsoft.Network/networkInterfaces/database-nic00/ipConfigurations/ip2",
"name": "ip2",
"properties": {
"primary": false,
"privateIPAddress": "10.172.0.6",
"privateIPAddressVersion": "IPv4",
"privateIPAllocationMethod": "Static",
"provisioningState": "Succeeded",
"subnet": {
"id": "/subscriptions/1d3d21b6/resourceGroups/DEVT/providers/Microsoft.Network/virtualNetworks/vNetOne/subnets/vmsubnet"
}
}
}
],
"macAddress": "00-0D-3A-36-BC-FB",
"networkSecurityGroup": {
"id": "/subscriptions/1cf52c2d3d21b6/resourceGroups/ImcSite-UPAASDEVT/providers/Microsoft.Network/networkSecurityGroups/database-nsg"
},
"primary": true,
"provisioningState": "Succeeded",
"resourceGuid": "4d2fd4441e3c",
"virtualMachine": {
"id": "/subscriptions/1cf7d3d21b6/resourceGroups/DEVT/providers/Microsoft.Compute/virtualMachines/database-vm0"
}
},
"tags": {
"component": "database",
"provider": "B52B9A0E5F"
},
"type": "Microsoft.Network/networkInterfaces"
}
]
},
"changed": false,
"item": {
"key": "database",
"value": [
"database-nic00"
]
}
}
I am trying to parse and get 10.172.240.11 and 10.172.240.4 address from the output using the following method. Can you please someone help me on this?
- debug: msg=" {{ item.value[0] }}"
with_dict:
- "{{ vm_net_intf }}"
I expect to print 10.172.240.11 and 10.172.240.4 ip address in debug
With the last part of the ansible_facts the play below below
tasks:
- debug:
msg: "{{ item.properties.ipConfigurations|
json_query('[].properties.privateIPAddress') }}"
loop: "{{ ansible_facts.azure_networkinterfaces }}"
gives (abridged):
"msg": [
"10.172.240.4",
"10.172.0.6"
]

Cloudformation stack CREATE_FAILED for ApiGateway::Method with no status reason

If I remove the RestAPI + related resources, the stack succeeds. I'm not sure how to get an error message to see why it is failing with this configuration.
Here's the JSON for the resources that are failing:
{
"RestAPI":{
"Type":"AWS::ApiGateway::RestApi",
"Properties":{
"Name":"FD-API"
}
},
"RestAPIResourceFDImage":{
"Type":"AWS::ApiGateway::Resource",
"Properties":{
"RestApiId":{
"Ref":"RestAPI"
},
"ParentId":{
"Fn::GetAtt":[
"RestAPI",
"RootResourceId"
]
},
"PathPart":"{image}"
},
"DependsOn": ["RestAPI"]
},
"RestAPIMethodGetProperties":{
"Type":"AWS::ApiGateway::Method",
"Properties":{
"AuthorizationType":"NONE",
"ResourceId":{
"Ref":"RestAPIResourceFDImage"
},
"HttpMethod":"GET",
"Integration":{
"Type":"AWS",
"Credentials": {
"Fn::GetAtt": [
"RoleFDApiGateway",
"Arn"
]
},
"IntegrationHttpMethod":"POST",
"PassthroughBehavior": "NEVER",
"Uri":{
"Fn::Join":[
"",
[
"arn:aws:apigateway:",
{
"Ref":"AWS::Region"
},
":lambda:path/2015-03-31/functions/",
{
"Fn::GetAtt":[
"FunctionFDLambda",
"Arn"
]
},
"/invocations"
]
]
},
"RequestTemplates": {
"application/json": {
"Fn::Join": [
"",
[
"{ \"key\": \"$input.params('image')\", \"bucket\": \"",
{
"Ref": "FDBucket"
},
"\" }"
]
]
}
}
}
},
"DependsOn": ["RestAPIResourceFDImage"]
},
"ReatAPIDeploymentFD": {
"Type": "AWS::ApiGateway::Deployment",
"Properties": {
"RestApiId": {"Ref": "RestAPI"},
"StageName": "v1"
},
"DependsOn": ["RestAPIMethodGetProperties"]
}
}

Resources