I have task which checks all kibana spaces, and if some kibana spaces doesn't exist it creates it
Here is my ansible code
- name: get all kibana spaces
uri:
url: '{{ kibana_url }}/api/spaces/space'
method: GET
force_basic_auth: yes
url_username: elastic
url_password: "{{elastic_ca_pass }}"
register: spaces_result
and here is a output of spaces.result variable ( all kibana spaces that exist )
"color": "#aabbcc",
"description": "tajikistan kibana space",
"disabledFeatures": [
"timelion",
"canvas",
"maps",
"Metrics",
"logs",
"apm",
"Security",
"uptime",
"advancedSettings",
"machineLearning",
"ingestManager"
],
"id": "tajikistan",
"initials": "MK",
"name": "tajikistan"
},
{
"color": "#aabbcc",
"description": "uzbekistan kibana space",
"disabledFeatures": [
"timelion",
"canvas",
"maps",
"Metrics",
"logs",
"apm",
"Security",
"uptime",
"advancedSettings",
"machineLearning",
"ingestManager"
],
"id": "uzbekistan",
"initials": "MK",
"name": "uzbekistan"
}
],
so we have a 2 Kibana spaces ( tajikistan and uzbekistan )
then the next task about to create uzbekistan space
- name: create uzbekistan kibana space
uri:
url: '{{ kibana_url }}/api/spaces/space'
method: POST
body:
{"id":"uzbekistan","name":"uzbekistan","description":"uzbekistan kibana space","color":"#aabbcc","initials":"MK","disabledFeatures":["timelion","canvas","maps","Metrics","logs","apm", "Security","uptime","advancedSettings", "machineLearning", "ingestManager"]}
body_format: json
force_basic_auth: yes
headers:
kbn-xsrf: 'true'
Content-Type: 'application/json'
url_username: elastic
url_password: " {{ elastic_ca_pass }}"
when:
- '"uzbekistan" not in spaces_result.json'
so this task will execute only if uzbekistan not in spaces_result variable but it execute why?
ASK [../roles/elasticsearch_nopci_efk_users : create uzbekistan kibana space] ***********************************************************
fatal: [loges-prod-01-uv01]: FAILED! => {"cache_control": "private, no-cache, no-store, must-revalidate", "changed": false, "connection": "close", "content": "{\"statusCode\":409,\"error\":\"Conflict\",\"message\":\"A space with the identifier uzbekistan already exists.\"}", "content_length": "99", "content_type": "application/json; charset=utf-8", "date": "Thu, 08 Apr 2021 09:13:51 GMT", "elapsed": 0, "json": {"error": "Conflict", "message": "A space with the identifier ibank already exists.", "statusCode": 409},
so why is it exeucte?
Related
I am trying to create a contact point in grafana for pagerduty using grafana API.
Tried with the help of these URLS: AlertProvisioning HTTP_API
API call reference
YAML reference of data changed to JSON and tried this way, the YAML reference
But getting error as
{"message":"invalid object specification: type should not be an empty string","traceID":"00000000000000000000000000000000"}
My API code below, replaced with dummy integration key for security.
curl -X POST --insecure -H "Authorization: Bearer XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" -H "Content-Type: application/json" -d '{
"contactPoints": [
{
"orgId": 1,
"name": "test1",
"receivers": [
{
"uid": "test1",
"type": "pagerduty",
"settings": {
"integrationKey": "XXXXXXXXXXXXXXXX",
"severity": "critical",
"class": "ping failure",
"component": "Grafana",
"group": "app-stack",
"summary": "{{ `{{ template \"default.message\" . }}` }}"
}
}
]
}
]
},
"overwrite": false
}' http://XXXXXXXXXXXXXXXX.us-east-2.elb.amazonaws.com/api/v1/provisioning/contact-points
I would recommend to enable Grafana swagger UI. You will see POST /api/v1/provisioning/contact-points model there:
Example:
{
"disableResolveMessage": false,
"name": "webhook_1",
"settings": {},
"type": "webhook",
"uid": "my_external_reference"
}
I have a cloudfront distribution that is working fine with an S3 origin.
After adding a second origin, I also add a new cache behaviour so I would get:
first.domain.com: goes to the first origin (via the default * cache behaviour path)
first.domain.com/elsewhere: goes to the new origin (via a new elsewhere/* cache behaviour path)
I feel something maybe wrong or missing, but can't tell from the docs what it could be.
After reading these answers:
One
Two
I can't still figure what is not working. I enabled the S3 logs but they can take hours to update.
Any help is appreciated!
The error I get after hitting the second URL is:
"response": {
"status": 403,
"statusText": "",
"httpVersion": "http/2.0",
"headers": [
{
"name": "status",
"value": "403"
},
{
"name": "content-type",
"value": "application/xml"
},
{
"name": "date",
"value": "Fri, 17 Aug 2018 03:28:54 GMT"
},
{
"name": "server",
"value": "AmazonS3"
},
{
"name": "x-cache",
"value": "Error from cloudfront"
},
{
"name": "via",
"value": "1.1 275132367c30f17c9825826491390fe3.cloudfront.net (CloudFront)"
},
{
"name": "x-amz-cf-id",
"value": "Ag_JzYYNMVJLMlz9Dd8yDgS1qDCRFlihzlCauDXOE0-fojAPQLQNQQ=="
}
It would seem that the dist has no access, but I did the same OAID as with the first origin, I checked the bucket permissions allow the OAID, and the first origin is working fine.
Maybe it's some slow propagation issue about adding an S3 origin?
I'm trying to proxy an S3 bucket configured as a website from an API Gateway endpoint. I configured an endpoint successfully using the console, but I am unable to recreate the configuration using Cloudformation.
After lots of trial and error and guessing, I've come up with the following CF stack template that gets me pretty close:
Resources:
Api:
Type: 'AWS::ApiGateway::RestApi'
Properties:
Name: ApiDocs
Resource:
Type: 'AWS::ApiGateway::Resource'
Properties:
ParentId: !GetAtt Api.RootResourceId
RestApiId: !Ref Api
PathPart: '{proxy+}'
RootMethod:
Type: 'AWS::ApiGateway::Method'
Properties:
HttpMethod: ANY
ResourceId: !GetAtt Api.RootResourceId
RestApiId: !Ref Api
AuthorizationType: NONE
Integration:
IntegrationHttpMethod: ANY
Type: HTTP_PROXY
Uri: 'http://my-bucket.s3-website-${AWS::Region}.amazonaws.com/'
PassthroughBehavior: WHEN_NO_MATCH
IntegrationResponses:
- StatusCode: 200
ProxyMethod:
Type: 'AWS::ApiGateway::Method'
Properties:
HttpMethod: ANY
ResourceId: !Ref Resource
RestApiId: !Ref Api
AuthorizationType: NONE
RequestParameters:
method.request.path.proxy: true
Integration:
CacheKeyParameters:
- 'method.request.path.proxy'
RequestParameters:
integration.request.path.proxy: 'method.request.path.proxy'
IntegrationHttpMethod: ANY
Type: HTTP_PROXY
Uri: 'http://my-bucket.s3-website-${AWS::Region}.amazonaws.com/{proxy}'
PassthroughBehavior: WHEN_NO_MATCH
IntegrationResponses:
- StatusCode: 200
Deployment:
DependsOn:
- RootMethod
- ProxyMethod
Type: 'AWS::ApiGateway::Deployment'
Properties:
RestApiId: !Ref Api
StageName: dev
Using this template I can successfully get the root of the bucket website, but the proxy resource gives me a 500:
curl -i https://abcdef.execute-api.eu-west-1.amazonaws.com/dev/index.html
HTTP/1.1 500 Internal Server Error
Content-Type: application/json
Content-Length: 36
Connection: keep-alive
Date: Mon, 11 Dec 2017 16:36:02 GMT
x-amzn-RequestId: 6014a809-de91-11e7-95e4-dda6e24d156a
X-Cache: Error from cloudfront
Via: 1.1 8f6f9aba914cc74bcbbf3c57e10df26a.cloudfront.net (CloudFront)
X-Amz-Cf-Id: TlOCX3eemHfY0aiVk9MLCp4qFzUEn5I0QUTIPkh14o6-nh7YAfUn5Q==
{"message": "Internal server error"}
I have no idea how to debug that 500.
To track down what may be wrong, I've compared the output of aws apigateway get-resource on the resource I created manually in the console (which is working) with the one Cloudformation made (which isn't). The resources look exactly alike. The output of get-method however, is subtly different, and I'm not sure it's possible to make them exactly the same using Cloudformation.
Working method configuration:
{
"apiKeyRequired": false,
"httpMethod": "ANY",
"methodIntegration": {
"integrationResponses": {
"200": {
"responseTemplates": {
"application/json": null
},
"statusCode": "200"
}
},
"passthroughBehavior": "WHEN_NO_MATCH",
"cacheKeyParameters": [
"method.request.path.proxy"
],
"requestParameters": {
"integration.request.path.proxy": "method.request.path.proxy"
},
"uri": "http://muybucket.s3-website-eu-west-1.amazonaws.com/{proxy}",
"httpMethod": "ANY",
"cacheNamespace": "abcdefg",
"type": "HTTP_PROXY"
},
"requestParameters": {
"method.request.path.proxy": true
},
"authorizationType": "NONE"
}
Configuration that doesn't work:
{
"apiKeyRequired": false,
"httpMethod": "ANY",
"methodIntegration": {
"integrationResponses": {
"200": {
"responseParameters": {},
"responseTemplates": {},
"statusCode": "200"
}
},
"passthroughBehavior": "WHEN_NO_MATCH",
"cacheKeyParameters": [
"method.request.path.proxy"
],
"requestParameters": {
"integration.request.path.proxy": "method.request.path.proxy"
},
"uri": "http://mybucket.s3-website-eu-west-1.amazonaws.com/{proxy}",
"httpMethod": "ANY",
"requestTemplates": {},
"cacheNamespace": "abcdef",
"type": "HTTP_PROXY"
},
"requestParameters": {
"method.request.path.proxy": true
},
"requestModels": {},
"authorizationType": "NONE"
}
The differences:
The working configuration has responseTemplates set to "application/json": null. As far as I can tell, there's no way to set a mapping explicitly to null using Cloudformation. My CF method instead just has an empty object here.
My CF method has "responseParameters": {},, while the working configuration does not have responseParameters at all
My CF method has "requestModels": {},, while the working configuration does not have requestModels at all
Comparing the two in the console, they are seemingly exactly the same.
I'm at my wits end here: what am I doing wrong? Is this possible to achieve using Cloudformation?
Answer: The above is correct. I had arrived at this solution through a series of steps, and re-applied the template over and over. Deleting the stack and deploying it anew with this configuration had the desired effect.
Can someone help with schemas refs in abao? How to use --schemas option? Here is simple gist https://gist.github.com/SeanSilke/e5a2f7673ad4aa2aa43ba800c9aec31b
I try to run "abao api.raml --schemas fref.json" but got error " Missing/unresolved JSON schema $refs (fref.json) in schema".
By the way the server is mocked by osprey-mock-service.
You need add id field to your JSON schemas.
For run use: abao api.raml --server http://localhost:3000 --schemas=./*.json
Example files:
api.raml
#%RAML 0.8
title: simple API
baseUri: http://localhost:3000
/song:
get:
responses:
200:
body:
application/json:
schema: !include schema.json
example: |
{
"songId": "e29b",
"songTitle": "The song",
"albumId": "18310"
}
fref.json
{
"id": "fref.json",
"type": "string"
}
schema.json
{
"$schema": "http://json-schema.org/draft-03/schema",
"id": "schema.json",
"type": "object",
"properties":{
"songId": {"$ref": "fref.json"}
},
"required": ["songId", "albumId", "songTitle"]
}
I am using WowzaStreamingEngine 4.4.1 at Ubuntu 14.04. I used restful api and created vod application (restful_vod) as in examples, it didn't work didn't stream vod files. That's why, I compare application.xml files of default vod application and restful_vod application. There is a difference between MediaReader properties. Default vod application has no property at there but restful_vod has below:
<MediaReader>
<!-- Properties defined here will override any properties defined in conf/MediaReaders.xml for any MediaReaders loaded by this applications -->
<Properties>
<Property>
<Name>randomAccessReaderClass</Name>
<Value></Value>
<Type>String</Type>
</Property>
</Properties>
</MediaReader>
When I removed randomAccessReaderClass named property, it started to work. I realized mediaReaderRandomAccessReaderClass parameter manage its value at restful api side. But I couldn't find a way to prevent adding it while using restful api. I tried not setting mediaReaderRandomAccessReaderClass value and also setting mediaReaderRandomAccessReaderClass false, null and empty string.
Is there any way to prevent adding it or a default working value for this?
Thanks.
You can set a default mediaReaderRandomAccessReaderClass by setting it as follows:
"mediaReaderRandomAccessReaderClass": ""
In your resulting Application.xml file, the MediaReader container would then be blank, which would indicate that it would use the default value:
<MediaReader>
<!-- Properties defined here will override any properties defined in conf/MediaReaders.xml for any MediaReaders loaded by this applications -->
<Properties>
</Properties>
</MediaReader>
A working REST API command to create a VOD file, for example, would look like this.
curl -X POST --header 'Accept:application/json; charset=utf-8' --header 'Content-type:application/json; charset=utf-8' http://localhost:8087/v2/servers/_defaultServer_/vhosts/_defaultVHost_/applications/testvod -d'
{
"restURI": "http://localhost:8087/v2/servers/_defaultServer_/vhosts/_defaultVHost_/applications/testvod",
"version": "1462342478287",
"name": "testvod",
"appType": "VOD",
"description": "Test VOD via REST.",
"applicationTimeout": 0,
"pingTimeout": 0,
"repeaterQueryString": "",
"clientStreamReadAccess": "*",
"avSyncMethod": "senderreport",
"maxRTCPWaitTime": 12000,
"httpStreamers": [
"cupertinostreaming",
"smoothstreaming",
"sanjosestreaming",
"mpegdashstreaming"
],
"mediaReaderRandomAccessReaderClass": "",
"httpOptimizeFileReads": false,
"mediaReaderBufferSeekIO": false,
"captionLiveIngestType": "",
"vodTimedTextProviders": [
"vodcaptionprovidermp4_3gpp"
],
"securityConfig": {
"restURI": "http://localhost:8087/v2/servers/_defaultServer_/vhosts/_defaultVHost_/applications/testvod/security",
"secureTokenVersion": 0,
"clientStreamWriteAccess": "*",
"publishRequirePassword": true,
"publishPasswordFile": "",
"publishRTMPSecureURL": "",
"publishIPBlackList": "",
"publishIPWhiteList": "",
"publishBlockDuplicateStreamNames": false,
"publishValidEncoders": "",
"publishAuthenticationMethod": "digest",
"playMaximumConnections": 0,
"playRequireSecureConnection": false,
"secureTokenSharedSecret": "",
"secureTokenUseTEAForRTMP": false,
"secureTokenIncludeClientIPInHash": false,
"secureTokenHashAlgorithm": "",
"secureTokenQueryParametersPrefix": "",
"secureTokenOriginSharedSecret": "",
"playIPBlackList": "",
"playIPWhiteList": "",
"playAuthenticationMethod": "none"
},
"streamConfig": {
"restURI": "http://localhost:8087/v2/servers/_defaultServer_/vhosts/_defaultVHost_/applications/testvod/streamconfiguration",
"streamType": "default",
"storageDir": "${com.wowza.wms.context.VHostConfigHome}/content",
"createStorageDir": false,
"storageDirExists": true,
"keyDir": "${com.wowza.wms.context.VHostConfigHome}/keys",
"httpRandomizeMediaName": false
},
"modules": {
"restURI": "http://localhost:8087/v2/servers/_defaultServer_/vhosts/_defaultVHost_/applications/testvod/modules",
"moduleList": [
{
"order": 0,
"name": "base",
"description": "Base",
"class": "com.wowza.wms.module.ModuleCore"
},
{
"order": 1,
"name": "logging",
"description": "Client Logging",
"class": "com.wowza.wms.module.ModuleClientLogging"
},
{
"order": 2,
"name": "flvplayback",
"description": "FLVPlayback",
"class": "com.wowza.wms.module.ModuleFLVPlayback"
},
{
"order": 3,
"name": "ModuleCoreSecurity",
"description": "Core Security Module for Applications",
"class": "com.wowza.wms.security.ModuleCoreSecurity"
}
]
}
}'