Skip to content

Commit

Permalink
metric-push-api cloudwatch fixes to get it to run in CODE
Browse files Browse the repository at this point in the history
  • Loading branch information
johnduffell committed Jun 20, 2019
1 parent 1ba316c commit 0bb8b89
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 38 deletions.
40 changes: 3 additions & 37 deletions handlers/metric-push-api/cfn.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ Resources:
Code:
S3Bucket: support-service-lambdas-dist
S3Key: !Sub membership/${Stage}/metric-push-api/metric-push-api.jar
Handler: Handler::apply
Handler: com.gu.metric_push_api.Handler::apply
Environment:
Variables:
Stage: !Ref Stage
Expand Down Expand Up @@ -87,10 +87,10 @@ Resources:
Type: AWS::ApiGateway::Method
Properties:
AuthorizationType: NONE
ApiKeyRequired: true
ApiKeyRequired: false
RestApiId: !Ref MetricPushAPI
ResourceId: !Ref MetricPushProxyResource
HttpMethod: POST
HttpMethod: GET
RequestParameters:
method.request.querystring.identityId: true
Integration:
Expand Down Expand Up @@ -124,40 +124,6 @@ Resources:
RestApiId: !Ref MetricPushAPI
DependsOn: MetricPushMethod

MetricPushAPIKey:
Type: AWS::ApiGateway::ApiKey
Properties:
Description: Key required to call contact merge API
Enabled: true
Name: !Sub metric-push-api-api-key-${Stage}
StageKeys:
- RestApiId: !Ref MetricPushAPI
StageName: !Sub ${Stage}
DependsOn:
- MetricPushAPI
- MetricPushAPIStage

MetricPushUsagePlan:
Type: "AWS::ApiGateway::UsagePlan"
Properties:
UsagePlanName: !Sub metric-push-api-api-usage-plan-${Stage}
ApiStages:
- ApiId: !Ref MetricPushAPI
Stage: !Ref MetricPushAPIStage
DependsOn:
- MetricPushAPI
- MetricPushAPIStage

MetricPushUsagePlanKey:
Type: "AWS::ApiGateway::UsagePlanKey"
Properties:
KeyId: !Ref MetricPushAPIKey
KeyType: API_KEY
UsagePlanId: !Ref MetricPushUsagePlan
DependsOn:
- MetricPushAPIKey
- MetricPushUsagePlan

MetricPushDomainName:
Type: "AWS::ApiGateway::DomainName"
Properties:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ class AWSCloudwatchMetricPutTest extends FlatSpec with Matchers {
)

AwsCloudWatchMetricPut(metricRequest) match {
case Success(value) => println("no checking possible, but hopefully it went into cloudwatch alright")
case Success(value) =>
println("no checking possible, but hopefully it went into cloudwatch alright")
println("see https://eu-west-1.console.aws.amazon.com/cloudwatch/home?region=eu-west-1#metricsV2:graph=~(view~'timeSeries~stacked~false~metrics~(~(~'support-service-lambdas~'EffectsTest~'Stage~'DEV))~region~'eu-west-1);query=~'*7bsupport-service-lambdas*2cStage*7d")
case Failure(exception) => fail("could not send metric to cloudwatch", exception)
}
Expand Down

0 comments on commit 0bb8b89

Please sign in to comment.