mirror of https://github.com/grafana/grafana
Merge pull request #6698 from grafana/cloudwatch_configurable_keys
Cloudwatch configurable keys from config page.pull/6750/head
commit
3c662ade8c
@ -0,0 +1,51 @@ |
||||
///<reference path="../../../headers/common.d.ts" />
|
||||
|
||||
import angular from 'angular'; |
||||
import _ from 'lodash'; |
||||
|
||||
export class CloudWatchConfigCtrl { |
||||
static templateUrl = 'partials/config.html'; |
||||
current: any; |
||||
|
||||
accessKeyExist: boolean = false; |
||||
secretKeyExist: boolean = false; |
||||
|
||||
/** @ngInject */ |
||||
constructor($scope) { |
||||
this.current.jsonData.timeField = this.current.jsonData.timeField || '@timestamp'; |
||||
this.current.jsonData.authType = this.current.jsonData.authType || 'credentials'; |
||||
|
||||
for (let key of this.current.encryptedFields) { |
||||
if (key === "accessKey") { |
||||
this.accessKeyExist = true; |
||||
} |
||||
if (key === "secretKey") { |
||||
this.secretKeyExist = true; |
||||
} |
||||
} |
||||
} |
||||
|
||||
resetAccessKey() { |
||||
this.accessKeyExist = false; |
||||
} |
||||
|
||||
resetSecretKey() { |
||||
this.secretKeyExist = false; |
||||
} |
||||
|
||||
authTypes = [ |
||||
{name: 'Access & secret key', value: 'keys'}, |
||||
{name: 'Credentials file', value: 'credentials'}, |
||||
{name: 'ARN', value: 'arn'}, |
||||
]; |
||||
|
||||
indexPatternTypes = [ |
||||
{name: 'No pattern', value: undefined}, |
||||
{name: 'Hourly', value: 'Hourly', example: '[logstash-]YYYY.MM.DD.HH'}, |
||||
{name: 'Daily', value: 'Daily', example: '[logstash-]YYYY.MM.DD'}, |
||||
{name: 'Weekly', value: 'Weekly', example: '[logstash-]GGGG.WW'}, |
||||
{name: 'Monthly', value: 'Monthly', example: '[logstash-]YYYY.MM'}, |
||||
{name: 'Yearly', value: 'Yearly', example: '[logstash-]YYYY'}, |
||||
]; |
||||
} |
||||
|
||||
@ -1,34 +1,57 @@ |
||||
<h3 class="page-heading">CloudWatch details</h3> |
||||
|
||||
<div class="gf-form-group max-width-30"> |
||||
<div class="gf-form"> |
||||
<label class="gf-form-label width-13">Credentials profile name</label> |
||||
<input type="text" class="gf-form-input max-width-18" ng-model='ctrl.current.database' placeholder="default"></input> |
||||
<info-popover mode="right-absolute"> |
||||
Credentials profile name, as specified in ~/.aws/credentials, leave blank for default |
||||
</info-popover> |
||||
</div> |
||||
<div class="gf-form"> |
||||
<label class="gf-form-label width-13">Default Region</label> |
||||
<div class="gf-form-select-wrapper max-width-18 gf-form-select-wrapper--has-help-icon"> |
||||
<select class="gf-form-input" ng-model="ctrl.current.jsonData.defaultRegion" ng-options="region for region in ['ap-northeast-1', 'ap-northeast-2', 'ap-southeast-1', 'ap-southeast-2', 'ap-south-1', 'cn-north-1', 'eu-central-1', 'eu-west-1', 'sa-east-1', 'us-east-1', 'us-east-2', 'us-gov-west-1', 'us-west-1', 'us-west-2']"></select> |
||||
<info-popover mode="right-absolute"> |
||||
Specify the region, such as for US West (Oregon) use ` us-west-2 ` as the region. |
||||
</info-popover> |
||||
</div> |
||||
</div> |
||||
<div class="gf-form"> |
||||
<label class="gf-form-label width-13">Custom Metrics namespace</label> |
||||
<input type="text" class="gf-form-input max-width-18" ng-model='ctrl.current.jsonData.customMetricsNamespaces' placeholder="Namespace1,Namespace2"></input> |
||||
<info-popover mode="right-absolute"> |
||||
Namespaces of Custom Metrics |
||||
</info-popover> |
||||
</div> |
||||
<div class="gf-form"> |
||||
<label class="gf-form-label width-13">Assume Role ARN</label> |
||||
<input type="text" class="gf-form-input max-width-18" ng-model='ctrl.current.jsonData.assumeRoleArn' placeholder="arn:aws:iam:*"></input> |
||||
<info-popover mode="right-absolute"> |
||||
ARN of Assume Role |
||||
</info-popover> |
||||
</div> |
||||
<div class="gf-form"> |
||||
<label class="gf-form-label width-13">Auth Provider</label> |
||||
<select class="gf-form-input gf-max-width-13" ng-model="ctrl.current.jsonData.authType" ng-options="f.value as f.name for f in ctrl.authTypes"></select> |
||||
</div> |
||||
|
||||
<div class="gf-form" ng-show='ctrl.current.jsonData.authType == "credentials"'> |
||||
<label class="gf-form-label width-13">Credentials profile name</label> |
||||
<input type="text" class="gf-form-input max-width-18" ng-model='ctrl.current.database' placeholder="default"></input> |
||||
<info-popover mode="right-absolute"> |
||||
Credentials profile name, as specified in ~/.aws/credentials, leave blank for default |
||||
</info-popover> |
||||
</div> |
||||
<div class="gf-form" ng-show='ctrl.current.jsonData.authType == "keys"'> |
||||
<label class="gf-form-label width-13">Access key </label> |
||||
<label class="gf-form-label width-13" ng-show="ctrl.accessKeyExist">Configured</label> |
||||
<a class="gf-form-button btn btn-danger btn-small" type="submit" ng-click="ctrl.resetAccessKey()" ng-show="ctrl.accessKeyExist">Reset</a> |
||||
<input type="text" |
||||
class="gf-form-input max-width-18" |
||||
ng-hide="ctrl.accessKeyExist" |
||||
ng-model='ctrl.current.secureJsonData.accessKey'></input> |
||||
</div> |
||||
<div class="gf-form" ng-show='ctrl.current.jsonData.authType == "keys"'> |
||||
<label class="gf-form-label width-13">Secret key</label> |
||||
<label class="gf-form-label width-13" ng-show="ctrl.secretKeyExist">Configured</label> |
||||
<a class="btn btn-danger gf-form-button btn-small" type="submit" ng-click="ctrl.resetSecretKey()" ng-show="ctrl.secretKeyExist">Reset</a> |
||||
<input type="text" |
||||
class="gf-form-input max-width-18" |
||||
ng-hide="ctrl.secretKeyExist" |
||||
ng-model='ctrl.current.secureJsonData.secretKey'></input> |
||||
</div> |
||||
<div class="gf-form" ng-show='ctrl.current.jsonData.authType == "arn"'> |
||||
<label class="gf-form-label width-13">Assume Role ARN</label> |
||||
<input type="text" class="gf-form-input max-width-18" ng-model='ctrl.current.jsonData.assumeRoleArn' placeholder="arn:aws:iam:*"></input> |
||||
<info-popover mode="right-absolute"> |
||||
ARN of Assume Role |
||||
</info-popover> |
||||
</div> |
||||
<div class="gf-form"> |
||||
<label class="gf-form-label width-13">Default Region</label> |
||||
<div class="gf-form-select-wrapper max-width-18 gf-form-select-wrapper--has-help-icon"> |
||||
<select class="gf-form-input" ng-model="ctrl.current.jsonData.defaultRegion" ng-options="region for region in ['ap-northeast-1', 'ap-northeast-2', 'ap-southeast-1', 'ap-southeast-2', 'ap-south-1', 'cn-north-1', 'eu-central-1', 'eu-west-1', 'sa-east-1', 'us-east-1', 'us-east-2', 'us-gov-west-1', 'us-west-1', 'us-west-2']"></select> |
||||
<info-popover mode="right-absolute"> |
||||
Specify the region, such as for US West (Oregon) use ` us-west-2 ` as the region. |
||||
</info-popover> |
||||
</div> |
||||
</div> |
||||
<div class="gf-form"> |
||||
<label class="gf-form-label width-13">Custom Metrics namespace</label> |
||||
<input type="text" class="gf-form-input max-width-18" ng-model='ctrl.current.jsonData.customMetricsNamespaces' placeholder="Namespace1,Namespace2"></input> |
||||
<info-popover mode="right-absolute"> |
||||
Namespaces of Custom Metrics |
||||
</info-popover> |
||||
</div> |
||||
</div> |
||||
|
||||
Loading…
Reference in new issue