From 28ef972c9f877d5093de497e99a6fffe1f83cac1 Mon Sep 17 00:00:00 2001 From: ubhatnagar Date: Wed, 23 Sep 2015 22:13:38 +0530 Subject: [PATCH 001/269] Added duplicate feature for variable. --- public/app/features/templating/editorCtrl.js | 8 ++++++++ public/app/features/templating/partials/editor.html | 5 +++++ 2 files changed, 13 insertions(+) diff --git a/public/app/features/templating/editorCtrl.js b/public/app/features/templating/editorCtrl.js index 74157ac3dd8..bd913e28fb5 100644 --- a/public/app/features/templating/editorCtrl.js +++ b/public/app/features/templating/editorCtrl.js @@ -96,6 +96,14 @@ function (angular, _) { } }; + $scope.duplicate = function(variable) { + $scope.current = angular.copy(variable); + $scope.variables.push($scope.current); + $scope.current = $scope.variables[$scope.variables.length - 1]; + $scope.current.name = 'copy_of_'+variable.name; + $scope.updateSubmenuVisibility(); + }; + $scope.update = function() { if ($scope.isValid()) { $scope.runQuery().then(function() { diff --git a/public/app/features/templating/partials/editor.html b/public/app/features/templating/partials/editor.html index 63ecd00adcf..43e2513e618 100644 --- a/public/app/features/templating/partials/editor.html +++ b/public/app/features/templating/partials/editor.html @@ -59,6 +59,11 @@ Edit + + + Duplicate + + From 9cdf0601eba06d63d6ea16698f257d8a8bb01432 Mon Sep 17 00:00:00 2001 From: ubhatnagar Date: Wed, 23 Sep 2015 22:20:38 +0530 Subject: [PATCH 002/269] Removed unnecessary statement. --- public/app/features/templating/editorCtrl.js | 1 - 1 file changed, 1 deletion(-) diff --git a/public/app/features/templating/editorCtrl.js b/public/app/features/templating/editorCtrl.js index bd913e28fb5..09dc300934e 100644 --- a/public/app/features/templating/editorCtrl.js +++ b/public/app/features/templating/editorCtrl.js @@ -99,7 +99,6 @@ function (angular, _) { $scope.duplicate = function(variable) { $scope.current = angular.copy(variable); $scope.variables.push($scope.current); - $scope.current = $scope.variables[$scope.variables.length - 1]; $scope.current.name = 'copy_of_'+variable.name; $scope.updateSubmenuVisibility(); }; From e70b99a706d10eadfb6ef3fc755a4added45cba6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Tue, 29 Sep 2015 18:00:15 +0200 Subject: [PATCH 003/269] poc: influxdb editor v3 test --- .../influxdb/partials/query.editor.html | 83 +++--- .../plugins/datasource/influxdb/query_ctrl.js | 12 +- .../plugins/datasource/influxdb/query_part.js | 161 ++++++++++++ .../datasource/influxdb/query_part_editor.js | 244 ++++++++++++++++++ 4 files changed, 452 insertions(+), 48 deletions(-) create mode 100644 public/app/plugins/datasource/influxdb/query_part.js create mode 100644 public/app/plugins/datasource/influxdb/query_part_editor.js diff --git a/public/app/plugins/datasource/influxdb/partials/query.editor.html b/public/app/plugins/datasource/influxdb/partials/query.editor.html index c9c7203bed7..8263db8e594 100644 --- a/public/app/plugins/datasource/influxdb/partials/query.editor.html +++ b/public/app/plugins/datasource/influxdb/partials/query.editor.html @@ -1,4 +1,4 @@ -
+
  • @@ -48,26 +48,22 @@
  • +
  • + WHERE +
  • +
  • + +
+
-
-
    -
  • - WHERE -
  • -
  • - -
  • -
-
-
    @@ -75,19 +71,11 @@ SELECT
  • - +
  • -
  • - -
  • -
  • - -
  • -
  • - AS -
  • -
  • - +
  • + +
@@ -108,30 +96,29 @@ GROUP BY
  • - time - - -
  • - -
  • - + +
  • + + + + + + + + + + + + + + + + + + + +
      @@ -146,6 +133,8 @@
    + +
    • diff --git a/public/app/plugins/datasource/influxdb/query_ctrl.js b/public/app/plugins/datasource/influxdb/query_ctrl.js index 75dd972fbaa..061a771c623 100644 --- a/public/app/plugins/datasource/influxdb/query_ctrl.js +++ b/public/app/plugins/datasource/influxdb/query_ctrl.js @@ -2,8 +2,10 @@ define([ 'angular', 'lodash', './query_builder', + './query_part', + './query_part_editor', ], -function (angular, _, InfluxQueryBuilder) { +function (angular, _, InfluxQueryBuilder, queryPart) { 'use strict'; var module = angular.module('grafana.controllers'); @@ -17,6 +19,14 @@ function (angular, _, InfluxQueryBuilder) { target.tags = target.tags || []; target.groupBy = target.groupBy || [{type: 'time', interval: 'auto'}]; target.fields = target.fields || [{name: 'value', func: target.function || 'mean'}]; + target.fields[0].parts = [ + queryPart.create('mean', { withDefaultParams: true }), + queryPart.create('derivate', { withDefaultParams: true }), + queryPart.create('math', { withDefaultParams: true }), + queryPart.create('alias', { withDefaultParams: true }), + ]; + + $scope.func = queryPart.create('time', { withDefaultParams: true }); $scope.queryBuilder = new InfluxQueryBuilder(target); diff --git a/public/app/plugins/datasource/influxdb/query_part.js b/public/app/plugins/datasource/influxdb/query_part.js new file mode 100644 index 00000000000..44394a50cdb --- /dev/null +++ b/public/app/plugins/datasource/influxdb/query_part.js @@ -0,0 +1,161 @@ +define([ + 'lodash', + 'jquery' +], +function (_, $) { + 'use strict'; + + var index = []; + var categories = { + Combine: [], + Transform: [], + Calculate: [], + Filter: [], + Special: [] + }; + + function addFuncDef(funcDef) { + funcDef.params = funcDef.params || []; + funcDef.defaultParams = funcDef.defaultParams || []; + + if (funcDef.category) { + funcDef.category.push(funcDef); + } + index[funcDef.name] = funcDef; + index[funcDef.shortName || funcDef.name] = funcDef; + } + + addFuncDef({ + name: 'mean', + category: categories.Transform, + params: [], + defaultParams: [], + }); + + addFuncDef({ + name: 'derivate', + category: categories.Transform, + params: [{ name: "rate", type: "interval", options: ['1s', '10s', '1m', '5min', '10m', '15m', '1h'] }], + defaultParams: ['10s'], + }); + + addFuncDef({ + name: 'time', + category: categories.Transform, + params: [{ name: "rate", type: "interval", options: ['$interval', '1s', '10s', '1m', '5min', '10m', '15m', '1h'] }], + defaultParams: ['$interval'], + }); + + addFuncDef({ + name: 'math', + category: categories.Transform, + params: [{ name: "expr", type: "string"}], + defaultParams: [' / 100'], + }); + + addFuncDef({ + name: 'alias', + category: categories.Transform, + params: [{ name: "name", type: "string"}], + defaultParams: ['alias'], + }); + + _.each(categories, function(funcList, catName) { + categories[catName] = _.sortBy(funcList, 'name'); + }); + + function FuncInstance(funcDef, options) { + this.def = funcDef; + this.params = []; + + if (options && options.withDefaultParams) { + this.params = funcDef.defaultParams.slice(0); + } + + this.updateText(); + } + + FuncInstance.prototype.render = function(metricExp) { + var str = this.def.name + '('; + var parameters = _.map(this.params, function(value, index) { + + var paramType = this.def.params[index].type; + if (paramType === 'int' || paramType === 'value_or_series' || paramType === 'boolean') { + return value; + } + else if (paramType === 'int_or_interval' && $.isNumeric(value)) { + return value; + } + + return "'" + value + "'"; + + }, this); + + if (metricExp) { + parameters.unshift(metricExp); + } + + return str + parameters.join(', ') + ')'; + }; + + FuncInstance.prototype._hasMultipleParamsInString = function(strValue, index) { + if (strValue.indexOf(',') === -1) { + return false; + } + + return this.def.params[index + 1] && this.def.params[index + 1].optional; + }; + + FuncInstance.prototype.updateParam = function(strValue, index) { + // handle optional parameters + // if string contains ',' and next param is optional, split and update both + if (this._hasMultipleParamsInString(strValue, index)) { + _.each(strValue.split(','), function(partVal, idx) { + this.updateParam(partVal.trim(), idx); + }, this); + return; + } + + if (strValue === '' && this.def.params[index].optional) { + this.params.splice(index, 1); + } + else { + this.params[index] = strValue; + } + + this.updateText(); + }; + + FuncInstance.prototype.updateText = function () { + if (this.params.length === 0) { + this.text = this.def.name + '()'; + return; + } + + var text = this.def.name + '('; + text += this.params.join(', '); + text += ')'; + this.text = text; + }; + + return { + create: function(funcDef, options) { + if (_.isString(funcDef)) { + if (!index[funcDef]) { + throw { message: 'Method not found ' + name }; + } + funcDef = index[funcDef]; + } + return new FuncInstance(funcDef, options); + }, + + getFuncDef: function(name) { + return index[name]; + }, + + getCategories: function() { + return categories; + } + }; + +}); diff --git a/public/app/plugins/datasource/influxdb/query_part_editor.js b/public/app/plugins/datasource/influxdb/query_part_editor.js new file mode 100644 index 00000000000..6c1f268a9d1 --- /dev/null +++ b/public/app/plugins/datasource/influxdb/query_part_editor.js @@ -0,0 +1,244 @@ +define([ + 'angular', + 'lodash', + 'jquery', +], +function (angular, _, $) { + 'use strict'; + + angular + .module('grafana.directives') + .directive('influxQueryPartEditor', function($compile, templateSrv) { + + var funcSpanTemplate = '{{func.def.name}}('; + var paramTemplate = ''; + + var funcControlsTemplate = + '
      ' + + '' + + '' + + '' + + '' + + '
      '; + + return { + restrict: 'A', + link: function postLink($scope, elem) { + var $funcLink = $(funcSpanTemplate); + var $funcControls = $(funcControlsTemplate); + var func = $scope.func; + var funcDef = func.def; + var scheduledRelink = false; + var paramCountAtLink = 0; + + function clickFuncParam(paramIndex) { + /*jshint validthis:true */ + + var $link = $(this); + var $input = $link.next(); + + $input.val(func.params[paramIndex]); + $input.css('width', ($link.width() + 16) + 'px'); + + $link.hide(); + $input.show(); + $input.focus(); + $input.select(); + + var typeahead = $input.data('typeahead'); + if (typeahead) { + $input.val(''); + typeahead.lookup(); + } + } + + function scheduledRelinkIfNeeded() { + if (paramCountAtLink === func.params.length) { + return; + } + + if (!scheduledRelink) { + scheduledRelink = true; + setTimeout(function() { + relink(); + scheduledRelink = false; + }, 200); + } + } + + function inputBlur(paramIndex) { + /*jshint validthis:true */ + var $input = $(this); + var $link = $input.prev(); + var newValue = $input.val(); + + if (newValue !== '' || func.def.params[paramIndex].optional) { + $link.html(templateSrv.highlightVariablesAsHtml(newValue)); + + func.updateParam($input.val(), paramIndex); + scheduledRelinkIfNeeded(); + + $scope.$apply($scope.targetChanged); + } + + $input.hide(); + $link.show(); + } + + function inputKeyPress(paramIndex, e) { + /*jshint validthis:true */ + if(e.which === 13) { + inputBlur.call(this, paramIndex); + } + } + + function inputKeyDown() { + /*jshint validthis:true */ + this.style.width = (3 + this.value.length) * 8 + 'px'; + } + + function addTypeahead($input, paramIndex) { + $input.attr('data-provide', 'typeahead'); + + var options = funcDef.params[paramIndex].options; + if (funcDef.params[paramIndex].type === 'int') { + options = _.map(options, function(val) { return val.toString(); }); + } + + $input.typeahead({ + source: options, + minLength: 0, + items: 20, + updater: function (value) { + setTimeout(function() { + inputBlur.call($input[0], paramIndex); + }, 0); + return value; + } + }); + + var typeahead = $input.data('typeahead'); + typeahead.lookup = function () { + this.query = this.$element.val() || ''; + return this.process(this.source); + }; + } + + function toggleFuncControls() { + var targetDiv = elem.closest('.tight-form'); + + if (elem.hasClass('show-function-controls')) { + elem.removeClass('show-function-controls'); + targetDiv.removeClass('has-open-function'); + $funcControls.hide(); + return; + } + + elem.addClass('show-function-controls'); + targetDiv.addClass('has-open-function'); + + $funcControls.show(); + } + + function addElementsAndCompile() { + $funcControls.appendTo(elem); + $funcLink.appendTo(elem); + + _.each(funcDef.params, function(param, index) { + if (param.optional && func.params.length <= index) { + return; + } + + if (index > 0) { + $(', ').appendTo(elem); + } + + var paramValue = templateSrv.highlightVariablesAsHtml(func.params[index]); + var $paramLink = $('' + paramValue + ''); + var $input = $(paramTemplate); + + paramCountAtLink++; + + $paramLink.appendTo(elem); + $input.appendTo(elem); + + $input.blur(_.partial(inputBlur, index)); + $input.keyup(inputKeyDown); + $input.keypress(_.partial(inputKeyPress, index)); + $paramLink.click(_.partial(clickFuncParam, index)); + + if (funcDef.params[index].options) { + addTypeahead($input, index); + } + + }); + + $(')').appendTo(elem); + + $compile(elem.contents())($scope); + } + + function ifJustAddedFocusFistParam() { + if ($scope.func.added) { + $scope.func.added = false; + setTimeout(function() { + elem.find('.graphite-func-param-link').first().click(); + }, 10); + } + } + + function registerFuncControlsToggle() { + $funcLink.click(toggleFuncControls); + } + + function registerFuncControlsActions() { + $funcControls.click(function(e) { + var $target = $(e.target); + if ($target.hasClass('fa-remove')) { + toggleFuncControls(); + $scope.$apply(function() { + $scope.removeFunction($scope.func); + }); + return; + } + + if ($target.hasClass('fa-arrow-left')) { + $scope.$apply(function() { + _.move($scope.functions, $scope.$index, $scope.$index - 1); + $scope.targetChanged(); + }); + return; + } + + if ($target.hasClass('fa-arrow-right')) { + $scope.$apply(function() { + _.move($scope.functions, $scope.$index, $scope.$index + 1); + $scope.targetChanged(); + }); + return; + } + + if ($target.hasClass('fa-question-circle')) { + window.open("http://graphite.readthedocs.org/en/latest/functions.html#graphite.render.functions." + funcDef.name,'_blank'); + return; + } + }); + } + + function relink() { + elem.children().remove(); + + addElementsAndCompile(); + ifJustAddedFocusFistParam(); + registerFuncControlsToggle(); + registerFuncControlsActions(); + } + + relink(); + } + }; + + }); + +}); From 2dc8fcd3be17d03b476c4e994c7288d5a38bf710 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Tue, 29 Sep 2015 21:32:15 +0200 Subject: [PATCH 004/269] poc(influxdb v3 editor): more testing of new influxdb editor approach --- .../influxdb/partials/query.editor.html | 7 ++---- .../plugins/datasource/influxdb/query_ctrl.js | 23 ++++++++++++++----- .../plugins/datasource/influxdb/query_part.js | 7 ++++++ .../datasource/influxdb/query_part_editor.js | 2 -- 4 files changed, 26 insertions(+), 13 deletions(-) diff --git a/public/app/plugins/datasource/influxdb/partials/query.editor.html b/public/app/plugins/datasource/influxdb/partials/query.editor.html index 8263db8e594..9fb39ad5abe 100644 --- a/public/app/plugins/datasource/influxdb/partials/query.editor.html +++ b/public/app/plugins/datasource/influxdb/partials/query.editor.html @@ -65,15 +65,12 @@
      -
      +
      • SELECT
      • -
      • - -
      • -
      • +
      • diff --git a/public/app/plugins/datasource/influxdb/query_ctrl.js b/public/app/plugins/datasource/influxdb/query_ctrl.js index 061a771c623..247205ab39d 100644 --- a/public/app/plugins/datasource/influxdb/query_ctrl.js +++ b/public/app/plugins/datasource/influxdb/query_ctrl.js @@ -18,14 +18,25 @@ function (angular, _, InfluxQueryBuilder, queryPart) { var target = $scope.target; target.tags = target.tags || []; target.groupBy = target.groupBy || [{type: 'time', interval: 'auto'}]; - target.fields = target.fields || [{name: 'value', func: target.function || 'mean'}]; - target.fields[0].parts = [ - queryPart.create('mean', { withDefaultParams: true }), - queryPart.create('derivate', { withDefaultParams: true }), - queryPart.create('math', { withDefaultParams: true }), - queryPart.create('alias', { withDefaultParams: true }), + target.fields = target.fields || [{name: 'value'}]; + target.select = target.select || [[{type: 'field', params: ['value']}]]; + target.select[0] = [ + {type: 'field', params: ['value']}, + {type: 'mean', params: []}, + {type: 'derivate', params: ['10s']}, + {type: 'math', params: ['/ 100']}, + {type: 'alias', params: ['google']}, ]; + $scope.select = _.map(target.select, function(parts) { + return _.map(parts, function(part) { + var partModel = queryPart.create(part.type); + partModel.params = part.params; + partModel.updateText(); + return partModel; + }); + }); + $scope.func = queryPart.create('time', { withDefaultParams: true }); $scope.queryBuilder = new InfluxQueryBuilder(target); diff --git a/public/app/plugins/datasource/influxdb/query_part.js b/public/app/plugins/datasource/influxdb/query_part.js index 44394a50cdb..37433d54951 100644 --- a/public/app/plugins/datasource/influxdb/query_part.js +++ b/public/app/plugins/datasource/influxdb/query_part.js @@ -25,6 +25,13 @@ function (_, $) { index[funcDef.shortName || funcDef.name] = funcDef; } + addFuncDef({ + name: 'field', + category: categories.Transform, + params: [{type: 'field'}], + defaultParams: ['value'], + }); + addFuncDef({ name: 'mean', category: categories.Transform, diff --git a/public/app/plugins/datasource/influxdb/query_part_editor.js b/public/app/plugins/datasource/influxdb/query_part_editor.js index 6c1f268a9d1..fd0dc3e1a6b 100644 --- a/public/app/plugins/datasource/influxdb/query_part_editor.js +++ b/public/app/plugins/datasource/influxdb/query_part_editor.js @@ -16,10 +16,8 @@ function (angular, _, $) { var funcControlsTemplate = '
        ' + - '' + '' + '' + - '' + '
        '; return { From f053b416453cf2ed702e7a4b40a769bd9417417d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Wed, 30 Sep 2015 14:37:27 +0200 Subject: [PATCH 005/269] feat(influxdb editor): more progress --- .../influxdb/partials/query.editor.html | 13 +- .../influxdb/partials/query_part.html | 6 + .../plugins/datasource/influxdb/query_ctrl.js | 42 ++--- .../plugins/datasource/influxdb/query_part.js | 168 ------------------ .../plugins/datasource/influxdb/query_part.ts | 165 +++++++++++++++++ .../datasource/influxdb/query_part_editor.js | 139 +++------------ 6 files changed, 225 insertions(+), 308 deletions(-) create mode 100644 public/app/plugins/datasource/influxdb/partials/query_part.html delete mode 100644 public/app/plugins/datasource/influxdb/query_part.js create mode 100644 public/app/plugins/datasource/influxdb/query_part.ts diff --git a/public/app/plugins/datasource/influxdb/partials/query.editor.html b/public/app/plugins/datasource/influxdb/partials/query.editor.html index 9fb39ad5abe..af40de12302 100644 --- a/public/app/plugins/datasource/influxdb/partials/query.editor.html +++ b/public/app/plugins/datasource/influxdb/partials/query.editor.html @@ -65,22 +65,20 @@
        -
        +
        • SELECT
        • -
        • - - +
        • +
        -
        • -
        • +
        @@ -93,8 +91,7 @@ GROUP BY
      • - - +
      • diff --git a/public/app/plugins/datasource/influxdb/partials/query_part.html b/public/app/plugins/datasource/influxdb/partials/query_part.html new file mode 100644 index 00000000000..0a28bee11f7 --- /dev/null +++ b/public/app/plugins/datasource/influxdb/partials/query_part.html @@ -0,0 +1,6 @@ +
        + + +
        + +{{part.def.name}}() diff --git a/public/app/plugins/datasource/influxdb/query_ctrl.js b/public/app/plugins/datasource/influxdb/query_ctrl.js index 247205ab39d..d4c4a7f6181 100644 --- a/public/app/plugins/datasource/influxdb/query_ctrl.js +++ b/public/app/plugins/datasource/influxdb/query_ctrl.js @@ -10,7 +10,7 @@ function (angular, _, InfluxQueryBuilder, queryPart) { var module = angular.module('grafana.controllers'); - module.controller('InfluxQueryCtrl', function($scope, $timeout, $sce, templateSrv, $q, uiSegmentSrv) { + module.controller('InfluxQueryCtrl', function($scope, templateSrv, $q, uiSegmentSrv) { $scope.init = function() { if (!$scope.target) { return; } @@ -19,25 +19,14 @@ function (angular, _, InfluxQueryBuilder, queryPart) { target.tags = target.tags || []; target.groupBy = target.groupBy || [{type: 'time', interval: 'auto'}]; target.fields = target.fields || [{name: 'value'}]; - target.select = target.select || [[{type: 'field', params: ['value']}]]; - target.select[0] = [ - {type: 'field', params: ['value']}, - {type: 'mean', params: []}, - {type: 'derivate', params: ['10s']}, - {type: 'math', params: ['/ 100']}, - {type: 'alias', params: ['google']}, - ]; + target.select = target.select || [[ + {name: 'field', params: ['value']}, + {name: 'mean', params: []}, + ]]; - $scope.select = _.map(target.select, function(parts) { - return _.map(parts, function(part) { - var partModel = queryPart.create(part.type); - partModel.params = part.params; - partModel.updateText(); - return partModel; - }); - }); + $scope.updateSelectParts(); - $scope.func = queryPart.create('time', { withDefaultParams: true }); + $scope.groupByParts = queryPart.create({name: 'time', params:['$interval']}); $scope.queryBuilder = new InfluxQueryBuilder(target); @@ -89,14 +78,27 @@ function (angular, _, InfluxQueryBuilder, queryPart) { }; $scope.addSelect = function() { - $scope.target.fields.push({name: "select field", func: 'mean'}); + $scope.target.select.push([ + {name: 'field', params: ['value']}, + {name: 'mean', params: []}, + ]); + $scope.updateSelectParts(); }; $scope.removeSelect = function(index) { - $scope.target.fields.splice(index, 1); + $scope.target.select.splice(index, 1); + $scope.updateSelectParts(); $scope.get_data(); }; + $scope.updateSelectParts = function() { + $scope.selectParts = _.map($scope.target.select, function(parts) { + return _.map(parts, function(part) { + return queryPart.create(part); + }); + }); + }; + $scope.changeFunction = function(func) { $scope.target.function = func; $scope.$parent.get_data(); diff --git a/public/app/plugins/datasource/influxdb/query_part.js b/public/app/plugins/datasource/influxdb/query_part.js deleted file mode 100644 index 37433d54951..00000000000 --- a/public/app/plugins/datasource/influxdb/query_part.js +++ /dev/null @@ -1,168 +0,0 @@ -define([ - 'lodash', - 'jquery' -], -function (_, $) { - 'use strict'; - - var index = []; - var categories = { - Combine: [], - Transform: [], - Calculate: [], - Filter: [], - Special: [] - }; - - function addFuncDef(funcDef) { - funcDef.params = funcDef.params || []; - funcDef.defaultParams = funcDef.defaultParams || []; - - if (funcDef.category) { - funcDef.category.push(funcDef); - } - index[funcDef.name] = funcDef; - index[funcDef.shortName || funcDef.name] = funcDef; - } - - addFuncDef({ - name: 'field', - category: categories.Transform, - params: [{type: 'field'}], - defaultParams: ['value'], - }); - - addFuncDef({ - name: 'mean', - category: categories.Transform, - params: [], - defaultParams: [], - }); - - addFuncDef({ - name: 'derivate', - category: categories.Transform, - params: [{ name: "rate", type: "interval", options: ['1s', '10s', '1m', '5min', '10m', '15m', '1h'] }], - defaultParams: ['10s'], - }); - - addFuncDef({ - name: 'time', - category: categories.Transform, - params: [{ name: "rate", type: "interval", options: ['$interval', '1s', '10s', '1m', '5min', '10m', '15m', '1h'] }], - defaultParams: ['$interval'], - }); - - addFuncDef({ - name: 'math', - category: categories.Transform, - params: [{ name: "expr", type: "string"}], - defaultParams: [' / 100'], - }); - - addFuncDef({ - name: 'alias', - category: categories.Transform, - params: [{ name: "name", type: "string"}], - defaultParams: ['alias'], - }); - - _.each(categories, function(funcList, catName) { - categories[catName] = _.sortBy(funcList, 'name'); - }); - - function FuncInstance(funcDef, options) { - this.def = funcDef; - this.params = []; - - if (options && options.withDefaultParams) { - this.params = funcDef.defaultParams.slice(0); - } - - this.updateText(); - } - - FuncInstance.prototype.render = function(metricExp) { - var str = this.def.name + '('; - var parameters = _.map(this.params, function(value, index) { - - var paramType = this.def.params[index].type; - if (paramType === 'int' || paramType === 'value_or_series' || paramType === 'boolean') { - return value; - } - else if (paramType === 'int_or_interval' && $.isNumeric(value)) { - return value; - } - - return "'" + value + "'"; - - }, this); - - if (metricExp) { - parameters.unshift(metricExp); - } - - return str + parameters.join(', ') + ')'; - }; - - FuncInstance.prototype._hasMultipleParamsInString = function(strValue, index) { - if (strValue.indexOf(',') === -1) { - return false; - } - - return this.def.params[index + 1] && this.def.params[index + 1].optional; - }; - - FuncInstance.prototype.updateParam = function(strValue, index) { - // handle optional parameters - // if string contains ',' and next param is optional, split and update both - if (this._hasMultipleParamsInString(strValue, index)) { - _.each(strValue.split(','), function(partVal, idx) { - this.updateParam(partVal.trim(), idx); - }, this); - return; - } - - if (strValue === '' && this.def.params[index].optional) { - this.params.splice(index, 1); - } - else { - this.params[index] = strValue; - } - - this.updateText(); - }; - - FuncInstance.prototype.updateText = function () { - if (this.params.length === 0) { - this.text = this.def.name + '()'; - return; - } - - var text = this.def.name + '('; - text += this.params.join(', '); - text += ')'; - this.text = text; - }; - - return { - create: function(funcDef, options) { - if (_.isString(funcDef)) { - if (!index[funcDef]) { - throw { message: 'Method not found ' + name }; - } - funcDef = index[funcDef]; - } - return new FuncInstance(funcDef, options); - }, - - getFuncDef: function(name) { - return index[name]; - }, - - getCategories: function() { - return categories; - } - }; - -}); diff --git a/public/app/plugins/datasource/influxdb/query_part.ts b/public/app/plugins/datasource/influxdb/query_part.ts new file mode 100644 index 00000000000..7e5dfff3277 --- /dev/null +++ b/public/app/plugins/datasource/influxdb/query_part.ts @@ -0,0 +1,165 @@ +/// + +import _ = require('lodash'); + +var index = []; +var categories = { + Combine: [], + Transform: [], + Calculate: [], + Filter: [], + Special: [] +}; + +class QueryPartDef { + name: string; + params: any[]; + defaultParams: any[]; + + constructor(options: any) { + this.name = options.name; + this.params = options.params; + this.defaultParams = options.defaultParams; + } + + static register(options: any) { + index[options.name] = new QueryPartDef(options); + } +} + +QueryPartDef.register({ + name: 'field', + category: categories.Transform, + params: [{type: 'field'}], + defaultParams: ['value'], +}); + +QueryPartDef.register({ + name: 'mean', + category: categories.Transform, + params: [], + defaultParams: [], +}); + +QueryPartDef.register({ + name: 'derivate', + category: categories.Transform, + params: [{ name: "rate", type: "interval", options: ['1s', '10s', '1m', '5min', '10m', '15m', '1h'] }], + defaultParams: ['10s'], +}); + +QueryPartDef.register({ + name: 'time', + category: categories.Transform, + params: [{ name: "rate", type: "interval", options: ['$interval', '1s', '10s', '1m', '5min', '10m', '15m', '1h'] }], + defaultParams: ['$interval'], +}); + +QueryPartDef.register({ + name: 'math', + category: categories.Transform, + params: [{ name: "expr", type: "string"}], + defaultParams: [' / 100'], +}); + +QueryPartDef.register({ + name: 'alias', + category: categories.Transform, + params: [{ name: "name", type: "string"}], + defaultParams: ['alias'], +}); + +class QueryPart { + part: any; + def: QueryPartDef; + params: any[]; + text: string; + + constructor(part: any) { + this.part = part; + this.def = index[part.name]; + if (!this.def) { + throw {message: 'Could not find query part ' + part.name}; + } + + this.params = part.params || _.clone(this.def.defaultParams); + } + + render(innerExpr: string) { + var str = this.def.name + '('; + var parameters = _.map(this.params, (value, index) => { + + var paramType = this.def.params[index].type; + if (paramType === 'int' || paramType === 'value_or_series' || paramType === 'boolean') { + return value; + } + else if (paramType === 'int_or_interval' && _.isNumber(value)) { + return value; + } + + return "'" + value + "'"; + + }); + + if (innerExpr) { + parameters.unshift(innerExpr); + } + + return str + parameters.join(', ') + ')'; + } + + hasMultipleParamsInString (strValue, index) { + if (strValue.indexOf(',') === -1) { + return false; + } + + return this.def.params[index + 1] && this.def.params[index + 1].optional; + } + + updateParam (strValue, index) { + // handle optional parameters + // if string contains ',' and next param is optional, split and update both + if (this.hasMultipleParamsInString(strValue, index)) { + _.each(strValue.split(','), function(partVal: string, idx) { + this.updateParam(partVal.trim(), idx); + }, this); + return; + } + + if (strValue === '' && this.def.params[index].optional) { + this.params.splice(index, 1); + } + else { + this.params[index] = strValue; + } + + this.part.params = this.params; + this.updateText(); + } + + updateText() { + if (this.params.length === 0) { + this.text = this.def.name + '()'; + return; + } + + var text = this.def.name + '('; + text += this.params.join(', '); + text += ')'; + this.text = text; + } +} + +export = { + create: function(part): any { + return new QueryPart(part); + }, + + getFuncDef: function(name) { + return index[name]; + }, + + getCategories: function() { + return categories; + } +}; diff --git a/public/app/plugins/datasource/influxdb/query_part_editor.js b/public/app/plugins/datasource/influxdb/query_part_editor.js index fd0dc3e1a6b..6cfcda5f4e7 100644 --- a/public/app/plugins/datasource/influxdb/query_part_editor.js +++ b/public/app/plugins/datasource/influxdb/query_part_editor.js @@ -10,33 +10,26 @@ function (angular, _, $) { .module('grafana.directives') .directive('influxQueryPartEditor', function($compile, templateSrv) { - var funcSpanTemplate = '{{func.def.name}}('; var paramTemplate = ''; - - var funcControlsTemplate = - '
        ' + - '' + - '' + - '
        '; - return { - restrict: 'A', + restrict: 'E', + templateUrl: 'app/plugins/datasource/influxdb/partials/query_part.html', + scope: { + part: "=" + }, link: function postLink($scope, elem) { - var $funcLink = $(funcSpanTemplate); - var $funcControls = $(funcControlsTemplate); - var func = $scope.func; - var funcDef = func.def; - var scheduledRelink = false; - var paramCountAtLink = 0; + var part = $scope.part; + var partDef = part.def; + var $paramsContainer = elem.find('.query-part-parameters'); + var $controlsContainer = elem.find('.tight-form-func-controls'); function clickFuncParam(paramIndex) { /*jshint validthis:true */ - var $link = $(this); var $input = $link.next(); - $input.val(func.params[paramIndex]); + $input.val(part.params[paramIndex]); $input.css('width', ($link.width() + 16) + 'px'); $link.hide(); @@ -51,32 +44,16 @@ function (angular, _, $) { } } - function scheduledRelinkIfNeeded() { - if (paramCountAtLink === func.params.length) { - return; - } - - if (!scheduledRelink) { - scheduledRelink = true; - setTimeout(function() { - relink(); - scheduledRelink = false; - }, 200); - } - } - function inputBlur(paramIndex) { /*jshint validthis:true */ var $input = $(this); var $link = $input.prev(); var newValue = $input.val(); - if (newValue !== '' || func.def.params[paramIndex].optional) { + if (newValue !== '' || part.def.params[paramIndex].optional) { $link.html(templateSrv.highlightVariablesAsHtml(newValue)); - func.updateParam($input.val(), paramIndex); - scheduledRelinkIfNeeded(); - + part.updateParam($input.val(), paramIndex); $scope.$apply($scope.targetChanged); } @@ -99,8 +76,8 @@ function (angular, _, $) { function addTypeahead($input, paramIndex) { $input.attr('data-provide', 'typeahead'); - var options = funcDef.params[paramIndex].options; - if (funcDef.params[paramIndex].type === 'int') { + var options = partDef.params[paramIndex].options; + if (partDef.params[paramIndex].type === 'int') { options = _.map(options, function(val) { return val.toString(); }); } @@ -123,114 +100,52 @@ function (angular, _, $) { }; } - function toggleFuncControls() { + $scope.toggleControls = function() { var targetDiv = elem.closest('.tight-form'); if (elem.hasClass('show-function-controls')) { elem.removeClass('show-function-controls'); targetDiv.removeClass('has-open-function'); - $funcControls.hide(); + $controlsContainer.hide(); return; } elem.addClass('show-function-controls'); targetDiv.addClass('has-open-function'); - - $funcControls.show(); - } + $controlsContainer.show(); + }; function addElementsAndCompile() { - $funcControls.appendTo(elem); - $funcLink.appendTo(elem); - - _.each(funcDef.params, function(param, index) { - if (param.optional && func.params.length <= index) { + _.each(partDef.params, function(param, index) { + if (param.optional && part.params.length <= index) { return; } if (index > 0) { - $(', ').appendTo(elem); + $(', ').appendTo($paramsContainer); } - var paramValue = templateSrv.highlightVariablesAsHtml(func.params[index]); - var $paramLink = $('' + paramValue + ''); + var paramValue = templateSrv.highlightVariablesAsHtml(part.params[index]); + var $paramLink = $('' + paramValue + ''); var $input = $(paramTemplate); - paramCountAtLink++; - - $paramLink.appendTo(elem); - $input.appendTo(elem); + $paramLink.appendTo($paramsContainer); + $input.appendTo($paramsContainer); $input.blur(_.partial(inputBlur, index)); $input.keyup(inputKeyDown); $input.keypress(_.partial(inputKeyPress, index)); $paramLink.click(_.partial(clickFuncParam, index)); - if (funcDef.params[index].options) { + if (partDef.params[index].options) { addTypeahead($input, index); } - - }); - - $(')').appendTo(elem); - - $compile(elem.contents())($scope); - } - - function ifJustAddedFocusFistParam() { - if ($scope.func.added) { - $scope.func.added = false; - setTimeout(function() { - elem.find('.graphite-func-param-link').first().click(); - }, 10); - } - } - - function registerFuncControlsToggle() { - $funcLink.click(toggleFuncControls); - } - - function registerFuncControlsActions() { - $funcControls.click(function(e) { - var $target = $(e.target); - if ($target.hasClass('fa-remove')) { - toggleFuncControls(); - $scope.$apply(function() { - $scope.removeFunction($scope.func); - }); - return; - } - - if ($target.hasClass('fa-arrow-left')) { - $scope.$apply(function() { - _.move($scope.functions, $scope.$index, $scope.$index - 1); - $scope.targetChanged(); - }); - return; - } - - if ($target.hasClass('fa-arrow-right')) { - $scope.$apply(function() { - _.move($scope.functions, $scope.$index, $scope.$index + 1); - $scope.targetChanged(); - }); - return; - } - - if ($target.hasClass('fa-question-circle')) { - window.open("http://graphite.readthedocs.org/en/latest/functions.html#graphite.render.functions." + funcDef.name,'_blank'); - return; - } }); } function relink() { - elem.children().remove(); - + $paramsContainer.empty(); addElementsAndCompile(); - ifJustAddedFocusFistParam(); - registerFuncControlsToggle(); - registerFuncControlsActions(); } relink(); From 83052352dc5f310190449153310cdd9bb7863e6b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Wed, 30 Sep 2015 17:16:34 +0200 Subject: [PATCH 006/269] feat(influxdb editor): lots of work on new editor, #2856 --- .../datasource/influxdb/influx_query.ts | 141 ++++++++++++++++++ .../influxdb/partials/query.editor.html | 8 +- .../datasource/influxdb/query_builder.js | 3 +- .../plugins/datasource/influxdb/query_ctrl.js | 77 ++-------- .../plugins/datasource/influxdb/query_part.ts | 80 ++++++---- .../influxdb/specs/influx_query_specs.ts | 36 +++++ .../influxdb/specs/query_builder_specs.ts | 66 ++++---- .../influxdb/specs/query_part_specs.ts | 41 +++++ 8 files changed, 317 insertions(+), 135 deletions(-) create mode 100644 public/app/plugins/datasource/influxdb/influx_query.ts create mode 100644 public/app/plugins/datasource/influxdb/specs/influx_query_specs.ts create mode 100644 public/app/plugins/datasource/influxdb/specs/query_part_specs.ts diff --git a/public/app/plugins/datasource/influxdb/influx_query.ts b/public/app/plugins/datasource/influxdb/influx_query.ts new file mode 100644 index 00000000000..bdc4ffa8e73 --- /dev/null +++ b/public/app/plugins/datasource/influxdb/influx_query.ts @@ -0,0 +1,141 @@ +/// +/// + +import _ = require('lodash'); +import queryPart = require('./query_part'); + +declare var InfluxQueryBuilder: any; + +class InfluxQuery { + target: any; + selectParts: any[]; + groupByParts: any; + queryBuilder: any; + + constructor(target) { + this.target = target; + + target.tags = target.tags || []; + target.groupBy = target.groupBy || [{type: 'time', interval: 'auto'}]; + target.select = target.select || [[ + {name: 'mean', params: ['value']}, + ]]; + + this.updateSelectParts(); + this.groupByParts = [ + queryPart.create({name: 'time', params: ['$interval']}) + ]; + } + + updateSelectParts() { + this.selectParts = _.map(this.target.select, function(parts: any) { + return _.map(parts, function(part: any) { + return queryPart.create(part); + }); + }); + } + + removeSelect(index: number) { + this.target.select.splice(index, 1); + this.updateSelectParts(); + } + + addSelect() { + this.target.select.push([ + {name: 'mean', params: ['value']}, + ]); + this.updateSelectParts(); + } + + private renderTagCondition(tag, index) { + var str = ""; + var operator = tag.operator; + var value = tag.value; + if (index > 0) { + str = (tag.condition || 'AND') + ' '; + } + + if (!operator) { + if (/^\/.*\/$/.test(tag.value)) { + operator = '=~'; + } else { + operator = '='; + } + } + + // quote value unless regex + if (operator !== '=~' && operator !== '!~') { + value = "'" + value + "'"; + } + + return str + '"' + tag.key + '" ' + operator + ' ' + value; + } + + private getGroupByTimeInterval(interval) { + if (interval === 'auto') { + return '$interval'; + } + return interval; + } + + render() { + var target = this.target; + + if (!target.measurement) { + throw "Metric measurement is missing"; + } + + if (!target.fields) { + target.fields = [{name: 'value', func: target.function || 'mean'}]; + } + + var query = 'SELECT '; + var i, y; + for (i = 0; i < this.selectParts.length; i++) { + let parts = this.selectParts[i]; + var selectText = ""; + for (y = 0; y < parts.length; y++) { + let part = parts[y]; + selectText = part.render(selectText); + } + + if (i > 0) { + query += ', '; + } + query += selectText; + } + + var measurement = target.measurement; + if (!measurement.match('^/.*/') && !measurement.match(/^merge\(.*\)/)) { + measurement = '"' + measurement+ '"'; + } + + query += ' FROM ' + measurement + ' WHERE '; + var conditions = _.map(target.tags, (tag, index) => { + return this.renderTagCondition(tag, index); + }); + + query += conditions.join(' '); + query += (conditions.length > 0 ? ' AND ' : '') + '$timeFilter'; + + query += ' GROUP BY'; + for (i = 0; i < target.groupBy.length; i++) { + var group = target.groupBy[i]; + if (group.type === 'time') { + query += ' time(' + this.getGroupByTimeInterval(group.interval) + ')'; + } else { + query += ', "' + group.key + '"'; + } + } + + if (target.fill) { + query += ' fill(' + target.fill + ')'; + } + + target.query = query; + + return query; + } +} + +export = InfluxQuery; diff --git a/public/app/plugins/datasource/influxdb/partials/query.editor.html b/public/app/plugins/datasource/influxdb/partials/query.editor.html index af40de12302..1993c2d7aa9 100644 --- a/public/app/plugins/datasource/influxdb/partials/query.editor.html +++ b/public/app/plugins/datasource/influxdb/partials/query.editor.html @@ -65,7 +65,7 @@
        -
        +
        • SELECT @@ -85,13 +85,13 @@
        -
        +
        • GROUP BY
        • -
        • - +
        • +
        • diff --git a/public/app/plugins/datasource/influxdb/query_builder.js b/public/app/plugins/datasource/influxdb/query_builder.js index 9ab0953b576..84b8b9c692c 100644 --- a/public/app/plugins/datasource/influxdb/query_builder.js +++ b/public/app/plugins/datasource/influxdb/query_builder.js @@ -4,8 +4,9 @@ define([ function (_) { 'use strict'; - function InfluxQueryBuilder(target) { + function InfluxQueryBuilder(target, queryModel) { this.target = target; + this.model = queryModel; if (target.groupByTags) { target.groupBy = [{type: 'time', interval: 'auto'}]; diff --git a/public/app/plugins/datasource/influxdb/query_ctrl.js b/public/app/plugins/datasource/influxdb/query_ctrl.js index d4c4a7f6181..924c7ab77fe 100644 --- a/public/app/plugins/datasource/influxdb/query_ctrl.js +++ b/public/app/plugins/datasource/influxdb/query_ctrl.js @@ -2,10 +2,10 @@ define([ 'angular', 'lodash', './query_builder', - './query_part', + './influx_query', './query_part_editor', ], -function (angular, _, InfluxQueryBuilder, queryPart) { +function (angular, _, InfluxQueryBuilder, InfluxQuery) { 'use strict'; var module = angular.module('grafana.controllers'); @@ -15,29 +15,18 @@ function (angular, _, InfluxQueryBuilder, queryPart) { $scope.init = function() { if (!$scope.target) { return; } - var target = $scope.target; - target.tags = target.tags || []; - target.groupBy = target.groupBy || [{type: 'time', interval: 'auto'}]; - target.fields = target.fields || [{name: 'value'}]; - target.select = target.select || [[ - {name: 'field', params: ['value']}, - {name: 'mean', params: []}, - ]]; + $scope.target = $scope.target; + $scope.queryModel = new InfluxQuery($scope.target); + $scope.queryBuilder = new InfluxQueryBuilder($scope.target); - $scope.updateSelectParts(); - - $scope.groupByParts = queryPart.create({name: 'time', params:['$interval']}); - - $scope.queryBuilder = new InfluxQueryBuilder(target); - - if (!target.measurement) { + if (!$scope.target.measurement) { $scope.measurementSegment = uiSegmentSrv.newSelectMeasurement(); } else { - $scope.measurementSegment = uiSegmentSrv.newSegment(target.measurement); + $scope.measurementSegment = uiSegmentSrv.newSegment($scope.target.measurement); } $scope.tagSegments = []; - _.each(target.tags, function(tag) { + _.each($scope.target.tags, function(tag) { if (!tag.operator) { if (/^\/.*\/$/.test(tag.value)) { tag.operator = "=~"; @@ -78,32 +67,14 @@ function (angular, _, InfluxQueryBuilder, queryPart) { }; $scope.addSelect = function() { - $scope.target.select.push([ - {name: 'field', params: ['value']}, - {name: 'mean', params: []}, - ]); - $scope.updateSelectParts(); + $scope.queryModel.addSelect(); }; $scope.removeSelect = function(index) { - $scope.target.select.splice(index, 1); - $scope.updateSelectParts(); + $scope.queryModel.removeSelect(index); $scope.get_data(); }; - $scope.updateSelectParts = function() { - $scope.selectParts = _.map($scope.target.select, function(parts) { - return _.map(parts, function(part) { - return queryPart.create(part); - }); - }); - }; - - $scope.changeFunction = function(func) { - $scope.target.function = func; - $scope.$parent.get_data(); - }; - $scope.measurementChanged = function() { $scope.target.measurement = $scope.measurementSegment.value; $scope.$parent.get_data(); @@ -125,22 +96,6 @@ function (angular, _, InfluxQueryBuilder, queryPart) { .then($scope.transformToSegments(true), $scope.handleQueryError); }; - $scope.getFunctions = function () { - var functionList = ['count', 'mean', 'sum', 'min', 'max', 'mode', 'distinct', 'median', - 'stddev', 'first', 'last' - ]; - return $q.when(_.map(functionList, function(func) { - return uiSegmentSrv.newSegment(func); - })); - }; - - $scope.getGroupByTimeIntervals = function () { - var times = ['auto', '1s', '10s', '1m', '2m', '5m', '10m', '30m', '1h', '1d']; - return $q.when(_.map(times, function(func) { - return uiSegmentSrv.newSegment(func); - })); - }; - $scope.handleQueryError = function(err) { $scope.parserError = err.message || 'Failed to issue metric query'; return []; @@ -202,18 +157,6 @@ function (angular, _, InfluxQueryBuilder, queryPart) { .then(null, $scope.handleQueryError); }; - $scope.addField = function() { - $scope.target.fields.push({name: $scope.addFieldSegment.value, func: 'mean'}); - _.extend($scope.addFieldSegment, uiSegmentSrv.newPlusButton()); - }; - - $scope.fieldChanged = function(field) { - if (field.name === '-- remove from select --') { - $scope.target.fields = _.without($scope.target.fields, field); - } - $scope.get_data(); - }; - $scope.getTagOptions = function() { var query = $scope.queryBuilder.buildExploreQuery('TAG_KEYS'); diff --git a/public/app/plugins/datasource/influxdb/query_part.ts b/public/app/plugins/datasource/influxdb/query_part.ts index 7e5dfff3277..9d6d92f569c 100644 --- a/public/app/plugins/datasource/influxdb/query_part.ts +++ b/public/app/plugins/datasource/influxdb/query_part.ts @@ -15,11 +15,13 @@ class QueryPartDef { name: string; params: any[]; defaultParams: any[]; + renderer: any; constructor(options: any) { this.name = options.name; this.params = options.params; this.defaultParams = options.defaultParams; + this.renderer = options.renderer; } static register(options: any) { @@ -27,25 +29,55 @@ class QueryPartDef { } } -QueryPartDef.register({ - name: 'field', - category: categories.Transform, - params: [{type: 'field'}], - defaultParams: ['value'], -}); +function functionRenderer(part, innerExpr) { + var str = part.def.name + '('; + var parameters = _.map(part.params, (value, index) => { + var paramType = part.def.params[index]; + if (paramType.quote === 'single') { + return "'" + value + "'"; + } else if (paramType.quote === 'double') { + return '"' + value + '"'; + } + + return value; + }); + + if (innerExpr) { + parameters.unshift(innerExpr); + } + return str + parameters.join(', ') + ')'; +} + +function aliasRenderer(part, innerExpr) { + return innerExpr + ' AS ' + '"' + part.params[0] + '"'; +} + +function suffixRenderer(part, innerExpr) { + return innerExpr + ' ' + part.params[0]; +} + +function identityRenderer(part, innerExpr) { + return part.params[0]; +} + +function quotedIdentityRenderer(part, innerExpr) { + return '"' + part.params[0] + '"'; +} QueryPartDef.register({ name: 'mean', category: categories.Transform, - params: [], - defaultParams: [], + params: [{type: 'field', quote: 'double'}], + defaultParams: ['value'], + renderer: functionRenderer, }); QueryPartDef.register({ - name: 'derivate', + name: 'derivative', category: categories.Transform, - params: [{ name: "rate", type: "interval", options: ['1s', '10s', '1m', '5min', '10m', '15m', '1h'] }], + params: [{ name: "duration", type: "interval", options: ['1s', '10s', '1m', '5min', '10m', '15m', '1h']}], defaultParams: ['10s'], + renderer: functionRenderer, }); QueryPartDef.register({ @@ -53,6 +85,7 @@ QueryPartDef.register({ category: categories.Transform, params: [{ name: "rate", type: "interval", options: ['$interval', '1s', '10s', '1m', '5min', '10m', '15m', '1h'] }], defaultParams: ['$interval'], + renderer: functionRenderer, }); QueryPartDef.register({ @@ -60,13 +93,16 @@ QueryPartDef.register({ category: categories.Transform, params: [{ name: "expr", type: "string"}], defaultParams: [' / 100'], + renderer: suffixRenderer, }); QueryPartDef.register({ name: 'alias', category: categories.Transform, - params: [{ name: "name", type: "string"}], + params: [{ name: "name", type: "string", quote: 'double'}], defaultParams: ['alias'], + renderMode: 'suffix', + renderer: aliasRenderer, }); class QueryPart { @@ -83,29 +119,11 @@ class QueryPart { } this.params = part.params || _.clone(this.def.defaultParams); + this.updateText(); } render(innerExpr: string) { - var str = this.def.name + '('; - var parameters = _.map(this.params, (value, index) => { - - var paramType = this.def.params[index].type; - if (paramType === 'int' || paramType === 'value_or_series' || paramType === 'boolean') { - return value; - } - else if (paramType === 'int_or_interval' && _.isNumber(value)) { - return value; - } - - return "'" + value + "'"; - - }); - - if (innerExpr) { - parameters.unshift(innerExpr); - } - - return str + parameters.join(', ') + ')'; + return this.def.renderer(this, innerExpr); } hasMultipleParamsInString (strValue, index) { diff --git a/public/app/plugins/datasource/influxdb/specs/influx_query_specs.ts b/public/app/plugins/datasource/influxdb/specs/influx_query_specs.ts new file mode 100644 index 00000000000..9634e327c67 --- /dev/null +++ b/public/app/plugins/datasource/influxdb/specs/influx_query_specs.ts @@ -0,0 +1,36 @@ +import {describe, beforeEach, it, sinon, expect} from 'test/lib/common'; + +import InfluxQuery = require('../influx_query'); + +describe.only('InfluxQuery', function() { + + describe('series with mesurement only', function() { + it('should generate correct query', function() { + var query = new InfluxQuery({ + measurement: 'cpu', + }); + + var queryText = query.render(); + expect(queryText).to.be('SELECT mean("value") FROM "cpu" WHERE $timeFilter GROUP BY time($interval)'); + }); + }); + + describe('series with math and alias', function() { + it('should generate correct query', function() { + var query = new InfluxQuery({ + measurement: 'cpu', + select: [ + [ + {name: 'mean', params: ['value']}, + {name: 'math', params: ['/100']}, + {name: 'alias', params: ['text']}, + ] + ] + }); + + var queryText = query.render(); + expect(queryText).to.be('SELECT mean("value") /100 AS "text" FROM "cpu" WHERE $timeFilter GROUP BY time($interval)'); + }); + }); + +}); diff --git a/public/app/plugins/datasource/influxdb/specs/query_builder_specs.ts b/public/app/plugins/datasource/influxdb/specs/query_builder_specs.ts index 65a2f453385..5e06ef77db4 100644 --- a/public/app/plugins/datasource/influxdb/specs/query_builder_specs.ts +++ b/public/app/plugins/datasource/influxdb/specs/query_builder_specs.ts @@ -9,8 +9,8 @@ describe('InfluxQueryBuilder', function() { describe('series with mesurement only', function() { it('should generate correct query', function() { var builder = new InfluxQueryBuilder({ - measurement: 'cpu', - groupBy: [{type: 'time', interval: 'auto'}] + measurement: 'cpu', + groupBy: [{type: 'time', interval: 'auto'}] }); var query = builder.build(); @@ -22,9 +22,9 @@ describe('InfluxQueryBuilder', function() { describe('series with math expr and as expr', function() { it('should generate correct query', function() { var builder = new InfluxQueryBuilder({ - measurement: 'cpu', - fields: [{name: 'test', func: 'max', mathExpr: '*2', asExpr: 'new_name'}], - groupBy: [{type: 'time', interval: 'auto'}] + measurement: 'cpu', + fields: [{name: 'test', func: 'max', mathExpr: '*2', asExpr: 'new_name'}], + groupBy: [{type: 'time', interval: 'auto'}] }); var query = builder.build(); @@ -36,22 +36,22 @@ describe('InfluxQueryBuilder', function() { describe('series with single tag only', function() { it('should generate correct query', function() { var builder = new InfluxQueryBuilder({ - measurement: 'cpu', - groupBy: [{type: 'time', interval: 'auto'}], - tags: [{key: 'hostname', value: 'server1'}] + measurement: 'cpu', + groupBy: [{type: 'time', interval: 'auto'}], + tags: [{key: 'hostname', value: 'server1'}] }); var query = builder.build(); expect(query).to.be('SELECT mean("value") AS "value" FROM "cpu" WHERE "hostname" = \'server1\' AND $timeFilter' - + ' GROUP BY time($interval)'); + + ' GROUP BY time($interval)'); }); it('should switch regex operator with tag value is regex', function() { var builder = new InfluxQueryBuilder({ - measurement: 'cpu', - groupBy: [{type: 'time', interval: 'auto'}], - tags: [{key: 'app', value: '/e.*/'}] + measurement: 'cpu', + groupBy: [{type: 'time', interval: 'auto'}], + tags: [{key: 'app', value: '/e.*/'}] }); var query = builder.build(); @@ -62,57 +62,57 @@ describe('InfluxQueryBuilder', function() { describe('series with multiple fields', function() { it('should generate correct query', function() { var builder = new InfluxQueryBuilder({ - measurement: 'cpu', - tags: [], - groupBy: [{type: 'time', interval: 'auto'}], - fields: [{ name: 'tx_in', func: 'sum' }, { name: 'tx_out', func: 'mean' }] + measurement: 'cpu', + tags: [], + groupBy: [{type: 'time', interval: 'auto'}], + fields: [{ name: 'tx_in', func: 'sum' }, { name: 'tx_out', func: 'mean' }] }); var query = builder.build(); expect(query).to.be('SELECT sum("tx_in") AS "tx_in", mean("tx_out") AS "tx_out" ' + - 'FROM "cpu" WHERE $timeFilter GROUP BY time($interval)'); + 'FROM "cpu" WHERE $timeFilter GROUP BY time($interval)'); }); }); describe('series with multiple tags only', function() { it('should generate correct query', function() { var builder = new InfluxQueryBuilder({ - measurement: 'cpu', - groupBy: [{type: 'time', interval: 'auto'}], - tags: [{key: 'hostname', value: 'server1'}, {key: 'app', value: 'email', condition: "AND"}] + measurement: 'cpu', + groupBy: [{type: 'time', interval: 'auto'}], + tags: [{key: 'hostname', value: 'server1'}, {key: 'app', value: 'email', condition: "AND"}] }); var query = builder.build(); expect(query).to.be('SELECT mean("value") AS "value" FROM "cpu" WHERE "hostname" = \'server1\' AND "app" = \'email\' AND ' + - '$timeFilter GROUP BY time($interval)'); + '$timeFilter GROUP BY time($interval)'); }); }); describe('series with tags OR condition', function() { it('should generate correct query', function() { var builder = new InfluxQueryBuilder({ - measurement: 'cpu', - groupBy: [{type: 'time', interval: 'auto'}], - tags: [{key: 'hostname', value: 'server1'}, {key: 'hostname', value: 'server2', condition: "OR"}] + measurement: 'cpu', + groupBy: [{type: 'time', interval: 'auto'}], + tags: [{key: 'hostname', value: 'server1'}, {key: 'hostname', value: 'server2', condition: "OR"}] }); var query = builder.build(); expect(query).to.be('SELECT mean("value") AS "value" FROM "cpu" WHERE "hostname" = \'server1\' OR "hostname" = \'server2\' AND ' + - '$timeFilter GROUP BY time($interval)'); + '$timeFilter GROUP BY time($interval)'); }); }); describe('series with groupByTag', function() { it('should generate correct query', function() { var builder = new InfluxQueryBuilder({ - measurement: 'cpu', - tags: [], - groupBy: [{type: 'time', interval: 'auto'}, {type: 'tag', key: 'host'}], + measurement: 'cpu', + tags: [], + groupBy: [{type: 'time', interval: 'auto'}, {type: 'tag', key: 'host'}], }); var query = builder.build(); expect(query).to.be('SELECT mean("value") AS "value" FROM "cpu" WHERE $timeFilter ' + - 'GROUP BY time($interval), "host"'); + 'GROUP BY time($interval), "host"'); }); }); @@ -126,8 +126,7 @@ describe('InfluxQueryBuilder', function() { it('should handle regex measurement in tag keys query', function() { var builder = new InfluxQueryBuilder({ - measurement: '/.*/', - tags: [] + measurement: '/.*/', tags: [] }); var query = builder.buildExploreQuery('TAG_KEYS'); expect(query).to.be('SHOW TAG KEYS FROM /.*/'); @@ -170,7 +169,10 @@ describe('InfluxQueryBuilder', function() { }); it('should switch to regex operator in tag condition', function() { - var builder = new InfluxQueryBuilder({measurement: 'cpu', tags: [{key: 'host', value: '/server.*/'}]}); + var builder = new InfluxQueryBuilder({ + measurement: 'cpu', + tags: [{key: 'host', value: '/server.*/'}] + }); var query = builder.buildExploreQuery('TAG_VALUES', 'app'); expect(query).to.be('SHOW TAG VALUES FROM "cpu" WITH KEY = "app" WHERE "host" =~ /server.*/'); }); diff --git a/public/app/plugins/datasource/influxdb/specs/query_part_specs.ts b/public/app/plugins/datasource/influxdb/specs/query_part_specs.ts new file mode 100644 index 00000000000..ea354bf1439 --- /dev/null +++ b/public/app/plugins/datasource/influxdb/specs/query_part_specs.ts @@ -0,0 +1,41 @@ + +import {describe, beforeEach, it, sinon, expect} from 'test/lib/common'; + +import queryPart = require('../query_part'); + +describe('InfluxQueryBuilder', () => { + + describe('series with mesurement only', () => { + it('should handle nested function parts', () => { + var part = queryPart.create({ + name: 'derivative', + params: ['10s'], + }); + + expect(part.text).to.be('derivative(10s)'); + expect(part.render('mean(value)')).to.be('derivative(mean(value), 10s)'); + }); + + it('should handle suffirx parts', () => { + var part = queryPart.create({ + name: 'math', + params: ['/ 100'], + }); + + expect(part.text).to.be('math(/ 100)'); + expect(part.render('mean(value)')).to.be('mean(value) / 100'); + }); + + it('should handle alias parts', () => { + var part = queryPart.create({ + name: 'alias', + params: ['test'], + }); + + expect(part.text).to.be('alias(test)'); + expect(part.render('mean(value)')).to.be('mean(value) AS "test"'); + }); + + }); + +}); From ef2094f817d82218924ee0a0316707312f352e55 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Thu, 1 Oct 2015 15:48:45 +0200 Subject: [PATCH 007/269] feat(influxdb): minor progress on #2802 --- .../influxdb/partials/query.editor.html | 8 +----- .../plugins/datasource/influxdb/query_ctrl.js | 20 ++++++++++++- .../plugins/datasource/influxdb/query_part.ts | 28 ++++++++++++------- .../datasource/influxdb/query_part_editor.js | 3 +- 4 files changed, 40 insertions(+), 19 deletions(-) diff --git a/public/app/plugins/datasource/influxdb/partials/query.editor.html b/public/app/plugins/datasource/influxdb/partials/query.editor.html index 1993c2d7aa9..98499303cc8 100644 --- a/public/app/plugins/datasource/influxdb/partials/query.editor.html +++ b/public/app/plugins/datasource/influxdb/partials/query.editor.html @@ -73,13 +73,7 @@
        • -
        -
          -
        • - -
        • -
        • - +
        diff --git a/public/app/plugins/datasource/influxdb/query_ctrl.js b/public/app/plugins/datasource/influxdb/query_ctrl.js index 924c7ab77fe..1eba65c7c87 100644 --- a/public/app/plugins/datasource/influxdb/query_ctrl.js +++ b/public/app/plugins/datasource/influxdb/query_ctrl.js @@ -3,9 +3,10 @@ define([ 'lodash', './query_builder', './influx_query', + './query_part', './query_part_editor', ], -function (angular, _, InfluxQueryBuilder, InfluxQuery) { +function (angular, _, InfluxQueryBuilder, InfluxQuery, queryPart) { 'use strict'; var module = angular.module('grafana.controllers'); @@ -45,9 +46,26 @@ function (angular, _, InfluxQueryBuilder, InfluxQuery) { }); $scope.fixTagSegments(); + $scope.buildSelectMenu(); $scope.removeTagFilterSegment = uiSegmentSrv.newSegment({fake: true, value: '-- remove tag filter --'}); }; + $scope.buildSelectMenu = function() { + var categories = queryPart.getCategories(); + $scope.selectMenu = _.reduce(categories, function(memo, cat, key) { + var menu = {text: key}; + menu.submenu = _.map(cat, function(item) { + return {text: item.name, value: item.name}; + }); + memo.push(menu); + return memo; + }, []); + }; + + $scope.selectMenuAction = function(selectParts, cat, subitem) { + selectParts.push(queryPart.create({name: subitem.value })); + }; + $scope.fixTagSegments = function() { var count = $scope.tagSegments.length; var lastSegment = $scope.tagSegments[Math.max(count-1, 0)]; diff --git a/public/app/plugins/datasource/influxdb/query_part.ts b/public/app/plugins/datasource/influxdb/query_part.ts index 9d6d92f569c..84dab84806a 100644 --- a/public/app/plugins/datasource/influxdb/query_part.ts +++ b/public/app/plugins/datasource/influxdb/query_part.ts @@ -4,11 +4,10 @@ import _ = require('lodash'); var index = []; var categories = { - Combine: [], - Transform: [], - Calculate: [], - Filter: [], - Special: [] + Aggregations: [], + Transformations: [], + Math: [], + Aliasing: [], }; class QueryPartDef { @@ -26,6 +25,7 @@ class QueryPartDef { static register(options: any) { index[options.name] = new QueryPartDef(options); + options.category.push(index[options.name]); } } @@ -66,7 +66,15 @@ function quotedIdentityRenderer(part, innerExpr) { QueryPartDef.register({ name: 'mean', - category: categories.Transform, + category: categories.Aggregations, + params: [{type: 'field', quote: 'double'}], + defaultParams: ['value'], + renderer: functionRenderer, +}); + +QueryPartDef.register({ + name: 'sum', + category: categories.Aggregations, params: [{type: 'field', quote: 'double'}], defaultParams: ['value'], renderer: functionRenderer, @@ -74,7 +82,7 @@ QueryPartDef.register({ QueryPartDef.register({ name: 'derivative', - category: categories.Transform, + category: categories.Transformations, params: [{ name: "duration", type: "interval", options: ['1s', '10s', '1m', '5min', '10m', '15m', '1h']}], defaultParams: ['10s'], renderer: functionRenderer, @@ -82,7 +90,7 @@ QueryPartDef.register({ QueryPartDef.register({ name: 'time', - category: categories.Transform, + category: categories.Transformations, params: [{ name: "rate", type: "interval", options: ['$interval', '1s', '10s', '1m', '5min', '10m', '15m', '1h'] }], defaultParams: ['$interval'], renderer: functionRenderer, @@ -90,7 +98,7 @@ QueryPartDef.register({ QueryPartDef.register({ name: 'math', - category: categories.Transform, + category: categories.Math, params: [{ name: "expr", type: "string"}], defaultParams: [' / 100'], renderer: suffixRenderer, @@ -98,7 +106,7 @@ QueryPartDef.register({ QueryPartDef.register({ name: 'alias', - category: categories.Transform, + category: categories.Aliasing, params: [{ name: "name", type: "string", quote: 'double'}], defaultParams: ['alias'], renderMode: 'suffix', diff --git a/public/app/plugins/datasource/influxdb/query_part_editor.js b/public/app/plugins/datasource/influxdb/query_part_editor.js index 6cfcda5f4e7..6adf41f9c3f 100644 --- a/public/app/plugins/datasource/influxdb/query_part_editor.js +++ b/public/app/plugins/datasource/influxdb/query_part_editor.js @@ -16,7 +16,8 @@ function (angular, _, $) { restrict: 'E', templateUrl: 'app/plugins/datasource/influxdb/partials/query_part.html', scope: { - part: "=" + part: "=", + deleteAction: "&", }, link: function postLink($scope, elem) { var part = $scope.part; From 0dc0e03c4c54663d1be58d40caeb68ebb6c3340d Mon Sep 17 00:00:00 2001 From: Ivan Babrou Date: Sun, 4 Oct 2015 12:54:43 +0100 Subject: [PATCH 008/269] Add suggest_tagk() and suggest_tagv() to OpenTSDB datasource (#2840) --- docs/sources/datasources/opentsdb.md | 6 ++++-- .../plugins/datasource/opentsdb/datasource.js | 20 +++++++++++++++---- public/test/specs/opentsdbDatasource-specs.js | 20 ++++++++++++++++++- 3 files changed, 39 insertions(+), 7 deletions(-) diff --git a/docs/sources/datasources/opentsdb.md b/docs/sources/datasources/opentsdb.md index 3368c39a0ae..bcaeed9056c 100644 --- a/docs/sources/datasources/opentsdb.md +++ b/docs/sources/datasources/opentsdb.md @@ -40,8 +40,10 @@ Grafana's OpenTSDB data source now supports template variable values queries. Th When using OpenTSDB with a template variable of `query` type you can use following syntax for lookup. - metrics() // returns metric names + metrics(prefix) // returns metric names with specific prefix (can be empty) tag_names(cpu) // return tag names (i.e. keys) for a specific cpu metric tag_values(cpu, hostname) // return tag values for metric cpu and tag key hostname + suggest_tagk(prefix) // return tag names (i.e. keys) for all metrics with specific prefix (can be empty) + suggest_tagv(prefix) // return tag values for all metrics with specific prefix (can be empty) -For details on opentsdb metric queries checkout the official [OpenTSDB documentation](http://opentsdb.net/docs/build/html/index.html) \ No newline at end of file +For details on opentsdb metric queries checkout the official [OpenTSDB documentation](http://opentsdb.net/docs/build/html/index.html) diff --git a/public/app/plugins/datasource/opentsdb/datasource.js b/public/app/plugins/datasource/opentsdb/datasource.js index 124c6597a00..c46b451a64c 100644 --- a/public/app/plugins/datasource/opentsdb/datasource.js +++ b/public/app/plugins/datasource/opentsdb/datasource.js @@ -80,8 +80,8 @@ function (angular, _, dateMath) { return backendSrv.datasourceRequest(options); }; - OpenTSDBDatasource.prototype._performSuggestQuery = function(query) { - return this._get('/api/suggest', {type: 'metrics', q: query, max: 1000}).then(function(result) { + OpenTSDBDatasource.prototype._performSuggestQuery = function(query, type) { + return this._get('/api/suggest', {type: type, q: query, max: 1000}).then(function(result) { return result.data; }); }; @@ -150,10 +150,12 @@ function (angular, _, dateMath) { var metrics_regex = /metrics\((.*)\)/; var tag_names_regex = /tag_names\((.*)\)/; var tag_values_regex = /tag_values\((.*),\s?(.*)\)/; + var tag_names_suggest_regex = /suggest_tagk\((.*)\)/; + var tag_values_suggest_regex = /suggest_tagv\((.*)\)/; var metrics_query = interpolated.match(metrics_regex); if (metrics_query) { - return this._performSuggestQuery(metrics_query[1]).then(responseTransform); + return this._performSuggestQuery(metrics_query[1], 'metrics').then(responseTransform); } var tag_names_query = interpolated.match(tag_names_regex); @@ -166,7 +168,17 @@ function (angular, _, dateMath) { return this._performMetricKeyValueLookup(tag_values_query[1], tag_values_query[2]).then(responseTransform); } - return $q.when([]); + var tag_names_suggest_query = interpolated.match(tag_names_suggest_regex); + if (tag_names_suggest_query) { + return this._performSuggestQuery(tag_names_suggest_query[1], 'tagk').then(responseTransform); + } + + var tag_values_suggest_query = interpolated.match(tag_values_suggest_regex); + if (tag_values_suggest_query) { + return this._performSuggestQuery(tag_values_suggest_query[1], 'tagv').then(responseTransform); + } + + return $q.when([{text: "wtf"}]); }; OpenTSDBDatasource.prototype.testDatasource = function() { diff --git a/public/test/specs/opentsdbDatasource-specs.js b/public/test/specs/opentsdbDatasource-specs.js index 57818fdc4fa..ecd2ca598e6 100644 --- a/public/test/specs/opentsdbDatasource-specs.js +++ b/public/test/specs/opentsdbDatasource-specs.js @@ -27,9 +27,11 @@ define([ }); it('metrics() should generate api suggest query', function() { - ctx.ds.metricFindQuery('metrics()').then(function(data) { results = data; }); + ctx.ds.metricFindQuery('metrics(pew)').then(function(data) { results = data; }); ctx.$rootScope.$apply(); expect(requestOptions.url).to.be('/api/suggest'); + expect(requestOptions.params.type).to.be('metrics'); + expect(requestOptions.params.q).to.be('pew'); }); it('tag_names(cpu) should generate looku query', function() { @@ -46,6 +48,22 @@ define([ expect(requestOptions.params.m).to.be('cpu{hostname=*}'); }); + it('suggest_tagk() should generate api suggest query', function() { + ctx.ds.metricFindQuery('suggest_tagk(foo)').then(function(data) { results = data; }); + ctx.$rootScope.$apply(); + expect(requestOptions.url).to.be('/api/suggest'); + expect(requestOptions.params.type).to.be('tagk'); + expect(requestOptions.params.q).to.be('foo'); + }); + + it('suggest_tagv() should generate api suggest query', function() { + ctx.ds.metricFindQuery('suggest_tagv(bar)').then(function(data) { results = data; }); + ctx.$rootScope.$apply(); + expect(requestOptions.url).to.be('/api/suggest'); + expect(requestOptions.params.type).to.be('tagv'); + expect(requestOptions.params.q).to.be('bar'); + }); + }); }); }); From 14f3a6821552e4a874deb5df05fc592704856f97 Mon Sep 17 00:00:00 2001 From: ubhatnagar Date: Fri, 9 Oct 2015 03:06:52 +0530 Subject: [PATCH 009/269] Added move row to top and bottom. --- public/app/features/dashboard/rowCtrl.js | 25 ++++++++++++++++++++++-- public/app/partials/dashboard.html | 6 ++++-- 2 files changed, 27 insertions(+), 4 deletions(-) diff --git a/public/app/features/dashboard/rowCtrl.js b/public/app/features/dashboard/rowCtrl.js index 27365f7bd1c..02cb59721a3 100644 --- a/public/app/features/dashboard/rowCtrl.js +++ b/public/app/features/dashboard/rowCtrl.js @@ -55,9 +55,30 @@ function (angular, _, config) { $scope.move_row = function(direction) { var rowsList = $scope.dashboard.rows; var rowIndex = _.indexOf(rowsList, $scope.row); - var newIndex = rowIndex + direction; + var newIndex = rowIndex; + switch(direction) { + case 'up': { + newIndex = rowIndex - 1; + break; + } + case 'down': { + newIndex = rowIndex + 1; + break; + } + case 'top': { + newIndex = 0; + break; + } + case 'bottom': { + newIndex = rowsList.length - 1; + break; + } + default: { + newIndex = rowIndex; + } + } if (newIndex >= 0 && newIndex <= (rowsList.length - 1)) { - _.move(rowsList, rowIndex, rowIndex + direction); + _.move(rowsList, rowIndex, newIndex); } }; diff --git a/public/app/partials/dashboard.html b/public/app/partials/dashboard.html index 156da97e50a..4edbb816eeb 100644 --- a/public/app/partials/dashboard.html +++ b/public/app/partials/dashboard.html @@ -60,8 +60,10 @@
      • From 9b5a0a54cf4ede0af7720b6c7440d5947e6484e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Fri, 9 Oct 2015 08:28:33 +0200 Subject: [PATCH 010/269] minor docs fix --- docs/mkdocs.yml | 2 +- docs/sources/guides/gettingstarted.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/mkdocs.yml b/docs/mkdocs.yml index 5081a138963..6489bd5c426 100644 --- a/docs/mkdocs.yml +++ b/docs/mkdocs.yml @@ -64,7 +64,7 @@ pages: - ['reference/http_api.md', 'Reference', 'HTTP API'] - ['reference/keyboard_shortcuts.md', 'Reference', 'Keyboard Shortcuts'] -- ['datasources/overview.md', 'Data Sources', 'Data Source Overview'] +- ['datasources/overview.md', 'Data Sources', 'Overview'] - ['datasources/graphite.md', 'Data Sources', 'Graphite'] - ['datasources/influxdb.md', 'Data Sources', 'InfluxDB'] - ['datasources/opentsdb.md', 'Data Sources', 'OpenTSDB'] diff --git a/docs/sources/guides/gettingstarted.md b/docs/sources/guides/gettingstarted.md index 93d67048ad6..b8bd27609a3 100644 --- a/docs/sources/guides/gettingstarted.md +++ b/docs/sources/guides/gettingstarted.md @@ -5,7 +5,7 @@ page_keywords: grafana, guide, documentation --- # Getting started -This guide will help you get started and acquainted with Grafana. It assumes you have a working Grafana 2.x instance, and have added at least one Grafana Data Source. +This guide will help you get started and acquainted with Grafana. It assumes you have a working Grafana 2.x instance, and have added at least one [Data Source](/datasources/overview). ## Beginner guides Watch the 10min [beginners guide to building dashboards](https://www.youtube.com/watch?v=sKNZMtoSHN4&index=7&list=PLDGkOdUX1Ujo3wHw9-z5Vo12YLqXRjzg2) to get a quick intro to setting up Dashboards and Panels. From b68987dcde14580276cc4e41e62d92814a301928 Mon Sep 17 00:00:00 2001 From: anryko Date: Fri, 9 Oct 2015 17:05:46 +0200 Subject: [PATCH 011/269] Fixed configuration example for Github OAuth team_ids. --- docs/sources/installation/configuration.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/sources/installation/configuration.md b/docs/sources/installation/configuration.md index 31d029b1101..e68edcbca0c 100644 --- a/docs/sources/installation/configuration.md +++ b/docs/sources/installation/configuration.md @@ -266,7 +266,7 @@ automatically signed up. ### team_ids Require an active team membership for at least one of the given teams on -GitHub. If the authenticated user isn't a member of at least one the +GitHub. If the authenticated user isn't a member of at least one of the teams they will not be able to register or authenticate with your Grafana instance. For example: @@ -274,7 +274,7 @@ Grafana instance. For example: enabled = true client_id = YOUR_GITHUB_APP_CLIENT_ID client_secret = YOUR_GITHUB_APP_CLIENT_SECRET - scopes = user:email + scopes = user:email,read:org team_ids = 150,300 auth_url = https://github.com/login/oauth/authorize token_url = https://github.com/login/oauth/access_token From c831369974f0cbbacd72678184a7fa73589d7a41 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Sat, 10 Oct 2015 11:46:00 -0400 Subject: [PATCH 012/269] fix(influxdb): influxdb data source did not use right http abstraction for metric queries, fixes #2919 --- docker/blocks/prometheus/prometheus.yml | 4 ---- pkg/plugins/plugins.go | 1 - public/app/plugins/datasource/influxdb/datasource.js | 4 ++-- 3 files changed, 2 insertions(+), 7 deletions(-) diff --git a/docker/blocks/prometheus/prometheus.yml b/docker/blocks/prometheus/prometheus.yml index 1d524b1b320..b0fc2a919cd 100644 --- a/docker/blocks/prometheus/prometheus.yml +++ b/docker/blocks/prometheus/prometheus.yml @@ -4,10 +4,6 @@ global: evaluation_interval: 10s # By default, scrape targets every 15 seconds. # scrape_timeout is set to the global default (10s). - # Attach these extra labels to all timeseries collected by this Prometheus instance. - labels: - monitor: 'codelab-monitor' - # Load and evaluate rules in this file every 'evaluation_interval' seconds. rule_files: # - "first.rules" diff --git a/pkg/plugins/plugins.go b/pkg/plugins/plugins.go index 2f7e5264e53..665cf6a36ca 100644 --- a/pkg/plugins/plugins.go +++ b/pkg/plugins/plugins.go @@ -91,7 +91,6 @@ func (scanner *PluginScanner) loadPluginJson(path string) error { if !exists { return errors.New("Did not find type property in plugin.json") } - DataSources[datasourceType.(string)] = pluginJson } diff --git a/public/app/plugins/datasource/influxdb/datasource.js b/public/app/plugins/datasource/influxdb/datasource.js index d6a5ccc37ad..fabe2278708 100644 --- a/public/app/plugins/datasource/influxdb/datasource.js +++ b/public/app/plugins/datasource/influxdb/datasource.js @@ -12,7 +12,7 @@ function (angular, _, dateMath, InfluxSeries, InfluxQueryBuilder) { var module = angular.module('grafana.services'); - module.factory('InfluxDatasource', function($q, $http, templateSrv) { + module.factory('InfluxDatasource', function($q, backendSrv, templateSrv) { function InfluxDatasource(datasource) { this.type = 'influxdb'; @@ -161,7 +161,7 @@ function (angular, _, dateMath, InfluxSeries, InfluxQueryBuilder) { options.headers.Authorization = self.basicAuth; } - return $http(options).then(function(result) { + return backendSrv.datasourceRequest(options).then(function(result) { return result.data; }, function(err) { if (err.status !== 0 || err.status >= 300) { From c0da52aac8b47501535ab5740305a73510d5d2bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Sat, 10 Oct 2015 14:38:22 -0400 Subject: [PATCH 013/269] fix(share): fixed share panel image url, did not generate correct url when domain name contained word dashboards, fixes #2916 --- public/app/features/dashboard/shareModalCtrl.js | 2 +- public/test/specs/helpers.js | 3 ++- public/test/specs/shareModalCtrl-specs.js | 12 ++++++++++++ 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/public/app/features/dashboard/shareModalCtrl.js b/public/app/features/dashboard/shareModalCtrl.js index 5afee9d39cd..9c0d14ee601 100644 --- a/public/app/features/dashboard/shareModalCtrl.js +++ b/public/app/features/dashboard/shareModalCtrl.js @@ -75,7 +75,7 @@ function (angular, _, require, config) { $scope.iframeHtml = ''; - $scope.imageUrl = soloUrl.replace('/dashboard', '/render/dashboard'); + $scope.imageUrl = soloUrl.replace('/dashboard-solo/', '/render/dashboard-solo/'); $scope.imageUrl += '&width=1000'; $scope.imageUrl += '&height=500'; }; diff --git a/public/test/specs/helpers.js b/public/test/specs/helpers.js index 011c0cc70d6..9fa5aeee209 100644 --- a/public/test/specs/helpers.js +++ b/public/test/specs/helpers.js @@ -38,9 +38,10 @@ define([ }; this.createControllerPhase = function(controllerName) { - return inject(function($controller, $rootScope, $q, $location) { + return inject(function($controller, $rootScope, $q, $location, $browser) { self.scope = $rootScope.$new(); self.$location = $location; + self.$browser = $browser; self.scope.contextSrv = {}; self.scope.panel = {}; self.scope.row = { panels:[] }; diff --git a/public/test/specs/shareModalCtrl-specs.js b/public/test/specs/shareModalCtrl-specs.js index 6aea645d557..f3ff4aeb719 100644 --- a/public/test/specs/shareModalCtrl-specs.js +++ b/public/test/specs/shareModalCtrl-specs.js @@ -7,6 +7,7 @@ define([ describe('ShareModalCtrl', function() { var ctx = new helpers.ControllerTestContext(); + var browser; function setTime(range) { ctx.timeSrv.timeRange = sinon.stub().returns(range); @@ -31,6 +32,17 @@ define([ expect(ctx.scope.shareUrl).to.be('http://server/#/test?from=1000&to=2000&panelId=22&fullscreen'); }); + it('should generate render url', function() { + ctx.$location.$$absUrl = 'http://dashboards.grafana.com/dashboard/db/my-dash'; + + ctx.scope.panel = { id: 22 }; + + ctx.scope.init(); + var base = 'http://dashboards.grafana.com/render/dashboard-solo/db/my-dash'; + var params = '?from=1000&to=2000&panelId=22&fullscreen&width=1000&height=500'; + expect(ctx.scope.imageUrl).to.be(base + params); + }); + it('should remove panel id when no panel in scope', function() { ctx.$location.path('/test'); ctx.scope.options.forCurrent = true; From d09bff903948eecc21f48355fed93fac838b218c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Sat, 10 Oct 2015 15:11:58 -0400 Subject: [PATCH 014/269] fixed failing jshint --- public/test/specs/shareModalCtrl-specs.js | 1 - 1 file changed, 1 deletion(-) diff --git a/public/test/specs/shareModalCtrl-specs.js b/public/test/specs/shareModalCtrl-specs.js index f3ff4aeb719..995d663779a 100644 --- a/public/test/specs/shareModalCtrl-specs.js +++ b/public/test/specs/shareModalCtrl-specs.js @@ -7,7 +7,6 @@ define([ describe('ShareModalCtrl', function() { var ctx = new helpers.ControllerTestContext(); - var browser; function setTime(range) { ctx.timeSrv.timeRange = sinon.stub().returns(range); From e873574e8c5ed95f39b0627991b57bf49eb29cbc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Sat, 10 Oct 2015 17:55:15 -0400 Subject: [PATCH 015/269] fix(logging): fixed so that router_logging = true actually logs all http requests, fixes #2902 --- pkg/middleware/logger.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pkg/middleware/logger.go b/pkg/middleware/logger.go index 5b1132e111e..eb5c7b8dde4 100644 --- a/pkg/middleware/logger.go +++ b/pkg/middleware/logger.go @@ -22,6 +22,7 @@ import ( "github.com/Unknwon/macaron" "github.com/grafana/grafana/pkg/log" + "github.com/grafana/grafana/pkg/setting" ) func Logger() macaron.Handler { @@ -36,7 +37,9 @@ func Logger() macaron.Handler { switch rw.Status() { case 200, 304: content = fmt.Sprintf("%s", content) - return + if !setting.RouterLogging { + return + } case 404: content = fmt.Sprintf("%s", content) case 500: From 4588c5a19a087540cbe4d943bf83ec81cba7c73d Mon Sep 17 00:00:00 2001 From: Mitsuhiro Tanda Date: Tue, 13 Oct 2015 12:29:42 +0900 Subject: [PATCH 016/269] pass dateMath to ScriptedDashboard script --- public/app/features/dashboard/dashboardLoaderSrv.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/public/app/features/dashboard/dashboardLoaderSrv.js b/public/app/features/dashboard/dashboardLoaderSrv.js index f2fc3c9c03f..85e6374e0a3 100644 --- a/public/app/features/dashboard/dashboardLoaderSrv.js +++ b/public/app/features/dashboard/dashboardLoaderSrv.js @@ -4,8 +4,9 @@ define([ 'lodash', 'jquery', 'kbn', + 'app/core/utils/datemath', ], -function (angular, moment, _, $, kbn) { +function (angular, moment, _, $, kbn, dateMath) { 'use strict'; var module = angular.module('grafana.services'); @@ -59,8 +60,8 @@ function (angular, moment, _, $, kbn) { }; /*jshint -W054 */ - var script_func = new Function('ARGS','kbn','_','moment','window','document','$','jQuery', 'services', result.data); - var script_result = script_func($routeParams, kbn, _ , moment, window, document, $, $, services); + var script_func = new Function('ARGS','kbn','dateMath','_','moment','window','document','$','jQuery', 'services', result.data); + var script_result = script_func($routeParams, kbn, dateMath, _ , moment, window, document, $, $, services); // Handle async dashboard scripts if (_.isFunction(script_result)) { From a906fa178a675b5961f5276adf1265fcbbb742ed Mon Sep 17 00:00:00 2001 From: Alex Bligh Date: Sun, 11 Oct 2015 17:14:46 +0100 Subject: [PATCH 017/269] Support multiple space-separated LDAP hosts Signed-off-by: Alex Bligh --- conf/ldap.toml | 2 +- pkg/login/ldap.go | 23 ++++++++++++++--------- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/conf/ldap.toml b/conf/ldap.toml index 9455c8df3a1..0688b84657a 100644 --- a/conf/ldap.toml +++ b/conf/ldap.toml @@ -2,7 +2,7 @@ verbose_logging = false [[servers]] -# Ldap server host +# Ldap server host (specify multiple hosts space separated) host = "127.0.0.1" # Default port is 389 or 636 if use_ssl = true port = 389 diff --git a/pkg/login/ldap.go b/pkg/login/ldap.go index af9982e77df..1bfbd817957 100644 --- a/pkg/login/ldap.go +++ b/pkg/login/ldap.go @@ -24,18 +24,23 @@ func NewLdapAuthenticator(server *LdapServerConf) *ldapAuther { } func (a *ldapAuther) Dial() error { - address := fmt.Sprintf("%s:%d", a.server.Host, a.server.Port) var err error - if a.server.UseSSL { - tlsCfg := &tls.Config{ - InsecureSkipVerify: a.server.SkipVerifySSL, - ServerName: a.server.Host, + for _, host := range strings.Split(a.server.Host, " ") { + address := fmt.Sprintf("%s:%d", host, a.server.Port) + if a.server.UseSSL { + tlsCfg := &tls.Config{ + InsecureSkipVerify: a.server.SkipVerifySSL, + ServerName: host, + } + a.conn, err = ldap.DialTLS("tcp", address, tlsCfg) + } else { + a.conn, err = ldap.Dial("tcp", address) } - a.conn, err = ldap.DialTLS("tcp", address, tlsCfg) - } else { - a.conn, err = ldap.Dial("tcp", address) - } + if err == nil { + return nil + } + } return err } From 458e6da7001eee58ba677784bd73a04a01839f6a Mon Sep 17 00:00:00 2001 From: Alex Bligh Date: Sun, 11 Oct 2015 17:38:33 +0100 Subject: [PATCH 018/269] Allow user specified CA certs Signed-off-by: Alex Bligh --- conf/ldap.toml | 2 ++ pkg/login/ldap.go | 16 ++++++++++++++++ pkg/login/settings.go | 1 + 3 files changed, 19 insertions(+) diff --git a/conf/ldap.toml b/conf/ldap.toml index 0688b84657a..af131ad23b9 100644 --- a/conf/ldap.toml +++ b/conf/ldap.toml @@ -10,6 +10,8 @@ port = 389 use_ssl = false # set to true if you want to skip ssl cert validation ssl_skip_verify = false +# set to the path to your root CA certificate or leave unset to use system defaults +# root_ca_cert = /path/to/certificate.crt # Search user bind dn bind_dn = "cn=admin,dc=grafana,dc=org" diff --git a/pkg/login/ldap.go b/pkg/login/ldap.go index 1bfbd817957..b98e54446f2 100644 --- a/pkg/login/ldap.go +++ b/pkg/login/ldap.go @@ -2,8 +2,10 @@ package login import ( "crypto/tls" + "crypto/x509" "errors" "fmt" + "io/ioutil" "strings" "github.com/davecgh/go-spew/spew" @@ -25,12 +27,26 @@ func NewLdapAuthenticator(server *LdapServerConf) *ldapAuther { func (a *ldapAuther) Dial() error { var err error + var certPool *x509.CertPool + if a.server.RootCACert != "" { + certPool := x509.NewCertPool() + for _, caCertFile := range strings.Split(a.server.RootCACert, " ") { + if pem, err := ioutil.ReadFile(caCertFile); err != nil { + return err + } else { + if !certPool.AppendCertsFromPEM(pem) { + return errors.New("Failed to append CA certficate " + caCertFile) + } + } + } + } for _, host := range strings.Split(a.server.Host, " ") { address := fmt.Sprintf("%s:%d", host, a.server.Port) if a.server.UseSSL { tlsCfg := &tls.Config{ InsecureSkipVerify: a.server.SkipVerifySSL, ServerName: host, + RootCAs: certPool, } a.conn, err = ldap.DialTLS("tcp", address, tlsCfg) } else { diff --git a/pkg/login/settings.go b/pkg/login/settings.go index 93ff04054c1..64fcf4da56d 100644 --- a/pkg/login/settings.go +++ b/pkg/login/settings.go @@ -19,6 +19,7 @@ type LdapServerConf struct { Port int `toml:"port"` UseSSL bool `toml:"use_ssl"` SkipVerifySSL bool `toml:"ssl_skip_verify"` + RootCACert string `toml:"root_ca_cert"` BindDN string `toml:"bind_dn"` BindPassword string `toml:"bind_password"` Attr LdapAttributeMap `toml:"attributes"` From e8256f0ad75f7dab9cd775bf59a91270e3a0b3b2 Mon Sep 17 00:00:00 2001 From: Alex Bligh Date: Tue, 13 Oct 2015 19:36:21 +0100 Subject: [PATCH 019/269] Add support for POSIX LDAP schema In the POSIX LDAP schema, there is no 'memberOf' attribute returned in relation to which groups a person is a member of. Rather, it is necessary to query the group objects which have the people as members. This commit adds an additional filter, which if specified explicitly searches for groups, rather than relying on the 'memberOf' attribute. This enables Grafana to work with LDAP POSIX schema (e.g. OpenLDAP etc.) Signed-off-by: Alex Bligh --- conf/ldap.toml | 21 +++++++++++++++++++++ pkg/login/ldap.go | 43 ++++++++++++++++++++++++++++++++++++++++--- pkg/login/settings.go | 3 +++ 3 files changed, 64 insertions(+), 3 deletions(-) diff --git a/conf/ldap.toml b/conf/ldap.toml index af131ad23b9..bfe28d4e835 100644 --- a/conf/ldap.toml +++ b/conf/ldap.toml @@ -18,11 +18,32 @@ bind_dn = "cn=admin,dc=grafana,dc=org" # Search user bind password bind_password = 'grafana' +# Schema's supporting memberOf + # Search filter, for example "(cn=%s)" or "(sAMAccountName=%s)" search_filter = "(cn=%s)" # An array of base dns to search through search_base_dns = ["dc=grafana,dc=org"] +# Uncomment this section (and comment out the previous 2 entries) to use POSIX schema. +# In POSIX LDAP schemas, querying the people 'ou' gives you entries that do not have a +# memberOf attribute, so a secondary query must be made for groups. This is done by +# enabling group_search_filter below. You must also set +# member_of = "cn" +# in [servers.attributes] below. +# +# Search filter, used to retrieve the user +# search_filter = "(uid=%s)" +# +# An array of the base DNs to search through for users. Typically uses ou=people. +# search_base_dns = ["ou=people,dc=grafana,dc=org"] +# +# Group search filter, to retrieve the groups of which the user is a member +# group_search_filter = "(&(objectClass=posixGroup)(memberUid=%s))" +# +# An array of the base DNs to search through for groups. Typically uses ou=groups +# group_search_base_dns = ["ou=groups,dc=grafana,dc=org"] + # Specify names of the ldap attributes your ldap uses [servers.attributes] name = "givenName" diff --git a/pkg/login/ldap.go b/pkg/login/ldap.go index b98e54446f2..6337f932256 100644 --- a/pkg/login/ldap.go +++ b/pkg/login/ldap.go @@ -311,18 +311,51 @@ func (a *ldapAuther) searchForUser(username string) (*ldapUserInfo, error) { return nil, errors.New("Ldap search matched more than one entry, please review your filter setting") } + var memberOf []string + if a.server.GroupSearchFilter == "" { + memberOf = getLdapAttrArray(a.server.Attr.MemberOf, searchResult) + } else { + // If we are using a POSIX LDAP schema it won't support memberOf, so we manually search the groups + var groupSearchResult *ldap.SearchResult + for _, groupSearchBase := range a.server.GroupSearchBaseDNs { + filter := strings.Replace(a.server.GroupSearchFilter, "%s", username, -1) + groupSearchReq := ldap.SearchRequest{ + BaseDN: groupSearchBase, + Scope: ldap.ScopeWholeSubtree, + DerefAliases: ldap.NeverDerefAliases, + Attributes: []string{ + // Here MemberOf would be the thing that identifies the group, which is normally 'cn' + a.server.Attr.MemberOf, + }, + Filter: filter, + } + + groupSearchResult, err = a.conn.Search(&groupSearchReq) + if err != nil { + return nil, err + } + + if len(groupSearchResult.Entries) > 0 { + for i := range groupSearchResult.Entries { + memberOf = append(memberOf, getLdapAttrN(a.server.Attr.MemberOf, groupSearchResult, i)) + } + break + } + } + } + return &ldapUserInfo{ DN: searchResult.Entries[0].DN, LastName: getLdapAttr(a.server.Attr.Surname, searchResult), FirstName: getLdapAttr(a.server.Attr.Name, searchResult), Username: getLdapAttr(a.server.Attr.Username, searchResult), Email: getLdapAttr(a.server.Attr.Email, searchResult), - MemberOf: getLdapAttrArray(a.server.Attr.MemberOf, searchResult), + MemberOf: memberOf, }, nil } -func getLdapAttr(name string, result *ldap.SearchResult) string { - for _, attr := range result.Entries[0].Attributes { +func getLdapAttrN(name string, result *ldap.SearchResult, n int) string { + for _, attr := range result.Entries[n].Attributes { if attr.Name == name { if len(attr.Values) > 0 { return attr.Values[0] @@ -332,6 +365,10 @@ func getLdapAttr(name string, result *ldap.SearchResult) string { return "" } +func getLdapAttr(name string, result *ldap.SearchResult) string { + return getLdapAttrN(name, result, 0) +} + func getLdapAttrArray(name string, result *ldap.SearchResult) []string { for _, attr := range result.Entries[0].Attributes { if attr.Name == name { diff --git a/pkg/login/settings.go b/pkg/login/settings.go index 64fcf4da56d..b181dac3281 100644 --- a/pkg/login/settings.go +++ b/pkg/login/settings.go @@ -27,6 +27,9 @@ type LdapServerConf struct { SearchFilter string `toml:"search_filter"` SearchBaseDNs []string `toml:"search_base_dns"` + GroupSearchFilter string `toml:"group_search_filter"` + GroupSearchBaseDNs []string `toml:"group_search_base_dns"` + LdapGroups []*LdapGroupToOrgRole `toml:"group_mappings"` } From 267417d6a8d27fe908375c63693310b6340bc022 Mon Sep 17 00:00:00 2001 From: Timo Tijhof Date: Wed, 14 Oct 2015 14:00:25 -0400 Subject: [PATCH 020/269] docs(): Fix changelog link in whats-new-in-v2-1 The quotes turn the value into a title attribute rather than href attribute, thus on http://docs.grafana.org/guides/whats-new-in-v2-1/ this link was rendered as CHANGELOG.md which when clicked goes back to itself (not to GitHub). --- docs/sources/guides/whats-new-in-v2-1.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/sources/guides/whats-new-in-v2-1.md b/docs/sources/guides/whats-new-in-v2-1.md index 6a6ebba98de..27285d08857 100644 --- a/docs/sources/guides/whats-new-in-v2-1.md +++ b/docs/sources/guides/whats-new-in-v2-1.md @@ -126,5 +126,5 @@ string values. ### Changelog For a detailed list and link to github issues for everything included in the 2.1 release please -view the [CHANGELOG.md]("https://github.com/grafana/grafana/blob/master/CHANGELOG.md") file. +view the [CHANGELOG.md](https://github.com/grafana/grafana/blob/master/CHANGELOG.md) file. From e3e21a251f67ad1b506aefa72ac9282c034cab71 Mon Sep 17 00:00:00 2001 From: Greg Look Date: Wed, 14 Oct 2015 12:41:20 -0700 Subject: [PATCH 021/269] Group helper functions in kbn.js. --- public/app/components/kbn.js | 56 +++++++++++++++++++----------------- 1 file changed, 30 insertions(+), 26 deletions(-) diff --git a/public/app/components/kbn.js b/public/app/components/kbn.js index 5b9516bc82f..a49c6a3bb4c 100644 --- a/public/app/components/kbn.js +++ b/public/app/components/kbn.js @@ -8,6 +8,8 @@ function($, _) { var kbn = {}; kbn.valueFormats = {}; + ///// HELPER FUNCTIONS ///// + kbn.round_interval = function(interval) { switch (true) { // 0.5s @@ -170,6 +172,33 @@ function($, _) { ].join(';') + '">
      • '; }; + kbn.slugifyForUrl = function(str) { + return str + .toLowerCase() + .replace(/[^\w ]+/g,'') + .replace(/ +/g,'-'); + }; + + kbn.exportSeriesListToCsv = function(seriesList) { + var text = 'Series;Time;Value\n'; + _.each(seriesList, function(series) { + _.each(series.datapoints, function(dp) { + text += series.alias + ';' + new Date(dp[1]).toISOString() + ';' + dp[0] + '\n'; + }); + }); + var blob = new Blob([text], { type: "text/csv;charset=utf-8" }); + window.saveAs(blob, 'grafana_data_export.csv'); + }; + + kbn.stringToJsRegex = function(str) { + if (str[0] !== '/') { + return new RegExp(str); + } + + var match = str.match(new RegExp('^/(.*?)/(g?i?m?y?)$')); + return new RegExp(match[1], match[2]); + }; + kbn.valueFormats.percent = function(size, decimals) { return kbn.toFixed(size, decimals) + '%'; }; @@ -354,32 +383,7 @@ function($, _) { } }; - kbn.slugifyForUrl = function(str) { - return str - .toLowerCase() - .replace(/[^\w ]+/g,'') - .replace(/ +/g,'-'); - }; - - kbn.exportSeriesListToCsv = function(seriesList) { - var text = 'Series;Time;Value\n'; - _.each(seriesList, function(series) { - _.each(series.datapoints, function(dp) { - text += series.alias + ';' + new Date(dp[1]).toISOString() + ';' + dp[0] + '\n'; - }); - }); - var blob = new Blob([text], { type: "text/csv;charset=utf-8" }); - window.saveAs(blob, 'grafana_data_export.csv'); - }; - - kbn.stringToJsRegex = function(str) { - if (str[0] !== '/') { - return new RegExp(str); - } - - var match = str.match(new RegExp('^/(.*?)/(g?i?m?y?)$')); - return new RegExp(match[1], match[2]); - }; + ///// FORMAT MENU ///// kbn.getUnitFormats = function() { return [ From 43c2ca2d7dbd9ffb8dc1474a0bf0a38bd2add065 Mon Sep 17 00:00:00 2001 From: Greg Look Date: Wed, 14 Oct 2015 12:51:59 -0700 Subject: [PATCH 022/269] Group value formats by type. --- public/app/components/kbn.js | 53 ++++++++++++++++++++++++------------ 1 file changed, 35 insertions(+), 18 deletions(-) diff --git a/public/app/components/kbn.js b/public/app/components/kbn.js index a49c6a3bb4c..be1f37dfacd 100644 --- a/public/app/components/kbn.js +++ b/public/app/components/kbn.js @@ -199,10 +199,6 @@ function($, _) { return new RegExp(match[1], match[2]); }; - kbn.valueFormats.percent = function(size, decimals) { - return kbn.toFixed(size, decimals) + '%'; - }; - kbn.formatFuncCreator = function(factor, extArray) { return function(size, decimals, scaledDecimals) { if (size === null) { @@ -253,36 +249,57 @@ function($, _) { return formatted; }; - kbn.valueFormats.bits = kbn.formatFuncCreator(1024, [' b', ' Kib', ' Mib', ' Gib', ' Tib', ' Pib', ' Eib', ' Zib', ' Yib']); - kbn.valueFormats.bytes = kbn.formatFuncCreator(1024, [' B', ' KiB', ' MiB', ' GiB', ' TiB', ' PiB', ' EiB', ' ZiB', ' YiB']); + ///// VALUE FORMATS ///// + + // Dimensionless Units + kbn.valueFormats.none = kbn.toFixed; + kbn.valueFormats.short = kbn.formatFuncCreator(1000, ['', ' K', ' Mil', ' Bil', ' Tri', ' Quadr', ' Quint', ' Sext', ' Sept']); + kbn.valueFormats.ppm = function(value, decimals) { return kbn.toFixed(value, decimals) + ' ppm'; }; + + kbn.valueFormats.percent = function(size, decimals) { + return kbn.toFixed(size, decimals) + '%'; + }; + + // Data + kbn.valueFormats.bits = kbn.formatFuncCreator(1024, [' b', ' Kib', ' Mib', ' Gib', ' Tib', ' Pib', ' Eib', ' Zib', ' Yib']); + kbn.valueFormats.bytes = kbn.formatFuncCreator(1024, [' B', ' KiB', ' MiB', ' GiB', ' TiB', ' PiB', ' EiB', ' ZiB', ' YiB']); kbn.valueFormats.kbytes = kbn.formatFuncCreator(1024, [' KiB', ' MiB', ' GiB', ' TiB', ' PiB', ' EiB', ' ZiB', ' YiB']); kbn.valueFormats.mbytes = kbn.formatFuncCreator(1024, [' MiB', ' GiB', ' TiB', ' PiB', ' EiB', ' ZiB', ' YiB']); kbn.valueFormats.gbytes = kbn.formatFuncCreator(1024, [' GiB', ' TiB', ' PiB', ' EiB', ' ZiB', ' YiB']); - kbn.valueFormats.bps = kbn.formatFuncCreator(1000, [' bps', ' Kbps', ' Mbps', ' Gbps', ' Tbps', ' Pbps', ' Ebps', ' Zbps', ' Ybps']); + + // Data Rate kbn.valueFormats.pps = kbn.formatFuncCreator(1000, [' pps', ' Kpps', ' Mpps', ' Gpps', ' Tpps', ' Ppps', ' Epps', ' Zpps', ' Ypps']); + kbn.valueFormats.bps = kbn.formatFuncCreator(1000, [' bps', ' Kbps', ' Mbps', ' Gbps', ' Tbps', ' Pbps', ' Ebps', ' Zbps', ' Ybps']); kbn.valueFormats.Bps = kbn.formatFuncCreator(1000, [' Bps', ' KBps', ' MBps', ' GBps', ' TBps', ' PBps', ' EBps', ' ZBps', ' YBps']); - kbn.valueFormats.short = kbn.formatFuncCreator(1000, ['', ' K', ' Mil', ' Bil', ' Tri', ' Quadr', ' Quint', ' Sext', ' Sept']); - kbn.valueFormats.joule = kbn.formatFuncCreator(1000, [' J', ' kJ', ' MJ', ' GJ', ' TJ', ' PJ', ' EJ', ' ZJ', ' YJ']); - kbn.valueFormats.amp = kbn.formatFuncCreator(1000, [' A', ' kA', ' MA', ' GA', ' TA', ' PA', ' EA', ' ZA', ' YA']); - kbn.valueFormats.volt = kbn.formatFuncCreator(1000, [' V', ' kV', ' MV', ' GV', ' TV', ' PV', ' EV', ' ZV', ' YV']); - kbn.valueFormats.hertz = kbn.formatFuncCreator(1000, [' Hz', ' kHz', ' MHz', ' GHz', ' THz', ' PHz', ' EHz', ' ZHz', ' YHz']); - kbn.valueFormats.watt = kbn.formatFuncCreator(1000, [' W', ' kW', ' MW', ' GW', ' TW', ' PW', ' EW', ' ZW', ' YW']); - kbn.valueFormats.kwatt = kbn.formatFuncCreator(1000, [' kW', ' MW', ' GW', ' TW', ' PW', ' EW', ' ZW', ' YW']); - kbn.valueFormats.watth = kbn.formatFuncCreator(1000, [' Wh', ' kWh', ' MWh', ' GWh', ' TWh', ' PWh', ' EWh', ' ZWh', ' YWh']); + + // Energy + kbn.valueFormats.watt = kbn.formatFuncCreator(1000, [' W', ' kW', ' MW', ' GW', ' TW', ' PW', ' EW', ' ZW', ' YW']); + kbn.valueFormats.kwatt = kbn.formatFuncCreator(1000, [' kW', ' MW', ' GW', ' TW', ' PW', ' EW', ' ZW', ' YW']); + kbn.valueFormats.watth = kbn.formatFuncCreator(1000, [' Wh', ' kWh', ' MWh', ' GWh', ' TWh', ' PWh', ' EWh', ' ZWh', ' YWh']); kbn.valueFormats.kwatth = kbn.formatFuncCreator(1000, [' kWh', ' MWh', ' GWh', ' TWh', ' PWh', ' EWh', ' ZWh', ' YWh']); - kbn.valueFormats.ev = kbn.formatFuncCreator(1000, [' eV', ' keV', ' MeV', 'GeV', 'TeV', 'PeV', 'EeV', 'ZeV', 'YeV']); - kbn.valueFormats.none = kbn.toFixed; + kbn.valueFormats.joule = kbn.formatFuncCreator(1000, [' J', ' kJ', ' MJ', ' GJ', ' TJ', ' PJ', ' EJ', ' ZJ', ' YJ']); + kbn.valueFormats.ev = kbn.formatFuncCreator(1000, [' eV', ' keV', ' MeV', 'GeV', 'TeV', 'PeV', 'EeV', 'ZeV', 'YeV']); + kbn.valueFormats.amp = kbn.formatFuncCreator(1000, [' A', ' kA', ' MA', ' GA', ' TA', ' PA', ' EA', ' ZA', ' YA']); + kbn.valueFormats.volt = kbn.formatFuncCreator(1000, [' V', ' kV', ' MV', ' GV', ' TV', ' PV', ' EV', ' ZV', ' YV']); + + // Temperature kbn.valueFormats.celsius = function(value, decimals) { return kbn.toFixed(value, decimals) + ' °C'; }; kbn.valueFormats.farenheit = function(value, decimals) { return kbn.toFixed(value, decimals) + ' °F'; }; kbn.valueFormats.humidity = function(value, decimals) { return kbn.toFixed(value, decimals) + ' %H'; }; + + // Pressure kbn.valueFormats.pressurembar = function(value, decimals) { return kbn.toFixed(value, decimals) + ' mbar'; }; kbn.valueFormats.pressurehpa = function(value, decimals) { return kbn.toFixed(value, decimals) + ' hPa'; }; - kbn.valueFormats.ppm = function(value, decimals) { return kbn.toFixed(value, decimals) + ' ppm'; }; + + // Velocity kbn.valueFormats.velocityms = function(value, decimals) { return kbn.toFixed(value, decimals) + ' m/s'; }; kbn.valueFormats.velocitykmh = function(value, decimals) { return kbn.toFixed(value, decimals) + ' km/h'; }; kbn.valueFormats.velocitymph = function(value, decimals) { return kbn.toFixed(value, decimals) + ' mph'; }; kbn.valueFormats.velocityknot = function(value, decimals) { return kbn.toFixed(value, decimals) + ' kn'; }; + // Time + kbn.valueFormats.hertz = kbn.formatFuncCreator(1000, [' Hz', ' kHz', ' MHz', ' GHz', ' THz', ' PHz', ' EHz', ' ZHz', ' YHz']); + kbn.roundValue = function (num, decimals) { if (num === null) { return null; } var n = Math.pow(10, decimals); From 0bc85d27f8b4cf91e79f76cf2be4814f322921fe Mon Sep 17 00:00:00 2001 From: Greg Look Date: Wed, 14 Oct 2015 12:56:31 -0700 Subject: [PATCH 023/269] Group rounding and fixed number functions. --- public/app/components/kbn.js | 79 +++++++++++++++++++----------------- 1 file changed, 41 insertions(+), 38 deletions(-) diff --git a/public/app/components/kbn.js b/public/app/components/kbn.js index be1f37dfacd..0fe0320feb8 100644 --- a/public/app/components/kbn.js +++ b/public/app/components/kbn.js @@ -199,30 +199,6 @@ function($, _) { return new RegExp(match[1], match[2]); }; - kbn.formatFuncCreator = function(factor, extArray) { - return function(size, decimals, scaledDecimals) { - if (size === null) { - return ""; - } - - var steps = 0; - var limit = extArray.length; - - while (Math.abs(size) >= factor) { - steps++; - size /= factor; - - if (steps >= limit) { return "NA"; } - } - - if (steps > 0 && scaledDecimals !== null) { - decimals = scaledDecimals + (3 * steps); - } - - return kbn.toFixed(size, decimals) + extArray[steps]; - }; - }; - kbn.toFixed = function(value, decimals) { if (value === null) { return ""; @@ -249,6 +225,46 @@ function($, _) { return formatted; }; + kbn.toFixedScaled = function(value, decimals, scaledDecimals, additionalDecimals, ext) { + if (scaledDecimals === null) { + return kbn.toFixed(value, decimals) + ext; + } else { + return kbn.toFixed(value, scaledDecimals + additionalDecimals) + ext; + } + }; + + kbn.roundValue = function (num, decimals) { + if (num === null) { return null; } + var n = Math.pow(10, decimals); + return Math.round((n * num).toFixed(decimals)) / n; + }; + + ///// FORMAT FUNCTION CONSTRUCTORS ///// + + kbn.formatFuncCreator = function(factor, extArray) { + return function(size, decimals, scaledDecimals) { + if (size === null) { + return ""; + } + + var steps = 0; + var limit = extArray.length; + + while (Math.abs(size) >= factor) { + steps++; + size /= factor; + + if (steps >= limit) { return "NA"; } + } + + if (steps > 0 && scaledDecimals !== null) { + decimals = scaledDecimals + (3 * steps); + } + + return kbn.toFixed(size, decimals) + extArray[steps]; + }; + }; + ///// VALUE FORMATS ///// // Dimensionless Units @@ -257,6 +273,7 @@ function($, _) { kbn.valueFormats.ppm = function(value, decimals) { return kbn.toFixed(value, decimals) + ' ppm'; }; kbn.valueFormats.percent = function(size, decimals) { + if (size == null) { return ""; } return kbn.toFixed(size, decimals) + '%'; }; @@ -300,20 +317,6 @@ function($, _) { // Time kbn.valueFormats.hertz = kbn.formatFuncCreator(1000, [' Hz', ' kHz', ' MHz', ' GHz', ' THz', ' PHz', ' EHz', ' ZHz', ' YHz']); - kbn.roundValue = function (num, decimals) { - if (num === null) { return null; } - var n = Math.pow(10, decimals); - return Math.round((n * num).toFixed(decimals)) / n; - }; - - kbn.toFixedScaled = function(value, decimals, scaledDecimals, additionalDecimals, ext) { - if (scaledDecimals === null) { - return kbn.toFixed(value, decimals) + ext; - } else { - return kbn.toFixed(value, scaledDecimals + additionalDecimals) + ext; - } - }; - kbn.valueFormats.ms = function(size, decimals, scaledDecimals) { if (size === null) { return ""; } From 7d24c5fda24abccd712a6df8002b62955d2f83a4 Mon Sep 17 00:00:00 2001 From: Greg Look Date: Wed, 14 Oct 2015 13:07:34 -0700 Subject: [PATCH 024/269] Add fixedUnit format builder. --- public/app/components/kbn.js | 41 +++++++++++++++++++++--------------- 1 file changed, 24 insertions(+), 17 deletions(-) diff --git a/public/app/components/kbn.js b/public/app/components/kbn.js index 0fe0320feb8..18821c17754 100644 --- a/public/app/components/kbn.js +++ b/public/app/components/kbn.js @@ -241,6 +241,17 @@ function($, _) { ///// FORMAT FUNCTION CONSTRUCTORS ///// + kbn.formatBuilders = {}; + + // Formatter which always appends a fixed unit string to the value. No + // scaling of the value is performed. + kbn.formatBuilders.fixedUnit = function(unit, separator) { + return function(size, decimals) { + if (size === null) { return ""; } + return kbn.toFixed(size, decimals) + (separator || ' ') + unit; + }; + }; + kbn.formatFuncCreator = function(factor, extArray) { return function(size, decimals, scaledDecimals) { if (size === null) { @@ -268,14 +279,10 @@ function($, _) { ///// VALUE FORMATS ///// // Dimensionless Units - kbn.valueFormats.none = kbn.toFixed; - kbn.valueFormats.short = kbn.formatFuncCreator(1000, ['', ' K', ' Mil', ' Bil', ' Tri', ' Quadr', ' Quint', ' Sext', ' Sept']); - kbn.valueFormats.ppm = function(value, decimals) { return kbn.toFixed(value, decimals) + ' ppm'; }; - - kbn.valueFormats.percent = function(size, decimals) { - if (size == null) { return ""; } - return kbn.toFixed(size, decimals) + '%'; - }; + kbn.valueFormats.none = kbn.toFixed; + kbn.valueFormats.short = kbn.formatFuncCreator(1000, ['', ' K', ' Mil', ' Bil', ' Tri', ' Quadr', ' Quint', ' Sext', ' Sept']); + kbn.valueFormats.ppm = kbn.formatBuilders.fixedUnit('ppm'); + kbn.valueFormats.percent = kbn.formatBuilders.fixedUnit('%', ''); // Data kbn.valueFormats.bits = kbn.formatFuncCreator(1024, [' b', ' Kib', ' Mib', ' Gib', ' Tib', ' Pib', ' Eib', ' Zib', ' Yib']); @@ -300,19 +307,19 @@ function($, _) { kbn.valueFormats.volt = kbn.formatFuncCreator(1000, [' V', ' kV', ' MV', ' GV', ' TV', ' PV', ' EV', ' ZV', ' YV']); // Temperature - kbn.valueFormats.celsius = function(value, decimals) { return kbn.toFixed(value, decimals) + ' °C'; }; - kbn.valueFormats.farenheit = function(value, decimals) { return kbn.toFixed(value, decimals) + ' °F'; }; - kbn.valueFormats.humidity = function(value, decimals) { return kbn.toFixed(value, decimals) + ' %H'; }; + kbn.valueFormats.celsius = kbn.formatBuilders.fixedUnit('°C'); + kbn.valueFormats.farenheit = kbn.formatBuilders.fixedUnit('°F'); + kbn.valueFormats.humidity = kbn.formatBuilders.fixedUnit('%H'); // Pressure - kbn.valueFormats.pressurembar = function(value, decimals) { return kbn.toFixed(value, decimals) + ' mbar'; }; - kbn.valueFormats.pressurehpa = function(value, decimals) { return kbn.toFixed(value, decimals) + ' hPa'; }; + kbn.valueFormats.pressurembar = kbn.formatBuilders.fixedUnit('mbar'); + kbn.valueFormats.pressurehpa = kbn.formatBuilders.fixedUnit('hPa'); // Velocity - kbn.valueFormats.velocityms = function(value, decimals) { return kbn.toFixed(value, decimals) + ' m/s'; }; - kbn.valueFormats.velocitykmh = function(value, decimals) { return kbn.toFixed(value, decimals) + ' km/h'; }; - kbn.valueFormats.velocitymph = function(value, decimals) { return kbn.toFixed(value, decimals) + ' mph'; }; - kbn.valueFormats.velocityknot = function(value, decimals) { return kbn.toFixed(value, decimals) + ' kn'; }; + kbn.valueFormats.velocityms = kbn.formatBuilders.fixedUnit('m/s'); + kbn.valueFormats.velocitykmh = kbn.formatBuilders.fixedUnit('km/h'); + kbn.valueFormats.velocitymph = kbn.formatBuilders.fixedUnit('mph'); + kbn.valueFormats.velocityknot = kbn.formatBuilders.fixedUnit('kn'); // Time kbn.valueFormats.hertz = kbn.formatFuncCreator(1000, [' Hz', ' kHz', ' MHz', ' GHz', ' THz', ' PHz', ' EHz', ' ZHz', ' YHz']); From 51a589f5a6e58cd4b004cf35590024361f68f373 Mon Sep 17 00:00:00 2001 From: Greg Look Date: Wed, 14 Oct 2015 13:18:02 -0700 Subject: [PATCH 025/269] Change formatFuncCreator to scaledUnits builder. Abstract out both decimal and binary SI prefixes into builders using scaledUnits. --- public/app/components/kbn.js | 60 ++++++++++++++++++++++++------------ 1 file changed, 41 insertions(+), 19 deletions(-) diff --git a/public/app/components/kbn.js b/public/app/components/kbn.js index 18821c17754..8f338a5a177 100644 --- a/public/app/components/kbn.js +++ b/public/app/components/kbn.js @@ -252,7 +252,10 @@ function($, _) { }; }; - kbn.formatFuncCreator = function(factor, extArray) { + // Formatter which scales the unit string geometrically according to the given + // numeric factor. Repeatedly scales the value down by the factor until it is + // less than the factor in magnitude, or the end of the array is reached. + kbn.formatBuilders.scaledUnits = function(factor, extArray) { return function(size, decimals, scaledDecimals) { if (size === null) { return ""; @@ -276,35 +279,54 @@ function($, _) { }; }; + // Extension of the scaledUnits builder which uses SI decimal prefixes. If an + // offset is given, it adjusts the starting units at the given prefix; a value + // of 0 starts at no scale; -3 drops to nano, +2 starts at mega, etc. + kbn.formatBuilders.decimalSIPrefix = function(unit, offset) { + var prefixes = ['n', 'µ', 'm', '', 'k', 'M', 'G', 'T', 'P', 'E', 'Z', 'Y']; + prefixes = prefixes.slice(3 + (offset || 0)); + var units = prefixes.map(function(p) { return ' ' + p + unit; }); + return kbn.formatBuilders.scaledUnits(1000, units); + }; + + // Extension of the scaledUnits builder which uses SI binary prefixes. If + // offset is given, it starts the units at the given prefix; otherwise, the + // offset defaults to zero and the initial unit is not prefixed. + kbn.formatBuilders.binarySIPrefix = function(unit, offset) { + var prefixes = ['', 'Ki', 'Mi', 'Gi', 'Ti', 'Pi', 'Ei', 'Zi', 'Yi'].slice(offset); + var units = prefixes.map(function(p) { return ' ' + p + unit; }); + return kbn.formatBuilders.scaledUnits(1024, units); + }; + ///// VALUE FORMATS ///// // Dimensionless Units kbn.valueFormats.none = kbn.toFixed; - kbn.valueFormats.short = kbn.formatFuncCreator(1000, ['', ' K', ' Mil', ' Bil', ' Tri', ' Quadr', ' Quint', ' Sext', ' Sept']); + kbn.valueFormats.short = kbn.formatBuilders.scaledUnits(1000, ['', ' K', ' Mil', ' Bil', ' Tri', ' Quadr', ' Quint', ' Sext', ' Sept']); kbn.valueFormats.ppm = kbn.formatBuilders.fixedUnit('ppm'); kbn.valueFormats.percent = kbn.formatBuilders.fixedUnit('%', ''); // Data - kbn.valueFormats.bits = kbn.formatFuncCreator(1024, [' b', ' Kib', ' Mib', ' Gib', ' Tib', ' Pib', ' Eib', ' Zib', ' Yib']); - kbn.valueFormats.bytes = kbn.formatFuncCreator(1024, [' B', ' KiB', ' MiB', ' GiB', ' TiB', ' PiB', ' EiB', ' ZiB', ' YiB']); - kbn.valueFormats.kbytes = kbn.formatFuncCreator(1024, [' KiB', ' MiB', ' GiB', ' TiB', ' PiB', ' EiB', ' ZiB', ' YiB']); - kbn.valueFormats.mbytes = kbn.formatFuncCreator(1024, [' MiB', ' GiB', ' TiB', ' PiB', ' EiB', ' ZiB', ' YiB']); - kbn.valueFormats.gbytes = kbn.formatFuncCreator(1024, [' GiB', ' TiB', ' PiB', ' EiB', ' ZiB', ' YiB']); + kbn.valueFormats.bits = kbn.formatBuilders.binarySIPrefix('b'); + kbn.valueFormats.bytes = kbn.formatBuilders.binarySIPrefix('B'); + kbn.valueFormats.kbytes = kbn.formatBuilders.binarySIPrefix('B', 1); + kbn.valueFormats.mbytes = kbn.formatBuilders.binarySIPrefix('B', 2); + kbn.valueFormats.gbytes = kbn.formatBuilders.binarySIPrefix('B', 3); // Data Rate - kbn.valueFormats.pps = kbn.formatFuncCreator(1000, [' pps', ' Kpps', ' Mpps', ' Gpps', ' Tpps', ' Ppps', ' Epps', ' Zpps', ' Ypps']); - kbn.valueFormats.bps = kbn.formatFuncCreator(1000, [' bps', ' Kbps', ' Mbps', ' Gbps', ' Tbps', ' Pbps', ' Ebps', ' Zbps', ' Ybps']); - kbn.valueFormats.Bps = kbn.formatFuncCreator(1000, [' Bps', ' KBps', ' MBps', ' GBps', ' TBps', ' PBps', ' EBps', ' ZBps', ' YBps']); + kbn.valueFormats.pps = kbn.formatBuilders.decimalSIPrefix('pps'); + kbn.valueFormats.bps = kbn.formatBuilders.decimalSIPrefix('bps'); + kbn.valueFormats.Bps = kbn.formatBuilders.decimalSIPrefix('Bps'); // Energy - kbn.valueFormats.watt = kbn.formatFuncCreator(1000, [' W', ' kW', ' MW', ' GW', ' TW', ' PW', ' EW', ' ZW', ' YW']); - kbn.valueFormats.kwatt = kbn.formatFuncCreator(1000, [' kW', ' MW', ' GW', ' TW', ' PW', ' EW', ' ZW', ' YW']); - kbn.valueFormats.watth = kbn.formatFuncCreator(1000, [' Wh', ' kWh', ' MWh', ' GWh', ' TWh', ' PWh', ' EWh', ' ZWh', ' YWh']); - kbn.valueFormats.kwatth = kbn.formatFuncCreator(1000, [' kWh', ' MWh', ' GWh', ' TWh', ' PWh', ' EWh', ' ZWh', ' YWh']); - kbn.valueFormats.joule = kbn.formatFuncCreator(1000, [' J', ' kJ', ' MJ', ' GJ', ' TJ', ' PJ', ' EJ', ' ZJ', ' YJ']); - kbn.valueFormats.ev = kbn.formatFuncCreator(1000, [' eV', ' keV', ' MeV', 'GeV', 'TeV', 'PeV', 'EeV', 'ZeV', 'YeV']); - kbn.valueFormats.amp = kbn.formatFuncCreator(1000, [' A', ' kA', ' MA', ' GA', ' TA', ' PA', ' EA', ' ZA', ' YA']); - kbn.valueFormats.volt = kbn.formatFuncCreator(1000, [' V', ' kV', ' MV', ' GV', ' TV', ' PV', ' EV', ' ZV', ' YV']); + kbn.valueFormats.watt = kbn.formatBuilders.decimalSIPrefix('W'); + kbn.valueFormats.kwatt = kbn.formatBuilders.decimalSIPrefix('W', 1); + kbn.valueFormats.watth = kbn.formatBuilders.decimalSIPrefix('Wh'); + kbn.valueFormats.kwatth = kbn.formatBuilders.decimalSIPrefix('Wh', 1); + kbn.valueFormats.joule = kbn.formatBuilders.decimalSIPrefix('J'); + kbn.valueFormats.ev = kbn.formatBuilders.decimalSIPrefix('eV'); + kbn.valueFormats.amp = kbn.formatBuilders.decimalSIPrefix('A'); + kbn.valueFormats.volt = kbn.formatBuilders.decimalSIPrefix('V'); // Temperature kbn.valueFormats.celsius = kbn.formatBuilders.fixedUnit('°C'); @@ -322,7 +344,7 @@ function($, _) { kbn.valueFormats.velocityknot = kbn.formatBuilders.fixedUnit('kn'); // Time - kbn.valueFormats.hertz = kbn.formatFuncCreator(1000, [' Hz', ' kHz', ' MHz', ' GHz', ' THz', ' PHz', ' EHz', ' ZHz', ' YHz']); + kbn.valueFormats.hertz = kbn.formatBuilders.decimalSIPrefix('Hz'); kbn.valueFormats.ms = function(size, decimals, scaledDecimals) { if (size === null) { return ""; } From 70269c81968f4a97f2e8639178af600d3423805b Mon Sep 17 00:00:00 2001 From: Greg Look Date: Wed, 14 Oct 2015 13:34:48 -0700 Subject: [PATCH 026/269] Reformat unit menu definition. --- public/app/components/kbn.js | 62 ++++++++++++++++++------------------ 1 file changed, 31 insertions(+), 31 deletions(-) diff --git a/public/app/components/kbn.js b/public/app/components/kbn.js index 8f338a5a177..4ac6d5712d9 100644 --- a/public/app/components/kbn.js +++ b/public/app/components/kbn.js @@ -439,28 +439,28 @@ function($, _) { { text: 'none', submenu: [ - {text: 'none' , value: 'none'}, - {text: 'short', value: 'short'}, - {text: 'percent', value: 'percent'}, - {text: 'ppm', value: 'ppm'}, - {text: 'dB', value: 'dB'}, + {text: 'none' , value: 'none' }, + {text: 'short', value: 'short' }, + {text: 'scaled percentage (0-100)', value: 'percent' }, + {text: 'ppm', value: 'ppm' }, + {text: 'decibel', value: 'dB' }, ] }, { text: 'duration', submenu: [ - {text: 'nanoseconds (ns)' , value: 'ns'}, - {text: 'microseconds (µs)', value: 'µs'}, - {text: 'milliseconds (ms)', value: 'ms'}, - {text: 'seconds (s)', value: 's'}, - {text: 'Hertz (1/s)', value: 'hertz'}, + {text: 'Hertz (1/s)', value: 'hertz'}, + {text: 'nanoseconds (ns)' , value: 'ns' }, + {text: 'microseconds (µs)', value: 'µs' }, + {text: 'milliseconds (ms)', value: 'ms' }, + {text: 'seconds (s)', value: 's' }, ] }, { text: 'data', submenu: [ - {text: 'bits', value: 'bits'}, - {text: 'bytes', value: 'bytes'}, + {text: 'bits', value: 'bits' }, + {text: 'bytes', value: 'bytes' }, {text: 'kilobytes', value: 'kbytes'}, {text: 'megabytes', value: 'mbytes'}, {text: 'gigabytes', value: 'gbytes'}, @@ -470,40 +470,40 @@ function($, _) { text: 'data rate', submenu: [ {text: 'packets/sec', value: 'pps'}, - {text: 'bits/sec', value: 'bps'}, - {text: 'bytes/sec', value: 'Bps'}, + {text: 'bits/sec', value: 'bps'}, + {text: 'bytes/sec', value: 'Bps'}, ] }, { text: 'energy', submenu: [ - {text: 'watt (W)', value: 'watt'}, - {text: 'kilowatt (kW)', value: 'kwatt'}, - {text: 'watt-hour (Wh)', value: 'watth'}, - {text: 'kilowatt-hour (kWh)', value: 'kwatth'}, - {text: 'joule (J)', value: 'joule'}, - {text: 'electron volt (eV)', value: 'ev'}, - {text: 'Ampere (A)', value: 'amp'}, - {text: 'Volt (V)', value: 'volt'}, + {text: 'watt (W)', value: 'watt' }, + {text: 'kilowatt (kW)', value: 'kwatt' }, + {text: 'watt-hour (Wh)', value: 'watth' }, + {text: 'kilowatt-hour (kWh)', value: 'kwatth'}, + {text: 'joule (J)', value: 'joule' }, + {text: 'electron volt (eV)', value: 'ev' }, + {text: 'Ampere (A)', value: 'amp' }, + {text: 'Volt (V)', value: 'volt' }, ] }, { text: 'weather', submenu: [ - {text: 'Celcius (°C)', value: 'celsius' }, - {text: 'Farenheit (°F)', value: 'farenheit'}, - {text: 'Humidity (%H)', value: 'humidity' }, - {text: 'Pressure (mbar)', value: 'pressurembar' }, - {text: 'Pressure (hPa)', value: 'pressurehpa' }, + {text: 'Celcius (°C)', value: 'celsius' }, + {text: 'Farenheit (°F)', value: 'farenheit' }, + {text: 'Humidity (%H)', value: 'humidity' }, + {text: 'Pressure (mbar)', value: 'pressurembar'}, + {text: 'Pressure (hPa)', value: 'pressurehpa' }, ] }, { text: 'velocity', submenu: [ - {text: 'm/s', value: 'velocityms' }, - {text: 'km/h', value: 'velocitykmh' }, - {text: 'mph', value: 'velocitymph' }, - {text: 'knot (kn)', value: 'velocityknot' }, + {text: 'm/s', value: 'velocityms' }, + {text: 'km/h', value: 'velocitykmh' }, + {text: 'mph', value: 'velocitymph' }, + {text: 'knot (kn)', value: 'velocityknot'}, ] }, ]; From 9185c94a2d4c14cebd0acd727486d128da3a4001 Mon Sep 17 00:00:00 2001 From: ubhatnagar Date: Wed, 14 Oct 2015 13:45:47 -0700 Subject: [PATCH 027/269] Added insert row option in the row menu. --- public/app/features/dashboard/rowCtrl.js | 10 ++++++++++ public/app/partials/dashboard.html | 7 +++++++ 2 files changed, 17 insertions(+) diff --git a/public/app/features/dashboard/rowCtrl.js b/public/app/features/dashboard/rowCtrl.js index 02cb59721a3..9b5de4c0a1b 100644 --- a/public/app/features/dashboard/rowCtrl.js +++ b/public/app/features/dashboard/rowCtrl.js @@ -82,6 +82,16 @@ function (angular, _, config) { } }; + $scope.insert_row = function(direction) { + var rowsList = $scope.dashboard.rows; + var currentRowIndex = _.indexOf(rowsList, $scope.row); + $scope.add_row_default(); + var newIndex = currentRowIndex + direction; + if (newIndex >= 0 && newIndex <= (rowsList.length - 1)) { + _.move(rowsList, rowsList.length - 1, newIndex); + } + }; + $scope.add_panel_default = function(type) { var defaultSpan = 12; var _as = 12 - $scope.dashboard.rowSpan($scope.row); diff --git a/public/app/partials/dashboard.html b/public/app/partials/dashboard.html index 4edbb816eeb..668363b111c 100644 --- a/public/app/partials/dashboard.html +++ b/public/app/partials/dashboard.html @@ -69,6 +69,13 @@
      • Row editor
      • +
      • Delete row
      • From dc5c3a393963ea4c949ebb7162ed78a693e351db Mon Sep 17 00:00:00 2001 From: Greg Look Date: Wed, 14 Oct 2015 13:39:27 -0700 Subject: [PATCH 028/269] Implement decibel and percentunit units. Add tests to exercise new units as well. --- public/app/components/kbn.js | 23 +++++++++++++++++------ public/test/specs/kbn-format-specs.js | 8 ++++++++ 2 files changed, 25 insertions(+), 6 deletions(-) diff --git a/public/app/components/kbn.js b/public/app/components/kbn.js index 4ac6d5712d9..208d3840fa1 100644 --- a/public/app/components/kbn.js +++ b/public/app/components/kbn.js @@ -245,10 +245,10 @@ function($, _) { // Formatter which always appends a fixed unit string to the value. No // scaling of the value is performed. - kbn.formatBuilders.fixedUnit = function(unit, separator) { + kbn.formatBuilders.fixedUnit = function(unit) { return function(size, decimals) { if (size === null) { return ""; } - return kbn.toFixed(size, decimals) + (separator || ' ') + unit; + return kbn.toFixed(size, decimals) + ' ' + unit; }; }; @@ -301,10 +301,20 @@ function($, _) { ///// VALUE FORMATS ///// // Dimensionless Units - kbn.valueFormats.none = kbn.toFixed; - kbn.valueFormats.short = kbn.formatBuilders.scaledUnits(1000, ['', ' K', ' Mil', ' Bil', ' Tri', ' Quadr', ' Quint', ' Sext', ' Sept']); - kbn.valueFormats.ppm = kbn.formatBuilders.fixedUnit('ppm'); - kbn.valueFormats.percent = kbn.formatBuilders.fixedUnit('%', ''); + kbn.valueFormats.none = kbn.toFixed; + kbn.valueFormats.short = kbn.formatBuilders.scaledUnits(1000, ['', ' K', ' Mil', ' Bil', ' Tri', ' Quadr', ' Quint', ' Sext', ' Sept']); + kbn.valueFormats.dB = kbn.formatBuilders.fixedUnit('dB'); + kbn.valueFormats.ppm = kbn.formatBuilders.fixedUnit('ppm'); + + kbn.valueFormats.percent = function(size, decimals) { + if (size === null) { return ""; } + return kbn.toFixed(size, decimals) + '%'; + }; + + kbn.valueFormats.percentunit = function(size, decimals) { + if (size === null) { return ""; } + return kbn.toFixed(100*size, decimals) + '%'; + }; // Data kbn.valueFormats.bits = kbn.formatBuilders.binarySIPrefix('b'); @@ -442,6 +452,7 @@ function($, _) { {text: 'none' , value: 'none' }, {text: 'short', value: 'short' }, {text: 'scaled percentage (0-100)', value: 'percent' }, + {text: 'unit percentage (0.0-1.0)', value: 'percentunit'}, {text: 'ppm', value: 'ppm' }, {text: 'decibel', value: 'dB' }, ] diff --git a/public/test/specs/kbn-format-specs.js b/public/test/specs/kbn-format-specs.js index 366ab575491..d7f97187716 100644 --- a/public/test/specs/kbn-format-specs.js +++ b/public/test/specs/kbn-format-specs.js @@ -26,6 +26,14 @@ define([ describeValueFormat('none', 2.75e-10, 0, 10, '3e-10'); describeValueFormat('none', 0, 0, 2, '0'); + describeValueFormat('dB', 10, 1000, 2, '10.00 dB'); + + describeValueFormat('percent', 0, 0, 0, '0%'); + describeValueFormat('percent', 53, 0, 1, '53.0%'); + describeValueFormat('percentunit', 0.0, 0, 0, '0%'); + describeValueFormat('percentunit', 0.278, 0, 1, '27.8%'); + describeValueFormat('percentunit', 1.0, 0, 0, '100%'); + describeValueFormat('bytes', -1.57e+308, -1.57e+308, 2, 'NA'); describeValueFormat('ns', 25, 1, 0, '25 ns'); From 3c7a483f5c582cbb822ab89ec4125730ec83ab7a Mon Sep 17 00:00:00 2001 From: Greg Look Date: Wed, 14 Oct 2015 14:13:21 -0700 Subject: [PATCH 029/269] Add length and volume units. --- public/app/components/kbn.js | 43 ++++++++++++++++++++++++++++-------- 1 file changed, 34 insertions(+), 9 deletions(-) diff --git a/public/app/components/kbn.js b/public/app/components/kbn.js index 208d3840fa1..6adc4fac17a 100644 --- a/public/app/components/kbn.js +++ b/public/app/components/kbn.js @@ -347,12 +347,20 @@ function($, _) { kbn.valueFormats.pressurembar = kbn.formatBuilders.fixedUnit('mbar'); kbn.valueFormats.pressurehpa = kbn.formatBuilders.fixedUnit('hPa'); + // Length + kbn.valueFormats.lengthm = kbn.formatBuilders.decimalSIPrefix('m'); + kbn.valueFormats.lengthkm = kbn.formatBuilders.decimalSIPrefix('m', 1); + // Velocity kbn.valueFormats.velocityms = kbn.formatBuilders.fixedUnit('m/s'); kbn.valueFormats.velocitykmh = kbn.formatBuilders.fixedUnit('km/h'); kbn.valueFormats.velocitymph = kbn.formatBuilders.fixedUnit('mph'); kbn.valueFormats.velocityknot = kbn.formatBuilders.fixedUnit('kn'); + // Volume + kbn.valueFormats.litre = kbn.formatBuilders.decimalSIPrefix('L'); + kbn.valueFormats.mlitre = kbn.formatBuilders.decimalSIPrefix('L', -1); + // Time kbn.valueFormats.hertz = kbn.formatBuilders.decimalSIPrefix('Hz'); @@ -485,6 +493,32 @@ function($, _) { {text: 'bytes/sec', value: 'Bps'}, ] }, + { + text: 'length', + submenu: [ + {text: 'millimetre (mm)', value: 'lengthmm'}, + {text: 'meter (m)', value: 'lengthm' }, + {text: 'kilometer (km)', value: 'lengthm' }, + {text: 'inches', value: 'lengthin'}, + {text: 'feet', value: 'lengthft'}, + ] + }, + { + text: 'velocity', + submenu: [ + {text: 'm/s', value: 'velocityms' }, + {text: 'km/h', value: 'velocitykmh' }, + {text: 'mph', value: 'velocitymph' }, + {text: 'knot (kn)', value: 'velocityknot'}, + ] + }, + { + text: 'volume', + submenu: [ + {text: 'millilitre', value: 'mlitre'}, + {text: 'litre', value: 'litre' }, + ] + }, { text: 'energy', submenu: [ @@ -508,15 +542,6 @@ function($, _) { {text: 'Pressure (hPa)', value: 'pressurehpa' }, ] }, - { - text: 'velocity', - submenu: [ - {text: 'm/s', value: 'velocityms' }, - {text: 'km/h', value: 'velocitykmh' }, - {text: 'mph', value: 'velocitymph' }, - {text: 'knot (kn)', value: 'velocityknot'}, - ] - }, ]; }; From d94b6635af06f12a3185d7261c6595b361230da1 Mon Sep 17 00:00:00 2001 From: Greg Look Date: Wed, 14 Oct 2015 14:50:43 -0700 Subject: [PATCH 030/269] Add temperature and pressure units, split submenus. --- public/app/components/kbn.js | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/public/app/components/kbn.js b/public/app/components/kbn.js index 6adc4fac17a..aa3aad19fd9 100644 --- a/public/app/components/kbn.js +++ b/public/app/components/kbn.js @@ -341,11 +341,14 @@ function($, _) { // Temperature kbn.valueFormats.celsius = kbn.formatBuilders.fixedUnit('°C'); kbn.valueFormats.farenheit = kbn.formatBuilders.fixedUnit('°F'); + kbn.valueFormats.kelvin = kbn.formatBuilders.fixedUnit('K'); kbn.valueFormats.humidity = kbn.formatBuilders.fixedUnit('%H'); // Pressure kbn.valueFormats.pressurembar = kbn.formatBuilders.fixedUnit('mbar'); kbn.valueFormats.pressurehpa = kbn.formatBuilders.fixedUnit('hPa'); + kbn.valueFormats.pressurehg = kbn.formatBuilders.fixedUnit('"Hg'); + kbn.valueFormats.pressurepsi = kbn.formatBuilders.scaledUnits(1000, [' psi', ' ksi', ' Mpsi']); // Length kbn.valueFormats.lengthm = kbn.formatBuilders.decimalSIPrefix('m'); @@ -461,12 +464,13 @@ function($, _) { {text: 'short', value: 'short' }, {text: 'scaled percentage (0-100)', value: 'percent' }, {text: 'unit percentage (0.0-1.0)', value: 'percentunit'}, + {text: 'Humidity (%H)', value: 'humidity' }, {text: 'ppm', value: 'ppm' }, {text: 'decibel', value: 'dB' }, ] }, { - text: 'duration', + text: 'time', submenu: [ {text: 'Hertz (1/s)', value: 'hertz'}, {text: 'nanoseconds (ns)' , value: 'ns' }, @@ -533,13 +537,20 @@ function($, _) { ] }, { - text: 'weather', + text: 'temperature', submenu: [ {text: 'Celcius (°C)', value: 'celsius' }, {text: 'Farenheit (°F)', value: 'farenheit' }, - {text: 'Humidity (%H)', value: 'humidity' }, - {text: 'Pressure (mbar)', value: 'pressurembar'}, - {text: 'Pressure (hPa)', value: 'pressurehpa' }, + {text: 'Kelvin (K)', value: 'kelvin' }, + ] + }, + { + text: 'pressure', + submenu: [ + {text: 'Millibars', value: 'pressurembar'}, + {text: 'Hectopascals', value: 'pressurehpa' }, + {text: 'Inches of mercury', value: 'pressurehq' }, + {text: 'PSI', value: 'pressurepsi' }, ] }, ]; From 85887ad1cf8063d08fec83fc17d7f7d2612946aa Mon Sep 17 00:00:00 2001 From: Greg Look Date: Wed, 14 Oct 2015 14:51:33 -0700 Subject: [PATCH 031/269] Add mile, fix menu values. --- public/app/components/kbn.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/public/app/components/kbn.js b/public/app/components/kbn.js index aa3aad19fd9..9c9b337f1b3 100644 --- a/public/app/components/kbn.js +++ b/public/app/components/kbn.js @@ -352,7 +352,9 @@ function($, _) { // Length kbn.valueFormats.lengthm = kbn.formatBuilders.decimalSIPrefix('m'); + kbn.valueFormats.lengthmm = kbn.formatBuilders.decimalSIPrefix('m', -1); kbn.valueFormats.lengthkm = kbn.formatBuilders.decimalSIPrefix('m', 1); + kbn.valueFormats.lengthmi = kbn.formatBuilders.fixedUnit('mi'); // Velocity kbn.valueFormats.velocityms = kbn.formatBuilders.fixedUnit('m/s'); @@ -502,9 +504,8 @@ function($, _) { submenu: [ {text: 'millimetre (mm)', value: 'lengthmm'}, {text: 'meter (m)', value: 'lengthm' }, - {text: 'kilometer (km)', value: 'lengthm' }, - {text: 'inches', value: 'lengthin'}, - {text: 'feet', value: 'lengthft'}, + {text: 'kilometer (km)', value: 'lengthkm'}, + {text: 'mile (mi)', value: 'lengthmi'}, ] }, { @@ -549,7 +550,7 @@ function($, _) { submenu: [ {text: 'Millibars', value: 'pressurembar'}, {text: 'Hectopascals', value: 'pressurehpa' }, - {text: 'Inches of mercury', value: 'pressurehq' }, + {text: 'Inches of mercury', value: 'pressurehg' }, {text: 'PSI', value: 'pressurepsi' }, ] }, From 524f5d45ec1b1e76ded0ae79ba1df5958cfa2bb0 Mon Sep 17 00:00:00 2001 From: Greg Look Date: Wed, 14 Oct 2015 14:51:42 -0700 Subject: [PATCH 032/269] Add test for unit menu structure. --- public/test/specs/kbn-format-specs.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/public/test/specs/kbn-format-specs.js b/public/test/specs/kbn-format-specs.js index d7f97187716..feae3c261aa 100644 --- a/public/test/specs/kbn-format-specs.js +++ b/public/test/specs/kbn-format-specs.js @@ -4,6 +4,25 @@ define([ ], function(kbn, dateMath) { 'use strict'; + describe('unit format menu', function() { + var menu = kbn.getUnitFormats(); + menu.map(function(submenu) { + describe('submenu ' + submenu.text, function() { + it('should have a title', function() { expect(submenu.text).to.be.a('string'); }); + it('should have a submenu', function() { expect(submenu.submenu).to.be.an('array'); }); + submenu.submenu.map(function(entry) { + describe('entry ' + entry.text, function() { + it('should have a title', function() { expect(entry.text).to.be.a('string'); }); + it('should have a format', function() { expect(entry.value).to.be.a('string'); }); + it('should have a valid format', function() { + expect(kbn.valueFormats[entry.value]).to.be.a('function'); + }); + }); + }); + }); + }); + }); + function describeValueFormat(desc, value, tickSize, tickDecimals, result) { describe('value format: ' + desc, function() { From 0b3e33e2265fb686080c3b2f18ee2ddb11f3d77f Mon Sep 17 00:00:00 2001 From: Greg Look Date: Wed, 14 Oct 2015 15:40:04 -0700 Subject: [PATCH 033/269] Shorten percent unit labels. --- public/app/components/kbn.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/public/app/components/kbn.js b/public/app/components/kbn.js index 9c9b337f1b3..e0aa81dc485 100644 --- a/public/app/components/kbn.js +++ b/public/app/components/kbn.js @@ -462,13 +462,13 @@ function($, _) { { text: 'none', submenu: [ - {text: 'none' , value: 'none' }, - {text: 'short', value: 'short' }, - {text: 'scaled percentage (0-100)', value: 'percent' }, - {text: 'unit percentage (0.0-1.0)', value: 'percentunit'}, - {text: 'Humidity (%H)', value: 'humidity' }, - {text: 'ppm', value: 'ppm' }, - {text: 'decibel', value: 'dB' }, + {text: 'none' , value: 'none' }, + {text: 'short', value: 'short' }, + {text: 'percent (0-100)', value: 'percent' }, + {text: 'percent (0.0-1.0)', value: 'percentunit'}, + {text: 'Humidity (%H)', value: 'humidity' }, + {text: 'ppm', value: 'ppm' }, + {text: 'decibel', value: 'dB' }, ] }, { From 882a988143711e551f42177fc11489dcf082db98 Mon Sep 17 00:00:00 2001 From: Greg Look Date: Thu, 15 Oct 2015 12:48:48 -0700 Subject: [PATCH 034/269] Add currency units from #1910. --- public/app/components/kbn.js | 23 +++++++++++++++++++++++ public/test/specs/kbn-format-specs.js | 4 ++++ 2 files changed, 27 insertions(+) diff --git a/public/app/components/kbn.js b/public/app/components/kbn.js index e0aa81dc485..ad2d4c3c422 100644 --- a/public/app/components/kbn.js +++ b/public/app/components/kbn.js @@ -298,6 +298,18 @@ function($, _) { return kbn.formatBuilders.scaledUnits(1024, units); }; + // Currency formatter for prefixing a symbol onto a number. Supports scaling + // up to the trillions. + kbn.formatBuilders.currency = function(symbol) { + var units = ['', 'K', 'M', 'B', 'T']; + var scaler = kbn.formatBuilders.scaledUnits(1000, units); + return function(size, decimals, scaledDecimals) { + if (size === null) { return ""; } + var scaled = scaler(size, decimals, scaledDecimals); + return symbol + scaled; + }; + }; + ///// VALUE FORMATS ///// // Dimensionless Units @@ -316,6 +328,10 @@ function($, _) { return kbn.toFixed(100*size, decimals) + '%'; }; + // Currencies + kbn.valueFormats.currencyUSD = kbn.formatBuilders.currency('$'); + kbn.valueFormats.currencyGBP = kbn.formatBuilders.currency('£'); + // Data kbn.valueFormats.bits = kbn.formatBuilders.binarySIPrefix('b'); kbn.valueFormats.bytes = kbn.formatBuilders.binarySIPrefix('B'); @@ -471,6 +487,13 @@ function($, _) { {text: 'decibel', value: 'dB' }, ] }, + { + text: 'currency', + submenu: [ + {text: 'Dollars ($)', value: 'currencyUSD'}, + {text: 'Pounds (£)', value: 'currencyGBP'}, + ] + }, { text: 'time', submenu: [ diff --git a/public/test/specs/kbn-format-specs.js b/public/test/specs/kbn-format-specs.js index feae3c261aa..f84544fff4f 100644 --- a/public/test/specs/kbn-format-specs.js +++ b/public/test/specs/kbn-format-specs.js @@ -53,6 +53,10 @@ define([ describeValueFormat('percentunit', 0.278, 0, 1, '27.8%'); describeValueFormat('percentunit', 1.0, 0, 0, '100%'); + describeValueFormat('currencyUSD', 7.42, 10000, 2, '$7.42'); + describeValueFormat('currencyUSD', 1532.82, 1000, 1, '$1.53K'); + describeValueFormat('currencyUSD', 18520408.7, 10000000, 0, '$19M'); + describeValueFormat('bytes', -1.57e+308, -1.57e+308, 2, 'NA'); describeValueFormat('ns', 25, 1, 0, '25 ns'); From bd77fd92bbddd157bf491069e96aced8e8f862c4 Mon Sep 17 00:00:00 2001 From: "Scott M. Likens" Date: Thu, 15 Oct 2015 19:45:40 -0700 Subject: [PATCH 035/269] I'm not sure what a dashboard is ... --- docs/sources/reference/graph.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/sources/reference/graph.md b/docs/sources/reference/graph.md index 9de23332a99..e8867d3d527 100644 --- a/docs/sources/reference/graph.md +++ b/docs/sources/reference/graph.md @@ -30,7 +30,7 @@ The drilldown section allows adding dynamic links to the panel that can link to or URLs Each link has a title, a type and params. A link can be either a ``dashboard`` or ``absolute`` links. -If it is a dashboard links, the `dashboard` value must be the name of a dashbaord. If it's an +If it is a dashboard links, the `dashboard` value must be the name of a dashboard. If it's an `absolute` link, the URL is the URL to link. ``params`` allows adding additional URL params to the links. The format is the ``name=value`` with From e507afc3d51a42af7e0c42de9fc0f981bd99ef51 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Fri, 16 Oct 2015 10:10:39 -0400 Subject: [PATCH 036/269] fix(panel): fix for firefox and placing cursor in text inputs when in panel fullscreen edit mode, fixes #2957 --- public/app/partials/dashboard.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/app/partials/dashboard.html b/public/app/partials/dashboard.html index 156da97e50a..78d54e1b5eb 100644 --- a/public/app/partials/dashboard.html +++ b/public/app/partials/dashboard.html @@ -79,7 +79,7 @@
        -
        From c320e9d58327f17c583287f365865e6d802aee0a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Fri, 16 Oct 2015 11:07:15 -0400 Subject: [PATCH 037/269] fix(annotations): fixed graphite annotations, broken by recent time handling changes, fixes #2947 --- public/app/plugins/datasource/graphite/datasource.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/app/plugins/datasource/graphite/datasource.js b/public/app/plugins/datasource/graphite/datasource.js index 553a11c2350..f9e747fb984 100644 --- a/public/app/plugins/datasource/graphite/datasource.js +++ b/public/app/plugins/datasource/graphite/datasource.js @@ -75,7 +75,7 @@ function (angular, _, $, config, dateMath) { if (annotation.target) { var target = templateSrv.replace(annotation.target); var graphiteQuery = { - range: rangeUnparsed, + rangeRaw: rangeUnparsed, targets: [{ target: target }], format: 'json', maxDataPoints: 100 From c95a991cb30c272e288d16f56a447418869a71a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Fri, 16 Oct 2015 11:58:44 -0400 Subject: [PATCH 038/269] fix(panel/common): fix for query letters when importing old dashboards, fixes #2943 --- public/app/features/dashboard/dashboardSrv.js | 19 +++++++++++++++---- public/test/specs/dashboardSrv-specs.js | 9 ++++++++- 2 files changed, 23 insertions(+), 5 deletions(-) diff --git a/public/app/features/dashboard/dashboardSrv.js b/public/app/features/dashboard/dashboardSrv.js index 170cce52fbf..66372dea026 100644 --- a/public/app/features/dashboard/dashboardSrv.js +++ b/public/app/features/dashboard/dashboardSrv.js @@ -328,9 +328,20 @@ function (angular, $, kbn, _, moment) { } } - if (oldVersion < 7 && old.nav && old.nav.length) { - this.timepicker = old.nav[0]; - delete this.nav; + if (oldVersion < 7) { + if (old.nav && old.nav.length) { + this.timepicker = old.nav[0]; + delete this.nav; + } + + // ensure query refIds + panelUpgrades.push(function(panel) { + _.each(panel.targets, function(target) { + if (!target.refId) { + target.refId = this.getNextQueryLetter(panel); + } + }, this); + }); } if (panelUpgrades.length === 0) { @@ -341,7 +352,7 @@ function (angular, $, kbn, _, moment) { var row = this.rows[i]; for (j = 0; j < row.panels.length; j++) { for (k = 0; k < panelUpgrades.length; k++) { - panelUpgrades[k](row.panels[j]); + panelUpgrades[k].call(this, row.panels[j]); } } } diff --git a/public/test/specs/dashboardSrv-specs.js b/public/test/specs/dashboardSrv-specs.js index 112dc7b9aad..276e28b32c8 100644 --- a/public/test/specs/dashboardSrv-specs.js +++ b/public/test/specs/dashboardSrv-specs.js @@ -152,7 +152,10 @@ define([ rows: [ { panels: [ - {type: 'graphite', legend: true, aliasYAxis: { test: 2 }, grid: { min: 1, max: 10 }} + { + type: 'graphite', legend: true, aliasYAxis: { test: 2 }, grid: { min: 1, max: 10 }, + targets: [{refId: 'A'}, {}], + } ] } ] @@ -178,6 +181,10 @@ define([ expect(graph.type).to.be('graph'); }); + it('queries without refId should get it', function() { + expect(graph.targets[1].refId).to.be('B'); + }); + it('update legend setting', function() { expect(graph.legend.show).to.be(true); }); From dbc1a9cf82c94caa06f0762e120163e4a8ea000d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Fri, 16 Oct 2015 12:07:35 -0400 Subject: [PATCH 039/269] fix(influxdb_0.8.x): fixed issue with new timepicker ranges like The day so far, fixes #2936 --- public/app/plugins/datasource/influxdb_08/datasource.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/public/app/plugins/datasource/influxdb_08/datasource.js b/public/app/plugins/datasource/influxdb_08/datasource.js index 5dabc93efa0..0bfa3f84527 100644 --- a/public/app/plugins/datasource/influxdb_08/datasource.js +++ b/public/app/plugins/datasource/influxdb_08/datasource.js @@ -266,11 +266,11 @@ function (angular, _, dateMath, InfluxSeries, InfluxQueryBuilder) { } function getInfluxTime(date, roundUp) { - if (_.isString(date) && date.indexOf('/') === -1) { + if (_.isString(date)) { if (date === 'now') { return 'now()'; } - if (date.indexOf('now-') >= 0) { + if (date.indexOf('now-') >= 0 && date.indexOf('/') === -1) { return date.replace('now', 'now()'); } date = dateMath.parse(date, roundUp); From b70b730cb96bd1d7f81e6bf67db3663c094843b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Fri, 16 Oct 2015 12:26:30 -0400 Subject: [PATCH 040/269] fix(build): minor fix for build script to make latest copy for rpm when version is pre release version --- build.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/build.go b/build.go index ca6f52ecd89..39c55c799ad 100644 --- a/build.go +++ b/build.go @@ -73,7 +73,7 @@ func main() { case "package": //verifyGitRepoIsClean() - grunt("release") + // grunt("release") createLinuxPackages() case "latest": @@ -89,8 +89,13 @@ func main() { } func makeLatestDistCopies() { + rpmIteration := "-1" + if linuxPackageIteration != "" { + rpmIteration = "-" + linuxPackageIteration + } + runError("cp", "dist/grafana_"+version+"_amd64.deb", "dist/grafana_latest_amd64.deb") - runError("cp", "dist/grafana-"+strings.Replace(version, "-", "_", 5)+"-1.x86_64.rpm", "dist/grafana-latest-1.x86_64.rpm") + runError("cp", "dist/grafana-"+linuxPackageVersion+rpmIteration+".x86_64.rpm", "dist/grafana-latest-1.x86_64.rpm") runError("cp", "dist/grafana-"+version+".linux-x64.tar.gz", "dist/grafana-latest.linux-x64.tar.gz") } From 43ca50ebbec938c1b29c27d3d7e75029240bf576 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Fri, 16 Oct 2015 13:03:20 -0400 Subject: [PATCH 041/269] fix(build): anonther minor build script fix --- build.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.go b/build.go index 39c55c799ad..7804d00890e 100644 --- a/build.go +++ b/build.go @@ -73,7 +73,7 @@ func main() { case "package": //verifyGitRepoIsClean() - // grunt("release") + grunt("release") createLinuxPackages() case "latest": From 867ac5df67c3a9baffb46e50b0be7d2a31df5bf7 Mon Sep 17 00:00:00 2001 From: Tom Dyas Date: Mon, 19 Oct 2015 13:07:18 -0400 Subject: [PATCH 042/269] fix appending query strings in linkSrv When linkSrv appends parameters to a URL's query string, it would blindly add a ? to the URL even if the URL already contained a ? or the string to add was empty. This change fixes that behavior and some other edge cases. Includes a unit test to verify expected behavior. --- public/app/features/panellinks/linkSrv.js | 22 ++++++++-- public/test/specs/linkSrv-specs.js | 50 +++++++++++++++++++++++ 2 files changed, 68 insertions(+), 4 deletions(-) create mode 100644 public/test/specs/linkSrv-specs.js diff --git a/public/app/features/panellinks/linkSrv.js b/public/app/features/panellinks/linkSrv.js index 413d3d9303b..2e1f3e16436 100644 --- a/public/app/features/panellinks/linkSrv.js +++ b/public/app/features/panellinks/linkSrv.js @@ -48,8 +48,22 @@ function (angular, kbn, _) { return url; } - url += (url.indexOf('?') !== -1 ? '&' : '?'); - return url + paramsArray.join('&'); + return this.appendToQueryString(url, paramsArray.join('&')); + }; + + this.appendToQueryString = function(url, stringToAppend) { + if (!_.isUndefined(stringToAppend) && stringToAppend !== null && stringToAppend !== '') { + var pos = url.indexOf('?'); + if (pos !== -1) { + if (url.length - pos > 1) { + url += '&'; + } + } else { + url += '?'; + } + url += stringToAppend; + } + return url; }; this.getAnchorInfo = function(link) { @@ -65,7 +79,6 @@ function (angular, kbn, _) { info.target = link.targetBlank ? '_blank' : '_self'; info.href = templateSrv.replace(link.url || '', scopedVars); info.title = templateSrv.replace(link.title || '', scopedVars); - info.href += '?'; } else if (link.dashUri) { info.href = 'dashboard/' + link.dashUri + '?'; @@ -91,8 +104,9 @@ function (angular, kbn, _) { } info.href = this.addParamsToUrl(info.href, params); + if (link.params) { - info.href += "&" + templateSrv.replace(link.params, scopedVars); + info.href = this.appendToQueryString(info.href, templateSrv.replace(link.params, scopedVars)); } return info; diff --git a/public/test/specs/linkSrv-specs.js b/public/test/specs/linkSrv-specs.js new file mode 100644 index 00000000000..8a978b650ff --- /dev/null +++ b/public/test/specs/linkSrv-specs.js @@ -0,0 +1,50 @@ +define([ + 'lodash', + 'app/features/panellinks/linkSrv' +], function(_) { + 'use strict'; + + describe('linkSrv', function() { + var _linkSrv; + + beforeEach(module('grafana.services')); + + beforeEach(inject(function(linkSrv) { + _linkSrv = linkSrv; + })); + + describe('when appending query strings', function() { + + it('add ? to URL if not present', function() { + var url = _linkSrv.appendToQueryString('http://example.com', 'foo=bar'); + expect(url).to.be('http://example.com?foo=bar'); + }); + + it('do not add & to URL if ? is present but query string is empty', function() { + var url = _linkSrv.appendToQueryString('http://example.com?', 'foo=bar'); + expect(url).to.be('http://example.com?foo=bar'); + }); + + it('add & to URL if query string is present', function() { + var url = _linkSrv.appendToQueryString('http://example.com?foo=bar', 'hello=world'); + expect(url).to.be('http://example.com?foo=bar&hello=world'); + }); + + it('do not change the URL if there is nothing to append', function() { + _.each(['', undefined, null], function(toAppend) { + var url1 = _linkSrv.appendToQueryString('http://example.com', toAppend); + expect(url1).to.be('http://example.com'); + + var url2 = _linkSrv.appendToQueryString('http://example.com?', toAppend); + expect(url2).to.be('http://example.com?'); + + var url3 = _linkSrv.appendToQueryString('http://example.com?foo=bar', toAppend); + expect(url3).to.be('http://example.com?foo=bar'); + }); + }); + + }); + + }); + +}); From 6fecb4bf3e28226b5de462d10062be24bcf2d33e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Tue, 20 Oct 2015 10:02:56 -0400 Subject: [PATCH 043/269] fix(http route): fixed dashboard-solo route to not return 404, fixes #2979 --- pkg/api/api.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pkg/api/api.go b/pkg/api/api.go index 27eb3c749db..013b2ebe076 100644 --- a/pkg/api/api.go +++ b/pkg/api/api.go @@ -40,7 +40,9 @@ func Register(r *macaron.Macaron) { r.Get("/admin/users/edit/:id", reqGrafanaAdmin, Index) r.Get("/admin/orgs", reqGrafanaAdmin, Index) r.Get("/admin/orgs/edit/:id", reqGrafanaAdmin, Index) + r.Get("/dashboard/*", reqSignedIn, Index) + r.Get("/dashboard-solo/*", reqSignedIn, Index) // sign up r.Get("/signup", Index) From f3ecdc5af4e1eb3545ae717fa1ab1a67720839b3 Mon Sep 17 00:00:00 2001 From: Jari Sukanen Date: Wed, 21 Oct 2015 14:31:06 +0300 Subject: [PATCH 044/269] influxdb: fix influxdb annotation query --- public/app/plugins/datasource/influxdb/datasource.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/app/plugins/datasource/influxdb/datasource.js b/public/app/plugins/datasource/influxdb/datasource.js index fabe2278708..b8ee9b15d49 100644 --- a/public/app/plugins/datasource/influxdb/datasource.js +++ b/public/app/plugins/datasource/influxdb/datasource.js @@ -78,7 +78,7 @@ function (angular, _, dateMath, InfluxSeries, InfluxQueryBuilder) { }; InfluxDatasource.prototype.annotationQuery = function(annotation, rangeUnparsed) { - var timeFilter = getTimeFilter({ range: rangeUnparsed }); + var timeFilter = getTimeFilter({ rangeRaw: rangeUnparsed }); var query = annotation.query.replace('$timeFilter', timeFilter); query = templateSrv.replace(query); From fc0705e87c5a2bb2aa77fe1234d87b2243cfad7a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Wed, 21 Oct 2015 10:59:02 -0400 Subject: [PATCH 045/269] fix(elasticsearch): fix for daily pattern when getting index for today, is now using utc, fixes #2913 --- public/app/plugins/datasource/elasticsearch/index_pattern.js | 2 +- .../datasource/elasticsearch/specs/index_pattern_specs.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/public/app/plugins/datasource/elasticsearch/index_pattern.js b/public/app/plugins/datasource/elasticsearch/index_pattern.js index 29ddc9e5741..d565e22c0b6 100644 --- a/public/app/plugins/datasource/elasticsearch/index_pattern.js +++ b/public/app/plugins/datasource/elasticsearch/index_pattern.js @@ -20,7 +20,7 @@ function (_, moment) { IndexPattern.prototype.getIndexForToday = function() { if (this.interval) { - return moment().format(this.pattern); + return moment.utc().format(this.pattern); } else { return this.pattern; } diff --git a/public/app/plugins/datasource/elasticsearch/specs/index_pattern_specs.ts b/public/app/plugins/datasource/elasticsearch/specs/index_pattern_specs.ts index 8f662bb075f..ccebef59a12 100644 --- a/public/app/plugins/datasource/elasticsearch/specs/index_pattern_specs.ts +++ b/public/app/plugins/datasource/elasticsearch/specs/index_pattern_specs.ts @@ -8,7 +8,7 @@ declare var IndexPattern: any; describe('IndexPattern', function() { - describe('when getting index for today', function() { + describe.only('when getting index for today', function() { it('should return correct index name', function() { var pattern = new IndexPattern('[asd-]YYYY.MM.DD', 'Daily'); var expected = 'asd-' + moment().format('YYYY.MM.DD'); From 58497ed59641acdfbb2fea39e7b22e6378c3aa45 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Wed, 21 Oct 2015 11:22:53 -0400 Subject: [PATCH 046/269] feat(panel): performance improvement for loading panels, closes #2994 --- public/app/app.js | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/public/app/app.js b/public/app/app.js index 4f30df34d89..1e7acf2e56f 100644 --- a/public/app/app.js +++ b/public/app/app.js @@ -100,12 +100,7 @@ function (angular, $, _, appLevelRequire) { var $scope = this; $scope.requireContext(deps, function () { var deps = _.toArray(arguments); - // Check that this is a valid scope. - if($scope.$id) { - $scope.$apply(function () { - fn.apply($scope, deps); - }); - } + fn.apply($scope, deps); }); }; }]); From a5e3d7a94b759fa7e5d381fb5b7b19bcf5088b0b Mon Sep 17 00:00:00 2001 From: ubhatnagar Date: Wed, 21 Oct 2015 20:58:04 -0700 Subject: [PATCH 047/269] Fixed datasources docs typos --- docs/sources/datasources/graphite.md | 4 ++-- docs/sources/datasources/influxdb.md | 2 +- docs/sources/datasources/kairosdb.md | 4 ++-- docs/sources/datasources/prometheus.md | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/docs/sources/datasources/graphite.md b/docs/sources/datasources/graphite.md index dc545af5007..9640d21a81d 100644 --- a/docs/sources/datasources/graphite.md +++ b/docs/sources/datasources/graphite.md @@ -29,7 +29,7 @@ Url | The http protocol, ip and port of you graphite-web or graphite-api install Access | Proxy = access via Grafana backend, Direct = access directory from browser. -Proxy access means that the Grafana backend will proxy all requests from the browser, and send them on to the Data Source. This is useful because it can eliminate CORS (Cross Origin Site Resource) issues, as well as eliminate the need to disseminate authentication details to the Data Source to the brower. +Proxy access means that the Grafana backend will proxy all requests from the browser, and send them on to the Data Source. This is useful because it can eliminate CORS (Cross Origin Site Resource) issues, as well as eliminate the need to disseminate authentication details to the Data Source to the browser. Direct access is still supported because in some cases it may be useful to access a Data Source directly depending on the use case and topology of Grafana, the user, and the Data Source. @@ -78,4 +78,4 @@ You can also create nested variables that use other variables in their definitio ## Query Reference -You can reference queries by the row “letter” that they’re on (similar to Microsoft Excel). If you add a second query to graph, you can reference the first query simply by typing in #A. This provides an easy and convenient way to build compounded queries. \ No newline at end of file +You can reference queries by the row “letter” that they’re on (similar to Microsoft Excel). If you add a second query to graph, you can reference the first query simply by typing in #A. This provides an easy and convenient way to build compounded queries. diff --git a/docs/sources/datasources/influxdb.md b/docs/sources/datasources/influxdb.md index b48b2b0097a..35a6c914e65 100644 --- a/docs/sources/datasources/influxdb.md +++ b/docs/sources/datasources/influxdb.md @@ -33,7 +33,7 @@ Database | Name of your influxdb database User | Name of your database user Password | Database user's password - > Proxy access means that the Grafana backend will proxy all requests from the browser, and send them on to the Data Source. This is useful because it can eliminate CORS (Cross Origin Site Resource) issues, as well as eliminate the need to disseminate authentication details to the Data Source to the brower. + > Proxy access means that the Grafana backend will proxy all requests from the browser, and send them on to the Data Source. This is useful because it can eliminate CORS (Cross Origin Site Resource) issues, as well as eliminate the need to disseminate authentication details to the Data Source to the browser. > Direct access is still supported because in some cases it may be useful to access a Data Source directly depending on the use case and topology of Grafana, the user, and the Data Source. diff --git a/docs/sources/datasources/kairosdb.md b/docs/sources/datasources/kairosdb.md index 7619c8e8b1f..fc9b5682515 100644 --- a/docs/sources/datasources/kairosdb.md +++ b/docs/sources/datasources/kairosdb.md @@ -32,7 +32,7 @@ Open a graph in edit mode by click the title. ![](/img/v2/kairos_query_editor.png) -For details on KairosDB metric queries checkout the offical. +For details on KairosDB metric queries checkout the official. - [Query Metrics - KairosDB 0.9.4 documentation](http://kairosdb.github.io/kairosdocs/restapi/QueryMetrics.html). ## Templated queries @@ -49,4 +49,4 @@ For details of `metric names`, `tag names`, and `tag values`, please refer to th - [List Metric Names - KairosDB 0.9.4 documentation](http://kairosdb.github.io/kairosdocs/restapi/ListMetricNames.html) - [List Tag Names - KairosDB 0.9.4 documentation](http://kairosdb.github.io/kairosdocs/restapi/ListTagNames.html) - [List Tag Values - KairosDB 0.9.4 documentation](http://kairosdb.github.io/kairosdocs/restapi/ListTagValues.html) -- [Query Metrics - KairosDB 0.9.4 documentation](http://kairosdb.github.io/kairosdocs/restapi/QueryMetrics.html). \ No newline at end of file +- [Query Metrics - KairosDB 0.9.4 documentation](http://kairosdb.github.io/kairosdocs/restapi/QueryMetrics.html). diff --git a/docs/sources/datasources/prometheus.md b/docs/sources/datasources/prometheus.md index e975a5cf8a4..61f6c0d66e8 100644 --- a/docs/sources/datasources/prometheus.md +++ b/docs/sources/datasources/prometheus.md @@ -28,7 +28,7 @@ Basic Auth | Enable basic authentication to the Prometheus datasource. User | Name of your Prometheus user Password | Database user's password - > Proxy access means that the Grafana backend will proxy all requests from the browser, and send them on to the Data Source. This is useful because it can eliminate CORS (Cross Origin Site Resource) issues, as well as eliminate the need to disseminate authentication details to the Data Source to the brower. + > Proxy access means that the Grafana backend will proxy all requests from the browser, and send them on to the Data Source. This is useful because it can eliminate CORS (Cross Origin Site Resource) issues, as well as eliminate the need to disseminate authentication details to the Data Source to the browser. > Direct access is still supported because in some cases it may be useful to access a Data Source directly depending on the use case and topology of Grafana, the user, and the Data Source. From aaf4b1a3994e9ba6a06c17d92e8ea70ef15543ae Mon Sep 17 00:00:00 2001 From: ubhatnagar Date: Wed, 21 Oct 2015 21:13:39 -0700 Subject: [PATCH 048/269] Fixed typos in guides. --- docs/sources/guides/gettingstarted.md | 2 +- docs/sources/guides/screencasts.md | 2 +- docs/sources/guides/whats-new-in-v2-1.md | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/sources/guides/gettingstarted.md b/docs/sources/guides/gettingstarted.md index 93d67048ad6..6f9ef76232d 100644 --- a/docs/sources/guides/gettingstarted.md +++ b/docs/sources/guides/gettingstarted.md @@ -29,7 +29,7 @@ The image above shows you the top header for a Dashboard. 6. Settings: Manage Dashboard settings and features such as Templating and Annotations. ## Dashboards, Panels, Rows, the building blocks of Grafana... -Dashboards are at the core of what Grafana is all about. Dashboards are composed of individual Panels arranged on a number of Rows. Grafana ships with a variety of Panels. Gafana makes it easy to construct the right queries, and customize the display properities so that you can create the perfect Dashboard for your need. Each Panel can interact with data from any configured Grafana Data Source (currently InfluxDB, Graphite, OpenTSDB, and KairosDB). The [Core Concepts](/guides/basic_concepts) guide explores these key ideas in detail. +Dashboards are at the core of what Grafana is all about. Dashboards are composed of individual Panels arranged on a number of Rows. Grafana ships with a variety of Panels. Grafana makes it easy to construct the right queries, and customize the display properties so that you can create the perfect Dashboard for your need. Each Panel can interact with data from any configured Grafana Data Source (currently InfluxDB, Graphite, OpenTSDB, and KairosDB). The [Core Concepts](/guides/basic_concepts) guide explores these key ideas in detail. ## Adding & Editing Graphs and Panels diff --git a/docs/sources/guides/screencasts.md b/docs/sources/guides/screencasts.md index edf3d7b8122..500ca9f9b6a 100644 --- a/docs/sources/guides/screencasts.md +++ b/docs/sources/guides/screencasts.md @@ -32,7 +32,7 @@ no_toc: true

        Episode 4 - Installation & Configuration on Ubuntu / Debian

        - Learn how to easily install the dependencies and packages to get Grafana 2.0 up and running on Ubuntu or Debian in just a few mintues. + Learn how to easily install the dependencies and packages to get Grafana 2.0 up and running on Ubuntu or Debian in just a few minutes.
        diff --git a/docs/sources/guides/whats-new-in-v2-1.md b/docs/sources/guides/whats-new-in-v2-1.md index 27285d08857..10519cb0422 100644 --- a/docs/sources/guides/whats-new-in-v2-1.md +++ b/docs/sources/guides/whats-new-in-v2-1.md @@ -112,7 +112,7 @@ for example make all series that contain the word **CPU** `red` and assigned to ![Define series color using regex rule](/img/v2/regex_color_override.png "Define series color using regex rule") -New series style override, negative-y transform and stack groups. Negative y tranform is +New series style override, negative-y transform and stack groups. Negative y transform is very useful if you want to plot a series on the negative y scale without affecting the legend values like min or max or the values shown in the hover tooltip. From 1e2e4ba3ad3ee2105add631c9254e428b9653864 Mon Sep 17 00:00:00 2001 From: ubhatnagar Date: Wed, 21 Oct 2015 22:09:07 -0700 Subject: [PATCH 049/269] Fixed other docs typos --- docs/sources/installation/docker.md | 2 +- docs/sources/installation/ldap.md | 6 +++--- docs/sources/project/building_from_source.md | 2 +- docs/sources/reference/admin.md | 2 +- docs/sources/reference/dashlist.md | 2 +- docs/sources/reference/graph.md | 2 +- docs/sources/reference/keyboard_shortcuts.md | 4 ++-- docs/sources/reference/search.md | 12 ++++++------ docs/sources/reference/sharing.md | 2 +- docs/sources/reference/singlestat.md | 6 +++--- docs/sources/reference/templating.md | 4 ++-- docs/sources/tutorials/hubot_howto.md | 6 +++--- 12 files changed, 25 insertions(+), 25 deletions(-) diff --git a/docs/sources/installation/docker.md b/docs/sources/installation/docker.md index 53366bed44a..18dcf964450 100644 --- a/docs/sources/installation/docker.md +++ b/docs/sources/installation/docker.md @@ -9,7 +9,7 @@ page_keywords: grafana, installation, docker, container, guide > **2.0.2 -> 2.1.0 Upgrade NOTICE!** > The data and log paths were not correct in the previous image. The grafana database was placed by default in /usr/share/grafana/data instead of the correct path /var/lib/grafana. This means it was not in a dir that was marked as a volume. So if you remove the container it will remove the grafana database. So before updating make sure you copy the /usr/share/grafana/data path from inside the container to the host. -## Install from offical docker image +## Install from official docker image Grafana has an official Docker container. diff --git a/docs/sources/installation/ldap.md b/docs/sources/installation/ldap.md index f0325a953fe..45552a8e2b0 100644 --- a/docs/sources/installation/ldap.md +++ b/docs/sources/installation/ldap.md @@ -1,6 +1,6 @@ --- page_title: LDAP Integration -page_description: LDAP Integrtaion guide for Grafana. +page_description: LDAP Integration guide for Grafana. page_keywords: grafana, ldap, configuration, documentation, integration --- @@ -85,12 +85,12 @@ bind_dn = "cn=%s,o=users,dc=grafana,dc=org" ``` In this case you skip providing a `bind_password` and instead provide a `bind_dn` value with a `%s` somewhere. This will be replaced with the username entered in on the Grafana login page. -The search filter and search bases settings are still needed to perform the LDAP search to retreive the other LDAP information (like LDAP groups and email). +The search filter and search bases settings are still needed to perform the LDAP search to retrieve the other LDAP information (like LDAP groups and email). ## LDAP to Grafana Org Role Sync ## Group Mappings -In `[[servers.group_mappings]]` you can map an LDAP group to a Grafana organization and role. These will be synced every time the user logs in, with LDAP being the authoratative source. +In `[[servers.group_mappings]]` you can map an LDAP group to a Grafana organization and role. These will be synced every time the user logs in, with LDAP being the authoritative source. So, if you change a user's role in the Grafana Org. Users page, this change will be reset the next time the user logs in. If you change the LDAP groups of a user, the change will take effect the next time the user logs in. ### Priority between Multiple Mappings diff --git a/docs/sources/project/building_from_source.md b/docs/sources/project/building_from_source.md index 45ab26249c8..71e94b088fb 100644 --- a/docs/sources/project/building_from_source.md +++ b/docs/sources/project/building_from_source.md @@ -25,7 +25,7 @@ go get github.com/grafana/grafana ``` cd $GOPATH/src/github.com/grafana/grafana go run build.go setup # (only needed once to install godep) -$GOPATH/bin/godep restore # (will pull down all golang lib dependecies in your current GOPATH) +$GOPATH/bin/godep restore # (will pull down all golang lib dependencies in your current GOPATH) go run build.go build # (or 'go build .') ``` diff --git a/docs/sources/reference/admin.md b/docs/sources/reference/admin.md index 854147b4240..c5d5073020d 100644 --- a/docs/sources/reference/admin.md +++ b/docs/sources/reference/admin.md @@ -24,7 +24,7 @@ modify Organization details and options. As a Grafana Administrator, you have complete access to any Organization or User in that instance of Grafana. -When performing actions as a Grafana admin, the sidebar will change it's apperance as below to indicate you are performing global server administration. +When performing actions as a Grafana admin, the sidebar will change it's appearance as below to indicate you are performing global server administration. From the Grafana Server Admin page, you can access the System Info page which summarizes all of the backend configuration settings of the Grafana server. diff --git a/docs/sources/reference/dashlist.md b/docs/sources/reference/dashlist.md index 1f0794dabfc..ea098541da2 100644 --- a/docs/sources/reference/dashlist.md +++ b/docs/sources/reference/dashlist.md @@ -8,7 +8,7 @@ page_keywords: grafana, dashlist, panel, documentation ## Overview -The dashboard list panel allows you to display dynamic links to other dashboards. The list can be configured to use starred dashbaords, a search query and/or dashboard tags. +The dashboard list panel allows you to display dynamic links to other dashboards. The list can be configured to use starred dashboards, a search query and/or dashboard tags. diff --git a/docs/sources/reference/graph.md b/docs/sources/reference/graph.md index e8867d3d527..9c2ab63fbaa 100644 --- a/docs/sources/reference/graph.md +++ b/docs/sources/reference/graph.md @@ -127,7 +127,7 @@ If you have stack enabled you can select what the mouse hover feature should sho ### Rendering - ``Flot`` - Render the graphs in the browser using Flot (default) -- ``Graphite PNG`` - Render the graph on the server using graphites render API. +- ``Graphite PNG`` - Render the graph on the server using graphite's render API. ### Tooltip diff --git a/docs/sources/reference/keyboard_shortcuts.md b/docs/sources/reference/keyboard_shortcuts.md index b6e199e4e70..627bfc5c3dd 100644 --- a/docs/sources/reference/keyboard_shortcuts.md +++ b/docs/sources/reference/keyboard_shortcuts.md @@ -1,5 +1,5 @@ -page_title: Kayboard Shortcuts -page_description: Kayboard Shortcuts for Grafana +page_title: Keyboard Shortcuts +page_description: Keyboard Shortcuts for Grafana page_keywords: grafana, export, import, documentation --- diff --git a/docs/sources/reference/search.md b/docs/sources/reference/search.md index 3c4555b843e..e2d6647229c 100644 --- a/docs/sources/reference/search.md +++ b/docs/sources/reference/search.md @@ -11,7 +11,7 @@ Dashboards can be searched by the dashboard name, filtered by one (or many) tags 1. `Dashboard Picker`: The Dashboard Picker is your primary navigation tool to move between dashboards. It is present on all dashboards, and open the Dashboard Search. The dashboard picker also doubles as the title of the current dashboard. -2. `Search Bar`: The search bar allows you to enter any string and search both database and file based dashbaords in real-time. +2. `Search Bar`: The search bar allows you to enter any string and search both database and file based dashboards in real-time. 3. `Starred`: The starred link allows you to filter the list to display only starred dashboards. 4. `Tags`: The tags filter allows you to filter the list by dashboard tags. @@ -25,14 +25,14 @@ To search and load dashboards click the open folder icon in the header or use th Dashboard search is: - Real-time -- *Not* case senstitive +- *Not* case sensitive - Functional across stored *and* file based dashboards. ## Filter by Tag(s) -Tags are a great way to organize your dashboards, especially as the number of dashbaords grow. Tags can be added and managed in the dashboard `Settings`. +Tags are a great way to organize your dashboards, especially as the number of dashboards grow. Tags can be added and managed in the dashboard `Settings`. -To filter the dashboard list by tag, click on any tag appearing in the right column. The list may be further filtered by cliking on additional tags: +To filter the dashboard list by tag, click on any tag appearing in the right column. The list may be further filtered by clicking on additional tags: @@ -40,7 +40,7 @@ Alternately, to see a list of all available tags, click the tags link in the sea -When using only a keybaord: `tab` to focus on the *tags* link, `▼` down arrow key to find a tag and select with the `Enter` key. +When using only a keyboard: `tab` to focus on the *tags* link, `▼` down arrow key to find a tag and select with the `Enter` key. **Note**: When multiple tags are selected, Grafana will show dashboards that include **all**. @@ -51,4 +51,4 @@ Starring is a great way to organize and find commonly used dashboards. To show o -When using only a keybaord: `tab` to focus on the *stars* link, `▼` down arrow key to find a tag and select with the `Enter` key. \ No newline at end of file +When using only a keyboard: `tab` to focus on the *stars* link, `▼` down arrow key to find a tag and select with the `Enter` key. \ No newline at end of file diff --git a/docs/sources/reference/sharing.md b/docs/sources/reference/sharing.md index e3a6ce3f2f5..c20f4e5f67c 100644 --- a/docs/sources/reference/sharing.md +++ b/docs/sources/reference/sharing.md @@ -5,7 +5,7 @@ page_keywords: grafana, sharing, guide, documentation --- # Sharing features -Grafana provides a number of ways to share a dashboard or a specfic panel to other users within your +Grafana provides a number of ways to share a dashboard or a specific panel to other users within your organization. It also provides ways to publish interactive snapshots that can be accessed by external partners. ## Share dashboard diff --git a/docs/sources/reference/singlestat.md b/docs/sources/reference/singlestat.md index 7a7c38da289..a6a6a06c806 100644 --- a/docs/sources/reference/singlestat.md +++ b/docs/sources/reference/singlestat.md @@ -21,7 +21,7 @@ The singlestat panel has a normal query editor to allow you define your exact me 3. `Values`: The Value fields let you set the function (min, max, average, current, total) that your entire query is reduced into a single value with. You can also set the font size of theand font-size (as a %) of the metric query that the Panel is configured with. This reduces the entire query into a single summary value that is displayed. 4. `Postfixes`: The Postfix fields let you define a custom label and font-size (as a %) to appear *after* the value 5. `Units`: Units are appended to the the Singlestat within the panel, and will respect the color and threshold settings for the value. -6. `Decimals`: The Decimal field allows you to override the automatic decimal precision, and set it explicitely. +6. `Decimals`: The Decimal field allows you to override the automatic decimal precision, and set it explicitly. ### Coloring @@ -29,9 +29,9 @@ The coloring options of the Singlestat Panel config allow you to dynamically cha -1. `Background`: This checkbox applies the configured thresholds and colors to the entirity of the Singlestat Panel background. +1. `Background`: This checkbox applies the configured thresholds and colors to the entirety of the Singlestat Panel background. 2. `Value`: This checkbox applies the configured thresholds and colors to the summary stat. -3. `Thresholds`: Change the background and value colors dyanmically within the panel, depending on the Singlestat value. The threshold field accepts **3 comma-separated** values, corresponding to the three colors directly to the right. +3. `Thresholds`: Change the background and value colors dynamically within the panel, depending on the Singlestat value. The threshold field accepts **3 comma-separated** values, corresponding to the three colors directly to the right. 4. `Colors`: Select a color and opacity 5. `Invert order`: This link toggles the threshold color order.
        For example: Green, Orange, Red () will become Red, Orange, Green (). diff --git a/docs/sources/reference/templating.md b/docs/sources/reference/templating.md index 239cb33c378..e605af845ea 100644 --- a/docs/sources/reference/templating.md +++ b/docs/sources/reference/templating.md @@ -63,7 +63,7 @@ Once configured, Multi-Select Tagging provides a convenient way to group and you ### Interval -Use the `Interval` type to create Template variables aroundr time ranges (eg. `1m`,`1h`, `1d`). There is also a special `auto` option that will change depending on the current time range, you can specify how many times the current time range should be divided to calculate the current `auto` range. +Use the `Interval` type to create Template variables around time ranges (eg. `1m`,`1h`, `1d`). There is also a special `auto` option that will change depending on the current time range, you can specify how many times the current time range should be divided to calculate the current `auto` range. ![](/img/v2/templated_variable_parameter.png) @@ -75,7 +75,7 @@ Use the `Custom` type to manually create Template variables around explicit valu Template Variables can be very useful to dynamically change what you're visualizing on a given panel. Sometimes, you might want to create entire new Panels (or Rows) based on what Template Variables have been selected. This is now possible in Grafana 2.1. -Once you've got your Template variables (of any type) configured the way you'd like, check out the Repeating Panels and Repeating Row documentatione +Once you've got your Template variables (of any type) configured the way you'd like, check out the Repeating Panels and Repeating Row documentation ## Screencast - Templated Graphite Queries diff --git a/docs/sources/tutorials/hubot_howto.md b/docs/sources/tutorials/hubot_howto.md index b2f53d0bece..85ebb3e7c85 100644 --- a/docs/sources/tutorials/hubot_howto.md +++ b/docs/sources/tutorials/hubot_howto.md @@ -64,13 +64,13 @@ The `hubot-grafana` plugin requires a number of environment variables to be set The hubot plugin will take advantage of the Grafana server side rendering feature that can render any panel on the server using phantomjs. Grafana ships with a phantomjs binary (linux only). -To verify that this freature works try the `Direct link to rendered image` link in the panel share dialog. +To verify that this feature works try the `Direct link to rendered image` link in the panel share dialog. If you do not get an image when opening this link verify that the required font packages are installed for phantomjs to work. ### Grafana API Key You need to set the environment variable `HUBOT_GRAFANA_API_KEY` to a Grafana API Key. -You can add these from the API Keys page wich you find in the Organization dropdown. +You can add these from the API Keys page which you find in the Organization dropdown. ### Amazon S3 The `S3` options are optional but for the images to work properly in services like Slack and Hipchat they need @@ -118,7 +118,7 @@ Now you can add an alias like this: ## Summary -Grafana is going to ship with integrated Slack and Hiptchat features some day but you do +Grafana is going to ship with integrated Slack and Hipchat features some day but you do not have to wait for that. Grafana 2 shipped with a very clever server side rendering feature that can render any panel to a png using phantomjs. The hubot plugin for Grafana is something you can install and use today! From eb8c2d9053ec55bc18a0192e1f1f20a7307b7621 Mon Sep 17 00:00:00 2001 From: Felix Barnsteiner Date: Thu, 22 Oct 2015 13:10:10 +0200 Subject: [PATCH 050/269] Ability to set a low limit for Elasticsearch date histogram interval closes #2901 --- .../elasticsearch/partials/query.options.html | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/public/app/plugins/datasource/elasticsearch/partials/query.options.html b/public/app/plugins/datasource/elasticsearch/partials/query.options.html index ab345d0eb59..eb6c6ff55fb 100644 --- a/public/app/plugins/datasource/elasticsearch/partials/query.options.html +++ b/public/app/plugins/datasource/elasticsearch/partials/query.options.html @@ -1,4 +1,22 @@
        +
        +
          +
        • + +
        • +
        • + Group by time interval +
        • +
        • + +
        • +
        • + +
        • +
        +
        +
        • From 62c908a905dcacfc94776dca4b99c3b902559731 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Thu, 22 Oct 2015 10:02:29 -0400 Subject: [PATCH 051/269] fix(build): fixed partials so they are included in optimized js file, fixes #2997 --- tasks/build_task.js | 1 - tasks/options/concat.js | 1 - tasks/options/ngtemplates.js | 2 +- 3 files changed, 1 insertion(+), 3 deletions(-) diff --git a/tasks/build_task.js b/tasks/build_task.js index 364c3dc797c..7773299a06d 100644 --- a/tasks/build_task.js +++ b/tasks/build_task.js @@ -23,7 +23,6 @@ module.exports = function(grunt) { 'filerev', 'remapFilerev', 'usemin', - 'clean:temp', 'uglify:genDir' ]); diff --git a/tasks/options/concat.js b/tasks/options/concat.js index 96ad9ae1341..c15aa8a2d6e 100644 --- a/tasks/options/concat.js +++ b/tasks/options/concat.js @@ -24,7 +24,6 @@ module.exports = function(config) { ], dest: '<%= genDir %>/css/grafana.light.min.css' }, - js: { src: [ '<%= tempDir %>/vendor/requirejs/require.js', diff --git a/tasks/options/ngtemplates.js b/tasks/options/ngtemplates.js index 2ccdf4ce5ef..10c39a49c39 100644 --- a/tasks/options/ngtemplates.js +++ b/tasks/options/ngtemplates.js @@ -6,7 +6,7 @@ module.exports = function(config) { dest: '<%= genDir %>/app/components/partials.js', options: { bootstrap: function(module, script) { - return "define('components/partials', ['angular'], function(angular) { \n" + + return "define('app/components/partials', ['angular'], function(angular) { \n" + "angular.module('grafana').run(['$templateCache', function($templateCache) { \n" + script + '\n}]);' + From 3228c4f41a584bc67c3556f710b7e4c4e5abd3e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Thu, 22 Oct 2015 12:27:22 -0400 Subject: [PATCH 052/269] changelog: updated with info about new units PR #2955 --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index e01e105db6c..bbe75e84210 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -28,6 +28,7 @@ it allows you to add queries of differnet data source types & instances to the s - [Issue #2708](https://github.com/grafana/grafana/issues/2708). InfluxDB: You can now set math expression for select clauses. - [Issue #1575](https://github.com/grafana/grafana/issues/1575). Drilldown link: now you can click on the external link icon in the panel header to access drilldown links! - [Issue #1646](https://github.com/grafana/grafana/issues/1646). OpenTSDB: Fetch list of aggregators from OpenTSDB +- [Issue #2955](https://github.com/grafana/grafana/issues/2955). Graph: More axis units (Length, Volume, Temperature, Pressure, etc), thanks @greglook **Fixes** - [Issue #2413](https://github.com/grafana/grafana/issues/2413). InfluxDB 0.9: Fix for handling empty series object in response from influxdb From 87715d6231b2c438bea991a2f1c30ee30dd09b4c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Thu, 22 Oct 2015 12:33:42 -0400 Subject: [PATCH 053/269] fix(solo panel): fixed solo panel view gray bottom for rendered image and embedd iframe scenarios, fixes #3004 --- public/app/features/panel/soloPanelCtrl.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/app/features/panel/soloPanelCtrl.js b/public/app/features/panel/soloPanelCtrl.js index 55e1c029200..c51f9c61a9d 100644 --- a/public/app/features/panel/soloPanelCtrl.js +++ b/public/app/features/panel/soloPanelCtrl.js @@ -26,7 +26,7 @@ function (angular, $) { $scope.initPanelScope = function() { $scope.row = { - height: ($(window).height() - 10) + 'px', + height: $(window).height() + 'px', }; $scope.test = "Hej"; From fcaecf4782ab60b41d1054b8327d164ee37ce8cb Mon Sep 17 00:00:00 2001 From: Mitsuhiro Tanda Date: Fri, 23 Oct 2015 01:12:27 +0900 Subject: [PATCH 054/269] revert prometheus link --- .../plugins/datasource/prometheus/datasource.js | 1 + .../prometheus/partials/query.editor.html | 5 +++++ .../plugins/datasource/prometheus/query_ctrl.js | 17 +++++++++++++++++ 3 files changed, 23 insertions(+) diff --git a/public/app/plugins/datasource/prometheus/datasource.js b/public/app/plugins/datasource/prometheus/datasource.js index 3f62279f6c9..3bcf1a46b8e 100644 --- a/public/app/plugins/datasource/prometheus/datasource.js +++ b/public/app/plugins/datasource/prometheus/datasource.js @@ -21,6 +21,7 @@ function (angular, _, moment, dateMath) { this.name = datasource.name; this.supportMetrics = true; this.url = datasource.url; + this.directUrl = datasource.directUrl; this.basicAuth = datasource.basicAuth; this.lastErrors = {}; } diff --git a/public/app/plugins/datasource/prometheus/partials/query.editor.html b/public/app/plugins/datasource/prometheus/partials/query.editor.html index f29f5c958a4..fe3894a1ef0 100644 --- a/public/app/plugins/datasource/prometheus/partials/query.editor.html +++ b/public/app/plugins/datasource/prometheus/partials/query.editor.html @@ -110,6 +110,11 @@ ng-change="refreshMetricData()">
        • +
        • + + + +
        diff --git a/public/app/plugins/datasource/prometheus/query_ctrl.js b/public/app/plugins/datasource/prometheus/query_ctrl.js index 809531f96ac..8fc9ae0d6a3 100644 --- a/public/app/plugins/datasource/prometheus/query_ctrl.js +++ b/public/app/plugins/datasource/prometheus/query_ctrl.js @@ -14,6 +14,7 @@ function (angular, _) { target.expr = target.expr || ''; target.intervalFactor = target.intervalFactor || 2; + target.prometheusLink = $scope.linkToPrometheus(); $scope.metric = ''; $scope.resolutions = _.map([1,2,3,4,5,10], function(f) { @@ -27,6 +28,7 @@ function (angular, _) { }; $scope.refreshMetricData = function() { + $scope.target.prometheusLink = $scope.linkToPrometheus(); if (!_.isEqual($scope.oldTarget, $scope.target)) { $scope.oldTarget = angular.copy($scope.target); $scope.get_data(); @@ -44,6 +46,21 @@ function (angular, _) { .then(callback); }; + $scope.linkToPrometheus = function() { + var range = Math.ceil(($scope.range.to.valueOf() - $scope.range.from.valueOf()) / 1000); + var endTime = $scope.range.to.utc().format('YYYY-MM-DD HH:MM'); + var expr = { + expr: $scope.target.expr, + range_input: range + 's', + end_input: endTime, + step_input: '', + stacked: $scope.panel.stack, + tab: 0 + }; + var hash = encodeURIComponent(JSON.stringify([expr])); + return $scope.datasource.directUrl + '/graph#' + hash; + }; + $scope.init(); }); From ae93f2b936cda93b8141a6ff61adb18037aca4ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Thu, 22 Oct 2015 16:23:21 -0400 Subject: [PATCH 055/269] fix(elasticsearch): fixed proper json escaping for lucene query, fixes #2981 --- .../datasource/elasticsearch/datasource.js | 5 ++++- .../elasticsearch/specs/datasource_specs.ts | 20 +++++++++++++------ .../specs/index_pattern_specs.ts | 2 +- 3 files changed, 19 insertions(+), 8 deletions(-) diff --git a/public/app/plugins/datasource/elasticsearch/datasource.js b/public/app/plugins/datasource/elasticsearch/datasource.js index 9d6b8e4c834..374fc9da90d 100644 --- a/public/app/plugins/datasource/elasticsearch/datasource.js +++ b/public/app/plugins/datasource/elasticsearch/datasource.js @@ -159,7 +159,10 @@ function (angular, _, moment, kbn, ElasticQueryBuilder, IndexPattern, ElasticRes if (target.hide) {return;} var esQuery = angular.toJson(this.queryBuilder.build(target)); - esQuery = esQuery.replace("$lucene_query", target.query || '*'); + var luceneQuery = angular.toJson(target.query || '*'); + // remove inner quotes + luceneQuery = luceneQuery.substr(1, luceneQuery.length - 2); + esQuery = esQuery.replace("$lucene_query", luceneQuery); payload += header + '\n' + esQuery + '\n'; sentTargets.push(target); diff --git a/public/app/plugins/datasource/elasticsearch/specs/datasource_specs.ts b/public/app/plugins/datasource/elasticsearch/specs/datasource_specs.ts index aecb16501b7..a5e55abe4dd 100644 --- a/public/app/plugins/datasource/elasticsearch/specs/datasource_specs.ts +++ b/public/app/plugins/datasource/elasticsearch/specs/datasource_specs.ts @@ -42,16 +42,15 @@ describe('ElasticDatasource', function() { }); describe('When issueing metric query with interval pattern', function() { + var requestOptions, parts, header; + beforeEach(function() { ctx.ds = new ctx.service({ url: 'http://es.com', index: '[asd-]YYYY.MM.DD', jsonData: { interval: 'Daily' } }); - }); - it('should translate index pattern to current day', function() { - var requestOptions; ctx.backendSrv.datasourceRequest = function(options) { requestOptions = options; return ctx.$q.when({data: {responses: []}}); @@ -62,13 +61,22 @@ describe('ElasticDatasource', function() { from: moment([2015, 4, 30, 10]), to: moment([2015, 5, 1, 10]) }, - targets: [{ bucketAggs: [], metrics: [] }] + targets: [{ bucketAggs: [], metrics: [], query: 'escape\\:test' }] }); ctx.$rootScope.$apply(); - var parts = requestOptions.data.split('\n'); - var header = angular.fromJson(parts[0]); + + parts = requestOptions.data.split('\n'); + header = angular.fromJson(parts[0]); + }); + + it('should translate index pattern to current day', function() { expect(header.index).to.eql(['asd-2015.05.30', 'asd-2015.05.31', 'asd-2015.06.01']); }); + + it('should json escape lucene query', function() { + var body = angular.fromJson(parts[1]); + expect(body.query.filtered.query.query_string.query).to.be('escape\\:test'); + }); }); }); diff --git a/public/app/plugins/datasource/elasticsearch/specs/index_pattern_specs.ts b/public/app/plugins/datasource/elasticsearch/specs/index_pattern_specs.ts index ccebef59a12..8f662bb075f 100644 --- a/public/app/plugins/datasource/elasticsearch/specs/index_pattern_specs.ts +++ b/public/app/plugins/datasource/elasticsearch/specs/index_pattern_specs.ts @@ -8,7 +8,7 @@ declare var IndexPattern: any; describe('IndexPattern', function() { - describe.only('when getting index for today', function() { + describe('when getting index for today', function() { it('should return correct index name', function() { var pattern = new IndexPattern('[asd-]YYYY.MM.DD', 'Daily'); var expected = 'asd-' + moment().format('YYYY.MM.DD'); From 8526230b59a45da968912c09e9fc64837c3136d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Thu, 22 Oct 2015 16:53:34 -0400 Subject: [PATCH 056/269] fix(influxdb_08): fixed influxdb 08 query editor issue, fixes #3009 --- .../datasource/influxdb_08/datasource.js | 8 +- .../{funcEditor.js => func_editor.js} | 0 .../{influxSeries.js => influx_series.js} | 0 .../{queryBuilder.js => query_builder.js} | 0 .../{queryCtrl.js => query_ctrl.js} | 3 +- .../influxdb_08/specs/datasource-specs.ts | 97 ++++++++ .../influxdb_08/specs/influx_series_specs.ts | 220 ++++++++++++++++++ .../influxdb_08/specs/query_builder_specs.ts | 78 +++++++ public/test/specs/influxQueryBuilder-specs.js | 78 ------- public/test/specs/influxSeries08-specs.js | 220 ------------------ .../test/specs/influxdb-datasource-specs.js | 101 -------- 11 files changed, 401 insertions(+), 404 deletions(-) rename public/app/plugins/datasource/influxdb_08/{funcEditor.js => func_editor.js} (100%) rename public/app/plugins/datasource/influxdb_08/{influxSeries.js => influx_series.js} (100%) rename public/app/plugins/datasource/influxdb_08/{queryBuilder.js => query_builder.js} (100%) rename public/app/plugins/datasource/influxdb_08/{queryCtrl.js => query_ctrl.js} (99%) create mode 100644 public/app/plugins/datasource/influxdb_08/specs/datasource-specs.ts create mode 100644 public/app/plugins/datasource/influxdb_08/specs/influx_series_specs.ts create mode 100644 public/app/plugins/datasource/influxdb_08/specs/query_builder_specs.ts delete mode 100644 public/test/specs/influxQueryBuilder-specs.js delete mode 100644 public/test/specs/influxSeries08-specs.js delete mode 100644 public/test/specs/influxdb-datasource-specs.js diff --git a/public/app/plugins/datasource/influxdb_08/datasource.js b/public/app/plugins/datasource/influxdb_08/datasource.js index 0bfa3f84527..a5058db3eb6 100644 --- a/public/app/plugins/datasource/influxdb_08/datasource.js +++ b/public/app/plugins/datasource/influxdb_08/datasource.js @@ -2,11 +2,11 @@ define([ 'angular', 'lodash', 'app/core/utils/datemath', - './influxSeries', - './queryBuilder', + './influx_series', + './query_builder', './directives', - './queryCtrl', - './funcEditor', + './query_ctrl', + './func_editor', ], function (angular, _, dateMath, InfluxSeries, InfluxQueryBuilder) { 'use strict'; diff --git a/public/app/plugins/datasource/influxdb_08/funcEditor.js b/public/app/plugins/datasource/influxdb_08/func_editor.js similarity index 100% rename from public/app/plugins/datasource/influxdb_08/funcEditor.js rename to public/app/plugins/datasource/influxdb_08/func_editor.js diff --git a/public/app/plugins/datasource/influxdb_08/influxSeries.js b/public/app/plugins/datasource/influxdb_08/influx_series.js similarity index 100% rename from public/app/plugins/datasource/influxdb_08/influxSeries.js rename to public/app/plugins/datasource/influxdb_08/influx_series.js diff --git a/public/app/plugins/datasource/influxdb_08/queryBuilder.js b/public/app/plugins/datasource/influxdb_08/query_builder.js similarity index 100% rename from public/app/plugins/datasource/influxdb_08/queryBuilder.js rename to public/app/plugins/datasource/influxdb_08/query_builder.js diff --git a/public/app/plugins/datasource/influxdb_08/queryCtrl.js b/public/app/plugins/datasource/influxdb_08/query_ctrl.js similarity index 99% rename from public/app/plugins/datasource/influxdb_08/queryCtrl.js rename to public/app/plugins/datasource/influxdb_08/query_ctrl.js index c6304bc50ae..093e0af84d1 100644 --- a/public/app/plugins/datasource/influxdb_08/queryCtrl.js +++ b/public/app/plugins/datasource/influxdb_08/query_ctrl.js @@ -89,6 +89,7 @@ function (angular) { } }; - }); + $scope.init(); + }); }); diff --git a/public/app/plugins/datasource/influxdb_08/specs/datasource-specs.ts b/public/app/plugins/datasource/influxdb_08/specs/datasource-specs.ts new file mode 100644 index 00000000000..c4ea81759e8 --- /dev/null +++ b/public/app/plugins/datasource/influxdb_08/specs/datasource-specs.ts @@ -0,0 +1,97 @@ +/// +/// +/// +/// + +import {describe, beforeEach, it, sinon, expect, angularMocks} from 'test/lib/common'; + +declare var helpers: any; + +describe('InfluxDatasource', function() { + var ctx = new helpers.ServiceTestContext(); + + beforeEach(angularMocks.module('grafana.services')); + beforeEach(ctx.providePhase(['templateSrv'])); + beforeEach(ctx.createService('InfluxDatasource_08')); + beforeEach(function() { + ctx.ds = new ctx.service({ url: '', user: 'test', password: 'mupp' }); + }); + + describe('When querying influxdb with one target using query editor target spec', function() { + var results; + var urlExpected = "/series?p=mupp&q=select+mean(value)+from+%22test%22+where+time+%3E+now()-1h+group+by+time(1s)+order+asc"; + var query = { + rangeRaw: { from: 'now-1h', to: 'now' }, + targets: [{ series: 'test', column: 'value', function: 'mean' }], + interval: '1s' + }; + + var response = [{ + columns: ["time", "sequence_nr", "value"], + name: 'test', + points: [[10, 1, 1]], + }]; + + beforeEach(function() { + ctx.$httpBackend.expect('GET', urlExpected).respond(response); + ctx.ds.query(query).then(function(data) { results = data; }); + ctx.$httpBackend.flush(); + }); + + it('should generate the correct query', function() { + ctx.$httpBackend.verifyNoOutstandingExpectation(); + }); + + it('should return series list', function() { + expect(results.data.length).to.be(1); + expect(results.data[0].target).to.be('test.value'); + }); + + }); + + describe('When querying influxdb with one raw query', function() { + var results; + var urlExpected = "/series?p=mupp&q=select+value+from+series+where+time+%3E+now()-1h"; + var query = { + rangeRaw: { from: 'now-1h', to: 'now' }, + targets: [{ query: "select value from series where $timeFilter", rawQuery: true }] + }; + + var response = []; + + beforeEach(function() { + ctx.$httpBackend.expect('GET', urlExpected).respond(response); + ctx.ds.query(query).then(function(data) { results = data; }); + ctx.$httpBackend.flush(); + }); + + it('should generate the correct query', function() { + ctx.$httpBackend.verifyNoOutstandingExpectation(); + }); + + }); + + describe('When issuing annotation query', function() { + var results; + var urlExpected = "/series?p=mupp&q=select+title+from+events.backend_01+where+time+%3E+now()-1h"; + + var range = { from: 'now-1h', to: 'now' }; + var annotation = { query: 'select title from events.$server where $timeFilter' }; + var response = []; + + beforeEach(function() { + ctx.templateSrv.replace = function(str) { + return str.replace('$server', 'backend_01'); + }; + ctx.$httpBackend.expect('GET', urlExpected).respond(response); + ctx.ds.annotationQuery(annotation, range).then(function(data) { results = data; }); + ctx.$httpBackend.flush(); + }); + + it('should generate the correct query', function() { + ctx.$httpBackend.verifyNoOutstandingExpectation(); + }); + + }); + +}); diff --git a/public/app/plugins/datasource/influxdb_08/specs/influx_series_specs.ts b/public/app/plugins/datasource/influxdb_08/specs/influx_series_specs.ts new file mode 100644 index 00000000000..f8f2e4ed62f --- /dev/null +++ b/public/app/plugins/datasource/influxdb_08/specs/influx_series_specs.ts @@ -0,0 +1,220 @@ +/// + +import {describe, beforeEach, it, sinon, expect} from 'test/lib/common'; + +declare var InfluxSeries: any; + +describe('when generating timeseries from influxdb response', function() { + + describe('given two series', function() { + var series = new InfluxSeries({ + seriesList: [ + { + columns: ['time', 'mean', 'sequence_number'], + name: 'prod.server1.cpu', + points: [[1402596000, 10, 1], [1402596001, 12, 2]] + }, + { + columns: ['time', 'mean', 'sequence_number'], + name: 'prod.server2.cpu', + points: [[1402596000, 15, 1], [1402596001, 16, 2]] + } + ] + }); + + var result = series.getTimeSeries(); + + it('should generate two time series', function() { + expect(result.length).to.be(2); + expect(result[0].target).to.be('prod.server1.cpu.mean'); + expect(result[0].datapoints[0][0]).to.be(10); + expect(result[0].datapoints[0][1]).to.be(1402596000); + expect(result[0].datapoints[1][0]).to.be(12); + expect(result[0].datapoints[1][1]).to.be(1402596001); + + expect(result[1].target).to.be('prod.server2.cpu.mean'); + expect(result[1].datapoints[0][0]).to.be(15); + expect(result[1].datapoints[0][1]).to.be(1402596000); + expect(result[1].datapoints[1][0]).to.be(16); + expect(result[1].datapoints[1][1]).to.be(1402596001); + }); + + }); + + describe('given an alias format', function() { + var series = new InfluxSeries({ + seriesList: [ + { + columns: ['time', 'mean', 'sequence_number'], + name: 'prod.server1.cpu', + points: [[1402596000, 10, 1], [1402596001, 12, 2]] + } + ], + alias: '$s.testing' + }); + + var result = series.getTimeSeries(); + + it('should generate correct series name', function() { + expect(result[0].target).to.be('prod.server1.cpu.testing'); + }); + + }); + + describe('given an alias format with segment numbers', function() { + var series = new InfluxSeries({ + seriesList: [ + { + columns: ['time', 'mean', 'sequence_number'], + name: 'prod.server1.cpu', + points: [[1402596000, 10, 1], [1402596001, 12, 2]] + } + ], + alias: '$1.mean' + }); + + var result = series.getTimeSeries(); + + it('should generate correct series name', function() { + expect(result[0].target).to.be('server1.mean'); + }); + + }); + + describe('given an alias format and many segments', function() { + var series = new InfluxSeries({ + seriesList: [ + { + columns: ['time', 'mean', 'sequence_number'], + name: 'a0.a1.a2.a3.a4.a5.a6.a7.a8.a9.a10.a11.a12', + points: [[1402596000, 10, 1], [1402596001, 12, 2]] + } + ], + alias: '$5.$11.mean' + }); + + var result = series.getTimeSeries(); + + it('should generate correct series name', function() { + expect(result[0].target).to.be('a5.a11.mean'); + }); + + }); + + + describe('given an alias format with group by field', function() { + var series = new InfluxSeries({ + seriesList: [ + { + columns: ['time', 'mean', 'host'], + name: 'prod.cpu', + points: [[1402596000, 10, 'A']] + } + ], + groupByField: 'host', + alias: '$g.$1' + }); + + var result = series.getTimeSeries(); + + it('should generate correct series name', function() { + expect(result[0].target).to.be('A.cpu'); + }); + + }); + + describe('given group by column', function() { + var series = new InfluxSeries({ + seriesList: [ + { + columns: ['time', 'mean', 'host'], + name: 'prod.cpu', + points: [ + [1402596000, 10, 'A'], + [1402596001, 11, 'A'], + [1402596000, 5, 'B'], + [1402596001, 6, 'B'], + ] + } + ], + groupByField: 'host' + }); + + var result = series.getTimeSeries(); + + it('should generate two time series', function() { + expect(result.length).to.be(2); + expect(result[0].target).to.be('prod.cpu.A'); + expect(result[0].datapoints[0][0]).to.be(10); + expect(result[0].datapoints[0][1]).to.be(1402596000); + expect(result[0].datapoints[1][0]).to.be(11); + expect(result[0].datapoints[1][1]).to.be(1402596001); + + expect(result[1].target).to.be('prod.cpu.B'); + expect(result[1].datapoints[0][0]).to.be(5); + expect(result[1].datapoints[0][1]).to.be(1402596000); + expect(result[1].datapoints[1][0]).to.be(6); + expect(result[1].datapoints[1][1]).to.be(1402596001); + }); + + }); + +}); + +describe("when creating annotations from influxdb response", function() { + describe('given column mapping for all columns', function() { + var series = new InfluxSeries({ + seriesList: [ + { + columns: ['time', 'text', 'sequence_number', 'title', 'tags'], + name: 'events1', + points: [[1402596000000, 'some text', 1, 'Hello', 'B'], [1402596001000, 'asd', 2, 'Hello2', 'B']] + } + ], + annotation: { + query: 'select', + titleColumn: 'title', + tagsColumn: 'tags', + textColumn: 'text', + } + }); + + var result = series.getAnnotations(); + + it(' should generate 2 annnotations ', function() { + expect(result.length).to.be(2); + expect(result[0].annotation.query).to.be('select'); + expect(result[0].title).to.be('Hello'); + expect(result[0].time).to.be(1402596000000); + expect(result[0].tags).to.be('B'); + expect(result[0].text).to.be('some text'); + }); + + }); + + describe('given no column mapping', function() { + var series = new InfluxSeries({ + seriesList: [ + { + columns: ['time', 'text', 'sequence_number'], + name: 'events1', + points: [[1402596000000, 'some text', 1]] + } + ], + annotation: { query: 'select' } + }); + + var result = series.getAnnotations(); + + it('should generate 1 annnotation', function() { + expect(result.length).to.be(1); + expect(result[0].title).to.be('some text'); + expect(result[0].time).to.be(1402596000000); + expect(result[0].tags).to.be(undefined); + expect(result[0].text).to.be(undefined); + }); + + }); + +}); + diff --git a/public/app/plugins/datasource/influxdb_08/specs/query_builder_specs.ts b/public/app/plugins/datasource/influxdb_08/specs/query_builder_specs.ts new file mode 100644 index 00000000000..5876efb962e --- /dev/null +++ b/public/app/plugins/datasource/influxdb_08/specs/query_builder_specs.ts @@ -0,0 +1,78 @@ +/// + +import {describe, beforeEach, it, sinon, expect} from 'test/lib/common'; + +declare var InfluxQueryBuilder: any; + +describe('InfluxQueryBuilder', function() { + + describe('series with conditon and group by', function() { + var builder = new InfluxQueryBuilder({ + series: 'google.test', + column: 'value', + function: 'mean', + condition: "code=1", + groupby_field: 'code' + }); + + var query = builder.build(); + + it('should generate correct query', function() { + expect(query).to.be('select code, mean(value) from "google.test" where $timeFilter and code=1 ' + + 'group by time($interval), code order asc'); + }); + + it('should expose groupByFiled', function() { + expect(builder.groupByField).to.be('code'); + }); + + }); + + describe('series with fill and minimum group by time', function() { + var builder = new InfluxQueryBuilder({ + series: 'google.test', + column: 'value', + function: 'mean', + fill: '0', + }); + + var query = builder.build(); + + it('should generate correct query', function() { + expect(query).to.be('select mean(value) from "google.test" where $timeFilter ' + + 'group by time($interval) fill(0) order asc'); + }); + + }); + + describe('merge function detection', function() { + it('should not quote wrap regex merged series', function() { + var builder = new InfluxQueryBuilder({ + series: 'merge(/^google.test/)', + column: 'value', + function: 'mean' + }); + + var query = builder.build(); + + expect(query).to.be('select mean(value) from merge(/^google.test/) where $timeFilter ' + + 'group by time($interval) order asc'); + }); + + it('should quote wrap series names that start with "merge"', function() { + var builder = new InfluxQueryBuilder({ + series: 'merge.google.test', + column: 'value', + function: 'mean' + }); + + var query = builder.build(); + + expect(query).to.be('select mean(value) from "merge.google.test" where $timeFilter ' + + 'group by time($interval) order asc'); + }); + + }); + +}); + diff --git a/public/test/specs/influxQueryBuilder-specs.js b/public/test/specs/influxQueryBuilder-specs.js deleted file mode 100644 index 5dcb7a9facd..00000000000 --- a/public/test/specs/influxQueryBuilder-specs.js +++ /dev/null @@ -1,78 +0,0 @@ -define([ - 'app/plugins/datasource/influxdb_08/queryBuilder' -], function(InfluxQueryBuilder) { - 'use strict'; - - describe('InfluxQueryBuilder', function() { - - describe('series with conditon and group by', function() { - var builder = new InfluxQueryBuilder({ - series: 'google.test', - column: 'value', - function: 'mean', - condition: "code=1", - groupby_field: 'code' - }); - - var query = builder.build(); - - it('should generate correct query', function() { - expect(query).to.be('select code, mean(value) from "google.test" where $timeFilter and code=1 ' + - 'group by time($interval), code order asc'); - }); - - it('should expose groupByFiled', function() { - expect(builder.groupByField).to.be('code'); - }); - - }); - - describe('series with fill and minimum group by time', function() { - var builder = new InfluxQueryBuilder({ - series: 'google.test', - column: 'value', - function: 'mean', - fill: '0', - }); - - var query = builder.build(); - - it('should generate correct query', function() { - expect(query).to.be('select mean(value) from "google.test" where $timeFilter ' + - 'group by time($interval) fill(0) order asc'); - }); - - }); - - describe('merge function detection', function() { - it('should not quote wrap regex merged series', function() { - var builder = new InfluxQueryBuilder({ - series: 'merge(/^google.test/)', - column: 'value', - function: 'mean' - }); - - var query = builder.build(); - - expect(query).to.be('select mean(value) from merge(/^google.test/) where $timeFilter ' + - 'group by time($interval) order asc'); - }); - - it('should quote wrap series names that start with "merge"', function() { - var builder = new InfluxQueryBuilder({ - series: 'merge.google.test', - column: 'value', - function: 'mean' - }); - - var query = builder.build(); - - expect(query).to.be('select mean(value) from "merge.google.test" where $timeFilter ' + - 'group by time($interval) order asc'); - }); - - }); - - }); - -}); diff --git a/public/test/specs/influxSeries08-specs.js b/public/test/specs/influxSeries08-specs.js deleted file mode 100644 index 7b99a3035a9..00000000000 --- a/public/test/specs/influxSeries08-specs.js +++ /dev/null @@ -1,220 +0,0 @@ -define([ - 'app/plugins/datasource/influxdb_08/influxSeries' -], function(InfluxSeries) { - 'use strict'; - - describe('when generating timeseries from influxdb response', function() { - - describe('given two series', function() { - var series = new InfluxSeries({ - seriesList: [ - { - columns: ['time', 'mean', 'sequence_number'], - name: 'prod.server1.cpu', - points: [[1402596000, 10, 1], [1402596001, 12, 2]] - }, - { - columns: ['time', 'mean', 'sequence_number'], - name: 'prod.server2.cpu', - points: [[1402596000, 15, 1], [1402596001, 16, 2]] - } - ] - }); - - var result = series.getTimeSeries(); - - it('should generate two time series', function() { - expect(result.length).to.be(2); - expect(result[0].target).to.be('prod.server1.cpu.mean'); - expect(result[0].datapoints[0][0]).to.be(10); - expect(result[0].datapoints[0][1]).to.be(1402596000); - expect(result[0].datapoints[1][0]).to.be(12); - expect(result[0].datapoints[1][1]).to.be(1402596001); - - expect(result[1].target).to.be('prod.server2.cpu.mean'); - expect(result[1].datapoints[0][0]).to.be(15); - expect(result[1].datapoints[0][1]).to.be(1402596000); - expect(result[1].datapoints[1][0]).to.be(16); - expect(result[1].datapoints[1][1]).to.be(1402596001); - }); - - }); - - describe('given an alias format', function() { - var series = new InfluxSeries({ - seriesList: [ - { - columns: ['time', 'mean', 'sequence_number'], - name: 'prod.server1.cpu', - points: [[1402596000, 10, 1], [1402596001, 12, 2]] - } - ], - alias: '$s.testing' - }); - - var result = series.getTimeSeries(); - - it('should generate correct series name', function() { - expect(result[0].target).to.be('prod.server1.cpu.testing'); - }); - - }); - - describe('given an alias format with segment numbers', function() { - var series = new InfluxSeries({ - seriesList: [ - { - columns: ['time', 'mean', 'sequence_number'], - name: 'prod.server1.cpu', - points: [[1402596000, 10, 1], [1402596001, 12, 2]] - } - ], - alias: '$1.mean' - }); - - var result = series.getTimeSeries(); - - it('should generate correct series name', function() { - expect(result[0].target).to.be('server1.mean'); - }); - - }); - - describe('given an alias format and many segments', function() { - var series = new InfluxSeries({ - seriesList: [ - { - columns: ['time', 'mean', 'sequence_number'], - name: 'a0.a1.a2.a3.a4.a5.a6.a7.a8.a9.a10.a11.a12', - points: [[1402596000, 10, 1], [1402596001, 12, 2]] - } - ], - alias: '$5.$11.mean' - }); - - var result = series.getTimeSeries(); - - it('should generate correct series name', function() { - expect(result[0].target).to.be('a5.a11.mean'); - }); - - }); - - - describe('given an alias format with group by field', function() { - var series = new InfluxSeries({ - seriesList: [ - { - columns: ['time', 'mean', 'host'], - name: 'prod.cpu', - points: [[1402596000, 10, 'A']] - } - ], - groupByField: 'host', - alias: '$g.$1' - }); - - var result = series.getTimeSeries(); - - it('should generate correct series name', function() { - expect(result[0].target).to.be('A.cpu'); - }); - - }); - - describe('given group by column', function() { - var series = new InfluxSeries({ - seriesList: [ - { - columns: ['time', 'mean', 'host'], - name: 'prod.cpu', - points: [ - [1402596000, 10, 'A'], - [1402596001, 11, 'A'], - [1402596000, 5, 'B'], - [1402596001, 6, 'B'], - ] - } - ], - groupByField: 'host' - }); - - var result = series.getTimeSeries(); - - it('should generate two time series', function() { - expect(result.length).to.be(2); - expect(result[0].target).to.be('prod.cpu.A'); - expect(result[0].datapoints[0][0]).to.be(10); - expect(result[0].datapoints[0][1]).to.be(1402596000); - expect(result[0].datapoints[1][0]).to.be(11); - expect(result[0].datapoints[1][1]).to.be(1402596001); - - expect(result[1].target).to.be('prod.cpu.B'); - expect(result[1].datapoints[0][0]).to.be(5); - expect(result[1].datapoints[0][1]).to.be(1402596000); - expect(result[1].datapoints[1][0]).to.be(6); - expect(result[1].datapoints[1][1]).to.be(1402596001); - }); - - }); - - }); - - describe("when creating annotations from influxdb response", function() { - describe('given column mapping for all columns', function() { - var series = new InfluxSeries({ - seriesList: [ - { - columns: ['time', 'text', 'sequence_number', 'title', 'tags'], - name: 'events1', - points: [[1402596000000, 'some text', 1, 'Hello', 'B'], [1402596001000, 'asd', 2, 'Hello2', 'B']] - } - ], - annotation: { - query: 'select', - titleColumn: 'title', - tagsColumn: 'tags', - textColumn: 'text', - } - }); - - var result = series.getAnnotations(); - - it(' should generate 2 annnotations ', function() { - expect(result.length).to.be(2); - expect(result[0].annotation.query).to.be('select'); - expect(result[0].title).to.be('Hello'); - expect(result[0].time).to.be(1402596000000); - expect(result[0].tags).to.be('B'); - expect(result[0].text).to.be('some text'); - }); - - }); - - describe('given no column mapping', function() { - var series = new InfluxSeries({ - seriesList: [ - { - columns: ['time', 'text', 'sequence_number'], - name: 'events1', - points: [[1402596000000, 'some text', 1]] - } - ], - annotation: { query: 'select' } - }); - - var result = series.getAnnotations(); - - it('should generate 1 annnotation', function() { - expect(result.length).to.be(1); - expect(result[0].title).to.be('some text'); - expect(result[0].time).to.be(1402596000000); - expect(result[0].tags).to.be(undefined); - expect(result[0].text).to.be(undefined); - }); - - }); - - }); - -}); diff --git a/public/test/specs/influxdb-datasource-specs.js b/public/test/specs/influxdb-datasource-specs.js deleted file mode 100644 index 175215663e0..00000000000 --- a/public/test/specs/influxdb-datasource-specs.js +++ /dev/null @@ -1,101 +0,0 @@ -define([ - './helpers', - 'app/plugins/datasource/influxdb_08/datasource', - 'app/services/backendSrv', - 'app/services/alertSrv' -], function(helpers) { - 'use strict'; - - describe('InfluxDatasource', function() { - var ctx = new helpers.ServiceTestContext(); - - beforeEach(module('grafana.services')); - beforeEach(ctx.providePhase(['templateSrv'])); - beforeEach(ctx.createService('InfluxDatasource_08')); - beforeEach(function() { - ctx.ds = new ctx.service({ url: '', user: 'test', password: 'mupp' }); - }); - - describe('When querying influxdb with one target using query editor target spec', function() { - var results; - var urlExpected = "/series?p=mupp&q=select+mean(value)+from+%22test%22"+ - "+where+time+%3E+now()-1h+group+by+time(1s)+order+asc"; - var query = { - rangeRaw: { from: 'now-1h', to: 'now' }, - targets: [{ series: 'test', column: 'value', function: 'mean' }], - interval: '1s' - }; - - var response = [{ - columns: ["time", "sequence_nr", "value"], - name: 'test', - points: [[10, 1, 1]], - }]; - - beforeEach(function() { - ctx.$httpBackend.expect('GET', urlExpected).respond(response); - ctx.ds.query(query).then(function(data) { results = data; }); - ctx.$httpBackend.flush(); - }); - - it('should generate the correct query', function() { - ctx.$httpBackend.verifyNoOutstandingExpectation(); - }); - - it('should return series list', function() { - expect(results.data.length).to.be(1); - expect(results.data[0].target).to.be('test.value'); - }); - - }); - - describe('When querying influxdb with one raw query', function() { - var results; - var urlExpected = "/series?p=mupp&q=select+value+from+series"+ - "+where+time+%3E+now()-1h"; - var query = { - rangeRaw: { from: 'now-1h', to: 'now' }, - targets: [{ query: "select value from series where $timeFilter", rawQuery: true }] - }; - - var response = []; - - beforeEach(function() { - ctx.$httpBackend.expect('GET', urlExpected).respond(response); - ctx.ds.query(query).then(function(data) { results = data; }); - ctx.$httpBackend.flush(); - }); - - it('should generate the correct query', function() { - ctx.$httpBackend.verifyNoOutstandingExpectation(); - }); - - }); - - describe('When issuing annotation query', function() { - var results; - var urlExpected = "/series?p=mupp&q=select+title+from+events.backend_01"+ - "+where+time+%3E+now()-1h"; - - var range = { from: 'now-1h', to: 'now' }; - var annotation = { query: 'select title from events.$server where $timeFilter' }; - var response = []; - - beforeEach(function() { - ctx.templateSrv.replace = function(str) { - return str.replace('$server', 'backend_01'); - }; - ctx.$httpBackend.expect('GET', urlExpected).respond(response); - ctx.ds.annotationQuery(annotation, range).then(function(data) { results = data; }); - ctx.$httpBackend.flush(); - }); - - it('should generate the correct query', function() { - ctx.$httpBackend.verifyNoOutstandingExpectation(); - }); - - }); - - }); -}); - From 5b01e9ec971b2744c4e1e152076ae4f096e0302c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Thu, 22 Oct 2015 16:58:31 -0400 Subject: [PATCH 057/269] fix(elasticsearch): minor fix to elasticsearch unit tests so that they work in any timezone, fixes #3010 --- .../plugins/datasource/elasticsearch/specs/datasource_specs.ts | 2 +- .../datasource/elasticsearch/specs/index_pattern_specs.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/public/app/plugins/datasource/elasticsearch/specs/datasource_specs.ts b/public/app/plugins/datasource/elasticsearch/specs/datasource_specs.ts index a5e55abe4dd..584f915a86d 100644 --- a/public/app/plugins/datasource/elasticsearch/specs/datasource_specs.ts +++ b/public/app/plugins/datasource/elasticsearch/specs/datasource_specs.ts @@ -36,7 +36,7 @@ describe('ElasticDatasource', function() { ctx.ds.testDatasource(); ctx.$rootScope.$apply(); - var today = moment().format("YYYY.MM.DD"); + var today = moment.utc().format("YYYY.MM.DD"); expect(requestOptions.url).to.be("http://es.com/asd-" + today + '/_stats'); }); }); diff --git a/public/app/plugins/datasource/elasticsearch/specs/index_pattern_specs.ts b/public/app/plugins/datasource/elasticsearch/specs/index_pattern_specs.ts index 8f662bb075f..1a19b550f4e 100644 --- a/public/app/plugins/datasource/elasticsearch/specs/index_pattern_specs.ts +++ b/public/app/plugins/datasource/elasticsearch/specs/index_pattern_specs.ts @@ -11,7 +11,7 @@ describe('IndexPattern', function() { describe('when getting index for today', function() { it('should return correct index name', function() { var pattern = new IndexPattern('[asd-]YYYY.MM.DD', 'Daily'); - var expected = 'asd-' + moment().format('YYYY.MM.DD'); + var expected = 'asd-' + moment.utc().format('YYYY.MM.DD'); expect(pattern.getIndexForToday()).to.be(expected); }); From 2d23251da95f15f1a40436b590e795600d515ad6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Thu, 22 Oct 2015 18:24:43 -0400 Subject: [PATCH 058/269] spelling: fixed selling in influxdb annotation partial, fixes #3012 --- .../datasource/influxdb/partials/annotations.editor.html | 2 +- .../datasource/influxdb_08/partials/annotations.editor.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/public/app/plugins/datasource/influxdb/partials/annotations.editor.html b/public/app/plugins/datasource/influxdb/partials/annotations.editor.html index fe867d68f36..cec47e7a7e4 100644 --- a/public/app/plugins/datasource/influxdb/partials/annotations.editor.html +++ b/public/app/plugins/datasource/influxdb/partials/annotations.editor.html @@ -9,7 +9,7 @@
        -
        Column mappings If your influxdb query returns more than one column you need to specify the column names bellow. An annotation event is composed of a title, tags, and an additional text field.
        +
        Column mappings If your influxdb query returns more than one column you need to specify the column names below. An annotation event is composed of a title, tags, and an additional text field.
        diff --git a/public/app/plugins/datasource/influxdb_08/partials/annotations.editor.html b/public/app/plugins/datasource/influxdb_08/partials/annotations.editor.html index fe867d68f36..cec47e7a7e4 100644 --- a/public/app/plugins/datasource/influxdb_08/partials/annotations.editor.html +++ b/public/app/plugins/datasource/influxdb_08/partials/annotations.editor.html @@ -9,7 +9,7 @@
        -
        Column mappings If your influxdb query returns more than one column you need to specify the column names bellow. An annotation event is composed of a title, tags, and an additional text field.
        +
        Column mappings If your influxdb query returns more than one column you need to specify the column names below. An annotation event is composed of a title, tags, and an additional text field.
        From c1d592b72cb8bf9dcc75a4e5e83f0a46bc6d86ca Mon Sep 17 00:00:00 2001 From: Mitsuhiro Tanda Date: Fri, 23 Oct 2015 09:58:42 +0900 Subject: [PATCH 059/269] fix, call linkToPrometheus() directly --- .../plugins/datasource/prometheus/partials/query.editor.html | 2 +- public/app/plugins/datasource/prometheus/query_ctrl.js | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/public/app/plugins/datasource/prometheus/partials/query.editor.html b/public/app/plugins/datasource/prometheus/partials/query.editor.html index fe3894a1ef0..75c432862ad 100644 --- a/public/app/plugins/datasource/prometheus/partials/query.editor.html +++ b/public/app/plugins/datasource/prometheus/partials/query.editor.html @@ -111,7 +111,7 @@
      • - +
      • diff --git a/public/app/plugins/datasource/prometheus/query_ctrl.js b/public/app/plugins/datasource/prometheus/query_ctrl.js index 8fc9ae0d6a3..bbbaff4aa56 100644 --- a/public/app/plugins/datasource/prometheus/query_ctrl.js +++ b/public/app/plugins/datasource/prometheus/query_ctrl.js @@ -14,7 +14,6 @@ function (angular, _) { target.expr = target.expr || ''; target.intervalFactor = target.intervalFactor || 2; - target.prometheusLink = $scope.linkToPrometheus(); $scope.metric = ''; $scope.resolutions = _.map([1,2,3,4,5,10], function(f) { @@ -28,7 +27,6 @@ function (angular, _) { }; $scope.refreshMetricData = function() { - $scope.target.prometheusLink = $scope.linkToPrometheus(); if (!_.isEqual($scope.oldTarget, $scope.target)) { $scope.oldTarget = angular.copy($scope.target); $scope.get_data(); From 184307816f7071a83fea36c7197d848869965a59 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Volker=20Fr=C3=B6hlich?= Date: Fri, 23 Oct 2015 11:32:51 +0200 Subject: [PATCH 060/269] "No limit" was not effective for ES terms aggregation This may belong to #2827 --- public/app/plugins/datasource/elasticsearch/query_builder.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/public/app/plugins/datasource/elasticsearch/query_builder.js b/public/app/plugins/datasource/elasticsearch/query_builder.js index ac61fe13a1e..43d8f96bc03 100644 --- a/public/app/plugins/datasource/elasticsearch/query_builder.js +++ b/public/app/plugins/datasource/elasticsearch/query_builder.js @@ -22,8 +22,7 @@ function (angular) { return queryNode; } - size = parseInt(aggDef.settings.size, 10); - if (size > 0) { queryNode.terms.size = size; } + queryNode.terms.size = parseInt(aggDef.settings.size, 10); if (aggDef.settings.orderBy !== void 0) { queryNode.terms.order = {}; queryNode.terms.order[aggDef.settings.orderBy] = aggDef.settings.order; From 6b9b08da3056555097a9ae32cd91328a4b32c57e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Volker=20Fr=C3=B6hlich?= Date: Fri, 23 Oct 2015 12:00:20 +0200 Subject: [PATCH 061/269] Remove declaration of unused variable size --- public/app/plugins/datasource/elasticsearch/query_builder.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/app/plugins/datasource/elasticsearch/query_builder.js b/public/app/plugins/datasource/elasticsearch/query_builder.js index 43d8f96bc03..d0fbb6a603a 100644 --- a/public/app/plugins/datasource/elasticsearch/query_builder.js +++ b/public/app/plugins/datasource/elasticsearch/query_builder.js @@ -15,7 +15,7 @@ function (angular) { }; ElasticQueryBuilder.prototype.buildTermsAgg = function(aggDef, queryNode, target) { - var metricRef, metric, size, y; + var metricRef, metric, y; queryNode.terms = { "field": aggDef.field }; if (!aggDef.settings) { From 4ec6691ea9ed6e073217e04237bcb917a6835cde Mon Sep 17 00:00:00 2001 From: Mathieu Parent Date: Fri, 23 Oct 2015 15:12:52 +0200 Subject: [PATCH 062/269] Fix LimitNOFILE in Debian systemd unit --- packaging/deb/systemd/grafana-server.service | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/deb/systemd/grafana-server.service b/packaging/deb/systemd/grafana-server.service index 16b975f23ea..dd5d2097149 100644 --- a/packaging/deb/systemd/grafana-server.service +++ b/packaging/deb/systemd/grafana-server.service @@ -14,7 +14,7 @@ ExecStart=/usr/sbin/grafana-server \ --config=${CONF_FILE} \ --pidfile=${PID_FILE} \ cfg:default.paths.logs=${LOG_DIR} \ - cfg:default.paths.data=${DATA_DIR} \ + cfg:default.paths.data=${DATA_DIR} LimitNOFILE=10000 TimeoutStopSec=20 UMask=0027 From e7834b885a4d7f2b686d42de45ce84ca730663ca Mon Sep 17 00:00:00 2001 From: Mathieu Parent Date: Fri, 23 Oct 2015 15:13:41 +0200 Subject: [PATCH 063/269] Fix LimitNOFILE in RPM systemd unit --- packaging/rpm/systemd/grafana-server.service | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/rpm/systemd/grafana-server.service b/packaging/rpm/systemd/grafana-server.service index 855dce53d08..fb2ec24d123 100644 --- a/packaging/rpm/systemd/grafana-server.service +++ b/packaging/rpm/systemd/grafana-server.service @@ -14,7 +14,7 @@ ExecStart=/usr/sbin/grafana-server \ --config=${CONF_FILE} \ --pidfile=${PID_FILE} \ cfg:default.paths.logs=${LOG_DIR} \ - cfg:default.paths.data=${DATA_DIR} \ + cfg:default.paths.data=${DATA_DIR} LimitNOFILE=10000 TimeoutStopSec=20 From 7205cf8ce113f072e9f4b2776cd2877d467e0763 Mon Sep 17 00:00:00 2001 From: ubhatnagar Date: Fri, 23 Oct 2015 07:29:15 -0700 Subject: [PATCH 064/269] Fixed 3014 --- docs/sources/reference/singlestat.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/sources/reference/singlestat.md b/docs/sources/reference/singlestat.md index a6a6a06c806..6f7c9fbd965 100644 --- a/docs/sources/reference/singlestat.md +++ b/docs/sources/reference/singlestat.md @@ -17,8 +17,8 @@ The singlestat panel has a normal query editor to allow you define your exact me 1. `Big Value`: Big Value refers to how we display the main stat for the Singlestat Panel. This is always a single value that is displayed in the Panel in between two strings, `Prefix` and `Suffix`. The single number is calculated by choosing a function (min,max,average,current,total) of your metric query. This functions reduces your query into a single numeric value. -2. `Font Size`: You can use this section -3. `Values`: The Value fields let you set the function (min, max, average, current, total) that your entire query is reduced into a single value with. You can also set the font size of theand font-size (as a %) of the metric query that the Panel is configured with. This reduces the entire query into a single summary value that is displayed. +2. `Font Size`: You can use this section to select the font size of the different texts in the Singlestat Panel, i.e. prefix, value and postfix. +3. `Values`: The Value fields let you set the function (min, max, average, current, total) that your entire query is reduced into a single value with. You can also set the font size of the Value field and font-size (as a %) of the metric query that the Panel is configured with. This reduces the entire query into a single summary value that is displayed. 4. `Postfixes`: The Postfix fields let you define a custom label and font-size (as a %) to appear *after* the value 5. `Units`: Units are appended to the the Singlestat within the panel, and will respect the color and threshold settings for the value. 6. `Decimals`: The Decimal field allows you to override the automatic decimal precision, and set it explicitly. From 0a6a3f9ab7963a509f6b919957884f2a65dbfb28 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arthur=20D=27Andr=C3=A9a=20Alemar?= Date: Fri, 23 Oct 2015 16:08:22 -0200 Subject: [PATCH 065/269] fix(prometheus): use time independent API to list metrics and labels names Using the "/api/v1/query" endpoint to extract information about metrics and labels are limited to the metrics available at the time parameter (that is set to current time), this can lead to labels not showing because they have no value in the current time even when the dashboard is displaying historic data. On the other hand "/api/v1/series" returns results including every metric and label known to Prometheus, independent of time and value. --- .../datasource/prometheus/datasource.js | 20 ++++++------------- .../prometheus/specs/datasource_specs.ts | 18 +++++++---------- 2 files changed, 13 insertions(+), 25 deletions(-) diff --git a/public/app/plugins/datasource/prometheus/datasource.js b/public/app/plugins/datasource/prometheus/datasource.js index 3f62279f6c9..64756f4c49e 100644 --- a/public/app/plugins/datasource/prometheus/datasource.js +++ b/public/app/plugins/datasource/prometheus/datasource.js @@ -148,20 +148,13 @@ function (angular, _, moment, dateMath) { }); }); } else { - var metric_query = 'count(' + label_values_query[1] + ') by (' + - label_values_query[2] + ')'; - url = '/api/v1/query?query=' + encodeURIComponent(metric_query) + - '&time=' + (moment().valueOf() / 1000); + url = '/api/v1/series?match[]=' + encodeURIComponent(label_values_query[1]); return this._request('GET', url) .then(function(result) { - if (result.data.data.result.length === 0 || - _.keys(result.data.data.result[0].metric).length === 0) { - return []; - } - return _.map(result.data.data.result, function(metricValue) { + return _.map(result.data.data, function(metric) { return { - text: metricValue.metric[label_values_query[2]], + text: metric[label_values_query[2]], expandable: true }; }); @@ -190,14 +183,13 @@ function (angular, _, moment, dateMath) { }); } else { // if query contains full metric name, return metric name and label list - url = '/api/v1/query?query=' + encodeURIComponent(interpolated) + - '&time=' + (moment().valueOf() / 1000); + url = '/api/v1/series?match[]=' + encodeURIComponent(interpolated); return this._request('GET', url) .then(function(result) { - return _.map(result.data.data.result, function(metricData) { + return _.map(result.data.data, function(metric) { return { - text: getOriginalMetricName(metricData.metric), + text: getOriginalMetricName(metric), expandable: true }; }); diff --git a/public/app/plugins/datasource/prometheus/specs/datasource_specs.ts b/public/app/plugins/datasource/prometheus/specs/datasource_specs.ts index fc43da279fc..a6b494ccbf8 100644 --- a/public/app/plugins/datasource/prometheus/specs/datasource_specs.ts +++ b/public/app/plugins/datasource/prometheus/specs/datasource_specs.ts @@ -59,19 +59,16 @@ describe('PrometheusDatasource', function() { ctx.$rootScope.$apply(); expect(results.length).to.be(3); }); - it('label_values(metric, resource) should generate count metric query', function() { + it('label_values(metric, resource) should generate series query', function() { response = { status: "success", - data: { - resultType: "vector", - result: [ - {metric: {resource: "value1"}, value: []}, - {metric: {resource: "value2"}, value: []}, - {metric: {resource: "value3"}, value: []} - ] - } + data: [ + {__name__: "metric", resource: "value1"}, + {__name__: "metric", resource: "value2"}, + {__name__: "metric", resource: "value3"} + ] }; - ctx.$httpBackend.expect('GET', /proxied\/api\/v1\/query\?query=count\(metric\)%20by%20\(resource\)&time=.*/).respond(response); + ctx.$httpBackend.expect('GET', 'proxied/api/v1/series?match[]=metric').respond(response); ctx.ds.metricFindQuery('label_values(metric, resource)').then(function(data) { results = data; }); ctx.$httpBackend.flush(); ctx.$rootScope.$apply(); @@ -90,4 +87,3 @@ describe('PrometheusDatasource', function() { }); }); }); - From 6c76e9728e5f1dc58c949345cbbf81eacb5ba497 Mon Sep 17 00:00:00 2001 From: ubhatnagar Date: Fri, 23 Oct 2015 22:53:30 -0700 Subject: [PATCH 066/269] Added OpenSuse installation command --- docs/sources/installation/rpm.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docs/sources/installation/rpm.md b/docs/sources/installation/rpm.md index c112c4c9fea..e8e61ea6d06 100644 --- a/docs/sources/installation/rpm.md +++ b/docs/sources/installation/rpm.md @@ -23,6 +23,10 @@ Or install manually using `rpm`. $ sudo yum install initscripts fontconfig $ sudo rpm -Uvh grafana-2.1.3-1.x86_64.rpm +On OpenSuse you need to run the following command to install the `rpm`. + + $ sudo rpm -i --nodeps grafana-2.1.3-1.x86_64.rpm + ## Install via YUM Repository Add the following to a new file at `/etc/yum.repos.d/grafana.repo` From 45cdbe0a188b8ff0db1cd1cba328192cd97080d3 Mon Sep 17 00:00:00 2001 From: ubhatnagar Date: Fri, 23 Oct 2015 23:03:58 -0700 Subject: [PATCH 067/269] Rearranged installation docs for OpenSuse --- docs/sources/installation/rpm.md | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/docs/sources/installation/rpm.md b/docs/sources/installation/rpm.md index e8e61ea6d06..9d6782f9c70 100644 --- a/docs/sources/installation/rpm.md +++ b/docs/sources/installation/rpm.md @@ -1,6 +1,6 @@ --- page_title: Installing on RPM-based Linux -page_description: Grafana Installation guide for Centos, Fedora, Redhat. +page_description: Grafana Installation guide for Centos, Fedora, OpenSuse, Redhat. page_keywords: grafana, installation, centos, fedora, opensuse, redhat, guide --- @@ -10,7 +10,7 @@ page_keywords: grafana, installation, centos, fedora, opensuse, redhat, guide Description | Download ------------ | ------------- -.RPM for Fedora / RHEL / CentOS Linux | [grafana-2.1.3-1.x86_64.rpm](https://grafanarel.s3.amazonaws.com/builds/grafana-2.1.3-1.x86_64.rpm) +.RPM for Fedora / RHEL / CentOS / OpenSuse Linux | [grafana-2.1.3-1.x86_64.rpm](https://grafanarel.s3.amazonaws.com/builds/grafana-2.1.3-1.x86_64.rpm) ## Install from package file @@ -20,10 +20,12 @@ You can install Grafana using Yum directly. Or install manually using `rpm`. +On Fedora / RHEL / CentOS run the following commands to install the `rpm`: + $ sudo yum install initscripts fontconfig $ sudo rpm -Uvh grafana-2.1.3-1.x86_64.rpm -On OpenSuse you need to run the following command to install the `rpm`. +On OpenSuse run the following command to install the `rpm`. $ sudo rpm -i --nodeps grafana-2.1.3-1.x86_64.rpm From 54be4c5e2ca1c78c3ae22453d727f1a35d46a2b6 Mon Sep 17 00:00:00 2001 From: Utkarsh Bhatnagar Date: Fri, 23 Oct 2015 23:21:00 -0700 Subject: [PATCH 068/269] Made installation doc consistent --- docs/sources/installation/rpm.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/sources/installation/rpm.md b/docs/sources/installation/rpm.md index 9d6782f9c70..67057384af0 100644 --- a/docs/sources/installation/rpm.md +++ b/docs/sources/installation/rpm.md @@ -10,7 +10,7 @@ page_keywords: grafana, installation, centos, fedora, opensuse, redhat, guide Description | Download ------------ | ------------- -.RPM for Fedora / RHEL / CentOS / OpenSuse Linux | [grafana-2.1.3-1.x86_64.rpm](https://grafanarel.s3.amazonaws.com/builds/grafana-2.1.3-1.x86_64.rpm) +.RPM for CentOS / Fedora / OpenSuse / Redhat Linux | [grafana-2.1.3-1.x86_64.rpm](https://grafanarel.s3.amazonaws.com/builds/grafana-2.1.3-1.x86_64.rpm) ## Install from package file @@ -20,12 +20,12 @@ You can install Grafana using Yum directly. Or install manually using `rpm`. -On Fedora / RHEL / CentOS run the following commands to install the `rpm`: +#### On CentOS / Fedora / Redhat: $ sudo yum install initscripts fontconfig $ sudo rpm -Uvh grafana-2.1.3-1.x86_64.rpm -On OpenSuse run the following command to install the `rpm`. +#### On OpenSuse: $ sudo rpm -i --nodeps grafana-2.1.3-1.x86_64.rpm From 21f3f859b9a4cddae56bd3bee562bb2164831315 Mon Sep 17 00:00:00 2001 From: mlbarrow Date: Sat, 24 Oct 2015 20:58:19 -0700 Subject: [PATCH 069/269] Update influxdb.md Typo fix --- docs/sources/datasources/influxdb.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/sources/datasources/influxdb.md b/docs/sources/datasources/influxdb.md index 35a6c914e65..8595548a1cb 100644 --- a/docs/sources/datasources/influxdb.md +++ b/docs/sources/datasources/influxdb.md @@ -28,7 +28,7 @@ Name | Description Name | The data source name, important that this is the same as in Grafana v1.x if you plan to import old dashboards. Default | Default data source means that it will be pre-selected for new panels. Url | The http protocol, ip and port of you influxdb api (influxdb api port is by default 8086) -Access | Proxy = access via Grafana backend, Direct = access directory from browser. +Access | Proxy = access via Grafana backend, Direct = access directly from browser. Database | Name of your influxdb database User | Name of your database user Password | Database user's password From da7ae2b0abca3311dc13ca5e19e910fc07a893c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Mon, 26 Oct 2015 12:48:30 +0100 Subject: [PATCH 070/269] fix(build/aws): updated aws dependency and fixed minor build issue, fixes #3026 --- Godeps/Godeps.json | 50 +- .../aws/aws-sdk-go/aws/awserr/types.go | 2 +- .../github.com/aws/aws-sdk-go/aws/config.go | 49 +- .../aws/aws-sdk-go/aws/config_test.go | 9 +- .../aws/{convutil.go => convert_types.go} | 0 ...convutil_test.go => convert_types_test.go} | 77 +- .../handlers.go} | 87 +- .../aws/corehandlers/handlers_test.go | 107 + .../aws/corehandlers/param_validator.go | 144 + .../aws/corehandlers/param_validator_test.go | 134 + .../aws-sdk-go/aws/credentials/credentials.go | 4 +- .../aws/credentials/ec2_role_provider_test.go | 108 - .../{ => ec2rolecreds}/ec2_role_provider.go | 92 +- .../ec2rolecreds/ec2_role_provider_test.go | 161 + .../shared_credentials_provider.go | 12 +- .../shared_credentials_provider_test.go | 25 +- .../stscreds/assume_role_provider.go | 11 +- .../stscreds/assume_role_provider_test.go | 7 +- .../aws/aws-sdk-go/aws/defaults/defaults.go | 39 + .../aws/aws-sdk-go/aws/ec2metadata/api.go | 43 + .../aws-sdk-go/aws/ec2metadata/api_test.go | 100 + .../aws/aws-sdk-go/aws/ec2metadata/service.go | 149 + .../github.com/aws/aws-sdk-go/aws/errors.go | 17 + .../aws-sdk-go/aws/handler_functions_test.go | 81 - .../aws/aws-sdk-go/aws/handlers_test.go | 31 - .../github.com/aws/aws-sdk-go/aws/logger.go | 9 + .../aws/aws-sdk-go/aws/param_validator.go | 89 - .../aws-sdk-go/aws/param_validator_test.go | 84 - .../aws-sdk-go/aws/{ => request}/handlers.go | 53 +- .../aws-sdk-go/aws/request/handlers_test.go | 47 + .../aws-sdk-go/aws/{ => request}/request.go | 56 +- .../{ => request}/request_pagination_test.go | 26 +- .../aws/{ => request}/request_test.go | 49 +- .../aws/aws-sdk-go/aws/request/retryer.go | 73 + .../github.com/aws/aws-sdk-go/aws/service.go | 194 - .../aws-sdk-go/aws/service/default_retryer.go | 49 + .../aws/aws-sdk-go/aws/service/service.go | 133 + .../aws/service/serviceinfo/service_info.go | 15 + .../github.com/aws/aws-sdk-go/aws/types.go | 33 + .../aws/aws-sdk-go/aws/types_test.go | 56 + .../github.com/aws/aws-sdk-go/aws/version.go | 2 +- .../aws-sdk-go/private/endpoints/endpoints.go | 31 + .../private/endpoints/endpoints.json | 81 + .../private/endpoints/endpoints_map.go | 93 + .../private/endpoints/endpoints_test.go | 28 + .../private/protocol/ec2query/build.go | 32 + .../protocol/ec2query/build_bench_test.go | 85 + .../private/protocol/ec2query/build_test.go | 882 ++ .../private/protocol/ec2query/unmarshal.go | 54 + .../protocol/ec2query/unmarshal_test.go | 838 ++ .../private/protocol/query/build.go | 33 + .../private/protocol/query/build_test.go | 1439 +++ .../protocol/query/queryutil/queryutil.go | 223 + .../private/protocol/query/unmarshal.go | 29 + .../private/protocol/query/unmarshal_error.go | 33 + .../private/protocol/query/unmarshal_test.go | 1452 +++ .../aws-sdk-go/private/protocol/rest/build.go | 254 + .../private/protocol/rest/payload.go | 45 + .../private/protocol/rest/unmarshal.go | 183 + .../private/protocol/xml/xmlutil/build.go | 287 + .../private/protocol/xml/xmlutil/unmarshal.go | 260 + .../protocol/xml/xmlutil/xml_to_struct.go | 105 + .../private/signer/v4/functional_test.go | 43 + .../aws/aws-sdk-go/private/signer/v4/v4.go | 365 + .../aws-sdk-go/private/signer/v4/v4_test.go | 247 + .../aws/aws-sdk-go/service/cloudwatch/api.go | 130 +- .../cloudwatch/cloudwatchiface/interface.go | 24 +- .../service/cloudwatch/examples_test.go | 200 +- .../aws-sdk-go/service/cloudwatch/service.go | 28 +- .../aws/aws-sdk-go/service/ec2/api.go | 8618 +++++++++-------- .../aws-sdk-go/service/ec2/customizations.go | 10 +- .../service/ec2/customizations_test.go | 4 +- .../service/ec2/ec2iface/interface.go | 562 +- .../aws-sdk-go/service/ec2/examples_test.go | 5064 ++++------ .../aws/aws-sdk-go/service/ec2/service.go | 28 +- build.go | 6 +- pkg/api/cloudwatch/cloudwatch.go | 2 +- 77 files changed, 15465 insertions(+), 8840 deletions(-) rename Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/{convutil.go => convert_types.go} (100%) rename Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/{convutil_test.go => convert_types_test.go} (89%) rename Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/{handler_functions.go => corehandlers/handlers.go} (64%) create mode 100644 Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/corehandlers/handlers_test.go create mode 100644 Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/corehandlers/param_validator.go create mode 100644 Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/corehandlers/param_validator_test.go delete mode 100644 Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/credentials/ec2_role_provider_test.go rename Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/credentials/{ => ec2rolecreds}/ec2_role_provider.go (60%) create mode 100644 Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/credentials/ec2rolecreds/ec2_role_provider_test.go create mode 100644 Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/defaults/defaults.go create mode 100644 Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/ec2metadata/api.go create mode 100644 Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/ec2metadata/api_test.go create mode 100644 Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/ec2metadata/service.go create mode 100644 Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/errors.go delete mode 100644 Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/handler_functions_test.go delete mode 100644 Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/handlers_test.go delete mode 100644 Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/param_validator.go delete mode 100644 Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/param_validator_test.go rename Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/{ => request}/handlers.go (57%) create mode 100644 Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/request/handlers_test.go rename Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/{ => request}/request.go (79%) rename Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/{ => request}/request_pagination_test.go (93%) rename Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/{ => request}/request_test.go (80%) create mode 100644 Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/request/retryer.go delete mode 100644 Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/service.go create mode 100644 Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/service/default_retryer.go create mode 100644 Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/service/service.go create mode 100644 Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/service/serviceinfo/service_info.go create mode 100644 Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/types_test.go create mode 100644 Godeps/_workspace/src/github.com/aws/aws-sdk-go/private/endpoints/endpoints.go create mode 100644 Godeps/_workspace/src/github.com/aws/aws-sdk-go/private/endpoints/endpoints.json create mode 100644 Godeps/_workspace/src/github.com/aws/aws-sdk-go/private/endpoints/endpoints_map.go create mode 100644 Godeps/_workspace/src/github.com/aws/aws-sdk-go/private/endpoints/endpoints_test.go create mode 100644 Godeps/_workspace/src/github.com/aws/aws-sdk-go/private/protocol/ec2query/build.go create mode 100644 Godeps/_workspace/src/github.com/aws/aws-sdk-go/private/protocol/ec2query/build_bench_test.go create mode 100644 Godeps/_workspace/src/github.com/aws/aws-sdk-go/private/protocol/ec2query/build_test.go create mode 100644 Godeps/_workspace/src/github.com/aws/aws-sdk-go/private/protocol/ec2query/unmarshal.go create mode 100644 Godeps/_workspace/src/github.com/aws/aws-sdk-go/private/protocol/ec2query/unmarshal_test.go create mode 100644 Godeps/_workspace/src/github.com/aws/aws-sdk-go/private/protocol/query/build.go create mode 100644 Godeps/_workspace/src/github.com/aws/aws-sdk-go/private/protocol/query/build_test.go create mode 100644 Godeps/_workspace/src/github.com/aws/aws-sdk-go/private/protocol/query/queryutil/queryutil.go create mode 100644 Godeps/_workspace/src/github.com/aws/aws-sdk-go/private/protocol/query/unmarshal.go create mode 100644 Godeps/_workspace/src/github.com/aws/aws-sdk-go/private/protocol/query/unmarshal_error.go create mode 100644 Godeps/_workspace/src/github.com/aws/aws-sdk-go/private/protocol/query/unmarshal_test.go create mode 100644 Godeps/_workspace/src/github.com/aws/aws-sdk-go/private/protocol/rest/build.go create mode 100644 Godeps/_workspace/src/github.com/aws/aws-sdk-go/private/protocol/rest/payload.go create mode 100644 Godeps/_workspace/src/github.com/aws/aws-sdk-go/private/protocol/rest/unmarshal.go create mode 100644 Godeps/_workspace/src/github.com/aws/aws-sdk-go/private/protocol/xml/xmlutil/build.go create mode 100644 Godeps/_workspace/src/github.com/aws/aws-sdk-go/private/protocol/xml/xmlutil/unmarshal.go create mode 100644 Godeps/_workspace/src/github.com/aws/aws-sdk-go/private/protocol/xml/xmlutil/xml_to_struct.go create mode 100644 Godeps/_workspace/src/github.com/aws/aws-sdk-go/private/signer/v4/functional_test.go create mode 100644 Godeps/_workspace/src/github.com/aws/aws-sdk-go/private/signer/v4/v4.go create mode 100644 Godeps/_workspace/src/github.com/aws/aws-sdk-go/private/signer/v4/v4_test.go diff --git a/Godeps/Godeps.json b/Godeps/Godeps.json index c3bb723f01a..104bff7d5f1 100644 --- a/Godeps/Godeps.json +++ b/Godeps/Godeps.json @@ -1,6 +1,6 @@ { "ImportPath": "github.com/grafana/grafana", - "GoVersion": "go1.4.2", + "GoVersion": "go1.5", "Packages": [ "./pkg/..." ], @@ -20,48 +20,48 @@ }, { "ImportPath": "github.com/aws/aws-sdk-go/aws", - "Comment": "v0.7.3", - "Rev": "bed164a424e75154a40550c04c313ef51a7bb275" + "Comment": "v0.9.16-3-g4944a94", + "Rev": "4944a94a3b092d1dad8a964415700a70f55e580a" }, { - "ImportPath": "github.com/aws/aws-sdk-go/internal/endpoints", - "Comment": "v0.7.3", - "Rev": "bed164a424e75154a40550c04c313ef51a7bb275" + "ImportPath": "github.com/aws/aws-sdk-go/private/endpoints", + "Comment": "v0.9.16-3-g4944a94", + "Rev": "4944a94a3b092d1dad8a964415700a70f55e580a" }, { - "ImportPath": "github.com/aws/aws-sdk-go/internal/protocol/ec2query", - "Comment": "v0.7.3", - "Rev": "bed164a424e75154a40550c04c313ef51a7bb275" + "ImportPath": "github.com/aws/aws-sdk-go/private/protocol/ec2query", + "Comment": "v0.9.16-3-g4944a94", + "Rev": "4944a94a3b092d1dad8a964415700a70f55e580a" }, { - "ImportPath": "github.com/aws/aws-sdk-go/internal/protocol/query", - "Comment": "v0.7.3", - "Rev": "bed164a424e75154a40550c04c313ef51a7bb275" + "ImportPath": "github.com/aws/aws-sdk-go/private/protocol/query", + "Comment": "v0.9.16-3-g4944a94", + "Rev": "4944a94a3b092d1dad8a964415700a70f55e580a" }, { - "ImportPath": "github.com/aws/aws-sdk-go/internal/protocol/rest", - "Comment": "v0.7.3", - "Rev": "bed164a424e75154a40550c04c313ef51a7bb275" + "ImportPath": "github.com/aws/aws-sdk-go/private/protocol/rest", + "Comment": "v0.9.16-3-g4944a94", + "Rev": "4944a94a3b092d1dad8a964415700a70f55e580a" }, { - "ImportPath": "github.com/aws/aws-sdk-go/internal/protocol/xml/xmlutil", - "Comment": "v0.7.3", - "Rev": "bed164a424e75154a40550c04c313ef51a7bb275" + "ImportPath": "github.com/aws/aws-sdk-go/private/protocol/xml/xmlutil", + "Comment": "v0.9.16-3-g4944a94", + "Rev": "4944a94a3b092d1dad8a964415700a70f55e580a" }, { - "ImportPath": "github.com/aws/aws-sdk-go/internal/signer/v4", - "Comment": "v0.7.3", - "Rev": "bed164a424e75154a40550c04c313ef51a7bb275" + "ImportPath": "github.com/aws/aws-sdk-go/private/signer/v4", + "Comment": "v0.9.16-3-g4944a94", + "Rev": "4944a94a3b092d1dad8a964415700a70f55e580a" }, { "ImportPath": "github.com/aws/aws-sdk-go/service/cloudwatch", - "Comment": "v0.7.3", - "Rev": "bed164a424e75154a40550c04c313ef51a7bb275" + "Comment": "v0.9.16-3-g4944a94", + "Rev": "4944a94a3b092d1dad8a964415700a70f55e580a" }, { "ImportPath": "github.com/aws/aws-sdk-go/service/ec2", - "Comment": "v0.7.3", - "Rev": "bed164a424e75154a40550c04c313ef51a7bb275" + "Comment": "v0.9.16-3-g4944a94", + "Rev": "4944a94a3b092d1dad8a964415700a70f55e580a" }, { "ImportPath": "github.com/davecgh/go-spew/spew", diff --git a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/awserr/types.go b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/awserr/types.go index 418fc4c14b4..003a6e8067e 100644 --- a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/awserr/types.go +++ b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/awserr/types.go @@ -113,7 +113,7 @@ func newRequestError(err Error, statusCode int, requestID string) *requestError // Error returns the string representation of the error. // Satisfies the error interface. func (r requestError) Error() string { - extra := fmt.Sprintf("status code: %d, request id: [%s]", + extra := fmt.Sprintf("status code: %d, request id: %s", r.statusCode, r.requestID) return SprintError(r.Code(), r.Message(), extra, r.OrigErr()) } diff --git a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/config.go b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/config.go index c27bdd3c106..cd2aade289f 100644 --- a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/config.go +++ b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/config.go @@ -2,48 +2,20 @@ package aws import ( "net/http" - "os" "time" "github.com/aws/aws-sdk-go/aws/credentials" ) -// DefaultChainCredentials is a Credentials which will find the first available -// credentials Value from the list of Providers. -// -// This should be used in the default case. Once the type of credentials are -// known switching to the specific Credentials will be more efficient. -var DefaultChainCredentials = credentials.NewChainCredentials( - []credentials.Provider{ - &credentials.EnvProvider{}, - &credentials.SharedCredentialsProvider{Filename: "", Profile: ""}, - &credentials.EC2RoleProvider{ExpiryWindow: 5 * time.Minute}, - }) - -// The default number of retries for a service. The value of -1 indicates that -// the service specific retry default will be used. +// DefaultRetries is the default number of retries for a service. The value of +// -1 indicates that the service specific retry default will be used. const DefaultRetries = -1 -// DefaultConfig is the default all service configuration will be based off of. -// By default, all clients use this structure for initialization options unless -// a custom configuration object is passed in. -// -// You may modify this global structure to change all default configuration -// in the SDK. Note that configuration options are copied by value, so any -// modifications must happen before constructing a client. -var DefaultConfig = NewConfig(). - WithCredentials(DefaultChainCredentials). - WithRegion(os.Getenv("AWS_REGION")). - WithHTTPClient(http.DefaultClient). - WithMaxRetries(DefaultRetries). - WithLogger(NewDefaultLogger()). - WithLogLevel(LogOff) - // A Config provides service configuration for service clients. By default, -// all clients will use the {DefaultConfig} structure. +// all clients will use the {defaults.DefaultConfig} structure. type Config struct { // The credentials object to use when signing requests. Defaults to - // {DefaultChainCredentials}. + // {defaults.DefaultChainCredentials}. Credentials *credentials.Credentials // An optional endpoint URL (hostname only or fully qualified URI) @@ -102,6 +74,8 @@ type Config struct { // @see http://docs.aws.amazon.com/AmazonS3/latest/dev/VirtualHosting.html // Amazon S3: Virtual Hosting of Buckets S3ForcePathStyle *bool + + SleepDelay func(time.Duration) } // NewConfig returns a new Config pointer that can be chained with builder methods to @@ -190,6 +164,13 @@ func (c *Config) WithS3ForcePathStyle(force bool) *Config { return c } +// WithSleepDelay overrides the function used to sleep while waiting for the +// next retry. Defaults to time.Sleep. +func (c *Config) WithSleepDelay(fn func(time.Duration)) *Config { + c.SleepDelay = fn + return c +} + // Merge returns a new Config with the other Config's attribute values merged into // this Config. If the other Config's attribute is nil it will not be merged into // the new Config to be returned. @@ -244,6 +225,10 @@ func (c Config) Merge(other *Config) *Config { dst.S3ForcePathStyle = other.S3ForcePathStyle } + if other.SleepDelay != nil { + dst.SleepDelay = other.SleepDelay + } + return &dst } diff --git a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/config_test.go b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/config_test.go index ddf3f39764d..c4320ca1ede 100644 --- a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/config_test.go +++ b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/config_test.go @@ -4,18 +4,11 @@ import ( "net/http" "reflect" "testing" - "time" "github.com/aws/aws-sdk-go/aws/credentials" ) -var testCredentials = credentials.NewChainCredentials([]credentials.Provider{ - &credentials.EnvProvider{}, - &credentials.SharedCredentialsProvider{ - Filename: "TestFilename", - Profile: "TestProfile"}, - &credentials.EC2RoleProvider{ExpiryWindow: 5 * time.Minute}, -}) +var testCredentials = credentials.NewStaticCredentials("AKID", "SECRET", "SESSION") var copyTestConfig = Config{ Credentials: testCredentials, diff --git a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/convutil.go b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/convert_types.go similarity index 100% rename from Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/convutil.go rename to Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/convert_types.go diff --git a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/convutil_test.go b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/convert_types_test.go similarity index 89% rename from Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/convutil_test.go rename to Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/convert_types_test.go index 6d06cd30f0a..df7a3e5d2de 100644 --- a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/convutil_test.go +++ b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/convert_types_test.go @@ -1,10 +1,9 @@ -package aws_test +package aws import ( "testing" "time" - "github.com/aws/aws-sdk-go/aws" "github.com/stretchr/testify/assert" ) @@ -18,20 +17,20 @@ func TestStringSlice(t *testing.T) { if in == nil { continue } - out := aws.StringSlice(in) + out := StringSlice(in) assert.Len(t, out, len(in), "Unexpected len at idx %d", idx) for i := range out { assert.Equal(t, in[i], *(out[i]), "Unexpected value at idx %d", idx) } - out2 := aws.StringValueSlice(out) + out2 := StringValueSlice(out) assert.Len(t, out2, len(in), "Unexpected len at idx %d", idx) assert.Equal(t, in, out2, "Unexpected value at idx %d", idx) } } var testCasesStringValueSlice = [][]*string{ - {aws.String("a"), aws.String("b"), nil, aws.String("c")}, + {String("a"), String("b"), nil, String("c")}, } func TestStringValueSlice(t *testing.T) { @@ -39,7 +38,7 @@ func TestStringValueSlice(t *testing.T) { if in == nil { continue } - out := aws.StringValueSlice(in) + out := StringValueSlice(in) assert.Len(t, out, len(in), "Unexpected len at idx %d", idx) for i := range out { if in[i] == nil { @@ -49,7 +48,7 @@ func TestStringValueSlice(t *testing.T) { } } - out2 := aws.StringSlice(out) + out2 := StringSlice(out) assert.Len(t, out2, len(in), "Unexpected len at idx %d", idx) for i := range out2 { if in[i] == nil { @@ -70,13 +69,13 @@ func TestStringMap(t *testing.T) { if in == nil { continue } - out := aws.StringMap(in) + out := StringMap(in) assert.Len(t, out, len(in), "Unexpected len at idx %d", idx) for i := range out { assert.Equal(t, in[i], *(out[i]), "Unexpected value at idx %d", idx) } - out2 := aws.StringValueMap(out) + out2 := StringValueMap(out) assert.Len(t, out2, len(in), "Unexpected len at idx %d", idx) assert.Equal(t, in, out2, "Unexpected value at idx %d", idx) } @@ -91,13 +90,13 @@ func TestBoolSlice(t *testing.T) { if in == nil { continue } - out := aws.BoolSlice(in) + out := BoolSlice(in) assert.Len(t, out, len(in), "Unexpected len at idx %d", idx) for i := range out { assert.Equal(t, in[i], *(out[i]), "Unexpected value at idx %d", idx) } - out2 := aws.BoolValueSlice(out) + out2 := BoolValueSlice(out) assert.Len(t, out2, len(in), "Unexpected len at idx %d", idx) assert.Equal(t, in, out2, "Unexpected value at idx %d", idx) } @@ -110,7 +109,7 @@ func TestBoolValueSlice(t *testing.T) { if in == nil { continue } - out := aws.BoolValueSlice(in) + out := BoolValueSlice(in) assert.Len(t, out, len(in), "Unexpected len at idx %d", idx) for i := range out { if in[i] == nil { @@ -120,7 +119,7 @@ func TestBoolValueSlice(t *testing.T) { } } - out2 := aws.BoolSlice(out) + out2 := BoolSlice(out) assert.Len(t, out2, len(in), "Unexpected len at idx %d", idx) for i := range out2 { if in[i] == nil { @@ -141,13 +140,13 @@ func TestBoolMap(t *testing.T) { if in == nil { continue } - out := aws.BoolMap(in) + out := BoolMap(in) assert.Len(t, out, len(in), "Unexpected len at idx %d", idx) for i := range out { assert.Equal(t, in[i], *(out[i]), "Unexpected value at idx %d", idx) } - out2 := aws.BoolValueMap(out) + out2 := BoolValueMap(out) assert.Len(t, out2, len(in), "Unexpected len at idx %d", idx) assert.Equal(t, in, out2, "Unexpected value at idx %d", idx) } @@ -162,13 +161,13 @@ func TestIntSlice(t *testing.T) { if in == nil { continue } - out := aws.IntSlice(in) + out := IntSlice(in) assert.Len(t, out, len(in), "Unexpected len at idx %d", idx) for i := range out { assert.Equal(t, in[i], *(out[i]), "Unexpected value at idx %d", idx) } - out2 := aws.IntValueSlice(out) + out2 := IntValueSlice(out) assert.Len(t, out2, len(in), "Unexpected len at idx %d", idx) assert.Equal(t, in, out2, "Unexpected value at idx %d", idx) } @@ -181,7 +180,7 @@ func TestIntValueSlice(t *testing.T) { if in == nil { continue } - out := aws.IntValueSlice(in) + out := IntValueSlice(in) assert.Len(t, out, len(in), "Unexpected len at idx %d", idx) for i := range out { if in[i] == nil { @@ -191,7 +190,7 @@ func TestIntValueSlice(t *testing.T) { } } - out2 := aws.IntSlice(out) + out2 := IntSlice(out) assert.Len(t, out2, len(in), "Unexpected len at idx %d", idx) for i := range out2 { if in[i] == nil { @@ -212,13 +211,13 @@ func TestIntMap(t *testing.T) { if in == nil { continue } - out := aws.IntMap(in) + out := IntMap(in) assert.Len(t, out, len(in), "Unexpected len at idx %d", idx) for i := range out { assert.Equal(t, in[i], *(out[i]), "Unexpected value at idx %d", idx) } - out2 := aws.IntValueMap(out) + out2 := IntValueMap(out) assert.Len(t, out2, len(in), "Unexpected len at idx %d", idx) assert.Equal(t, in, out2, "Unexpected value at idx %d", idx) } @@ -233,13 +232,13 @@ func TestInt64Slice(t *testing.T) { if in == nil { continue } - out := aws.Int64Slice(in) + out := Int64Slice(in) assert.Len(t, out, len(in), "Unexpected len at idx %d", idx) for i := range out { assert.Equal(t, in[i], *(out[i]), "Unexpected value at idx %d", idx) } - out2 := aws.Int64ValueSlice(out) + out2 := Int64ValueSlice(out) assert.Len(t, out2, len(in), "Unexpected len at idx %d", idx) assert.Equal(t, in, out2, "Unexpected value at idx %d", idx) } @@ -252,7 +251,7 @@ func TestInt64ValueSlice(t *testing.T) { if in == nil { continue } - out := aws.Int64ValueSlice(in) + out := Int64ValueSlice(in) assert.Len(t, out, len(in), "Unexpected len at idx %d", idx) for i := range out { if in[i] == nil { @@ -262,7 +261,7 @@ func TestInt64ValueSlice(t *testing.T) { } } - out2 := aws.Int64Slice(out) + out2 := Int64Slice(out) assert.Len(t, out2, len(in), "Unexpected len at idx %d", idx) for i := range out2 { if in[i] == nil { @@ -283,13 +282,13 @@ func TestInt64Map(t *testing.T) { if in == nil { continue } - out := aws.Int64Map(in) + out := Int64Map(in) assert.Len(t, out, len(in), "Unexpected len at idx %d", idx) for i := range out { assert.Equal(t, in[i], *(out[i]), "Unexpected value at idx %d", idx) } - out2 := aws.Int64ValueMap(out) + out2 := Int64ValueMap(out) assert.Len(t, out2, len(in), "Unexpected len at idx %d", idx) assert.Equal(t, in, out2, "Unexpected value at idx %d", idx) } @@ -304,13 +303,13 @@ func TestFloat64Slice(t *testing.T) { if in == nil { continue } - out := aws.Float64Slice(in) + out := Float64Slice(in) assert.Len(t, out, len(in), "Unexpected len at idx %d", idx) for i := range out { assert.Equal(t, in[i], *(out[i]), "Unexpected value at idx %d", idx) } - out2 := aws.Float64ValueSlice(out) + out2 := Float64ValueSlice(out) assert.Len(t, out2, len(in), "Unexpected len at idx %d", idx) assert.Equal(t, in, out2, "Unexpected value at idx %d", idx) } @@ -323,7 +322,7 @@ func TestFloat64ValueSlice(t *testing.T) { if in == nil { continue } - out := aws.Float64ValueSlice(in) + out := Float64ValueSlice(in) assert.Len(t, out, len(in), "Unexpected len at idx %d", idx) for i := range out { if in[i] == nil { @@ -333,7 +332,7 @@ func TestFloat64ValueSlice(t *testing.T) { } } - out2 := aws.Float64Slice(out) + out2 := Float64Slice(out) assert.Len(t, out2, len(in), "Unexpected len at idx %d", idx) for i := range out2 { if in[i] == nil { @@ -354,13 +353,13 @@ func TestFloat64Map(t *testing.T) { if in == nil { continue } - out := aws.Float64Map(in) + out := Float64Map(in) assert.Len(t, out, len(in), "Unexpected len at idx %d", idx) for i := range out { assert.Equal(t, in[i], *(out[i]), "Unexpected value at idx %d", idx) } - out2 := aws.Float64ValueMap(out) + out2 := Float64ValueMap(out) assert.Len(t, out2, len(in), "Unexpected len at idx %d", idx) assert.Equal(t, in, out2, "Unexpected value at idx %d", idx) } @@ -375,13 +374,13 @@ func TestTimeSlice(t *testing.T) { if in == nil { continue } - out := aws.TimeSlice(in) + out := TimeSlice(in) assert.Len(t, out, len(in), "Unexpected len at idx %d", idx) for i := range out { assert.Equal(t, in[i], *(out[i]), "Unexpected value at idx %d", idx) } - out2 := aws.TimeValueSlice(out) + out2 := TimeValueSlice(out) assert.Len(t, out2, len(in), "Unexpected len at idx %d", idx) assert.Equal(t, in, out2, "Unexpected value at idx %d", idx) } @@ -394,7 +393,7 @@ func TestTimeValueSlice(t *testing.T) { if in == nil { continue } - out := aws.TimeValueSlice(in) + out := TimeValueSlice(in) assert.Len(t, out, len(in), "Unexpected len at idx %d", idx) for i := range out { if in[i] == nil { @@ -404,7 +403,7 @@ func TestTimeValueSlice(t *testing.T) { } } - out2 := aws.TimeSlice(out) + out2 := TimeSlice(out) assert.Len(t, out2, len(in), "Unexpected len at idx %d", idx) for i := range out2 { if in[i] == nil { @@ -425,13 +424,13 @@ func TestTimeMap(t *testing.T) { if in == nil { continue } - out := aws.TimeMap(in) + out := TimeMap(in) assert.Len(t, out, len(in), "Unexpected len at idx %d", idx) for i := range out { assert.Equal(t, in[i], *(out[i]), "Unexpected value at idx %d", idx) } - out2 := aws.TimeValueMap(out) + out2 := TimeValueMap(out) assert.Len(t, out2, len(in), "Unexpected len at idx %d", idx) assert.Equal(t, in, out2, "Unexpected value at idx %d", idx) } diff --git a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/handler_functions.go b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/corehandlers/handlers.go similarity index 64% rename from Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/handler_functions.go rename to Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/corehandlers/handlers.go index 45ae8807359..597feb4fa44 100644 --- a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/handler_functions.go +++ b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/corehandlers/handlers.go @@ -1,4 +1,4 @@ -package aws +package corehandlers import ( "bytes" @@ -9,24 +9,21 @@ import ( "net/url" "regexp" "strconv" - "time" + "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/aws/awserr" + "github.com/aws/aws-sdk-go/aws/request" ) -var sleepDelay = func(delay time.Duration) { - time.Sleep(delay) -} - // Interface for matching types which also have a Len method. type lener interface { Len() int } -// BuildContentLength builds the content length of a request based on the body, +// BuildContentLengthHandler builds the content length of a request based on the body, // or will use the HTTPRequest.Header's "Content-Length" if defined. If unable // to determine request body length and no "Content-Length" was specified it will panic. -func BuildContentLength(r *Request) { +var BuildContentLengthHandler = request.NamedHandler{"core.BuildContentLengthHandler", func(r *request.Request) { if slength := r.HTTPRequest.Header.Get("Content-Length"); slength != "" { length, _ := strconv.ParseInt(slength, 10, 64) r.HTTPRequest.ContentLength = length @@ -40,27 +37,27 @@ func BuildContentLength(r *Request) { case lener: length = int64(body.Len()) case io.Seeker: - r.bodyStart, _ = body.Seek(0, 1) + r.BodyStart, _ = body.Seek(0, 1) end, _ := body.Seek(0, 2) - body.Seek(r.bodyStart, 0) // make sure to seek back to original location - length = end - r.bodyStart + body.Seek(r.BodyStart, 0) // make sure to seek back to original location + length = end - r.BodyStart default: panic("Cannot get length of body, must provide `ContentLength`") } r.HTTPRequest.ContentLength = length r.HTTPRequest.Header.Set("Content-Length", fmt.Sprintf("%d", length)) -} +}} // UserAgentHandler is a request handler for injecting User agent into requests. -func UserAgentHandler(r *Request) { - r.HTTPRequest.Header.Set("User-Agent", SDKName+"/"+SDKVersion) -} +var UserAgentHandler = request.NamedHandler{"core.UserAgentHandler", func(r *request.Request) { + r.HTTPRequest.Header.Set("User-Agent", aws.SDKName+"/"+aws.SDKVersion) +}} -var reStatusCode = regexp.MustCompile(`^(\d+)`) +var reStatusCode = regexp.MustCompile(`^(\d{3})`) // SendHandler is a request handler to send service request using HTTP client. -func SendHandler(r *Request) { +var SendHandler = request.NamedHandler{"core.SendHandler", func(r *request.Request) { var err error r.HTTPResponse, err = r.Service.Config.HTTPClient.Do(r.HTTPRequest) if err != nil { @@ -68,8 +65,8 @@ func SendHandler(r *Request) { // response. e.g. 301 without location header comes back as string // error and r.HTTPResponse is nil. Other url redirect errors will // comeback in a similar method. - if e, ok := err.(*url.Error); ok { - if s := reStatusCode.FindStringSubmatch(e.Error()); s != nil { + if e, ok := err.(*url.Error); ok && e.Err != nil { + if s := reStatusCode.FindStringSubmatch(e.Err.Error()); s != nil { code, _ := strconv.ParseInt(s[1], 10, 64) r.HTTPResponse = &http.Response{ StatusCode: int(code), @@ -79,7 +76,7 @@ func SendHandler(r *Request) { return } } - if r.HTTPRequest == nil { + if r.HTTPResponse == nil { // Add a dummy request response object to ensure the HTTPResponse // value is consistent. r.HTTPResponse = &http.Response{ @@ -90,68 +87,50 @@ func SendHandler(r *Request) { } // Catch all other request errors. r.Error = awserr.New("RequestError", "send request failed", err) - r.Retryable = Bool(true) // network errors are retryable + r.Retryable = aws.Bool(true) // network errors are retryable } -} +}} // ValidateResponseHandler is a request handler to validate service response. -func ValidateResponseHandler(r *Request) { +var ValidateResponseHandler = request.NamedHandler{"core.ValidateResponseHandler", func(r *request.Request) { if r.HTTPResponse.StatusCode == 0 || r.HTTPResponse.StatusCode >= 300 { // this may be replaced by an UnmarshalError handler r.Error = awserr.New("UnknownError", "unknown error", nil) } -} +}} // AfterRetryHandler performs final checks to determine if the request should // be retried and how long to delay. -func AfterRetryHandler(r *Request) { +var AfterRetryHandler = request.NamedHandler{"core.AfterRetryHandler", func(r *request.Request) { // If one of the other handlers already set the retry state // we don't want to override it based on the service's state if r.Retryable == nil { - r.Retryable = Bool(r.Service.ShouldRetry(r)) + r.Retryable = aws.Bool(r.ShouldRetry(r)) } if r.WillRetry() { - r.RetryDelay = r.Service.RetryRules(r) - sleepDelay(r.RetryDelay) + r.RetryDelay = r.RetryRules(r) + r.Service.Config.SleepDelay(r.RetryDelay) // when the expired token exception occurs the credentials // need to be expired locally so that the next request to // get credentials will trigger a credentials refresh. - if r.Error != nil { - if err, ok := r.Error.(awserr.Error); ok { - if isCodeExpiredCreds(err.Code()) { - r.Config.Credentials.Expire() - } - } + if r.IsErrorExpired() { + r.Service.Config.Credentials.Expire() } r.RetryCount++ r.Error = nil } -} - -var ( - // ErrMissingRegion is an error that is returned if region configuration is - // not found. - // - // @readonly - ErrMissingRegion error = awserr.New("MissingRegion", "could not find region configuration", nil) - - // ErrMissingEndpoint is an error that is returned if an endpoint cannot be - // resolved for a service. - // - // @readonly - ErrMissingEndpoint error = awserr.New("MissingEndpoint", "'Endpoint' configuration is required for this service", nil) -) +}} // ValidateEndpointHandler is a request handler to validate a request had the // appropriate Region and Endpoint set. Will set r.Error if the endpoint or // region is not valid. -func ValidateEndpointHandler(r *Request) { - if r.Service.SigningRegion == "" && StringValue(r.Service.Config.Region) == "" { - r.Error = ErrMissingRegion +var ValidateEndpointHandler = request.NamedHandler{"core.ValidateEndpointHandler", func(r *request.Request) { + if r.Service.SigningRegion == "" && aws.StringValue(r.Service.Config.Region) == "" { + r.Error = aws.ErrMissingRegion } else if r.Service.Endpoint == "" { - r.Error = ErrMissingEndpoint + r.Error = aws.ErrMissingEndpoint } -} +}} diff --git a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/corehandlers/handlers_test.go b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/corehandlers/handlers_test.go new file mode 100644 index 00000000000..214adcab088 --- /dev/null +++ b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/corehandlers/handlers_test.go @@ -0,0 +1,107 @@ +package corehandlers_test + +import ( + "fmt" + "net/http" + "os" + "testing" + + "github.com/stretchr/testify/assert" + + "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/aws/awserr" + "github.com/aws/aws-sdk-go/aws/corehandlers" + "github.com/aws/aws-sdk-go/aws/credentials" + "github.com/aws/aws-sdk-go/aws/request" + "github.com/aws/aws-sdk-go/aws/service" +) + +func TestValidateEndpointHandler(t *testing.T) { + os.Clearenv() + svc := service.New(aws.NewConfig().WithRegion("us-west-2")) + svc.Handlers.Clear() + svc.Handlers.Validate.PushBackNamed(corehandlers.ValidateEndpointHandler) + + req := svc.NewRequest(&request.Operation{Name: "Operation"}, nil, nil) + err := req.Build() + + assert.NoError(t, err) +} + +func TestValidateEndpointHandlerErrorRegion(t *testing.T) { + os.Clearenv() + svc := service.New(nil) + svc.Handlers.Clear() + svc.Handlers.Validate.PushBackNamed(corehandlers.ValidateEndpointHandler) + + req := svc.NewRequest(&request.Operation{Name: "Operation"}, nil, nil) + err := req.Build() + + assert.Error(t, err) + assert.Equal(t, aws.ErrMissingRegion, err) +} + +type mockCredsProvider struct { + expired bool + retrieveCalled bool +} + +func (m *mockCredsProvider) Retrieve() (credentials.Value, error) { + m.retrieveCalled = true + return credentials.Value{}, nil +} + +func (m *mockCredsProvider) IsExpired() bool { + return m.expired +} + +func TestAfterRetryRefreshCreds(t *testing.T) { + os.Clearenv() + credProvider := &mockCredsProvider{} + svc := service.New(&aws.Config{Credentials: credentials.NewCredentials(credProvider), MaxRetries: aws.Int(1)}) + + svc.Handlers.Clear() + svc.Handlers.ValidateResponse.PushBack(func(r *request.Request) { + r.Error = awserr.New("UnknownError", "", nil) + r.HTTPResponse = &http.Response{StatusCode: 400} + }) + svc.Handlers.UnmarshalError.PushBack(func(r *request.Request) { + r.Error = awserr.New("ExpiredTokenException", "", nil) + }) + svc.Handlers.AfterRetry.PushBackNamed(corehandlers.AfterRetryHandler) + + assert.True(t, svc.Config.Credentials.IsExpired(), "Expect to start out expired") + assert.False(t, credProvider.retrieveCalled) + + req := svc.NewRequest(&request.Operation{Name: "Operation"}, nil, nil) + req.Send() + + assert.True(t, svc.Config.Credentials.IsExpired()) + assert.False(t, credProvider.retrieveCalled) + + _, err := svc.Config.Credentials.Get() + assert.NoError(t, err) + assert.True(t, credProvider.retrieveCalled) +} + +type testSendHandlerTransport struct{} + +func (t *testSendHandlerTransport) RoundTrip(r *http.Request) (*http.Response, error) { + return nil, fmt.Errorf("mock error") +} + +func TestSendHandlerError(t *testing.T) { + svc := service.New(&aws.Config{ + HTTPClient: &http.Client{ + Transport: &testSendHandlerTransport{}, + }, + }) + svc.Handlers.Clear() + svc.Handlers.Send.PushBackNamed(corehandlers.SendHandler) + r := svc.NewRequest(&request.Operation{Name: "Operation"}, nil, nil) + + r.Send() + + assert.Error(t, r.Error) + assert.NotNil(t, r.HTTPResponse) +} diff --git a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/corehandlers/param_validator.go b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/corehandlers/param_validator.go new file mode 100644 index 00000000000..c70d422dfb0 --- /dev/null +++ b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/corehandlers/param_validator.go @@ -0,0 +1,144 @@ +package corehandlers + +import ( + "fmt" + "reflect" + "strconv" + "strings" + + "github.com/aws/aws-sdk-go/aws/awserr" + "github.com/aws/aws-sdk-go/aws/request" +) + +// ValidateParametersHandler is a request handler to validate the input parameters. +// Validating parameters only has meaning if done prior to the request being sent. +var ValidateParametersHandler = request.NamedHandler{"core.ValidateParametersHandler", func(r *request.Request) { + if r.ParamsFilled() { + v := validator{errors: []string{}} + v.validateAny(reflect.ValueOf(r.Params), "") + + if count := len(v.errors); count > 0 { + format := "%d validation errors:\n- %s" + msg := fmt.Sprintf(format, count, strings.Join(v.errors, "\n- ")) + r.Error = awserr.New("InvalidParameter", msg, nil) + } + } +}} + +// A validator validates values. Collects validations errors which occurs. +type validator struct { + errors []string +} + +// validateAny will validate any struct, slice or map type. All validations +// are also performed recursively for nested types. +func (v *validator) validateAny(value reflect.Value, path string) { + value = reflect.Indirect(value) + if !value.IsValid() { + return + } + + switch value.Kind() { + case reflect.Struct: + v.validateStruct(value, path) + case reflect.Slice: + for i := 0; i < value.Len(); i++ { + v.validateAny(value.Index(i), path+fmt.Sprintf("[%d]", i)) + } + case reflect.Map: + for _, n := range value.MapKeys() { + v.validateAny(value.MapIndex(n), path+fmt.Sprintf("[%q]", n.String())) + } + } +} + +// validateStruct will validate the struct value's fields. If the structure has +// nested types those types will be validated also. +func (v *validator) validateStruct(value reflect.Value, path string) { + prefix := "." + if path == "" { + prefix = "" + } + + for i := 0; i < value.Type().NumField(); i++ { + f := value.Type().Field(i) + if strings.ToLower(f.Name[0:1]) == f.Name[0:1] { + continue + } + fvalue := value.FieldByName(f.Name) + + err := validateField(f, fvalue, validateFieldRequired, validateFieldMin) + if err != nil { + v.errors = append(v.errors, fmt.Sprintf("%s: %s", err.Error(), path+prefix+f.Name)) + continue + } + + v.validateAny(fvalue, path+prefix+f.Name) + } +} + +type validatorFunc func(f reflect.StructField, fvalue reflect.Value) error + +func validateField(f reflect.StructField, fvalue reflect.Value, funcs ...validatorFunc) error { + for _, fn := range funcs { + if err := fn(f, fvalue); err != nil { + return err + } + } + return nil +} + +// Validates that a field has a valid value provided for required fields. +func validateFieldRequired(f reflect.StructField, fvalue reflect.Value) error { + if f.Tag.Get("required") == "" { + return nil + } + + switch fvalue.Kind() { + case reflect.Ptr, reflect.Slice, reflect.Map: + if fvalue.IsNil() { + return fmt.Errorf("missing required parameter") + } + default: + if !fvalue.IsValid() { + return fmt.Errorf("missing required parameter") + } + } + return nil +} + +// Validates that if a value is provided for a field, that value must be at +// least a minimum length. +func validateFieldMin(f reflect.StructField, fvalue reflect.Value) error { + minStr := f.Tag.Get("min") + if minStr == "" { + return nil + } + min, _ := strconv.ParseInt(minStr, 10, 64) + + kind := fvalue.Kind() + if kind == reflect.Ptr { + if fvalue.IsNil() { + return nil + } + fvalue = fvalue.Elem() + } + + switch fvalue.Kind() { + case reflect.String: + if int64(fvalue.Len()) < min { + return fmt.Errorf("field too short, minimum length %d", min) + } + case reflect.Slice, reflect.Map: + if fvalue.IsNil() { + return nil + } + if int64(fvalue.Len()) < min { + return fmt.Errorf("field too short, minimum length %d", min) + } + + // TODO min can also apply to number minimum value. + + } + return nil +} diff --git a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/corehandlers/param_validator_test.go b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/corehandlers/param_validator_test.go new file mode 100644 index 00000000000..db483ba408b --- /dev/null +++ b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/corehandlers/param_validator_test.go @@ -0,0 +1,134 @@ +package corehandlers_test + +import ( + "testing" + + "github.com/stretchr/testify/assert" + + "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/aws/awserr" + "github.com/aws/aws-sdk-go/aws/corehandlers" + "github.com/aws/aws-sdk-go/aws/request" + "github.com/aws/aws-sdk-go/aws/service" + "github.com/aws/aws-sdk-go/aws/service/serviceinfo" + "github.com/stretchr/testify/require" +) + +var testSvc = func() *service.Service { + s := &service.Service{ + ServiceInfo: serviceinfo.ServiceInfo{ + Config: &aws.Config{}, + ServiceName: "mock-service", + APIVersion: "2015-01-01", + }, + } + return s +}() + +type StructShape struct { + RequiredList []*ConditionalStructShape `required:"true"` + RequiredMap map[string]*ConditionalStructShape `required:"true"` + RequiredBool *bool `required:"true"` + OptionalStruct *ConditionalStructShape + + hiddenParameter *string + + metadataStructureShape +} + +type metadataStructureShape struct { + SDKShapeTraits bool +} + +type ConditionalStructShape struct { + Name *string `required:"true"` + SDKShapeTraits bool +} + +func TestNoErrors(t *testing.T) { + input := &StructShape{ + RequiredList: []*ConditionalStructShape{}, + RequiredMap: map[string]*ConditionalStructShape{ + "key1": {Name: aws.String("Name")}, + "key2": {Name: aws.String("Name")}, + }, + RequiredBool: aws.Bool(true), + OptionalStruct: &ConditionalStructShape{Name: aws.String("Name")}, + } + + req := testSvc.NewRequest(&request.Operation{}, input, nil) + corehandlers.ValidateParametersHandler.Fn(req) + require.NoError(t, req.Error) +} + +func TestMissingRequiredParameters(t *testing.T) { + input := &StructShape{} + req := testSvc.NewRequest(&request.Operation{}, input, nil) + corehandlers.ValidateParametersHandler.Fn(req) + + require.Error(t, req.Error) + assert.Equal(t, "InvalidParameter", req.Error.(awserr.Error).Code()) + assert.Equal(t, "3 validation errors:\n- missing required parameter: RequiredList\n- missing required parameter: RequiredMap\n- missing required parameter: RequiredBool", req.Error.(awserr.Error).Message()) +} + +func TestNestedMissingRequiredParameters(t *testing.T) { + input := &StructShape{ + RequiredList: []*ConditionalStructShape{{}}, + RequiredMap: map[string]*ConditionalStructShape{ + "key1": {Name: aws.String("Name")}, + "key2": {}, + }, + RequiredBool: aws.Bool(true), + OptionalStruct: &ConditionalStructShape{}, + } + + req := testSvc.NewRequest(&request.Operation{}, input, nil) + corehandlers.ValidateParametersHandler.Fn(req) + + require.Error(t, req.Error) + assert.Equal(t, "InvalidParameter", req.Error.(awserr.Error).Code()) + assert.Equal(t, "3 validation errors:\n- missing required parameter: RequiredList[0].Name\n- missing required parameter: RequiredMap[\"key2\"].Name\n- missing required parameter: OptionalStruct.Name", req.Error.(awserr.Error).Message()) +} + +type testInput struct { + StringField string `min:"5"` + PtrStrField *string `min:"2"` + ListField []string `min:"3"` + MapField map[string]string `min:"4"` +} + +var testsFieldMin = []struct { + err awserr.Error + in testInput +}{ + { + err: awserr.New("InvalidParameter", "1 validation errors:\n- field too short, minimum length 5: StringField", nil), + in: testInput{StringField: "abcd"}, + }, + { + err: awserr.New("InvalidParameter", "2 validation errors:\n- field too short, minimum length 5: StringField\n- field too short, minimum length 3: ListField", nil), + in: testInput{StringField: "abcd", ListField: []string{"a", "b"}}, + }, + { + err: awserr.New("InvalidParameter", "3 validation errors:\n- field too short, minimum length 5: StringField\n- field too short, minimum length 3: ListField\n- field too short, minimum length 4: MapField", nil), + in: testInput{StringField: "abcd", ListField: []string{"a", "b"}, MapField: map[string]string{"a": "a", "b": "b"}}, + }, + { + err: awserr.New("InvalidParameter", "1 validation errors:\n- field too short, minimum length 2: PtrStrField", nil), + in: testInput{StringField: "abcde", PtrStrField: aws.String("v")}, + }, + { + err: nil, + in: testInput{StringField: "abcde", PtrStrField: aws.String("value"), + ListField: []string{"a", "b", "c"}, MapField: map[string]string{"a": "a", "b": "b", "c": "c", "d": "d"}}, + }, +} + +func TestValidateFieldMinParameter(t *testing.T) { + for i, c := range testsFieldMin { + req := testSvc.NewRequest(&request.Operation{}, &c.in, nil) + corehandlers.ValidateParametersHandler.Fn(req) + + require.Equal(t, c.err, req.Error, "%d case failed", i) + } +} diff --git a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/credentials/credentials.go b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/credentials/credentials.go index 2834a088aab..5dd71f02e80 100644 --- a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/credentials/credentials.go +++ b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/credentials/credentials.go @@ -53,8 +53,8 @@ import ( "time" ) -// Create an empty Credential object that can be used as dummy placeholder -// credentials for requests that do not need signed. +// AnonymousCredentials is an empty Credential object that can be used as +// dummy placeholder credentials for requests that do not need signed. // // This Credentials can be used to configure a service to not sign requests // when making service API calls. For example, when accessing public diff --git a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/credentials/ec2_role_provider_test.go b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/credentials/ec2_role_provider_test.go deleted file mode 100644 index da1549a4f2e..00000000000 --- a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/credentials/ec2_role_provider_test.go +++ /dev/null @@ -1,108 +0,0 @@ -package credentials - -import ( - "fmt" - "github.com/stretchr/testify/assert" - "net/http" - "net/http/httptest" - "testing" - "time" -) - -func initTestServer(expireOn string) *httptest.Server { - server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - if r.RequestURI == "/" { - fmt.Fprintln(w, "/creds") - } else { - fmt.Fprintf(w, `{ - "AccessKeyId" : "accessKey", - "SecretAccessKey" : "secret", - "Token" : "token", - "Expiration" : "%s" -}`, expireOn) - } - })) - - return server -} - -func TestEC2RoleProvider(t *testing.T) { - server := initTestServer("2014-12-16T01:51:37Z") - defer server.Close() - - p := &EC2RoleProvider{Client: http.DefaultClient, Endpoint: server.URL} - - creds, err := p.Retrieve() - assert.Nil(t, err, "Expect no error") - - assert.Equal(t, "accessKey", creds.AccessKeyID, "Expect access key ID to match") - assert.Equal(t, "secret", creds.SecretAccessKey, "Expect secret access key to match") - assert.Equal(t, "token", creds.SessionToken, "Expect session token to match") -} - -func TestEC2RoleProviderIsExpired(t *testing.T) { - server := initTestServer("2014-12-16T01:51:37Z") - defer server.Close() - - p := &EC2RoleProvider{Client: http.DefaultClient, Endpoint: server.URL} - p.CurrentTime = func() time.Time { - return time.Date(2014, 12, 15, 21, 26, 0, 0, time.UTC) - } - - assert.True(t, p.IsExpired(), "Expect creds to be expired before retrieve.") - - _, err := p.Retrieve() - assert.Nil(t, err, "Expect no error") - - assert.False(t, p.IsExpired(), "Expect creds to not be expired after retrieve.") - - p.CurrentTime = func() time.Time { - return time.Date(3014, 12, 15, 21, 26, 0, 0, time.UTC) - } - - assert.True(t, p.IsExpired(), "Expect creds to be expired.") -} - -func TestEC2RoleProviderExpiryWindowIsExpired(t *testing.T) { - server := initTestServer("2014-12-16T01:51:37Z") - defer server.Close() - - p := &EC2RoleProvider{Client: http.DefaultClient, Endpoint: server.URL, ExpiryWindow: time.Hour * 1} - p.CurrentTime = func() time.Time { - return time.Date(2014, 12, 15, 0, 51, 37, 0, time.UTC) - } - - assert.True(t, p.IsExpired(), "Expect creds to be expired before retrieve.") - - _, err := p.Retrieve() - assert.Nil(t, err, "Expect no error") - - assert.False(t, p.IsExpired(), "Expect creds to not be expired after retrieve.") - - p.CurrentTime = func() time.Time { - return time.Date(2014, 12, 16, 0, 55, 37, 0, time.UTC) - } - - assert.True(t, p.IsExpired(), "Expect creds to be expired.") -} - -func BenchmarkEC2RoleProvider(b *testing.B) { - server := initTestServer("2014-12-16T01:51:37Z") - defer server.Close() - - p := &EC2RoleProvider{Client: http.DefaultClient, Endpoint: server.URL} - _, err := p.Retrieve() - if err != nil { - b.Fatal(err) - } - - b.ResetTimer() - b.RunParallel(func(pb *testing.PB) { - for pb.Next() { - _, err := p.Retrieve() - if err != nil { - b.Fatal(err) - } - } - }) -} diff --git a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/credentials/ec2_role_provider.go b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/credentials/ec2rolecreds/ec2_role_provider.go similarity index 60% rename from Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/credentials/ec2_role_provider.go rename to Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/credentials/ec2rolecreds/ec2_role_provider.go index 0eecbe3b125..946a117206e 100644 --- a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/credentials/ec2_role_provider.go +++ b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/credentials/ec2rolecreds/ec2_role_provider.go @@ -1,24 +1,25 @@ -package credentials +package ec2rolecreds import ( "bufio" "encoding/json" "fmt" - "net/http" + "path" + "strings" "time" "github.com/aws/aws-sdk-go/aws/awserr" + "github.com/aws/aws-sdk-go/aws/credentials" + "github.com/aws/aws-sdk-go/aws/ec2metadata" ) -const metadataCredentialsEndpoint = "http://169.254.169.254/latest/meta-data/iam/security-credentials/" - // A EC2RoleProvider retrieves credentials from the EC2 service, and keeps track if // those credentials are expired. // // Example how to configure the EC2RoleProvider with custom http Client, Endpoint // or ExpiryWindow // -// p := &credentials.EC2RoleProvider{ +// p := &ec2rolecreds.EC2RoleProvider{ // // Pass in a custom timeout to be used when requesting // // IAM EC2 Role credentials. // Client: &http.Client{ @@ -32,13 +33,10 @@ const metadataCredentialsEndpoint = "http://169.254.169.254/latest/meta-data/iam // ExpiryWindow: 0, // } type EC2RoleProvider struct { - Expiry + credentials.Expiry - // Endpoint must be fully quantified URL - Endpoint string - - // HTTP client to use when connecting to EC2 service - Client *http.Client + // EC2Metadata client to use when connecting to EC2 metadata service + Client *ec2metadata.Client // ExpiryWindow will allow the credentials to trigger refreshing prior to // the credentials actually expiring. This is beneficial so race conditions @@ -52,7 +50,7 @@ type EC2RoleProvider struct { ExpiryWindow time.Duration } -// NewEC2RoleCredentials returns a pointer to a new Credentials object +// NewCredentials returns a pointer to a new Credentials object // wrapping the EC2RoleProvider. // // Takes a custom http.Client which can be configured for custom handling of @@ -64,9 +62,8 @@ type EC2RoleProvider struct { // Window is the expiry window that will be subtracted from the expiry returned // by the role credential request. This is done so that the credentials will // expire sooner than their actual lifespan. -func NewEC2RoleCredentials(client *http.Client, endpoint string, window time.Duration) *Credentials { - return NewCredentials(&EC2RoleProvider{ - Endpoint: endpoint, +func NewCredentials(client *ec2metadata.Client, window time.Duration) *credentials.Credentials { + return credentials.NewCredentials(&EC2RoleProvider{ Client: client, ExpiryWindow: window, }) @@ -75,32 +72,29 @@ func NewEC2RoleCredentials(client *http.Client, endpoint string, window time.Dur // Retrieve retrieves credentials from the EC2 service. // Error will be returned if the request fails, or unable to extract // the desired credentials. -func (m *EC2RoleProvider) Retrieve() (Value, error) { +func (m *EC2RoleProvider) Retrieve() (credentials.Value, error) { if m.Client == nil { - m.Client = http.DefaultClient - } - if m.Endpoint == "" { - m.Endpoint = metadataCredentialsEndpoint + m.Client = ec2metadata.New(nil) } - credsList, err := requestCredList(m.Client, m.Endpoint) + credsList, err := requestCredList(m.Client) if err != nil { - return Value{}, err + return credentials.Value{}, err } if len(credsList) == 0 { - return Value{}, awserr.New("EmptyEC2RoleList", "empty EC2 Role list", nil) + return credentials.Value{}, awserr.New("EmptyEC2RoleList", "empty EC2 Role list", nil) } credsName := credsList[0] - roleCreds, err := requestCred(m.Client, m.Endpoint, credsName) + roleCreds, err := requestCred(m.Client, credsName) if err != nil { - return Value{}, err + return credentials.Value{}, err } m.SetExpiration(roleCreds.Expiration, m.ExpiryWindow) - return Value{ + return credentials.Value{ AccessKeyID: roleCreds.AccessKeyID, SecretAccessKey: roleCreds.SecretAccessKey, SessionToken: roleCreds.Token, @@ -110,29 +104,35 @@ func (m *EC2RoleProvider) Retrieve() (Value, error) { // A ec2RoleCredRespBody provides the shape for deserializing credential // request responses. type ec2RoleCredRespBody struct { + // Success State Expiration time.Time AccessKeyID string SecretAccessKey string Token string + + // Error state + Code string + Message string } +const iamSecurityCredsPath = "/iam/security-credentials" + // requestCredList requests a list of credentials from the EC2 service. // If there are no credentials, or there is an error making or receiving the request -func requestCredList(client *http.Client, endpoint string) ([]string, error) { - resp, err := client.Get(endpoint) +func requestCredList(client *ec2metadata.Client) ([]string, error) { + resp, err := client.GetMetadata(iamSecurityCredsPath) if err != nil { - return nil, awserr.New("ListEC2Role", "failed to list EC2 Roles", err) + return nil, awserr.New("EC2RoleRequestError", "failed to list EC2 Roles", err) } - defer resp.Body.Close() credsList := []string{} - s := bufio.NewScanner(resp.Body) + s := bufio.NewScanner(strings.NewReader(resp)) for s.Scan() { credsList = append(credsList, s.Text()) } if err := s.Err(); err != nil { - return nil, awserr.New("ReadEC2Role", "failed to read list of EC2 Roles", err) + return nil, awserr.New("SerializationError", "failed to read list of EC2 Roles", err) } return credsList, nil @@ -142,20 +142,26 @@ func requestCredList(client *http.Client, endpoint string) ([]string, error) { // // If the credentials cannot be found, or there is an error reading the response // and error will be returned. -func requestCred(client *http.Client, endpoint, credsName string) (*ec2RoleCredRespBody, error) { - resp, err := client.Get(endpoint + credsName) +func requestCred(client *ec2metadata.Client, credsName string) (ec2RoleCredRespBody, error) { + resp, err := client.GetMetadata(path.Join(iamSecurityCredsPath, credsName)) if err != nil { - return nil, awserr.New("GetEC2RoleCredentials", - fmt.Sprintf("failed to get %s EC2 Role credentials", credsName), - err) + return ec2RoleCredRespBody{}, + awserr.New("EC2RoleRequestError", + fmt.Sprintf("failed to get %s EC2 Role credentials", credsName), + err) } - defer resp.Body.Close() - respCreds := &ec2RoleCredRespBody{} - if err := json.NewDecoder(resp.Body).Decode(respCreds); err != nil { - return nil, awserr.New("DecodeEC2RoleCredentials", - fmt.Sprintf("failed to decode %s EC2 Role credentials", credsName), - err) + respCreds := ec2RoleCredRespBody{} + if err := json.NewDecoder(strings.NewReader(resp)).Decode(&respCreds); err != nil { + return ec2RoleCredRespBody{}, + awserr.New("SerializationError", + fmt.Sprintf("failed to decode %s EC2 Role credentials", credsName), + err) + } + + if respCreds.Code != "Success" { + // If an error code was returned something failed requesting the role. + return ec2RoleCredRespBody{}, awserr.New(respCreds.Code, respCreds.Message, nil) } return respCreds, nil diff --git a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/credentials/ec2rolecreds/ec2_role_provider_test.go b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/credentials/ec2rolecreds/ec2_role_provider_test.go new file mode 100644 index 00000000000..cd0cbc97e06 --- /dev/null +++ b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/credentials/ec2rolecreds/ec2_role_provider_test.go @@ -0,0 +1,161 @@ +package ec2rolecreds_test + +import ( + "fmt" + "net/http" + "net/http/httptest" + "testing" + "time" + + "github.com/stretchr/testify/assert" + + "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/aws/awserr" + "github.com/aws/aws-sdk-go/aws/credentials/ec2rolecreds" + "github.com/aws/aws-sdk-go/aws/ec2metadata" +) + +const credsRespTmpl = `{ + "Code": "Success", + "Type": "AWS-HMAC", + "AccessKeyId" : "accessKey", + "SecretAccessKey" : "secret", + "Token" : "token", + "Expiration" : "%s", + "LastUpdated" : "2009-11-23T0:00:00Z" +}` + +const credsFailRespTmpl = `{ + "Code": "ErrorCode", + "Message": "ErrorMsg", + "LastUpdated": "2009-11-23T0:00:00Z" +}` + +func initTestServer(expireOn string, failAssume bool) *httptest.Server { + server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + if r.URL.Path == "/latest/meta-data/iam/security-credentials" { + fmt.Fprintln(w, "RoleName") + } else if r.URL.Path == "/latest/meta-data/iam/security-credentials/RoleName" { + if failAssume { + fmt.Fprintf(w, credsFailRespTmpl) + } else { + fmt.Fprintf(w, credsRespTmpl, expireOn) + } + } else { + http.Error(w, "bad request", http.StatusBadRequest) + } + })) + + return server +} + +func TestEC2RoleProvider(t *testing.T) { + server := initTestServer("2014-12-16T01:51:37Z", false) + defer server.Close() + + p := &ec2rolecreds.EC2RoleProvider{ + Client: ec2metadata.New(&ec2metadata.Config{Endpoint: aws.String(server.URL + "/latest")}), + } + + creds, err := p.Retrieve() + assert.Nil(t, err, "Expect no error") + + assert.Equal(t, "accessKey", creds.AccessKeyID, "Expect access key ID to match") + assert.Equal(t, "secret", creds.SecretAccessKey, "Expect secret access key to match") + assert.Equal(t, "token", creds.SessionToken, "Expect session token to match") +} + +func TestEC2RoleProviderFailAssume(t *testing.T) { + server := initTestServer("2014-12-16T01:51:37Z", true) + defer server.Close() + + p := &ec2rolecreds.EC2RoleProvider{ + Client: ec2metadata.New(&ec2metadata.Config{Endpoint: aws.String(server.URL + "/latest")}), + } + + creds, err := p.Retrieve() + assert.Error(t, err, "Expect error") + + e := err.(awserr.Error) + assert.Equal(t, "ErrorCode", e.Code()) + assert.Equal(t, "ErrorMsg", e.Message()) + assert.Nil(t, e.OrigErr()) + + assert.Equal(t, "", creds.AccessKeyID, "Expect access key ID to match") + assert.Equal(t, "", creds.SecretAccessKey, "Expect secret access key to match") + assert.Equal(t, "", creds.SessionToken, "Expect session token to match") +} + +func TestEC2RoleProviderIsExpired(t *testing.T) { + server := initTestServer("2014-12-16T01:51:37Z", false) + defer server.Close() + + p := &ec2rolecreds.EC2RoleProvider{ + Client: ec2metadata.New(&ec2metadata.Config{Endpoint: aws.String(server.URL + "/latest")}), + } + p.CurrentTime = func() time.Time { + return time.Date(2014, 12, 15, 21, 26, 0, 0, time.UTC) + } + + assert.True(t, p.IsExpired(), "Expect creds to be expired before retrieve.") + + _, err := p.Retrieve() + assert.Nil(t, err, "Expect no error") + + assert.False(t, p.IsExpired(), "Expect creds to not be expired after retrieve.") + + p.CurrentTime = func() time.Time { + return time.Date(3014, 12, 15, 21, 26, 0, 0, time.UTC) + } + + assert.True(t, p.IsExpired(), "Expect creds to be expired.") +} + +func TestEC2RoleProviderExpiryWindowIsExpired(t *testing.T) { + server := initTestServer("2014-12-16T01:51:37Z", false) + defer server.Close() + + p := &ec2rolecreds.EC2RoleProvider{ + Client: ec2metadata.New(&ec2metadata.Config{Endpoint: aws.String(server.URL + "/latest")}), + ExpiryWindow: time.Hour * 1, + } + p.CurrentTime = func() time.Time { + return time.Date(2014, 12, 15, 0, 51, 37, 0, time.UTC) + } + + assert.True(t, p.IsExpired(), "Expect creds to be expired before retrieve.") + + _, err := p.Retrieve() + assert.Nil(t, err, "Expect no error") + + assert.False(t, p.IsExpired(), "Expect creds to not be expired after retrieve.") + + p.CurrentTime = func() time.Time { + return time.Date(2014, 12, 16, 0, 55, 37, 0, time.UTC) + } + + assert.True(t, p.IsExpired(), "Expect creds to be expired.") +} + +func BenchmarkEC2RoleProvider(b *testing.B) { + server := initTestServer("2014-12-16T01:51:37Z", false) + defer server.Close() + + p := &ec2rolecreds.EC2RoleProvider{ + Client: ec2metadata.New(&ec2metadata.Config{Endpoint: aws.String(server.URL + "/latest")}), + } + _, err := p.Retrieve() + if err != nil { + b.Fatal(err) + } + + b.ResetTimer() + b.RunParallel(func(pb *testing.PB) { + for pb.Next() { + _, err := p.Retrieve() + if err != nil { + b.Fatal(err) + } + } + }) +} diff --git a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/credentials/shared_credentials_provider.go b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/credentials/shared_credentials_provider.go index b457e63a338..fac6d78c41e 100644 --- a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/credentials/shared_credentials_provider.go +++ b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/credentials/shared_credentials_provider.go @@ -22,8 +22,12 @@ var ( // // Profile ini file example: $HOME/.aws/credentials type SharedCredentialsProvider struct { - // Path to the shared credentials file. If empty will default to current user's - // home directory. + // Path to the shared credentials file. + // + // If empty will look for "AWS_SHARED_CREDENTIALS_FILE" env variable. If the + // env value is empty will default to current user's home directory. + // Linux/OSX: "$HOME/.aws/credentials" + // Windows: "%USERPROFILE%\.aws\credentials" Filename string // AWS Profile to extract credentials from the shared credentials file. If empty @@ -106,6 +110,10 @@ func loadProfile(filename, profile string) (Value, error) { // Will return an error if the user's home directory path cannot be found. func (p *SharedCredentialsProvider) filename() (string, error) { if p.Filename == "" { + if p.Filename = os.Getenv("AWS_SHARED_CREDENTIALS_FILE"); p.Filename != "" { + return p.Filename, nil + } + homeDir := os.Getenv("HOME") // *nix if homeDir == "" { // Windows homeDir = os.Getenv("USERPROFILE") diff --git a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/credentials/shared_credentials_provider_test.go b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/credentials/shared_credentials_provider_test.go index 3621d56eddc..1d9983f2ce1 100644 --- a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/credentials/shared_credentials_provider_test.go +++ b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/credentials/shared_credentials_provider_test.go @@ -31,6 +31,19 @@ func TestSharedCredentialsProviderIsExpired(t *testing.T) { assert.False(t, p.IsExpired(), "Expect creds to not be expired after retrieve") } +func TestSharedCredentialsProviderWithAWS_SHARED_CREDENTIALS_FILE(t *testing.T) { + os.Clearenv() + os.Setenv("AWS_SHARED_CREDENTIALS_FILE", "example.ini") + p := SharedCredentialsProvider{} + creds, err := p.Retrieve() + + assert.Nil(t, err, "Expect no error") + + assert.Equal(t, "accessKey", creds.AccessKeyID, "Expect access key ID to match") + assert.Equal(t, "secret", creds.SecretAccessKey, "Expect secret access key to match") + assert.Equal(t, "token", creds.SessionToken, "Expect session token to match") +} + func TestSharedCredentialsProviderWithAWS_PROFILE(t *testing.T) { os.Clearenv() os.Setenv("AWS_PROFILE", "no_token") @@ -66,12 +79,10 @@ func BenchmarkSharedCredentialsProvider(b *testing.B) { } b.ResetTimer() - b.RunParallel(func(pb *testing.PB) { - for pb.Next() { - _, err := p.Retrieve() - if err != nil { - b.Fatal(err) - } + for i := 0; i < b.N; i++ { + _, err := p.Retrieve() + if err != nil { + b.Fatal(err) } - }) + } } diff --git a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/credentials/stscreds/assume_role_provider.go b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/credentials/stscreds/assume_role_provider.go index 80890b9d0dd..7a4459f8046 100644 --- a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/credentials/stscreds/assume_role_provider.go +++ b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/credentials/stscreds/assume_role_provider.go @@ -6,10 +6,11 @@ package stscreds import ( "fmt" + "time" + "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/aws/credentials" "github.com/aws/aws-sdk-go/service/sts" - "time" ) // AssumeRoler represents the minimal subset of the STS client API used by this provider. @@ -53,6 +54,9 @@ type AssumeRoleProvider struct { // Expiry duration of the STS credentials. Defaults to 15 minutes if not set. Duration time.Duration + // Optional ExternalID to pass along, defaults to nil if not set. + ExternalID *string + // ExpiryWindow will allow the credentials to trigger refreshing prior to // the credentials actually expiring. This is beneficial so race conditions // with expiring credentials do not cause request to fail unexpectedly @@ -101,8 +105,9 @@ func (p *AssumeRoleProvider) Retrieve() (credentials.Value, error) { roleOutput, err := p.Client.AssumeRole(&sts.AssumeRoleInput{ DurationSeconds: aws.Int64(int64(p.Duration / time.Second)), - RoleARN: aws.String(p.RoleARN), + RoleArn: aws.String(p.RoleARN), RoleSessionName: aws.String(p.RoleSessionName), + ExternalId: p.ExternalID, }) if err != nil { @@ -113,7 +118,7 @@ func (p *AssumeRoleProvider) Retrieve() (credentials.Value, error) { p.SetExpiration(*roleOutput.Credentials.Expiration, p.ExpiryWindow) return credentials.Value{ - AccessKeyID: *roleOutput.Credentials.AccessKeyID, + AccessKeyID: *roleOutput.Credentials.AccessKeyId, SecretAccessKey: *roleOutput.Credentials.SecretAccessKey, SessionToken: *roleOutput.Credentials.SessionToken, }, nil diff --git a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/credentials/stscreds/assume_role_provider_test.go b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/credentials/stscreds/assume_role_provider_test.go index 98b7690026b..f5b97c0053b 100644 --- a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/credentials/stscreds/assume_role_provider_test.go +++ b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/credentials/stscreds/assume_role_provider_test.go @@ -1,11 +1,12 @@ package stscreds import ( + "testing" + "time" + "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/service/sts" "github.com/stretchr/testify/assert" - "testing" - "time" ) type stubSTS struct { @@ -16,7 +17,7 @@ func (s *stubSTS) AssumeRole(input *sts.AssumeRoleInput) (*sts.AssumeRoleOutput, return &sts.AssumeRoleOutput{ Credentials: &sts.Credentials{ // Just reflect the role arn to the provider. - AccessKeyID: input.RoleARN, + AccessKeyId: input.RoleArn, SecretAccessKey: aws.String("assumedSecretAccessKey"), SessionToken: aws.String("assumedSessionToken"), Expiration: &expiry, diff --git a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/defaults/defaults.go b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/defaults/defaults.go new file mode 100644 index 00000000000..2f161b57f1d --- /dev/null +++ b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/defaults/defaults.go @@ -0,0 +1,39 @@ +package defaults + +import ( + "net/http" + "os" + "time" + + "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/aws/credentials" + "github.com/aws/aws-sdk-go/aws/credentials/ec2rolecreds" +) + +// DefaultChainCredentials is a Credentials which will find the first available +// credentials Value from the list of Providers. +// +// This should be used in the default case. Once the type of credentials are +// known switching to the specific Credentials will be more efficient. +var DefaultChainCredentials = credentials.NewChainCredentials( + []credentials.Provider{ + &credentials.EnvProvider{}, + &credentials.SharedCredentialsProvider{Filename: "", Profile: ""}, + &ec2rolecreds.EC2RoleProvider{ExpiryWindow: 5 * time.Minute}, + }) + +// DefaultConfig is the default all service configuration will be based off of. +// By default, all clients use this structure for initialization options unless +// a custom configuration object is passed in. +// +// You may modify this global structure to change all default configuration +// in the SDK. Note that configuration options are copied by value, so any +// modifications must happen before constructing a client. +var DefaultConfig = aws.NewConfig(). + WithCredentials(DefaultChainCredentials). + WithRegion(os.Getenv("AWS_REGION")). + WithHTTPClient(http.DefaultClient). + WithMaxRetries(aws.DefaultRetries). + WithLogger(aws.NewDefaultLogger()). + WithLogLevel(aws.LogOff). + WithSleepDelay(time.Sleep) diff --git a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/ec2metadata/api.go b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/ec2metadata/api.go new file mode 100644 index 00000000000..9d784b6e6ab --- /dev/null +++ b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/ec2metadata/api.go @@ -0,0 +1,43 @@ +package ec2metadata + +import ( + "path" + + "github.com/aws/aws-sdk-go/aws/request" +) + +// GetMetadata uses the path provided to request +func (c *Client) GetMetadata(p string) (string, error) { + op := &request.Operation{ + Name: "GetMetadata", + HTTPMethod: "GET", + HTTPPath: path.Join("/", "meta-data", p), + } + + output := &metadataOutput{} + req := request.New(c.Service.ServiceInfo, c.Service.Handlers, c.Service.Retryer, op, nil, output) + + return output.Content, req.Send() +} + +// Region returns the region the instance is running in. +func (c *Client) Region() (string, error) { + resp, err := c.GetMetadata("placement/availability-zone") + if err != nil { + return "", err + } + + // returns region without the suffix. Eg: us-west-2a becomes us-west-2 + return resp[:len(resp)-1], nil +} + +// Available returns if the application has access to the EC2 Metadata service. +// Can be used to determine if application is running within an EC2 Instance and +// the metadata service is available. +func (c *Client) Available() bool { + if _, err := c.GetMetadata("instance-id"); err != nil { + return false + } + + return true +} diff --git a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/ec2metadata/api_test.go b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/ec2metadata/api_test.go new file mode 100644 index 00000000000..61ab62a5305 --- /dev/null +++ b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/ec2metadata/api_test.go @@ -0,0 +1,100 @@ +package ec2metadata_test + +import ( + "bytes" + "io/ioutil" + "net/http" + "net/http/httptest" + "path" + "testing" + + "github.com/stretchr/testify/assert" + + "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/aws/awserr" + "github.com/aws/aws-sdk-go/aws/ec2metadata" + "github.com/aws/aws-sdk-go/aws/request" +) + +func initTestServer(path string, resp string) *httptest.Server { + return httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + if r.RequestURI != path { + http.Error(w, "not found", http.StatusNotFound) + return + } + + w.Write([]byte(resp)) + })) +} + +func TestEndpoint(t *testing.T) { + c := ec2metadata.New(&ec2metadata.Config{}) + op := &request.Operation{ + Name: "GetMetadata", + HTTPMethod: "GET", + HTTPPath: path.Join("/", "meta-data", "testpath"), + } + + req := c.Service.NewRequest(op, nil, nil) + assert.Equal(t, "http://169.254.169.254/latest", req.Service.Endpoint) + assert.Equal(t, "http://169.254.169.254/latest/meta-data/testpath", req.HTTPRequest.URL.String()) +} + +func TestGetMetadata(t *testing.T) { + server := initTestServer( + "/latest/meta-data/some/path", + "success", // real response includes suffix + ) + defer server.Close() + c := ec2metadata.New(&ec2metadata.Config{Endpoint: aws.String(server.URL + "/latest")}) + + resp, err := c.GetMetadata("some/path") + + assert.NoError(t, err) + assert.Equal(t, "success", resp) +} + +func TestGetRegion(t *testing.T) { + server := initTestServer( + "/latest/meta-data/placement/availability-zone", + "us-west-2a", // real response includes suffix + ) + defer server.Close() + c := ec2metadata.New(&ec2metadata.Config{Endpoint: aws.String(server.URL + "/latest")}) + + region, err := c.Region() + + assert.NoError(t, err) + assert.Equal(t, "us-west-2", region) +} + +func TestMetadataAvailable(t *testing.T) { + server := initTestServer( + "/latest/meta-data/instance-id", + "instance-id", + ) + defer server.Close() + c := ec2metadata.New(&ec2metadata.Config{Endpoint: aws.String(server.URL + "/latest")}) + + available := c.Available() + + assert.True(t, available) +} + +func TestMetadataNotAvailable(t *testing.T) { + c := ec2metadata.New(nil) + c.Handlers.Send.Clear() + c.Handlers.Send.PushBack(func(r *request.Request) { + r.HTTPResponse = &http.Response{ + StatusCode: int(0), + Status: http.StatusText(int(0)), + Body: ioutil.NopCloser(bytes.NewReader([]byte{})), + } + r.Error = awserr.New("RequestError", "send request failed", nil) + r.Retryable = aws.Bool(true) // network errors are retryable + }) + + available := c.Available() + + assert.False(t, available) +} diff --git a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/ec2metadata/service.go b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/ec2metadata/service.go new file mode 100644 index 00000000000..73a12c9129a --- /dev/null +++ b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/ec2metadata/service.go @@ -0,0 +1,149 @@ +package ec2metadata + +import ( + "io/ioutil" + "net" + "net/http" + "time" + + "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/aws/awserr" + "github.com/aws/aws-sdk-go/aws/credentials" + "github.com/aws/aws-sdk-go/aws/request" + "github.com/aws/aws-sdk-go/aws/service" + "github.com/aws/aws-sdk-go/aws/service/serviceinfo" +) + +// DefaultRetries states the default number of times the service client will +// attempt to retry a failed request before failing. +const DefaultRetries = 3 + +// A Config provides the configuration for the EC2 Metadata service. +type Config struct { + // An optional endpoint URL (hostname only or fully qualified URI) + // that overrides the default service endpoint for a client. Set this + // to nil, or `""` to use the default service endpoint. + Endpoint *string + + // The HTTP client to use when sending requests. Defaults to + // `http.DefaultClient`. + HTTPClient *http.Client + + // An integer value representing the logging level. The default log level + // is zero (LogOff), which represents no logging. To enable logging set + // to a LogLevel Value. + Logger aws.Logger + + // The logger writer interface to write logging messages to. Defaults to + // standard out. + LogLevel *aws.LogLevelType + + // The maximum number of times that a request will be retried for failures. + // Defaults to DefaultRetries for the number of retries to be performed + // per request. + MaxRetries *int +} + +// A Client is an EC2 Metadata service Client. +type Client struct { + *service.Service +} + +// New creates a new instance of the EC2 Metadata service client. +// +// In the general use case the configuration for this service client should not +// be needed and `nil` can be provided. Configuration is only needed if the +// `ec2metadata.Config` defaults need to be overridden. Eg. Setting LogLevel. +// +// @note This configuration will NOT be merged with the default AWS service +// client configuration `defaults.DefaultConfig`. Due to circular dependencies +// with the defaults package and credentials EC2 Role Provider. +func New(config *Config) *Client { + service := &service.Service{ + ServiceInfo: serviceinfo.ServiceInfo{ + Config: copyConfig(config), + ServiceName: "Client", + Endpoint: "http://169.254.169.254/latest", + APIVersion: "latest", + }, + } + service.Initialize() + service.Handlers.Unmarshal.PushBack(unmarshalHandler) + service.Handlers.UnmarshalError.PushBack(unmarshalError) + service.Handlers.Validate.Clear() + service.Handlers.Validate.PushBack(validateEndpointHandler) + + return &Client{service} +} + +func copyConfig(config *Config) *aws.Config { + if config == nil { + config = &Config{} + } + c := &aws.Config{ + Credentials: credentials.AnonymousCredentials, + Endpoint: config.Endpoint, + HTTPClient: config.HTTPClient, + Logger: config.Logger, + LogLevel: config.LogLevel, + MaxRetries: config.MaxRetries, + } + + if c.HTTPClient == nil { + c.HTTPClient = &http.Client{ + Transport: &http.Transport{ + Proxy: http.ProxyFromEnvironment, + Dial: (&net.Dialer{ + // use a shorter timeout than default because the metadata + // service is local if it is running, and to fail faster + // if not running on an ec2 instance. + Timeout: 5 * time.Second, + KeepAlive: 30 * time.Second, + }).Dial, + TLSHandshakeTimeout: 10 * time.Second, + }, + } + } + if c.Logger == nil { + c.Logger = aws.NewDefaultLogger() + } + if c.LogLevel == nil { + c.LogLevel = aws.LogLevel(aws.LogOff) + } + if c.MaxRetries == nil { + c.MaxRetries = aws.Int(DefaultRetries) + } + + return c +} + +type metadataOutput struct { + Content string +} + +func unmarshalHandler(r *request.Request) { + defer r.HTTPResponse.Body.Close() + b, err := ioutil.ReadAll(r.HTTPResponse.Body) + if err != nil { + r.Error = awserr.New("SerializationError", "unable to unmarshal EC2 metadata respose", err) + } + + data := r.Data.(*metadataOutput) + data.Content = string(b) +} + +func unmarshalError(r *request.Request) { + defer r.HTTPResponse.Body.Close() + _, err := ioutil.ReadAll(r.HTTPResponse.Body) + if err != nil { + r.Error = awserr.New("SerializationError", "unable to unmarshal EC2 metadata error respose", err) + } + + // TODO extract the error... +} + +func validateEndpointHandler(r *request.Request) { + if r.Service.Endpoint == "" { + r.Error = aws.ErrMissingEndpoint + } +} diff --git a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/errors.go b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/errors.go new file mode 100644 index 00000000000..db2f481b01b --- /dev/null +++ b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/errors.go @@ -0,0 +1,17 @@ +package aws + +import "github.com/aws/aws-sdk-go/aws/awserr" + +var ( + // ErrMissingRegion is an error that is returned if region configuration is + // not found. + // + // @readonly + ErrMissingRegion error = awserr.New("MissingRegion", "could not find region configuration", nil) + + // ErrMissingEndpoint is an error that is returned if an endpoint cannot be + // resolved for a service. + // + // @readonly + ErrMissingEndpoint error = awserr.New("MissingEndpoint", "'Endpoint' configuration is required for this service", nil) +) diff --git a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/handler_functions_test.go b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/handler_functions_test.go deleted file mode 100644 index bc6a8f29c1e..00000000000 --- a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/handler_functions_test.go +++ /dev/null @@ -1,81 +0,0 @@ -package aws - -import ( - "net/http" - "os" - "testing" - - "github.com/aws/aws-sdk-go/aws/awserr" - "github.com/aws/aws-sdk-go/aws/credentials" - "github.com/stretchr/testify/assert" -) - -func TestValidateEndpointHandler(t *testing.T) { - os.Clearenv() - svc := NewService(NewConfig().WithRegion("us-west-2")) - svc.Handlers.Clear() - svc.Handlers.Validate.PushBack(ValidateEndpointHandler) - - req := NewRequest(svc, &Operation{Name: "Operation"}, nil, nil) - err := req.Build() - - assert.NoError(t, err) -} - -func TestValidateEndpointHandlerErrorRegion(t *testing.T) { - os.Clearenv() - svc := NewService(nil) - svc.Handlers.Clear() - svc.Handlers.Validate.PushBack(ValidateEndpointHandler) - - req := NewRequest(svc, &Operation{Name: "Operation"}, nil, nil) - err := req.Build() - - assert.Error(t, err) - assert.Equal(t, ErrMissingRegion, err) -} - -type mockCredsProvider struct { - expired bool - retrieveCalled bool -} - -func (m *mockCredsProvider) Retrieve() (credentials.Value, error) { - m.retrieveCalled = true - return credentials.Value{}, nil -} - -func (m *mockCredsProvider) IsExpired() bool { - return m.expired -} - -func TestAfterRetryRefreshCreds(t *testing.T) { - os.Clearenv() - credProvider := &mockCredsProvider{} - svc := NewService(&Config{Credentials: credentials.NewCredentials(credProvider), MaxRetries: Int(1)}) - - svc.Handlers.Clear() - svc.Handlers.ValidateResponse.PushBack(func(r *Request) { - r.Error = awserr.New("UnknownError", "", nil) - r.HTTPResponse = &http.Response{StatusCode: 400} - }) - svc.Handlers.UnmarshalError.PushBack(func(r *Request) { - r.Error = awserr.New("ExpiredTokenException", "", nil) - }) - svc.Handlers.AfterRetry.PushBack(func(r *Request) { - AfterRetryHandler(r) - }) - - assert.True(t, svc.Config.Credentials.IsExpired(), "Expect to start out expired") - assert.False(t, credProvider.retrieveCalled) - - req := NewRequest(svc, &Operation{Name: "Operation"}, nil, nil) - req.Send() - - assert.True(t, svc.Config.Credentials.IsExpired()) - assert.False(t, credProvider.retrieveCalled) - - _, err := svc.Config.Credentials.Get() - assert.NoError(t, err) - assert.True(t, credProvider.retrieveCalled) -} diff --git a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/handlers_test.go b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/handlers_test.go deleted file mode 100644 index 944e1d3edcf..00000000000 --- a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/handlers_test.go +++ /dev/null @@ -1,31 +0,0 @@ -package aws - -import ( - "testing" - - "github.com/stretchr/testify/assert" -) - -func TestHandlerList(t *testing.T) { - s := "" - r := &Request{} - l := HandlerList{} - l.PushBack(func(r *Request) { - s += "a" - r.Data = s - }) - l.Run(r) - assert.Equal(t, "a", s) - assert.Equal(t, "a", r.Data) -} - -func TestMultipleHandlers(t *testing.T) { - r := &Request{} - l := HandlerList{} - l.PushBack(func(r *Request) { r.Data = nil }) - l.PushFront(func(r *Request) { r.Data = Bool(true) }) - l.Run(r) - if r.Data != nil { - t.Error("Expected handler to execute") - } -} diff --git a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/logger.go b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/logger.go index 935661c0b70..f5369487384 100644 --- a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/logger.go +++ b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/logger.go @@ -62,6 +62,15 @@ const ( // see the body content of requests and responses made while using the SDK // Will also enable LogDebug. LogDebugWithHTTPBody + + // LogDebugWithRequestRetries states the SDK should log when service requests will + // be retried. This should be used to log when you want to log when service + // requests are being retried. Will also enable LogDebug. + LogDebugWithRequestRetries + + // LogDebugWithRequestErrors states the SDK should log when service requests fail + // to build, send, validate, or unmarshal. + LogDebugWithRequestErrors ) // A Logger is a minimalistic interface for the SDK to log messages to. Should diff --git a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/param_validator.go b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/param_validator.go deleted file mode 100644 index b4e95cebd57..00000000000 --- a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/param_validator.go +++ /dev/null @@ -1,89 +0,0 @@ -package aws - -import ( - "fmt" - "reflect" - "strings" - - "github.com/aws/aws-sdk-go/aws/awserr" -) - -// ValidateParameters is a request handler to validate the input parameters. -// Validating parameters only has meaning if done prior to the request being sent. -func ValidateParameters(r *Request) { - if r.ParamsFilled() { - v := validator{errors: []string{}} - v.validateAny(reflect.ValueOf(r.Params), "") - - if count := len(v.errors); count > 0 { - format := "%d validation errors:\n- %s" - msg := fmt.Sprintf(format, count, strings.Join(v.errors, "\n- ")) - r.Error = awserr.New("InvalidParameter", msg, nil) - } - } -} - -// A validator validates values. Collects validations errors which occurs. -type validator struct { - errors []string -} - -// validateAny will validate any struct, slice or map type. All validations -// are also performed recursively for nested types. -func (v *validator) validateAny(value reflect.Value, path string) { - value = reflect.Indirect(value) - if !value.IsValid() { - return - } - - switch value.Kind() { - case reflect.Struct: - v.validateStruct(value, path) - case reflect.Slice: - for i := 0; i < value.Len(); i++ { - v.validateAny(value.Index(i), path+fmt.Sprintf("[%d]", i)) - } - case reflect.Map: - for _, n := range value.MapKeys() { - v.validateAny(value.MapIndex(n), path+fmt.Sprintf("[%q]", n.String())) - } - } -} - -// validateStruct will validate the struct value's fields. If the structure has -// nested types those types will be validated also. -func (v *validator) validateStruct(value reflect.Value, path string) { - prefix := "." - if path == "" { - prefix = "" - } - - for i := 0; i < value.Type().NumField(); i++ { - f := value.Type().Field(i) - if strings.ToLower(f.Name[0:1]) == f.Name[0:1] { - continue - } - fvalue := value.FieldByName(f.Name) - - notset := false - if f.Tag.Get("required") != "" { - switch fvalue.Kind() { - case reflect.Ptr, reflect.Slice, reflect.Map: - if fvalue.IsNil() { - notset = true - } - default: - if !fvalue.IsValid() { - notset = true - } - } - } - - if notset { - msg := "missing required parameter: " + path + prefix + f.Name - v.errors = append(v.errors, msg) - } else { - v.validateAny(fvalue, path+prefix+f.Name) - } - } -} diff --git a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/param_validator_test.go b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/param_validator_test.go deleted file mode 100644 index e09acf8af34..00000000000 --- a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/param_validator_test.go +++ /dev/null @@ -1,84 +0,0 @@ -package aws_test - -import ( - "testing" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/awserr" - "github.com/stretchr/testify/assert" -) - -var service = func() *aws.Service { - s := &aws.Service{ - Config: &aws.Config{}, - ServiceName: "mock-service", - APIVersion: "2015-01-01", - } - return s -}() - -type StructShape struct { - RequiredList []*ConditionalStructShape `required:"true"` - RequiredMap map[string]*ConditionalStructShape `required:"true"` - RequiredBool *bool `required:"true"` - OptionalStruct *ConditionalStructShape - - hiddenParameter *string - - metadataStructureShape -} - -type metadataStructureShape struct { - SDKShapeTraits bool -} - -type ConditionalStructShape struct { - Name *string `required:"true"` - SDKShapeTraits bool -} - -func TestNoErrors(t *testing.T) { - input := &StructShape{ - RequiredList: []*ConditionalStructShape{}, - RequiredMap: map[string]*ConditionalStructShape{ - "key1": {Name: aws.String("Name")}, - "key2": {Name: aws.String("Name")}, - }, - RequiredBool: aws.Bool(true), - OptionalStruct: &ConditionalStructShape{Name: aws.String("Name")}, - } - - req := aws.NewRequest(service, &aws.Operation{}, input, nil) - aws.ValidateParameters(req) - assert.NoError(t, req.Error) -} - -func TestMissingRequiredParameters(t *testing.T) { - input := &StructShape{} - req := aws.NewRequest(service, &aws.Operation{}, input, nil) - aws.ValidateParameters(req) - - assert.Error(t, req.Error) - assert.Equal(t, "InvalidParameter", req.Error.(awserr.Error).Code()) - assert.Equal(t, "3 validation errors:\n- missing required parameter: RequiredList\n- missing required parameter: RequiredMap\n- missing required parameter: RequiredBool", req.Error.(awserr.Error).Message()) -} - -func TestNestedMissingRequiredParameters(t *testing.T) { - input := &StructShape{ - RequiredList: []*ConditionalStructShape{{}}, - RequiredMap: map[string]*ConditionalStructShape{ - "key1": {Name: aws.String("Name")}, - "key2": {}, - }, - RequiredBool: aws.Bool(true), - OptionalStruct: &ConditionalStructShape{}, - } - - req := aws.NewRequest(service, &aws.Operation{}, input, nil) - aws.ValidateParameters(req) - - assert.Error(t, req.Error) - assert.Equal(t, "InvalidParameter", req.Error.(awserr.Error).Code()) - assert.Equal(t, "3 validation errors:\n- missing required parameter: RequiredList[0].Name\n- missing required parameter: RequiredMap[\"key2\"].Name\n- missing required parameter: OptionalStruct.Name", req.Error.(awserr.Error).Message()) - -} diff --git a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/handlers.go b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/request/handlers.go similarity index 57% rename from Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/handlers.go rename to Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/request/handlers.go index 1968cb9f8b1..85bc122e7b3 100644 --- a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/handlers.go +++ b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/request/handlers.go @@ -1,4 +1,4 @@ -package aws +package request // A Handlers provides a collection of request handlers for various // stages of handling requests. @@ -15,8 +15,8 @@ type Handlers struct { AfterRetry HandlerList } -// copy returns of this handler's lists. -func (h *Handlers) copy() Handlers { +// Copy returns of this handler's lists. +func (h *Handlers) Copy() Handlers { return Handlers{ Validate: h.Validate.copy(), Build: h.Build.copy(), @@ -47,19 +47,25 @@ func (h *Handlers) Clear() { // A HandlerList manages zero or more handlers in a list. type HandlerList struct { - list []func(*Request) + list []NamedHandler +} + +// A NamedHandler is a struct that contains a name and function callback. +type NamedHandler struct { + Name string + Fn func(*Request) } // copy creates a copy of the handler list. func (l *HandlerList) copy() HandlerList { var n HandlerList - n.list = append([]func(*Request){}, l.list...) + n.list = append([]NamedHandler{}, l.list...) return n } // Clear clears the handler list. func (l *HandlerList) Clear() { - l.list = []func(*Request){} + l.list = []NamedHandler{} } // Len returns the number of handlers in the list. @@ -67,19 +73,40 @@ func (l *HandlerList) Len() int { return len(l.list) } -// PushBack pushes handlers f to the back of the handler list. -func (l *HandlerList) PushBack(f ...func(*Request)) { - l.list = append(l.list, f...) +// PushBack pushes handler f to the back of the handler list. +func (l *HandlerList) PushBack(f func(*Request)) { + l.list = append(l.list, NamedHandler{"__anonymous", f}) } -// PushFront pushes handlers f to the front of the handler list. -func (l *HandlerList) PushFront(f ...func(*Request)) { - l.list = append(f, l.list...) +// PushFront pushes handler f to the front of the handler list. +func (l *HandlerList) PushFront(f func(*Request)) { + l.list = append([]NamedHandler{{"__anonymous", f}}, l.list...) +} + +// PushBackNamed pushes named handler f to the back of the handler list. +func (l *HandlerList) PushBackNamed(n NamedHandler) { + l.list = append(l.list, n) +} + +// PushFrontNamed pushes named handler f to the front of the handler list. +func (l *HandlerList) PushFrontNamed(n NamedHandler) { + l.list = append([]NamedHandler{n}, l.list...) +} + +// Remove removes a NamedHandler n +func (l *HandlerList) Remove(n NamedHandler) { + newlist := []NamedHandler{} + for _, m := range l.list { + if m.Name != n.Name { + newlist = append(newlist, m) + } + } + l.list = newlist } // Run executes all handlers in the list with a given request object. func (l *HandlerList) Run(r *Request) { for _, f := range l.list { - f(r) + f.Fn(r) } } diff --git a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/request/handlers_test.go b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/request/handlers_test.go new file mode 100644 index 00000000000..2ff05a8154e --- /dev/null +++ b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/request/handlers_test.go @@ -0,0 +1,47 @@ +package request_test + +import ( + "testing" + + "github.com/stretchr/testify/assert" + + "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/aws/request" +) + +func TestHandlerList(t *testing.T) { + s := "" + r := &request.Request{} + l := request.HandlerList{} + l.PushBack(func(r *request.Request) { + s += "a" + r.Data = s + }) + l.Run(r) + assert.Equal(t, "a", s) + assert.Equal(t, "a", r.Data) +} + +func TestMultipleHandlers(t *testing.T) { + r := &request.Request{} + l := request.HandlerList{} + l.PushBack(func(r *request.Request) { r.Data = nil }) + l.PushFront(func(r *request.Request) { r.Data = aws.Bool(true) }) + l.Run(r) + if r.Data != nil { + t.Error("Expected handler to execute") + } +} + +func TestNamedHandlers(t *testing.T) { + l := request.HandlerList{} + named := request.NamedHandler{"Name", func(r *request.Request) {}} + named2 := request.NamedHandler{"NotName", func(r *request.Request) {}} + l.PushBackNamed(named) + l.PushBackNamed(named) + l.PushBackNamed(named2) + l.PushBack(func(r *request.Request) {}) + assert.Equal(t, 4, l.Len()) + l.Remove(named) + assert.Equal(t, 2, l.Len()) +} diff --git a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/request.go b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/request/request.go similarity index 79% rename from Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/request.go rename to Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/request/request.go index f3248fc467a..70c28b88316 100644 --- a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/request.go +++ b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/request/request.go @@ -1,7 +1,8 @@ -package aws +package request import ( "bytes" + "fmt" "io" "io/ioutil" "net/http" @@ -10,12 +11,15 @@ import ( "strings" "time" + "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/aws/awsutil" + "github.com/aws/aws-sdk-go/aws/service/serviceinfo" ) // A Request is the service request to be made. type Request struct { - *Service + Retryer + Service serviceinfo.ServiceInfo Handlers Handlers Time time.Time ExpireTime time.Duration @@ -23,7 +27,7 @@ type Request struct { HTTPRequest *http.Request HTTPResponse *http.Response Body io.ReadSeeker - bodyStart int64 // offset from beginning of Body that the request body starts + BodyStart int64 // offset from beginning of Body that the request body starts Params interface{} Error error Data interface{} @@ -51,13 +55,13 @@ type Paginator struct { TruncationToken string } -// NewRequest returns a new Request pointer for the service API +// New returns a new Request pointer for the service API // operation and parameters. // // Params is any value of input parameters to be the request payload. // Data is pointer value to an object which the request's response // payload will be deserialized to. -func NewRequest(service *Service, operation *Operation, params interface{}, data interface{}) *Request { +func New(service serviceinfo.ServiceInfo, handlers Handlers, retryer Retryer, operation *Operation, params interface{}, data interface{}) *Request { method := operation.HTTPMethod if method == "" { method = "POST" @@ -71,8 +75,9 @@ func NewRequest(service *Service, operation *Operation, params interface{}, data httpReq.URL, _ = url.Parse(service.Endpoint + p) r := &Request{ + Retryer: retryer, Service: service, - Handlers: service.Handlers.copy(), + Handlers: handlers.Copy(), Time: time.Now(), ExpireTime: 0, Operation: operation, @@ -89,7 +94,7 @@ func NewRequest(service *Service, operation *Operation, params interface{}, data // WillRetry returns if the request's can be retried. func (r *Request) WillRetry() bool { - return r.Error != nil && BoolValue(r.Retryable) && r.RetryCount < r.Service.MaxRetries() + return r.Error != nil && aws.BoolValue(r.Retryable) && r.RetryCount < r.MaxRetries() } // ParamsFilled returns if the request's parameters have been populated @@ -134,6 +139,20 @@ func (r *Request) Presign(expireTime time.Duration) (string, error) { return r.HTTPRequest.URL.String(), nil } +func debugLogReqError(r *Request, stage string, retrying bool, err error) { + if !r.Service.Config.LogLevel.Matches(aws.LogDebugWithRequestErrors) { + return + } + + retryStr := "not retrying" + if retrying { + retryStr = "will retry" + } + + r.Service.Config.Logger.Log(fmt.Sprintf("DEBUG: %s %s/%s failed, %s, error %v", + stage, r.Service.ServiceName, r.Operation.Name, retryStr, err)) +} + // Build will build the request's object so it can be signed and sent // to the service. Build will also validate all the request's parameters. // Anny additional build Handlers set on this request will be run @@ -149,6 +168,7 @@ func (r *Request) Build() error { r.Error = nil r.Handlers.Validate.Run(r) if r.Error != nil { + debugLogReqError(r, "Validate Request", false, r.Error) return r.Error } r.Handlers.Build.Run(r) @@ -165,6 +185,7 @@ func (r *Request) Build() error { func (r *Request) Sign() error { r.Build() if r.Error != nil { + debugLogReqError(r, "Build Request", false, r.Error) return r.Error } @@ -183,42 +204,57 @@ func (r *Request) Send() error { return r.Error } - if BoolValue(r.Retryable) { + if aws.BoolValue(r.Retryable) { + if r.Service.Config.LogLevel.Matches(aws.LogDebugWithRequestRetries) { + r.Service.Config.Logger.Log(fmt.Sprintf("DEBUG: Retrying Request %s/%s, attempt %d", + r.Service.ServiceName, r.Operation.Name, r.RetryCount)) + } + // Re-seek the body back to the original point in for a retry so that // send will send the body's contents again in the upcoming request. - r.Body.Seek(r.bodyStart, 0) + r.Body.Seek(r.BodyStart, 0) + r.HTTPRequest.Body = ioutil.NopCloser(r.Body) } r.Retryable = nil r.Handlers.Send.Run(r) if r.Error != nil { + err := r.Error r.Handlers.Retry.Run(r) r.Handlers.AfterRetry.Run(r) if r.Error != nil { + debugLogReqError(r, "Send Request", false, r.Error) return r.Error } + debugLogReqError(r, "Send Request", true, err) continue } r.Handlers.UnmarshalMeta.Run(r) r.Handlers.ValidateResponse.Run(r) if r.Error != nil { + err := r.Error r.Handlers.UnmarshalError.Run(r) r.Handlers.Retry.Run(r) r.Handlers.AfterRetry.Run(r) if r.Error != nil { + debugLogReqError(r, "Validate Response", false, r.Error) return r.Error } + debugLogReqError(r, "Validate Response", true, err) continue } r.Handlers.Unmarshal.Run(r) if r.Error != nil { + err := r.Error r.Handlers.Retry.Run(r) r.Handlers.AfterRetry.Run(r) if r.Error != nil { + debugLogReqError(r, "Unmarshal Response", false, r.Error) return r.Error } + debugLogReqError(r, "Unmarshal Response", true, err) continue } @@ -279,7 +315,7 @@ func (r *Request) NextPage() *Request { } data := reflect.New(reflect.TypeOf(r.Data).Elem()).Interface() - nr := NewRequest(r.Service, r.Operation, awsutil.CopyOf(r.Params), data) + nr := New(r.Service, r.Handlers, r.Retryer, r.Operation, awsutil.CopyOf(r.Params), data) for i, intok := range nr.Operation.InputTokens { awsutil.SetValueAtAnyPath(nr.Params, intok, tokens[i]) } diff --git a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/request_pagination_test.go b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/request/request_pagination_test.go similarity index 93% rename from Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/request_pagination_test.go rename to Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/request/request_pagination_test.go index 6b20c073193..7869da89e3d 100644 --- a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/request_pagination_test.go +++ b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/request/request_pagination_test.go @@ -1,13 +1,15 @@ -package aws_test +package request_test import ( "testing" + "github.com/stretchr/testify/assert" + "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/internal/test/unit" + "github.com/aws/aws-sdk-go/aws/request" + "github.com/aws/aws-sdk-go/awstesting/unit" "github.com/aws/aws-sdk-go/service/dynamodb" "github.com/aws/aws-sdk-go/service/s3" - "github.com/stretchr/testify/assert" ) var _ = unit.Imported @@ -28,7 +30,7 @@ func TestPagination(t *testing.T) { db.Handlers.Unmarshal.Clear() db.Handlers.UnmarshalMeta.Clear() db.Handlers.ValidateResponse.Clear() - db.Handlers.Build.PushBack(func(r *aws.Request) { + db.Handlers.Build.PushBack(func(r *request.Request) { in := r.Params.(*dynamodb.ListTablesInput) if in == nil { tokens = append(tokens, "") @@ -36,7 +38,7 @@ func TestPagination(t *testing.T) { tokens = append(tokens, *in.ExclusiveStartTableName) } }) - db.Handlers.Unmarshal.PushBack(func(r *aws.Request) { + db.Handlers.Unmarshal.PushBack(func(r *request.Request) { r.Data = resps[reqNum] reqNum++ }) @@ -80,7 +82,7 @@ func TestPaginationEachPage(t *testing.T) { db.Handlers.Unmarshal.Clear() db.Handlers.UnmarshalMeta.Clear() db.Handlers.ValidateResponse.Clear() - db.Handlers.Build.PushBack(func(r *aws.Request) { + db.Handlers.Build.PushBack(func(r *request.Request) { in := r.Params.(*dynamodb.ListTablesInput) if in == nil { tokens = append(tokens, "") @@ -88,7 +90,7 @@ func TestPaginationEachPage(t *testing.T) { tokens = append(tokens, *in.ExclusiveStartTableName) } }) - db.Handlers.Unmarshal.PushBack(func(r *aws.Request) { + db.Handlers.Unmarshal.PushBack(func(r *request.Request) { r.Data = resps[reqNum] reqNum++ }) @@ -133,7 +135,7 @@ func TestPaginationEarlyExit(t *testing.T) { db.Handlers.Unmarshal.Clear() db.Handlers.UnmarshalMeta.Clear() db.Handlers.ValidateResponse.Clear() - db.Handlers.Unmarshal.PushBack(func(r *aws.Request) { + db.Handlers.Unmarshal.PushBack(func(r *request.Request) { r.Data = resps[reqNum] reqNum++ }) @@ -164,7 +166,7 @@ func TestSkipPagination(t *testing.T) { client.Handlers.Unmarshal.Clear() client.Handlers.UnmarshalMeta.Clear() client.Handlers.ValidateResponse.Clear() - client.Handlers.Unmarshal.PushBack(func(r *aws.Request) { + client.Handlers.Unmarshal.PushBack(func(r *request.Request) { r.Data = &s3.HeadBucketOutput{} }) @@ -199,7 +201,7 @@ func TestPaginationTruncation(t *testing.T) { client.Handlers.Unmarshal.Clear() client.Handlers.UnmarshalMeta.Clear() client.Handlers.ValidateResponse.Clear() - client.Handlers.Unmarshal.PushBack(func(r *aws.Request) { + client.Handlers.Unmarshal.PushBack(func(r *request.Request) { r.Data = resps[*reqNum] *reqNum++ }) @@ -260,7 +262,7 @@ var benchDb = func() *dynamodb.DynamoDB { func BenchmarkCodegenIterator(b *testing.B) { reqNum := 0 db := benchDb() - db.Handlers.Unmarshal.PushBack(func(r *aws.Request) { + db.Handlers.Unmarshal.PushBack(func(r *request.Request) { r.Data = benchResps[reqNum] reqNum++ }) @@ -289,7 +291,7 @@ func BenchmarkCodegenIterator(b *testing.B) { func BenchmarkEachPageIterator(b *testing.B) { reqNum := 0 db := benchDb() - db.Handlers.Unmarshal.PushBack(func(r *aws.Request) { + db.Handlers.Unmarshal.PushBack(func(r *request.Request) { r.Data = benchResps[reqNum] reqNum++ }) diff --git a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/request_test.go b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/request/request_test.go similarity index 80% rename from Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/request_test.go rename to Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/request/request_test.go index d5d945d983f..6cea0bd2fff 100644 --- a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/request_test.go +++ b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/request/request_test.go @@ -1,4 +1,4 @@ -package aws +package request_test import ( "bytes" @@ -10,8 +10,11 @@ import ( "testing" "time" + "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/aws/awserr" "github.com/aws/aws-sdk-go/aws/credentials" + "github.com/aws/aws-sdk-go/aws/request" + "github.com/aws/aws-sdk-go/aws/service" "github.com/stretchr/testify/assert" ) @@ -23,7 +26,7 @@ func body(str string) io.ReadCloser { return ioutil.NopCloser(bytes.NewReader([]byte(str))) } -func unmarshal(req *Request) { +func unmarshal(req *request.Request) { defer req.HTTPResponse.Body.Close() if req.Data != nil { json.NewDecoder(req.HTTPResponse.Body).Decode(req.Data) @@ -31,7 +34,7 @@ func unmarshal(req *Request) { return } -func unmarshalError(req *Request) { +func unmarshalError(req *request.Request) { bodyBytes, err := ioutil.ReadAll(req.HTTPResponse.Body) if err != nil { req.Error = awserr.New("UnmarshaleError", req.HTTPResponse.Status, err) @@ -71,17 +74,17 @@ func TestRequestRecoverRetry5xx(t *testing.T) { {StatusCode: 200, Body: body(`{"data":"valid"}`)}, } - s := NewService(NewConfig().WithMaxRetries(10)) + s := service.New(aws.NewConfig().WithMaxRetries(10)) s.Handlers.Validate.Clear() s.Handlers.Unmarshal.PushBack(unmarshal) s.Handlers.UnmarshalError.PushBack(unmarshalError) s.Handlers.Send.Clear() // mock sending - s.Handlers.Send.PushBack(func(r *Request) { + s.Handlers.Send.PushBack(func(r *request.Request) { r.HTTPResponse = &reqs[reqNum] reqNum++ }) out := &testData{} - r := NewRequest(s, &Operation{Name: "Operation"}, nil, out) + r := s.NewRequest(&request.Operation{Name: "Operation"}, nil, out) err := r.Send() assert.Nil(t, err) assert.Equal(t, 2, int(r.RetryCount)) @@ -97,17 +100,17 @@ func TestRequestRecoverRetry4xxRetryable(t *testing.T) { {StatusCode: 200, Body: body(`{"data":"valid"}`)}, } - s := NewService(NewConfig().WithMaxRetries(10)) + s := service.New(aws.NewConfig().WithMaxRetries(10)) s.Handlers.Validate.Clear() s.Handlers.Unmarshal.PushBack(unmarshal) s.Handlers.UnmarshalError.PushBack(unmarshalError) s.Handlers.Send.Clear() // mock sending - s.Handlers.Send.PushBack(func(r *Request) { + s.Handlers.Send.PushBack(func(r *request.Request) { r.HTTPResponse = &reqs[reqNum] reqNum++ }) out := &testData{} - r := NewRequest(s, &Operation{Name: "Operation"}, nil, out) + r := s.NewRequest(&request.Operation{Name: "Operation"}, nil, out) err := r.Send() assert.Nil(t, err) assert.Equal(t, 2, int(r.RetryCount)) @@ -116,16 +119,16 @@ func TestRequestRecoverRetry4xxRetryable(t *testing.T) { // test that retries don't occur for 4xx status codes with a response type that can't be retried func TestRequest4xxUnretryable(t *testing.T) { - s := NewService(NewConfig().WithMaxRetries(10)) + s := service.New(aws.NewConfig().WithMaxRetries(10)) s.Handlers.Validate.Clear() s.Handlers.Unmarshal.PushBack(unmarshal) s.Handlers.UnmarshalError.PushBack(unmarshalError) s.Handlers.Send.Clear() // mock sending - s.Handlers.Send.PushBack(func(r *Request) { + s.Handlers.Send.PushBack(func(r *request.Request) { r.HTTPResponse = &http.Response{StatusCode: 401, Body: body(`{"__type":"SignatureDoesNotMatch","message":"Signature does not match."}`)} }) out := &testData{} - r := NewRequest(s, &Operation{Name: "Operation"}, nil, out) + r := s.NewRequest(&request.Operation{Name: "Operation"}, nil, out) err := r.Send() assert.NotNil(t, err) if e, ok := err.(awserr.RequestFailure); ok { @@ -140,7 +143,7 @@ func TestRequest4xxUnretryable(t *testing.T) { func TestRequestExhaustRetries(t *testing.T) { delays := []time.Duration{} - sleepDelay = func(delay time.Duration) { + sleepDelay := func(delay time.Duration) { delays = append(delays, delay) } @@ -152,16 +155,16 @@ func TestRequestExhaustRetries(t *testing.T) { {StatusCode: 500, Body: body(`{"__type":"UnknownError","message":"An error occurred."}`)}, } - s := NewService(NewConfig().WithMaxRetries(DefaultRetries)) + s := service.New(aws.NewConfig().WithMaxRetries(aws.DefaultRetries).WithSleepDelay(sleepDelay)) s.Handlers.Validate.Clear() s.Handlers.Unmarshal.PushBack(unmarshal) s.Handlers.UnmarshalError.PushBack(unmarshalError) s.Handlers.Send.Clear() // mock sending - s.Handlers.Send.PushBack(func(r *Request) { + s.Handlers.Send.PushBack(func(r *request.Request) { r.HTTPResponse = &reqs[reqNum] reqNum++ }) - r := NewRequest(s, &Operation{Name: "Operation"}, nil, nil) + r := s.NewRequest(&request.Operation{Name: "Operation"}, nil, nil) err := r.Send() assert.NotNil(t, err) if e, ok := err.(awserr.RequestFailure); ok { @@ -190,7 +193,7 @@ func TestRequestRecoverExpiredCreds(t *testing.T) { {StatusCode: 200, Body: body(`{"data":"valid"}`)}, } - s := NewService(&Config{MaxRetries: Int(10), Credentials: credentials.NewStaticCredentials("AKID", "SECRET", "")}) + s := service.New(&aws.Config{MaxRetries: aws.Int(10), Credentials: credentials.NewStaticCredentials("AKID", "SECRET", "")}) s.Handlers.Validate.Clear() s.Handlers.Unmarshal.PushBack(unmarshal) s.Handlers.UnmarshalError.PushBack(unmarshalError) @@ -198,21 +201,21 @@ func TestRequestRecoverExpiredCreds(t *testing.T) { credExpiredBeforeRetry := false credExpiredAfterRetry := false - s.Handlers.AfterRetry.PushBack(func(r *Request) { - credExpiredAfterRetry = r.Config.Credentials.IsExpired() + s.Handlers.AfterRetry.PushBack(func(r *request.Request) { + credExpiredAfterRetry = r.Service.Config.Credentials.IsExpired() }) s.Handlers.Sign.Clear() - s.Handlers.Sign.PushBack(func(r *Request) { - r.Config.Credentials.Get() + s.Handlers.Sign.PushBack(func(r *request.Request) { + r.Service.Config.Credentials.Get() }) s.Handlers.Send.Clear() // mock sending - s.Handlers.Send.PushBack(func(r *Request) { + s.Handlers.Send.PushBack(func(r *request.Request) { r.HTTPResponse = &reqs[reqNum] reqNum++ }) out := &testData{} - r := NewRequest(s, &Operation{Name: "Operation"}, nil, out) + r := s.NewRequest(&request.Operation{Name: "Operation"}, nil, out) err := r.Send() assert.Nil(t, err) diff --git a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/request/retryer.go b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/request/retryer.go new file mode 100644 index 00000000000..52667510257 --- /dev/null +++ b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/request/retryer.go @@ -0,0 +1,73 @@ +package request + +import ( + "time" + + "github.com/aws/aws-sdk-go/aws/awserr" +) + +// Retryer is an interface to control retry logic for a given service. +// The default implementation used by most services is the service.DefaultRetryer +// structure, which contains basic retry logic using exponential backoff. +type Retryer interface { + RetryRules(*Request) time.Duration + ShouldRetry(*Request) bool + MaxRetries() uint +} + +// retryableCodes is a collection of service response codes which are retry-able +// without any further action. +var retryableCodes = map[string]struct{}{ + "RequestError": {}, + "ProvisionedThroughputExceededException": {}, + "Throttling": {}, + "ThrottlingException": {}, + "RequestLimitExceeded": {}, + "RequestThrottled": {}, + "LimitExceededException": {}, // Deleting 10+ DynamoDb tables at once + "TooManyRequestsException": {}, // Lambda functions +} + +// credsExpiredCodes is a collection of error codes which signify the credentials +// need to be refreshed. Expired tokens require refreshing of credentials, and +// resigning before the request can be retried. +var credsExpiredCodes = map[string]struct{}{ + "ExpiredToken": {}, + "ExpiredTokenException": {}, + "RequestExpired": {}, // EC2 Only +} + +func isCodeRetryable(code string) bool { + if _, ok := retryableCodes[code]; ok { + return true + } + + return isCodeExpiredCreds(code) +} + +func isCodeExpiredCreds(code string) bool { + _, ok := credsExpiredCodes[code] + return ok +} + +// IsErrorRetryable returns whether the error is retryable, based on its Code. +// Returns false if the request has no Error set. +func (r *Request) IsErrorRetryable() bool { + if r.Error != nil { + if err, ok := r.Error.(awserr.Error); ok { + return isCodeRetryable(err.Code()) + } + } + return false +} + +// IsErrorExpired returns whether the error code is a credential expiry error. +// Returns false if the request has no Error set. +func (r *Request) IsErrorExpired() bool { + if r.Error != nil { + if err, ok := r.Error.(awserr.Error); ok { + return isCodeExpiredCreds(err.Code()) + } + } + return false +} diff --git a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/service.go b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/service.go deleted file mode 100644 index 672f7de1d63..00000000000 --- a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/service.go +++ /dev/null @@ -1,194 +0,0 @@ -package aws - -import ( - "fmt" - "math" - "math/rand" - "net/http" - "net/http/httputil" - "regexp" - "time" - - "github.com/aws/aws-sdk-go/aws/awserr" - "github.com/aws/aws-sdk-go/internal/endpoints" -) - -// A Service implements the base service request and response handling -// used by all services. -type Service struct { - Config *Config - Handlers Handlers - ServiceName string - APIVersion string - Endpoint string - SigningName string - SigningRegion string - JSONVersion string - TargetPrefix string - RetryRules func(*Request) time.Duration - ShouldRetry func(*Request) bool - DefaultMaxRetries uint -} - -var schemeRE = regexp.MustCompile("^([^:]+)://") - -// NewService will return a pointer to a new Server object initialized. -func NewService(config *Config) *Service { - svc := &Service{Config: config} - svc.Initialize() - return svc -} - -// Initialize initializes the service. -func (s *Service) Initialize() { - if s.Config == nil { - s.Config = &Config{} - } - if s.Config.HTTPClient == nil { - s.Config.HTTPClient = http.DefaultClient - } - - if s.RetryRules == nil { - s.RetryRules = retryRules - } - - if s.ShouldRetry == nil { - s.ShouldRetry = shouldRetry - } - - s.DefaultMaxRetries = 3 - s.Handlers.Validate.PushBack(ValidateEndpointHandler) - s.Handlers.Build.PushBack(UserAgentHandler) - s.Handlers.Sign.PushBack(BuildContentLength) - s.Handlers.Send.PushBack(SendHandler) - s.Handlers.AfterRetry.PushBack(AfterRetryHandler) - s.Handlers.ValidateResponse.PushBack(ValidateResponseHandler) - s.AddDebugHandlers() - s.buildEndpoint() - - if !BoolValue(s.Config.DisableParamValidation) { - s.Handlers.Validate.PushBack(ValidateParameters) - } -} - -// buildEndpoint builds the endpoint values the service will use to make requests with. -func (s *Service) buildEndpoint() { - if StringValue(s.Config.Endpoint) != "" { - s.Endpoint = *s.Config.Endpoint - } else { - s.Endpoint, s.SigningRegion = - endpoints.EndpointForRegion(s.ServiceName, StringValue(s.Config.Region)) - } - - if s.Endpoint != "" && !schemeRE.MatchString(s.Endpoint) { - scheme := "https" - if BoolValue(s.Config.DisableSSL) { - scheme = "http" - } - s.Endpoint = scheme + "://" + s.Endpoint - } -} - -// AddDebugHandlers injects debug logging handlers into the service to log request -// debug information. -func (s *Service) AddDebugHandlers() { - if !s.Config.LogLevel.AtLeast(LogDebug) { - return - } - - s.Handlers.Send.PushFront(logRequest) - s.Handlers.Send.PushBack(logResponse) -} - -const logReqMsg = `DEBUG: Request %s/%s Details: ----[ REQUEST POST-SIGN ]----------------------------- -%s ------------------------------------------------------` - -func logRequest(r *Request) { - logBody := r.Config.LogLevel.Matches(LogDebugWithHTTPBody) - dumpedBody, _ := httputil.DumpRequestOut(r.HTTPRequest, logBody) - - r.Config.Logger.Log(fmt.Sprintf(logReqMsg, r.ServiceName, r.Operation.Name, string(dumpedBody))) -} - -const logRespMsg = `DEBUG: Response %s/%s Details: ----[ RESPONSE ]-------------------------------------- -%s ------------------------------------------------------` - -func logResponse(r *Request) { - var msg = "no reponse data" - if r.HTTPResponse != nil { - logBody := r.Config.LogLevel.Matches(LogDebugWithHTTPBody) - dumpedBody, _ := httputil.DumpResponse(r.HTTPResponse, logBody) - msg = string(dumpedBody) - } else if r.Error != nil { - msg = r.Error.Error() - } - r.Config.Logger.Log(fmt.Sprintf(logRespMsg, r.ServiceName, r.Operation.Name, msg)) -} - -// MaxRetries returns the number of maximum returns the service will use to make -// an individual API request. -func (s *Service) MaxRetries() uint { - if IntValue(s.Config.MaxRetries) < 0 { - return s.DefaultMaxRetries - } - return uint(IntValue(s.Config.MaxRetries)) -} - -var seededRand = rand.New(rand.NewSource(time.Now().UnixNano())) - -// retryRules returns the delay duration before retrying this request again -func retryRules(r *Request) time.Duration { - - delay := int(math.Pow(2, float64(r.RetryCount))) * (seededRand.Intn(30) + 30) - return time.Duration(delay) * time.Millisecond -} - -// retryableCodes is a collection of service response codes which are retry-able -// without any further action. -var retryableCodes = map[string]struct{}{ - "RequestError": {}, - "ProvisionedThroughputExceededException": {}, - "Throttling": {}, - "ThrottlingException": {}, - "RequestLimitExceeded": {}, - "RequestThrottled": {}, -} - -// credsExpiredCodes is a collection of error codes which signify the credentials -// need to be refreshed. Expired tokens require refreshing of credentials, and -// resigning before the request can be retried. -var credsExpiredCodes = map[string]struct{}{ - "ExpiredToken": {}, - "ExpiredTokenException": {}, - "RequestExpired": {}, // EC2 Only -} - -func isCodeRetryable(code string) bool { - if _, ok := retryableCodes[code]; ok { - return true - } - - return isCodeExpiredCreds(code) -} - -func isCodeExpiredCreds(code string) bool { - _, ok := credsExpiredCodes[code] - return ok -} - -// shouldRetry returns if the request should be retried. -func shouldRetry(r *Request) bool { - if r.HTTPResponse.StatusCode >= 500 { - return true - } - if r.Error != nil { - if err, ok := r.Error.(awserr.Error); ok { - return isCodeRetryable(err.Code()) - } - } - return false -} diff --git a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/service/default_retryer.go b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/service/default_retryer.go new file mode 100644 index 00000000000..c3dd0fa35a1 --- /dev/null +++ b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/service/default_retryer.go @@ -0,0 +1,49 @@ +package service + +import ( + "math" + "math/rand" + "time" + + "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/aws/request" +) + +// DefaultRetryer implements basic retry logic using exponential backoff for +// most services. If you want to implement custom retry logic, implement the +// request.Retryer interface or create a structure type that composes this +// struct and override the specific methods. For example, to override only +// the MaxRetries method: +// +// type retryer struct { +// service.DefaultRetryer +// } +// +// // This implementation always has 100 max retries +// func (d retryer) MaxRetries() uint { return 100 } +type DefaultRetryer struct { + *Service +} + +// MaxRetries returns the number of maximum returns the service will use to make +// an individual API request. +func (d DefaultRetryer) MaxRetries() uint { + if aws.IntValue(d.Service.Config.MaxRetries) < 0 { + return d.DefaultMaxRetries + } + return uint(aws.IntValue(d.Service.Config.MaxRetries)) +} + +// RetryRules returns the delay duration before retrying this request again +func (d DefaultRetryer) RetryRules(r *request.Request) time.Duration { + delay := int(math.Pow(2, float64(r.RetryCount))) * (rand.Intn(30) + 30) + return time.Duration(delay) * time.Millisecond +} + +// ShouldRetry returns if the request should be retried. +func (d DefaultRetryer) ShouldRetry(r *request.Request) bool { + if r.HTTPResponse.StatusCode >= 500 { + return true + } + return r.IsErrorRetryable() +} diff --git a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/service/service.go b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/service/service.go new file mode 100644 index 00000000000..38aa5d51484 --- /dev/null +++ b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/service/service.go @@ -0,0 +1,133 @@ +package service + +import ( + "fmt" + "io/ioutil" + "net/http" + "net/http/httputil" + "regexp" + "time" + + "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/aws/corehandlers" + "github.com/aws/aws-sdk-go/aws/request" + "github.com/aws/aws-sdk-go/aws/service/serviceinfo" + "github.com/aws/aws-sdk-go/private/endpoints" +) + +// A Service implements the base service request and response handling +// used by all services. +type Service struct { + serviceinfo.ServiceInfo + request.Retryer + DefaultMaxRetries uint + Handlers request.Handlers +} + +var schemeRE = regexp.MustCompile("^([^:]+)://") + +// New will return a pointer to a new Server object initialized. +func New(config *aws.Config) *Service { + svc := &Service{ServiceInfo: serviceinfo.ServiceInfo{Config: config}} + svc.Initialize() + return svc +} + +// Initialize initializes the service. +func (s *Service) Initialize() { + if s.Config == nil { + s.Config = &aws.Config{} + } + if s.Config.HTTPClient == nil { + s.Config.HTTPClient = http.DefaultClient + } + if s.Config.SleepDelay == nil { + s.Config.SleepDelay = time.Sleep + } + + s.Retryer = DefaultRetryer{s} + s.DefaultMaxRetries = 3 + s.Handlers.Validate.PushBackNamed(corehandlers.ValidateEndpointHandler) + s.Handlers.Build.PushBackNamed(corehandlers.UserAgentHandler) + s.Handlers.Sign.PushBackNamed(corehandlers.BuildContentLengthHandler) + s.Handlers.Send.PushBackNamed(corehandlers.SendHandler) + s.Handlers.AfterRetry.PushBackNamed(corehandlers.AfterRetryHandler) + s.Handlers.ValidateResponse.PushBackNamed(corehandlers.ValidateResponseHandler) + if !aws.BoolValue(s.Config.DisableParamValidation) { + s.Handlers.Validate.PushBackNamed(corehandlers.ValidateParametersHandler) + } + s.AddDebugHandlers() + s.buildEndpoint() +} + +// NewRequest returns a new Request pointer for the service API +// operation and parameters. +func (s *Service) NewRequest(operation *request.Operation, params interface{}, data interface{}) *request.Request { + return request.New(s.ServiceInfo, s.Handlers, s.Retryer, operation, params, data) +} + +// buildEndpoint builds the endpoint values the service will use to make requests with. +func (s *Service) buildEndpoint() { + if aws.StringValue(s.Config.Endpoint) != "" { + s.Endpoint = *s.Config.Endpoint + } else if s.Endpoint == "" { + s.Endpoint, s.SigningRegion = + endpoints.EndpointForRegion(s.ServiceName, aws.StringValue(s.Config.Region)) + } + + if s.Endpoint != "" && !schemeRE.MatchString(s.Endpoint) { + scheme := "https" + if aws.BoolValue(s.Config.DisableSSL) { + scheme = "http" + } + s.Endpoint = scheme + "://" + s.Endpoint + } +} + +// AddDebugHandlers injects debug logging handlers into the service to log request +// debug information. +func (s *Service) AddDebugHandlers() { + if !s.Config.LogLevel.AtLeast(aws.LogDebug) { + return + } + + s.Handlers.Send.PushFront(logRequest) + s.Handlers.Send.PushBack(logResponse) +} + +const logReqMsg = `DEBUG: Request %s/%s Details: +---[ REQUEST POST-SIGN ]----------------------------- +%s +-----------------------------------------------------` + +func logRequest(r *request.Request) { + logBody := r.Service.Config.LogLevel.Matches(aws.LogDebugWithHTTPBody) + dumpedBody, _ := httputil.DumpRequestOut(r.HTTPRequest, logBody) + + if logBody { + // Reset the request body because dumpRequest will re-wrap the r.HTTPRequest's + // Body as a NoOpCloser and will not be reset after read by the HTTP + // client reader. + r.Body.Seek(r.BodyStart, 0) + r.HTTPRequest.Body = ioutil.NopCloser(r.Body) + } + + r.Service.Config.Logger.Log(fmt.Sprintf(logReqMsg, r.Service.ServiceName, r.Operation.Name, string(dumpedBody))) +} + +const logRespMsg = `DEBUG: Response %s/%s Details: +---[ RESPONSE ]-------------------------------------- +%s +-----------------------------------------------------` + +func logResponse(r *request.Request) { + var msg = "no reponse data" + if r.HTTPResponse != nil { + logBody := r.Service.Config.LogLevel.Matches(aws.LogDebugWithHTTPBody) + dumpedBody, _ := httputil.DumpResponse(r.HTTPResponse, logBody) + msg = string(dumpedBody) + } else if r.Error != nil { + msg = r.Error.Error() + } + r.Service.Config.Logger.Log(fmt.Sprintf(logRespMsg, r.Service.ServiceName, r.Operation.Name, msg)) +} diff --git a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/service/serviceinfo/service_info.go b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/service/serviceinfo/service_info.go new file mode 100644 index 00000000000..a920e96a967 --- /dev/null +++ b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/service/serviceinfo/service_info.go @@ -0,0 +1,15 @@ +package serviceinfo + +import "github.com/aws/aws-sdk-go/aws" + +// ServiceInfo wraps immutable data from the service.Service structure. +type ServiceInfo struct { + Config *aws.Config + ServiceName string + APIVersion string + Endpoint string + SigningName string + SigningRegion string + JSONVersion string + TargetPrefix string +} diff --git a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/types.go b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/types.go index 87905d7e06e..846b732dda1 100644 --- a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/types.go +++ b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/types.go @@ -2,6 +2,7 @@ package aws import ( "io" + "sync" ) // ReadSeekCloser wraps a io.Reader returning a ReaderSeakerCloser @@ -53,3 +54,35 @@ func (r ReaderSeekerCloser) Close() error { } return nil } + +// A WriteAtBuffer provides a in memory buffer supporting the io.WriterAt interface +// Can be used with the s3manager.Downloader to download content to a buffer +// in memory. Safe to use concurrently. +type WriteAtBuffer struct { + buf []byte + m sync.Mutex +} + +// WriteAt writes a slice of bytes to a buffer starting at the position provided +// The number of bytes written will be returned, or error. Can overwrite previous +// written slices if the write ats overlap. +func (b *WriteAtBuffer) WriteAt(p []byte, pos int64) (n int, err error) { + b.m.Lock() + defer b.m.Unlock() + + expLen := pos + int64(len(p)) + if int64(len(b.buf)) < expLen { + newBuf := make([]byte, expLen) + copy(newBuf, b.buf) + b.buf = newBuf + } + copy(b.buf[pos:], p) + return len(p), nil +} + +// Bytes returns a slice of bytes written to the buffer. +func (b *WriteAtBuffer) Bytes() []byte { + b.m.Lock() + defer b.m.Unlock() + return b.buf[:len(b.buf):len(b.buf)] +} diff --git a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/types_test.go b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/types_test.go new file mode 100644 index 00000000000..a4ed20e7d22 --- /dev/null +++ b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/types_test.go @@ -0,0 +1,56 @@ +package aws + +import ( + "math/rand" + "testing" + + "github.com/stretchr/testify/assert" +) + +func TestWriteAtBuffer(t *testing.T) { + b := &WriteAtBuffer{} + + n, err := b.WriteAt([]byte{1}, 0) + assert.NoError(t, err) + assert.Equal(t, 1, n) + + n, err = b.WriteAt([]byte{1, 1, 1}, 5) + assert.NoError(t, err) + assert.Equal(t, 3, n) + + n, err = b.WriteAt([]byte{2}, 1) + assert.NoError(t, err) + assert.Equal(t, 1, n) + + n, err = b.WriteAt([]byte{3}, 2) + assert.NoError(t, err) + assert.Equal(t, 1, n) + + assert.Equal(t, []byte{1, 2, 3, 0, 0, 1, 1, 1}, b.Bytes()) +} + +func BenchmarkWriteAtBuffer(b *testing.B) { + buf := &WriteAtBuffer{} + r := rand.New(rand.NewSource(1)) + + b.ResetTimer() + for i := 0; i < b.N; i++ { + to := r.Intn(10) * 4096 + bs := make([]byte, to) + buf.WriteAt(bs, r.Int63n(10)*4096) + } +} + +func BenchmarkWriteAtBufferParallel(b *testing.B) { + buf := &WriteAtBuffer{} + r := rand.New(rand.NewSource(1)) + + b.ResetTimer() + b.RunParallel(func(pb *testing.PB) { + for pb.Next() { + to := r.Intn(10) * 4096 + bs := make([]byte, to) + buf.WriteAt(bs, r.Int63n(10)*4096) + } + }) +} diff --git a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/version.go b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/version.go index 681a6e265c1..b7de9e35190 100644 --- a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/version.go +++ b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/version.go @@ -5,4 +5,4 @@ package aws const SDKName = "aws-sdk-go" // SDKVersion is the version of this SDK -const SDKVersion = "0.7.3" +const SDKVersion = "0.9.16" diff --git a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/private/endpoints/endpoints.go b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/private/endpoints/endpoints.go new file mode 100644 index 00000000000..d040cccd57d --- /dev/null +++ b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/private/endpoints/endpoints.go @@ -0,0 +1,31 @@ +// Package endpoints validates regional endpoints for services. +package endpoints + +//go:generate go run ../model/cli/gen-endpoints/main.go endpoints.json endpoints_map.go +//go:generate gofmt -s -w endpoints_map.go + +import "strings" + +// EndpointForRegion returns an endpoint and its signing region for a service and region. +// if the service and region pair are not found endpoint and signingRegion will be empty. +func EndpointForRegion(svcName, region string) (endpoint, signingRegion string) { + derivedKeys := []string{ + region + "/" + svcName, + region + "/*", + "*/" + svcName, + "*/*", + } + + for _, key := range derivedKeys { + if val, ok := endpointsMap.Endpoints[key]; ok { + ep := val.Endpoint + ep = strings.Replace(ep, "{region}", region, -1) + ep = strings.Replace(ep, "{service}", svcName, -1) + + endpoint = ep + signingRegion = val.SigningRegion + return + } + } + return +} diff --git a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/private/endpoints/endpoints.json b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/private/endpoints/endpoints.json new file mode 100644 index 00000000000..62b8231d48b --- /dev/null +++ b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/private/endpoints/endpoints.json @@ -0,0 +1,81 @@ +{ + "version": 2, + "endpoints": { + "*/*": { + "endpoint": "{service}.{region}.amazonaws.com" + }, + "cn-north-1/*": { + "endpoint": "{service}.{region}.amazonaws.com.cn", + "signatureVersion": "v4" + }, + "us-gov-west-1/iam": { + "endpoint": "iam.us-gov.amazonaws.com" + }, + "us-gov-west-1/sts": { + "endpoint": "sts.us-gov-west-1.amazonaws.com" + }, + "us-gov-west-1/s3": { + "endpoint": "s3-{region}.amazonaws.com" + }, + "*/cloudfront": { + "endpoint": "cloudfront.amazonaws.com", + "signingRegion": "us-east-1" + }, + "*/cloudsearchdomain": { + "endpoint": "", + "signingRegion": "us-east-1" + }, + "*/data.iot": { + "endpoint": "", + "signingRegion": "us-east-1" + }, + "*/iam": { + "endpoint": "iam.amazonaws.com", + "signingRegion": "us-east-1" + }, + "*/importexport": { + "endpoint": "importexport.amazonaws.com", + "signingRegion": "us-east-1" + }, + "*/route53": { + "endpoint": "route53.amazonaws.com", + "signingRegion": "us-east-1" + }, + "*/sts": { + "endpoint": "sts.amazonaws.com", + "signingRegion": "us-east-1" + }, + "us-east-1/sdb": { + "endpoint": "sdb.amazonaws.com", + "signingRegion": "us-east-1" + }, + "us-east-1/s3": { + "endpoint": "s3.amazonaws.com" + }, + "us-west-1/s3": { + "endpoint": "s3-{region}.amazonaws.com" + }, + "us-west-2/s3": { + "endpoint": "s3-{region}.amazonaws.com" + }, + "eu-west-1/s3": { + "endpoint": "s3-{region}.amazonaws.com" + }, + "ap-southeast-1/s3": { + "endpoint": "s3-{region}.amazonaws.com" + }, + "ap-southeast-2/s3": { + "endpoint": "s3-{region}.amazonaws.com" + }, + "ap-northeast-1/s3": { + "endpoint": "s3-{region}.amazonaws.com" + }, + "sa-east-1/s3": { + "endpoint": "s3-{region}.amazonaws.com" + }, + "eu-central-1/s3": { + "endpoint": "{service}.{region}.amazonaws.com", + "signatureVersion": "v4" + } + } +} diff --git a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/private/endpoints/endpoints_map.go b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/private/endpoints/endpoints_map.go new file mode 100644 index 00000000000..62fdc16bdd7 --- /dev/null +++ b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/private/endpoints/endpoints_map.go @@ -0,0 +1,93 @@ +package endpoints + +// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. + +type endpointStruct struct { + Version int + Endpoints map[string]endpointEntry +} + +type endpointEntry struct { + Endpoint string + SigningRegion string +} + +var endpointsMap = endpointStruct{ + Version: 2, + Endpoints: map[string]endpointEntry{ + "*/*": { + Endpoint: "{service}.{region}.amazonaws.com", + }, + "*/cloudfront": { + Endpoint: "cloudfront.amazonaws.com", + SigningRegion: "us-east-1", + }, + "*/cloudsearchdomain": { + Endpoint: "", + SigningRegion: "us-east-1", + }, + "*/data.iot": { + Endpoint: "", + SigningRegion: "us-east-1", + }, + "*/iam": { + Endpoint: "iam.amazonaws.com", + SigningRegion: "us-east-1", + }, + "*/importexport": { + Endpoint: "importexport.amazonaws.com", + SigningRegion: "us-east-1", + }, + "*/route53": { + Endpoint: "route53.amazonaws.com", + SigningRegion: "us-east-1", + }, + "*/sts": { + Endpoint: "sts.amazonaws.com", + SigningRegion: "us-east-1", + }, + "ap-northeast-1/s3": { + Endpoint: "s3-{region}.amazonaws.com", + }, + "ap-southeast-1/s3": { + Endpoint: "s3-{region}.amazonaws.com", + }, + "ap-southeast-2/s3": { + Endpoint: "s3-{region}.amazonaws.com", + }, + "cn-north-1/*": { + Endpoint: "{service}.{region}.amazonaws.com.cn", + }, + "eu-central-1/s3": { + Endpoint: "{service}.{region}.amazonaws.com", + }, + "eu-west-1/s3": { + Endpoint: "s3-{region}.amazonaws.com", + }, + "sa-east-1/s3": { + Endpoint: "s3-{region}.amazonaws.com", + }, + "us-east-1/s3": { + Endpoint: "s3.amazonaws.com", + }, + "us-east-1/sdb": { + Endpoint: "sdb.amazonaws.com", + SigningRegion: "us-east-1", + }, + "us-gov-west-1/iam": { + Endpoint: "iam.us-gov.amazonaws.com", + }, + "us-gov-west-1/s3": { + Endpoint: "s3-{region}.amazonaws.com", + }, + "us-gov-west-1/sts": { + Endpoint: "sts.us-gov-west-1.amazonaws.com", + }, + "us-west-1/s3": { + Endpoint: "s3-{region}.amazonaws.com", + }, + "us-west-2/s3": { + Endpoint: "s3-{region}.amazonaws.com", + }, + }, +} diff --git a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/private/endpoints/endpoints_test.go b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/private/endpoints/endpoints_test.go new file mode 100644 index 00000000000..8af65879d40 --- /dev/null +++ b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/private/endpoints/endpoints_test.go @@ -0,0 +1,28 @@ +package endpoints + +import ( + "testing" + + "github.com/stretchr/testify/assert" +) + +func TestGlobalEndpoints(t *testing.T) { + region := "mock-region-1" + svcs := []string{"cloudfront", "iam", "importexport", "route53", "sts"} + + for _, name := range svcs { + ep, sr := EndpointForRegion(name, region) + assert.Equal(t, name+".amazonaws.com", ep) + assert.Equal(t, "us-east-1", sr) + } +} + +func TestServicesInCN(t *testing.T) { + region := "cn-north-1" + svcs := []string{"cloudfront", "iam", "importexport", "route53", "sts", "s3"} + + for _, name := range svcs { + ep, _ := EndpointForRegion(name, region) + assert.Equal(t, name+"."+region+".amazonaws.com.cn", ep) + } +} diff --git a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/private/protocol/ec2query/build.go b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/private/protocol/ec2query/build.go new file mode 100644 index 00000000000..8e646140b30 --- /dev/null +++ b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/private/protocol/ec2query/build.go @@ -0,0 +1,32 @@ +// Package ec2query provides serialisation of AWS EC2 requests and responses. +package ec2query + +//go:generate go run ../../../models/protocol_tests/generate.go ../../../models/protocol_tests/input/ec2.json build_test.go + +import ( + "net/url" + + "github.com/aws/aws-sdk-go/aws/awserr" + "github.com/aws/aws-sdk-go/aws/request" + "github.com/aws/aws-sdk-go/private/protocol/query/queryutil" +) + +// Build builds a request for the EC2 protocol. +func Build(r *request.Request) { + body := url.Values{ + "Action": {r.Operation.Name}, + "Version": {r.Service.APIVersion}, + } + if err := queryutil.Parse(body, r.Params, true); err != nil { + r.Error = awserr.New("SerializationError", "failed encoding EC2 Query request", err) + } + + if r.ExpireTime == 0 { + r.HTTPRequest.Method = "POST" + r.HTTPRequest.Header.Set("Content-Type", "application/x-www-form-urlencoded; charset=utf-8") + r.SetBufferBody([]byte(body.Encode())) + } else { // This is a pre-signed request + r.HTTPRequest.Method = "GET" + r.HTTPRequest.URL.RawQuery = body.Encode() + } +} diff --git a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/private/protocol/ec2query/build_bench_test.go b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/private/protocol/ec2query/build_bench_test.go new file mode 100644 index 00000000000..6e563722edc --- /dev/null +++ b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/private/protocol/ec2query/build_bench_test.go @@ -0,0 +1,85 @@ +// +build bench + +package ec2query_test + +import ( + "testing" + + "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/aws/request" + "github.com/aws/aws-sdk-go/aws/service" + "github.com/aws/aws-sdk-go/private/protocol/ec2query" + "github.com/aws/aws-sdk-go/service/ec2" +) + +func BenchmarkEC2QueryBuild_Complex_ec2AuthorizeSecurityGroupEgress(b *testing.B) { + params := &ec2.AuthorizeSecurityGroupEgressInput{ + GroupId: aws.String("String"), // Required + CidrIp: aws.String("String"), + DryRun: aws.Bool(true), + FromPort: aws.Int64(1), + IpPermissions: []*ec2.IpPermission{ + { // Required + FromPort: aws.Int64(1), + IpProtocol: aws.String("String"), + IpRanges: []*ec2.IpRange{ + { // Required + CidrIp: aws.String("String"), + }, + // More values... + }, + PrefixListIds: []*ec2.PrefixListId{ + { // Required + PrefixListId: aws.String("String"), + }, + // More values... + }, + ToPort: aws.Int64(1), + UserIdGroupPairs: []*ec2.UserIdGroupPair{ + { // Required + GroupId: aws.String("String"), + GroupName: aws.String("String"), + UserId: aws.String("String"), + }, + // More values... + }, + }, + // More values... + }, + IpProtocol: aws.String("String"), + SourceSecurityGroupName: aws.String("String"), + SourceSecurityGroupOwnerId: aws.String("String"), + ToPort: aws.Int64(1), + } + + benchEC2QueryBuild(b, "AuthorizeSecurityGroupEgress", params) +} + +func BenchmarkEC2QueryBuild_Simple_ec2AttachNetworkInterface(b *testing.B) { + params := &ec2.AttachNetworkInterfaceInput{ + DeviceIndex: aws.Int64(1), // Required + InstanceId: aws.String("String"), // Required + NetworkInterfaceId: aws.String("String"), // Required + DryRun: aws.Bool(true), + } + + benchEC2QueryBuild(b, "AttachNetworkInterface", params) +} + +func benchEC2QueryBuild(b *testing.B, opName string, params interface{}) { + svc := service.New(nil) + svc.ServiceName = "ec2" + svc.APIVersion = "2015-04-15" + + for i := 0; i < b.N; i++ { + r := svc.NewRequest(&request.Operation{ + Name: opName, + HTTPMethod: "POST", + HTTPPath: "/", + }, params, nil) + ec2query.Build(r) + if r.Error != nil { + b.Fatal("Unexpected error", r.Error) + } + } +} diff --git a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/private/protocol/ec2query/build_test.go b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/private/protocol/ec2query/build_test.go new file mode 100644 index 00000000000..a3846344d6b --- /dev/null +++ b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/private/protocol/ec2query/build_test.go @@ -0,0 +1,882 @@ +package ec2query_test + +import ( + "bytes" + "encoding/json" + "encoding/xml" + "io" + "io/ioutil" + "net/http" + "net/url" + "testing" + "time" + + "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/aws/defaults" + "github.com/aws/aws-sdk-go/aws/request" + "github.com/aws/aws-sdk-go/aws/service" + "github.com/aws/aws-sdk-go/aws/service/serviceinfo" + "github.com/aws/aws-sdk-go/awstesting" + "github.com/aws/aws-sdk-go/private/protocol/ec2query" + "github.com/aws/aws-sdk-go/private/protocol/xml/xmlutil" + "github.com/aws/aws-sdk-go/private/signer/v4" + "github.com/aws/aws-sdk-go/private/util" + "github.com/stretchr/testify/assert" +) + +var _ bytes.Buffer // always import bytes +var _ http.Request +var _ json.Marshaler +var _ time.Time +var _ xmlutil.XMLNode +var _ xml.Attr +var _ = awstesting.GenerateAssertions +var _ = ioutil.Discard +var _ = util.Trim("") +var _ = url.Values{} +var _ = io.EOF + +type InputService1ProtocolTest struct { + *service.Service +} + +// New returns a new InputService1ProtocolTest client. +func NewInputService1ProtocolTest(config *aws.Config) *InputService1ProtocolTest { + service := &service.Service{ + ServiceInfo: serviceinfo.ServiceInfo{ + Config: defaults.DefaultConfig.Merge(config), + ServiceName: "inputservice1protocoltest", + APIVersion: "2014-01-01", + }, + } + service.Initialize() + + // Handlers + service.Handlers.Sign.PushBack(v4.Sign) + service.Handlers.Build.PushBack(ec2query.Build) + service.Handlers.Unmarshal.PushBack(ec2query.Unmarshal) + service.Handlers.UnmarshalMeta.PushBack(ec2query.UnmarshalMeta) + service.Handlers.UnmarshalError.PushBack(ec2query.UnmarshalError) + + return &InputService1ProtocolTest{service} +} + +// newRequest creates a new request for a InputService1ProtocolTest operation and runs any +// custom request initialization. +func (c *InputService1ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { + req := c.NewRequest(op, params, data) + + return req +} + +const opInputService1TestCaseOperation1 = "OperationName" + +// InputService1TestCaseOperation1Request generates a request for the InputService1TestCaseOperation1 operation. +func (c *InputService1ProtocolTest) InputService1TestCaseOperation1Request(input *InputService1TestShapeInputService1TestCaseOperation1Input) (req *request.Request, output *InputService1TestShapeInputService1TestCaseOperation1Output) { + op := &request.Operation{ + Name: opInputService1TestCaseOperation1, + } + + if input == nil { + input = &InputService1TestShapeInputService1TestCaseOperation1Input{} + } + + req = c.newRequest(op, input, output) + output = &InputService1TestShapeInputService1TestCaseOperation1Output{} + req.Data = output + return +} + +func (c *InputService1ProtocolTest) InputService1TestCaseOperation1(input *InputService1TestShapeInputService1TestCaseOperation1Input) (*InputService1TestShapeInputService1TestCaseOperation1Output, error) { + req, out := c.InputService1TestCaseOperation1Request(input) + err := req.Send() + return out, err +} + +type InputService1TestShapeInputService1TestCaseOperation1Input struct { + Bar *string `type:"string"` + + Foo *string `type:"string"` + + metadataInputService1TestShapeInputService1TestCaseOperation1Input `json:"-" xml:"-"` +} + +type metadataInputService1TestShapeInputService1TestCaseOperation1Input struct { + SDKShapeTraits bool `type:"structure"` +} + +type InputService1TestShapeInputService1TestCaseOperation1Output struct { + metadataInputService1TestShapeInputService1TestCaseOperation1Output `json:"-" xml:"-"` +} + +type metadataInputService1TestShapeInputService1TestCaseOperation1Output struct { + SDKShapeTraits bool `type:"structure"` +} + +type InputService2ProtocolTest struct { + *service.Service +} + +// New returns a new InputService2ProtocolTest client. +func NewInputService2ProtocolTest(config *aws.Config) *InputService2ProtocolTest { + service := &service.Service{ + ServiceInfo: serviceinfo.ServiceInfo{ + Config: defaults.DefaultConfig.Merge(config), + ServiceName: "inputservice2protocoltest", + APIVersion: "2014-01-01", + }, + } + service.Initialize() + + // Handlers + service.Handlers.Sign.PushBack(v4.Sign) + service.Handlers.Build.PushBack(ec2query.Build) + service.Handlers.Unmarshal.PushBack(ec2query.Unmarshal) + service.Handlers.UnmarshalMeta.PushBack(ec2query.UnmarshalMeta) + service.Handlers.UnmarshalError.PushBack(ec2query.UnmarshalError) + + return &InputService2ProtocolTest{service} +} + +// newRequest creates a new request for a InputService2ProtocolTest operation and runs any +// custom request initialization. +func (c *InputService2ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { + req := c.NewRequest(op, params, data) + + return req +} + +const opInputService2TestCaseOperation1 = "OperationName" + +// InputService2TestCaseOperation1Request generates a request for the InputService2TestCaseOperation1 operation. +func (c *InputService2ProtocolTest) InputService2TestCaseOperation1Request(input *InputService2TestShapeInputService2TestCaseOperation1Input) (req *request.Request, output *InputService2TestShapeInputService2TestCaseOperation1Output) { + op := &request.Operation{ + Name: opInputService2TestCaseOperation1, + } + + if input == nil { + input = &InputService2TestShapeInputService2TestCaseOperation1Input{} + } + + req = c.newRequest(op, input, output) + output = &InputService2TestShapeInputService2TestCaseOperation1Output{} + req.Data = output + return +} + +func (c *InputService2ProtocolTest) InputService2TestCaseOperation1(input *InputService2TestShapeInputService2TestCaseOperation1Input) (*InputService2TestShapeInputService2TestCaseOperation1Output, error) { + req, out := c.InputService2TestCaseOperation1Request(input) + err := req.Send() + return out, err +} + +type InputService2TestShapeInputService2TestCaseOperation1Input struct { + Bar *string `locationName:"barLocationName" type:"string"` + + Foo *string `type:"string"` + + Yuck *string `locationName:"yuckLocationName" queryName:"yuckQueryName" type:"string"` + + metadataInputService2TestShapeInputService2TestCaseOperation1Input `json:"-" xml:"-"` +} + +type metadataInputService2TestShapeInputService2TestCaseOperation1Input struct { + SDKShapeTraits bool `type:"structure"` +} + +type InputService2TestShapeInputService2TestCaseOperation1Output struct { + metadataInputService2TestShapeInputService2TestCaseOperation1Output `json:"-" xml:"-"` +} + +type metadataInputService2TestShapeInputService2TestCaseOperation1Output struct { + SDKShapeTraits bool `type:"structure"` +} + +type InputService3ProtocolTest struct { + *service.Service +} + +// New returns a new InputService3ProtocolTest client. +func NewInputService3ProtocolTest(config *aws.Config) *InputService3ProtocolTest { + service := &service.Service{ + ServiceInfo: serviceinfo.ServiceInfo{ + Config: defaults.DefaultConfig.Merge(config), + ServiceName: "inputservice3protocoltest", + APIVersion: "2014-01-01", + }, + } + service.Initialize() + + // Handlers + service.Handlers.Sign.PushBack(v4.Sign) + service.Handlers.Build.PushBack(ec2query.Build) + service.Handlers.Unmarshal.PushBack(ec2query.Unmarshal) + service.Handlers.UnmarshalMeta.PushBack(ec2query.UnmarshalMeta) + service.Handlers.UnmarshalError.PushBack(ec2query.UnmarshalError) + + return &InputService3ProtocolTest{service} +} + +// newRequest creates a new request for a InputService3ProtocolTest operation and runs any +// custom request initialization. +func (c *InputService3ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { + req := c.NewRequest(op, params, data) + + return req +} + +const opInputService3TestCaseOperation1 = "OperationName" + +// InputService3TestCaseOperation1Request generates a request for the InputService3TestCaseOperation1 operation. +func (c *InputService3ProtocolTest) InputService3TestCaseOperation1Request(input *InputService3TestShapeInputService3TestCaseOperation1Input) (req *request.Request, output *InputService3TestShapeInputService3TestCaseOperation1Output) { + op := &request.Operation{ + Name: opInputService3TestCaseOperation1, + } + + if input == nil { + input = &InputService3TestShapeInputService3TestCaseOperation1Input{} + } + + req = c.newRequest(op, input, output) + output = &InputService3TestShapeInputService3TestCaseOperation1Output{} + req.Data = output + return +} + +func (c *InputService3ProtocolTest) InputService3TestCaseOperation1(input *InputService3TestShapeInputService3TestCaseOperation1Input) (*InputService3TestShapeInputService3TestCaseOperation1Output, error) { + req, out := c.InputService3TestCaseOperation1Request(input) + err := req.Send() + return out, err +} + +type InputService3TestShapeInputService3TestCaseOperation1Input struct { + StructArg *InputService3TestShapeStructType `locationName:"Struct" type:"structure"` + + metadataInputService3TestShapeInputService3TestCaseOperation1Input `json:"-" xml:"-"` +} + +type metadataInputService3TestShapeInputService3TestCaseOperation1Input struct { + SDKShapeTraits bool `type:"structure"` +} + +type InputService3TestShapeInputService3TestCaseOperation1Output struct { + metadataInputService3TestShapeInputService3TestCaseOperation1Output `json:"-" xml:"-"` +} + +type metadataInputService3TestShapeInputService3TestCaseOperation1Output struct { + SDKShapeTraits bool `type:"structure"` +} + +type InputService3TestShapeStructType struct { + ScalarArg *string `locationName:"Scalar" type:"string"` + + metadataInputService3TestShapeStructType `json:"-" xml:"-"` +} + +type metadataInputService3TestShapeStructType struct { + SDKShapeTraits bool `type:"structure"` +} + +type InputService4ProtocolTest struct { + *service.Service +} + +// New returns a new InputService4ProtocolTest client. +func NewInputService4ProtocolTest(config *aws.Config) *InputService4ProtocolTest { + service := &service.Service{ + ServiceInfo: serviceinfo.ServiceInfo{ + Config: defaults.DefaultConfig.Merge(config), + ServiceName: "inputservice4protocoltest", + APIVersion: "2014-01-01", + }, + } + service.Initialize() + + // Handlers + service.Handlers.Sign.PushBack(v4.Sign) + service.Handlers.Build.PushBack(ec2query.Build) + service.Handlers.Unmarshal.PushBack(ec2query.Unmarshal) + service.Handlers.UnmarshalMeta.PushBack(ec2query.UnmarshalMeta) + service.Handlers.UnmarshalError.PushBack(ec2query.UnmarshalError) + + return &InputService4ProtocolTest{service} +} + +// newRequest creates a new request for a InputService4ProtocolTest operation and runs any +// custom request initialization. +func (c *InputService4ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { + req := c.NewRequest(op, params, data) + + return req +} + +const opInputService4TestCaseOperation1 = "OperationName" + +// InputService4TestCaseOperation1Request generates a request for the InputService4TestCaseOperation1 operation. +func (c *InputService4ProtocolTest) InputService4TestCaseOperation1Request(input *InputService4TestShapeInputService4TestCaseOperation1Input) (req *request.Request, output *InputService4TestShapeInputService4TestCaseOperation1Output) { + op := &request.Operation{ + Name: opInputService4TestCaseOperation1, + } + + if input == nil { + input = &InputService4TestShapeInputService4TestCaseOperation1Input{} + } + + req = c.newRequest(op, input, output) + output = &InputService4TestShapeInputService4TestCaseOperation1Output{} + req.Data = output + return +} + +func (c *InputService4ProtocolTest) InputService4TestCaseOperation1(input *InputService4TestShapeInputService4TestCaseOperation1Input) (*InputService4TestShapeInputService4TestCaseOperation1Output, error) { + req, out := c.InputService4TestCaseOperation1Request(input) + err := req.Send() + return out, err +} + +type InputService4TestShapeInputService4TestCaseOperation1Input struct { + ListArg []*string `type:"list"` + + metadataInputService4TestShapeInputService4TestCaseOperation1Input `json:"-" xml:"-"` +} + +type metadataInputService4TestShapeInputService4TestCaseOperation1Input struct { + SDKShapeTraits bool `type:"structure"` +} + +type InputService4TestShapeInputService4TestCaseOperation1Output struct { + metadataInputService4TestShapeInputService4TestCaseOperation1Output `json:"-" xml:"-"` +} + +type metadataInputService4TestShapeInputService4TestCaseOperation1Output struct { + SDKShapeTraits bool `type:"structure"` +} + +type InputService5ProtocolTest struct { + *service.Service +} + +// New returns a new InputService5ProtocolTest client. +func NewInputService5ProtocolTest(config *aws.Config) *InputService5ProtocolTest { + service := &service.Service{ + ServiceInfo: serviceinfo.ServiceInfo{ + Config: defaults.DefaultConfig.Merge(config), + ServiceName: "inputservice5protocoltest", + APIVersion: "2014-01-01", + }, + } + service.Initialize() + + // Handlers + service.Handlers.Sign.PushBack(v4.Sign) + service.Handlers.Build.PushBack(ec2query.Build) + service.Handlers.Unmarshal.PushBack(ec2query.Unmarshal) + service.Handlers.UnmarshalMeta.PushBack(ec2query.UnmarshalMeta) + service.Handlers.UnmarshalError.PushBack(ec2query.UnmarshalError) + + return &InputService5ProtocolTest{service} +} + +// newRequest creates a new request for a InputService5ProtocolTest operation and runs any +// custom request initialization. +func (c *InputService5ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { + req := c.NewRequest(op, params, data) + + return req +} + +const opInputService5TestCaseOperation1 = "OperationName" + +// InputService5TestCaseOperation1Request generates a request for the InputService5TestCaseOperation1 operation. +func (c *InputService5ProtocolTest) InputService5TestCaseOperation1Request(input *InputService5TestShapeInputService5TestCaseOperation1Input) (req *request.Request, output *InputService5TestShapeInputService5TestCaseOperation1Output) { + op := &request.Operation{ + Name: opInputService5TestCaseOperation1, + } + + if input == nil { + input = &InputService5TestShapeInputService5TestCaseOperation1Input{} + } + + req = c.newRequest(op, input, output) + output = &InputService5TestShapeInputService5TestCaseOperation1Output{} + req.Data = output + return +} + +func (c *InputService5ProtocolTest) InputService5TestCaseOperation1(input *InputService5TestShapeInputService5TestCaseOperation1Input) (*InputService5TestShapeInputService5TestCaseOperation1Output, error) { + req, out := c.InputService5TestCaseOperation1Request(input) + err := req.Send() + return out, err +} + +type InputService5TestShapeInputService5TestCaseOperation1Input struct { + ListArg []*string `locationName:"ListMemberName" locationNameList:"item" type:"list"` + + metadataInputService5TestShapeInputService5TestCaseOperation1Input `json:"-" xml:"-"` +} + +type metadataInputService5TestShapeInputService5TestCaseOperation1Input struct { + SDKShapeTraits bool `type:"structure"` +} + +type InputService5TestShapeInputService5TestCaseOperation1Output struct { + metadataInputService5TestShapeInputService5TestCaseOperation1Output `json:"-" xml:"-"` +} + +type metadataInputService5TestShapeInputService5TestCaseOperation1Output struct { + SDKShapeTraits bool `type:"structure"` +} + +type InputService6ProtocolTest struct { + *service.Service +} + +// New returns a new InputService6ProtocolTest client. +func NewInputService6ProtocolTest(config *aws.Config) *InputService6ProtocolTest { + service := &service.Service{ + ServiceInfo: serviceinfo.ServiceInfo{ + Config: defaults.DefaultConfig.Merge(config), + ServiceName: "inputservice6protocoltest", + APIVersion: "2014-01-01", + }, + } + service.Initialize() + + // Handlers + service.Handlers.Sign.PushBack(v4.Sign) + service.Handlers.Build.PushBack(ec2query.Build) + service.Handlers.Unmarshal.PushBack(ec2query.Unmarshal) + service.Handlers.UnmarshalMeta.PushBack(ec2query.UnmarshalMeta) + service.Handlers.UnmarshalError.PushBack(ec2query.UnmarshalError) + + return &InputService6ProtocolTest{service} +} + +// newRequest creates a new request for a InputService6ProtocolTest operation and runs any +// custom request initialization. +func (c *InputService6ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { + req := c.NewRequest(op, params, data) + + return req +} + +const opInputService6TestCaseOperation1 = "OperationName" + +// InputService6TestCaseOperation1Request generates a request for the InputService6TestCaseOperation1 operation. +func (c *InputService6ProtocolTest) InputService6TestCaseOperation1Request(input *InputService6TestShapeInputService6TestCaseOperation1Input) (req *request.Request, output *InputService6TestShapeInputService6TestCaseOperation1Output) { + op := &request.Operation{ + Name: opInputService6TestCaseOperation1, + } + + if input == nil { + input = &InputService6TestShapeInputService6TestCaseOperation1Input{} + } + + req = c.newRequest(op, input, output) + output = &InputService6TestShapeInputService6TestCaseOperation1Output{} + req.Data = output + return +} + +func (c *InputService6ProtocolTest) InputService6TestCaseOperation1(input *InputService6TestShapeInputService6TestCaseOperation1Input) (*InputService6TestShapeInputService6TestCaseOperation1Output, error) { + req, out := c.InputService6TestCaseOperation1Request(input) + err := req.Send() + return out, err +} + +type InputService6TestShapeInputService6TestCaseOperation1Input struct { + ListArg []*string `locationName:"ListMemberName" queryName:"ListQueryName" locationNameList:"item" type:"list"` + + metadataInputService6TestShapeInputService6TestCaseOperation1Input `json:"-" xml:"-"` +} + +type metadataInputService6TestShapeInputService6TestCaseOperation1Input struct { + SDKShapeTraits bool `type:"structure"` +} + +type InputService6TestShapeInputService6TestCaseOperation1Output struct { + metadataInputService6TestShapeInputService6TestCaseOperation1Output `json:"-" xml:"-"` +} + +type metadataInputService6TestShapeInputService6TestCaseOperation1Output struct { + SDKShapeTraits bool `type:"structure"` +} + +type InputService7ProtocolTest struct { + *service.Service +} + +// New returns a new InputService7ProtocolTest client. +func NewInputService7ProtocolTest(config *aws.Config) *InputService7ProtocolTest { + service := &service.Service{ + ServiceInfo: serviceinfo.ServiceInfo{ + Config: defaults.DefaultConfig.Merge(config), + ServiceName: "inputservice7protocoltest", + APIVersion: "2014-01-01", + }, + } + service.Initialize() + + // Handlers + service.Handlers.Sign.PushBack(v4.Sign) + service.Handlers.Build.PushBack(ec2query.Build) + service.Handlers.Unmarshal.PushBack(ec2query.Unmarshal) + service.Handlers.UnmarshalMeta.PushBack(ec2query.UnmarshalMeta) + service.Handlers.UnmarshalError.PushBack(ec2query.UnmarshalError) + + return &InputService7ProtocolTest{service} +} + +// newRequest creates a new request for a InputService7ProtocolTest operation and runs any +// custom request initialization. +func (c *InputService7ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { + req := c.NewRequest(op, params, data) + + return req +} + +const opInputService7TestCaseOperation1 = "OperationName" + +// InputService7TestCaseOperation1Request generates a request for the InputService7TestCaseOperation1 operation. +func (c *InputService7ProtocolTest) InputService7TestCaseOperation1Request(input *InputService7TestShapeInputService7TestCaseOperation1Input) (req *request.Request, output *InputService7TestShapeInputService7TestCaseOperation1Output) { + op := &request.Operation{ + Name: opInputService7TestCaseOperation1, + } + + if input == nil { + input = &InputService7TestShapeInputService7TestCaseOperation1Input{} + } + + req = c.newRequest(op, input, output) + output = &InputService7TestShapeInputService7TestCaseOperation1Output{} + req.Data = output + return +} + +func (c *InputService7ProtocolTest) InputService7TestCaseOperation1(input *InputService7TestShapeInputService7TestCaseOperation1Input) (*InputService7TestShapeInputService7TestCaseOperation1Output, error) { + req, out := c.InputService7TestCaseOperation1Request(input) + err := req.Send() + return out, err +} + +type InputService7TestShapeInputService7TestCaseOperation1Input struct { + BlobArg []byte `type:"blob"` + + metadataInputService7TestShapeInputService7TestCaseOperation1Input `json:"-" xml:"-"` +} + +type metadataInputService7TestShapeInputService7TestCaseOperation1Input struct { + SDKShapeTraits bool `type:"structure"` +} + +type InputService7TestShapeInputService7TestCaseOperation1Output struct { + metadataInputService7TestShapeInputService7TestCaseOperation1Output `json:"-" xml:"-"` +} + +type metadataInputService7TestShapeInputService7TestCaseOperation1Output struct { + SDKShapeTraits bool `type:"structure"` +} + +type InputService8ProtocolTest struct { + *service.Service +} + +// New returns a new InputService8ProtocolTest client. +func NewInputService8ProtocolTest(config *aws.Config) *InputService8ProtocolTest { + service := &service.Service{ + ServiceInfo: serviceinfo.ServiceInfo{ + Config: defaults.DefaultConfig.Merge(config), + ServiceName: "inputservice8protocoltest", + APIVersion: "2014-01-01", + }, + } + service.Initialize() + + // Handlers + service.Handlers.Sign.PushBack(v4.Sign) + service.Handlers.Build.PushBack(ec2query.Build) + service.Handlers.Unmarshal.PushBack(ec2query.Unmarshal) + service.Handlers.UnmarshalMeta.PushBack(ec2query.UnmarshalMeta) + service.Handlers.UnmarshalError.PushBack(ec2query.UnmarshalError) + + return &InputService8ProtocolTest{service} +} + +// newRequest creates a new request for a InputService8ProtocolTest operation and runs any +// custom request initialization. +func (c *InputService8ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { + req := c.NewRequest(op, params, data) + + return req +} + +const opInputService8TestCaseOperation1 = "OperationName" + +// InputService8TestCaseOperation1Request generates a request for the InputService8TestCaseOperation1 operation. +func (c *InputService8ProtocolTest) InputService8TestCaseOperation1Request(input *InputService8TestShapeInputService8TestCaseOperation1Input) (req *request.Request, output *InputService8TestShapeInputService8TestCaseOperation1Output) { + op := &request.Operation{ + Name: opInputService8TestCaseOperation1, + } + + if input == nil { + input = &InputService8TestShapeInputService8TestCaseOperation1Input{} + } + + req = c.newRequest(op, input, output) + output = &InputService8TestShapeInputService8TestCaseOperation1Output{} + req.Data = output + return +} + +func (c *InputService8ProtocolTest) InputService8TestCaseOperation1(input *InputService8TestShapeInputService8TestCaseOperation1Input) (*InputService8TestShapeInputService8TestCaseOperation1Output, error) { + req, out := c.InputService8TestCaseOperation1Request(input) + err := req.Send() + return out, err +} + +type InputService8TestShapeInputService8TestCaseOperation1Input struct { + TimeArg *time.Time `type:"timestamp" timestampFormat:"iso8601"` + + metadataInputService8TestShapeInputService8TestCaseOperation1Input `json:"-" xml:"-"` +} + +type metadataInputService8TestShapeInputService8TestCaseOperation1Input struct { + SDKShapeTraits bool `type:"structure"` +} + +type InputService8TestShapeInputService8TestCaseOperation1Output struct { + metadataInputService8TestShapeInputService8TestCaseOperation1Output `json:"-" xml:"-"` +} + +type metadataInputService8TestShapeInputService8TestCaseOperation1Output struct { + SDKShapeTraits bool `type:"structure"` +} + +// +// Tests begin here +// + +func TestInputService1ProtocolTestScalarMembersCase1(t *testing.T) { + svc := NewInputService1ProtocolTest(nil) + svc.Endpoint = "https://test" + + input := &InputService1TestShapeInputService1TestCaseOperation1Input{ + Bar: aws.String("val2"), + Foo: aws.String("val1"), + } + req, _ := svc.InputService1TestCaseOperation1Request(input) + r := req.HTTPRequest + + // build request + ec2query.Build(req) + assert.NoError(t, req.Error) + + // assert body + assert.NotNil(t, r.Body) + body, _ := ioutil.ReadAll(r.Body) + awstesting.AssertQuery(t, `Action=OperationName&Bar=val2&Foo=val1&Version=2014-01-01`, util.Trim(string(body))) + + // assert URL + awstesting.AssertURL(t, "https://test/", r.URL.String()) + + // assert headers + +} + +func TestInputService2ProtocolTestStructureWithLocationNameAndQueryNameAppliedToMembersCase1(t *testing.T) { + svc := NewInputService2ProtocolTest(nil) + svc.Endpoint = "https://test" + + input := &InputService2TestShapeInputService2TestCaseOperation1Input{ + Bar: aws.String("val2"), + Foo: aws.String("val1"), + Yuck: aws.String("val3"), + } + req, _ := svc.InputService2TestCaseOperation1Request(input) + r := req.HTTPRequest + + // build request + ec2query.Build(req) + assert.NoError(t, req.Error) + + // assert body + assert.NotNil(t, r.Body) + body, _ := ioutil.ReadAll(r.Body) + awstesting.AssertQuery(t, `Action=OperationName&BarLocationName=val2&Foo=val1&Version=2014-01-01&yuckQueryName=val3`, util.Trim(string(body))) + + // assert URL + awstesting.AssertURL(t, "https://test/", r.URL.String()) + + // assert headers + +} + +func TestInputService3ProtocolTestNestedStructureMembersCase1(t *testing.T) { + svc := NewInputService3ProtocolTest(nil) + svc.Endpoint = "https://test" + + input := &InputService3TestShapeInputService3TestCaseOperation1Input{ + StructArg: &InputService3TestShapeStructType{ + ScalarArg: aws.String("foo"), + }, + } + req, _ := svc.InputService3TestCaseOperation1Request(input) + r := req.HTTPRequest + + // build request + ec2query.Build(req) + assert.NoError(t, req.Error) + + // assert body + assert.NotNil(t, r.Body) + body, _ := ioutil.ReadAll(r.Body) + awstesting.AssertQuery(t, `Action=OperationName&Struct.Scalar=foo&Version=2014-01-01`, util.Trim(string(body))) + + // assert URL + awstesting.AssertURL(t, "https://test/", r.URL.String()) + + // assert headers + +} + +func TestInputService4ProtocolTestListTypesCase1(t *testing.T) { + svc := NewInputService4ProtocolTest(nil) + svc.Endpoint = "https://test" + + input := &InputService4TestShapeInputService4TestCaseOperation1Input{ + ListArg: []*string{ + aws.String("foo"), + aws.String("bar"), + aws.String("baz"), + }, + } + req, _ := svc.InputService4TestCaseOperation1Request(input) + r := req.HTTPRequest + + // build request + ec2query.Build(req) + assert.NoError(t, req.Error) + + // assert body + assert.NotNil(t, r.Body) + body, _ := ioutil.ReadAll(r.Body) + awstesting.AssertQuery(t, `Action=OperationName&ListArg.1=foo&ListArg.2=bar&ListArg.3=baz&Version=2014-01-01`, util.Trim(string(body))) + + // assert URL + awstesting.AssertURL(t, "https://test/", r.URL.String()) + + // assert headers + +} + +func TestInputService5ProtocolTestListWithLocationNameAppliedToMemberCase1(t *testing.T) { + svc := NewInputService5ProtocolTest(nil) + svc.Endpoint = "https://test" + + input := &InputService5TestShapeInputService5TestCaseOperation1Input{ + ListArg: []*string{ + aws.String("a"), + aws.String("b"), + aws.String("c"), + }, + } + req, _ := svc.InputService5TestCaseOperation1Request(input) + r := req.HTTPRequest + + // build request + ec2query.Build(req) + assert.NoError(t, req.Error) + + // assert body + assert.NotNil(t, r.Body) + body, _ := ioutil.ReadAll(r.Body) + awstesting.AssertQuery(t, `Action=OperationName&ListMemberName.1=a&ListMemberName.2=b&ListMemberName.3=c&Version=2014-01-01`, util.Trim(string(body))) + + // assert URL + awstesting.AssertURL(t, "https://test/", r.URL.String()) + + // assert headers + +} + +func TestInputService6ProtocolTestListWithLocationNameAndQueryNameCase1(t *testing.T) { + svc := NewInputService6ProtocolTest(nil) + svc.Endpoint = "https://test" + + input := &InputService6TestShapeInputService6TestCaseOperation1Input{ + ListArg: []*string{ + aws.String("a"), + aws.String("b"), + aws.String("c"), + }, + } + req, _ := svc.InputService6TestCaseOperation1Request(input) + r := req.HTTPRequest + + // build request + ec2query.Build(req) + assert.NoError(t, req.Error) + + // assert body + assert.NotNil(t, r.Body) + body, _ := ioutil.ReadAll(r.Body) + awstesting.AssertQuery(t, `Action=OperationName&ListQueryName.1=a&ListQueryName.2=b&ListQueryName.3=c&Version=2014-01-01`, util.Trim(string(body))) + + // assert URL + awstesting.AssertURL(t, "https://test/", r.URL.String()) + + // assert headers + +} + +func TestInputService7ProtocolTestBase64EncodedBlobsCase1(t *testing.T) { + svc := NewInputService7ProtocolTest(nil) + svc.Endpoint = "https://test" + + input := &InputService7TestShapeInputService7TestCaseOperation1Input{ + BlobArg: []byte("foo"), + } + req, _ := svc.InputService7TestCaseOperation1Request(input) + r := req.HTTPRequest + + // build request + ec2query.Build(req) + assert.NoError(t, req.Error) + + // assert body + assert.NotNil(t, r.Body) + body, _ := ioutil.ReadAll(r.Body) + awstesting.AssertQuery(t, `Action=OperationName&BlobArg=Zm9v&Version=2014-01-01`, util.Trim(string(body))) + + // assert URL + awstesting.AssertURL(t, "https://test/", r.URL.String()) + + // assert headers + +} + +func TestInputService8ProtocolTestTimestampValuesCase1(t *testing.T) { + svc := NewInputService8ProtocolTest(nil) + svc.Endpoint = "https://test" + + input := &InputService8TestShapeInputService8TestCaseOperation1Input{ + TimeArg: aws.Time(time.Unix(1422172800, 0)), + } + req, _ := svc.InputService8TestCaseOperation1Request(input) + r := req.HTTPRequest + + // build request + ec2query.Build(req) + assert.NoError(t, req.Error) + + // assert body + assert.NotNil(t, r.Body) + body, _ := ioutil.ReadAll(r.Body) + awstesting.AssertQuery(t, `Action=OperationName&TimeArg=2015-01-25T08%3A00%3A00Z&Version=2014-01-01`, util.Trim(string(body))) + + // assert URL + awstesting.AssertURL(t, "https://test/", r.URL.String()) + + // assert headers + +} diff --git a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/private/protocol/ec2query/unmarshal.go b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/private/protocol/ec2query/unmarshal.go new file mode 100644 index 00000000000..658190f7051 --- /dev/null +++ b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/private/protocol/ec2query/unmarshal.go @@ -0,0 +1,54 @@ +package ec2query + +//go:generate go run ../../../models/protocol_tests/generate.go ../../../models/protocol_tests/output/ec2.json unmarshal_test.go + +import ( + "encoding/xml" + "io" + + "github.com/aws/aws-sdk-go/aws/awserr" + "github.com/aws/aws-sdk-go/aws/request" + "github.com/aws/aws-sdk-go/private/protocol/xml/xmlutil" +) + +// Unmarshal unmarshals a response body for the EC2 protocol. +func Unmarshal(r *request.Request) { + defer r.HTTPResponse.Body.Close() + if r.DataFilled() { + decoder := xml.NewDecoder(r.HTTPResponse.Body) + err := xmlutil.UnmarshalXML(r.Data, decoder, "") + if err != nil { + r.Error = awserr.New("SerializationError", "failed decoding EC2 Query response", err) + return + } + } +} + +// UnmarshalMeta unmarshals response headers for the EC2 protocol. +func UnmarshalMeta(r *request.Request) { + // TODO implement unmarshaling of request IDs +} + +type xmlErrorResponse struct { + XMLName xml.Name `xml:"Response"` + Code string `xml:"Errors>Error>Code"` + Message string `xml:"Errors>Error>Message"` + RequestID string `xml:"RequestId"` +} + +// UnmarshalError unmarshals a response error for the EC2 protocol. +func UnmarshalError(r *request.Request) { + defer r.HTTPResponse.Body.Close() + + resp := &xmlErrorResponse{} + err := xml.NewDecoder(r.HTTPResponse.Body).Decode(resp) + if err != nil && err != io.EOF { + r.Error = awserr.New("SerializationError", "failed decoding EC2 Query error response", err) + } else { + r.Error = awserr.NewRequestFailure( + awserr.New(resp.Code, resp.Message, nil), + r.HTTPResponse.StatusCode, + resp.RequestID, + ) + } +} diff --git a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/private/protocol/ec2query/unmarshal_test.go b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/private/protocol/ec2query/unmarshal_test.go new file mode 100644 index 00000000000..b9ee3dc7667 --- /dev/null +++ b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/private/protocol/ec2query/unmarshal_test.go @@ -0,0 +1,838 @@ +package ec2query_test + +import ( + "bytes" + "encoding/json" + "encoding/xml" + "io" + "io/ioutil" + "net/http" + "net/url" + "testing" + "time" + + "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/aws/defaults" + "github.com/aws/aws-sdk-go/aws/request" + "github.com/aws/aws-sdk-go/aws/service" + "github.com/aws/aws-sdk-go/aws/service/serviceinfo" + "github.com/aws/aws-sdk-go/awstesting" + "github.com/aws/aws-sdk-go/private/protocol/ec2query" + "github.com/aws/aws-sdk-go/private/protocol/xml/xmlutil" + "github.com/aws/aws-sdk-go/private/signer/v4" + "github.com/aws/aws-sdk-go/private/util" + "github.com/stretchr/testify/assert" +) + +var _ bytes.Buffer // always import bytes +var _ http.Request +var _ json.Marshaler +var _ time.Time +var _ xmlutil.XMLNode +var _ xml.Attr +var _ = awstesting.GenerateAssertions +var _ = ioutil.Discard +var _ = util.Trim("") +var _ = url.Values{} +var _ = io.EOF + +type OutputService1ProtocolTest struct { + *service.Service +} + +// New returns a new OutputService1ProtocolTest client. +func NewOutputService1ProtocolTest(config *aws.Config) *OutputService1ProtocolTest { + service := &service.Service{ + ServiceInfo: serviceinfo.ServiceInfo{ + Config: defaults.DefaultConfig.Merge(config), + ServiceName: "outputservice1protocoltest", + APIVersion: "", + }, + } + service.Initialize() + + // Handlers + service.Handlers.Sign.PushBack(v4.Sign) + service.Handlers.Build.PushBack(ec2query.Build) + service.Handlers.Unmarshal.PushBack(ec2query.Unmarshal) + service.Handlers.UnmarshalMeta.PushBack(ec2query.UnmarshalMeta) + service.Handlers.UnmarshalError.PushBack(ec2query.UnmarshalError) + + return &OutputService1ProtocolTest{service} +} + +// newRequest creates a new request for a OutputService1ProtocolTest operation and runs any +// custom request initialization. +func (c *OutputService1ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { + req := c.NewRequest(op, params, data) + + return req +} + +const opOutputService1TestCaseOperation1 = "OperationName" + +// OutputService1TestCaseOperation1Request generates a request for the OutputService1TestCaseOperation1 operation. +func (c *OutputService1ProtocolTest) OutputService1TestCaseOperation1Request(input *OutputService1TestShapeOutputService1TestCaseOperation1Input) (req *request.Request, output *OutputService1TestShapeOutputService1TestCaseOperation1Output) { + op := &request.Operation{ + Name: opOutputService1TestCaseOperation1, + } + + if input == nil { + input = &OutputService1TestShapeOutputService1TestCaseOperation1Input{} + } + + req = c.newRequest(op, input, output) + output = &OutputService1TestShapeOutputService1TestCaseOperation1Output{} + req.Data = output + return +} + +func (c *OutputService1ProtocolTest) OutputService1TestCaseOperation1(input *OutputService1TestShapeOutputService1TestCaseOperation1Input) (*OutputService1TestShapeOutputService1TestCaseOperation1Output, error) { + req, out := c.OutputService1TestCaseOperation1Request(input) + err := req.Send() + return out, err +} + +type OutputService1TestShapeOutputService1TestCaseOperation1Input struct { + metadataOutputService1TestShapeOutputService1TestCaseOperation1Input `json:"-" xml:"-"` +} + +type metadataOutputService1TestShapeOutputService1TestCaseOperation1Input struct { + SDKShapeTraits bool `type:"structure"` +} + +type OutputService1TestShapeOutputService1TestCaseOperation1Output struct { + Char *string `type:"character"` + + Double *float64 `type:"double"` + + FalseBool *bool `type:"boolean"` + + Float *float64 `type:"float"` + + Long *int64 `type:"long"` + + Num *int64 `locationName:"FooNum" type:"integer"` + + Str *string `type:"string"` + + TrueBool *bool `type:"boolean"` + + metadataOutputService1TestShapeOutputService1TestCaseOperation1Output `json:"-" xml:"-"` +} + +type metadataOutputService1TestShapeOutputService1TestCaseOperation1Output struct { + SDKShapeTraits bool `type:"structure"` +} + +type OutputService2ProtocolTest struct { + *service.Service +} + +// New returns a new OutputService2ProtocolTest client. +func NewOutputService2ProtocolTest(config *aws.Config) *OutputService2ProtocolTest { + service := &service.Service{ + ServiceInfo: serviceinfo.ServiceInfo{ + Config: defaults.DefaultConfig.Merge(config), + ServiceName: "outputservice2protocoltest", + APIVersion: "", + }, + } + service.Initialize() + + // Handlers + service.Handlers.Sign.PushBack(v4.Sign) + service.Handlers.Build.PushBack(ec2query.Build) + service.Handlers.Unmarshal.PushBack(ec2query.Unmarshal) + service.Handlers.UnmarshalMeta.PushBack(ec2query.UnmarshalMeta) + service.Handlers.UnmarshalError.PushBack(ec2query.UnmarshalError) + + return &OutputService2ProtocolTest{service} +} + +// newRequest creates a new request for a OutputService2ProtocolTest operation and runs any +// custom request initialization. +func (c *OutputService2ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { + req := c.NewRequest(op, params, data) + + return req +} + +const opOutputService2TestCaseOperation1 = "OperationName" + +// OutputService2TestCaseOperation1Request generates a request for the OutputService2TestCaseOperation1 operation. +func (c *OutputService2ProtocolTest) OutputService2TestCaseOperation1Request(input *OutputService2TestShapeOutputService2TestCaseOperation1Input) (req *request.Request, output *OutputService2TestShapeOutputService2TestCaseOperation1Output) { + op := &request.Operation{ + Name: opOutputService2TestCaseOperation1, + } + + if input == nil { + input = &OutputService2TestShapeOutputService2TestCaseOperation1Input{} + } + + req = c.newRequest(op, input, output) + output = &OutputService2TestShapeOutputService2TestCaseOperation1Output{} + req.Data = output + return +} + +func (c *OutputService2ProtocolTest) OutputService2TestCaseOperation1(input *OutputService2TestShapeOutputService2TestCaseOperation1Input) (*OutputService2TestShapeOutputService2TestCaseOperation1Output, error) { + req, out := c.OutputService2TestCaseOperation1Request(input) + err := req.Send() + return out, err +} + +type OutputService2TestShapeOutputService2TestCaseOperation1Input struct { + metadataOutputService2TestShapeOutputService2TestCaseOperation1Input `json:"-" xml:"-"` +} + +type metadataOutputService2TestShapeOutputService2TestCaseOperation1Input struct { + SDKShapeTraits bool `type:"structure"` +} + +type OutputService2TestShapeOutputService2TestCaseOperation1Output struct { + Blob []byte `type:"blob"` + + metadataOutputService2TestShapeOutputService2TestCaseOperation1Output `json:"-" xml:"-"` +} + +type metadataOutputService2TestShapeOutputService2TestCaseOperation1Output struct { + SDKShapeTraits bool `type:"structure"` +} + +type OutputService3ProtocolTest struct { + *service.Service +} + +// New returns a new OutputService3ProtocolTest client. +func NewOutputService3ProtocolTest(config *aws.Config) *OutputService3ProtocolTest { + service := &service.Service{ + ServiceInfo: serviceinfo.ServiceInfo{ + Config: defaults.DefaultConfig.Merge(config), + ServiceName: "outputservice3protocoltest", + APIVersion: "", + }, + } + service.Initialize() + + // Handlers + service.Handlers.Sign.PushBack(v4.Sign) + service.Handlers.Build.PushBack(ec2query.Build) + service.Handlers.Unmarshal.PushBack(ec2query.Unmarshal) + service.Handlers.UnmarshalMeta.PushBack(ec2query.UnmarshalMeta) + service.Handlers.UnmarshalError.PushBack(ec2query.UnmarshalError) + + return &OutputService3ProtocolTest{service} +} + +// newRequest creates a new request for a OutputService3ProtocolTest operation and runs any +// custom request initialization. +func (c *OutputService3ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { + req := c.NewRequest(op, params, data) + + return req +} + +const opOutputService3TestCaseOperation1 = "OperationName" + +// OutputService3TestCaseOperation1Request generates a request for the OutputService3TestCaseOperation1 operation. +func (c *OutputService3ProtocolTest) OutputService3TestCaseOperation1Request(input *OutputService3TestShapeOutputService3TestCaseOperation1Input) (req *request.Request, output *OutputService3TestShapeOutputService3TestCaseOperation1Output) { + op := &request.Operation{ + Name: opOutputService3TestCaseOperation1, + } + + if input == nil { + input = &OutputService3TestShapeOutputService3TestCaseOperation1Input{} + } + + req = c.newRequest(op, input, output) + output = &OutputService3TestShapeOutputService3TestCaseOperation1Output{} + req.Data = output + return +} + +func (c *OutputService3ProtocolTest) OutputService3TestCaseOperation1(input *OutputService3TestShapeOutputService3TestCaseOperation1Input) (*OutputService3TestShapeOutputService3TestCaseOperation1Output, error) { + req, out := c.OutputService3TestCaseOperation1Request(input) + err := req.Send() + return out, err +} + +type OutputService3TestShapeOutputService3TestCaseOperation1Input struct { + metadataOutputService3TestShapeOutputService3TestCaseOperation1Input `json:"-" xml:"-"` +} + +type metadataOutputService3TestShapeOutputService3TestCaseOperation1Input struct { + SDKShapeTraits bool `type:"structure"` +} + +type OutputService3TestShapeOutputService3TestCaseOperation1Output struct { + ListMember []*string `type:"list"` + + metadataOutputService3TestShapeOutputService3TestCaseOperation1Output `json:"-" xml:"-"` +} + +type metadataOutputService3TestShapeOutputService3TestCaseOperation1Output struct { + SDKShapeTraits bool `type:"structure"` +} + +type OutputService4ProtocolTest struct { + *service.Service +} + +// New returns a new OutputService4ProtocolTest client. +func NewOutputService4ProtocolTest(config *aws.Config) *OutputService4ProtocolTest { + service := &service.Service{ + ServiceInfo: serviceinfo.ServiceInfo{ + Config: defaults.DefaultConfig.Merge(config), + ServiceName: "outputservice4protocoltest", + APIVersion: "", + }, + } + service.Initialize() + + // Handlers + service.Handlers.Sign.PushBack(v4.Sign) + service.Handlers.Build.PushBack(ec2query.Build) + service.Handlers.Unmarshal.PushBack(ec2query.Unmarshal) + service.Handlers.UnmarshalMeta.PushBack(ec2query.UnmarshalMeta) + service.Handlers.UnmarshalError.PushBack(ec2query.UnmarshalError) + + return &OutputService4ProtocolTest{service} +} + +// newRequest creates a new request for a OutputService4ProtocolTest operation and runs any +// custom request initialization. +func (c *OutputService4ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { + req := c.NewRequest(op, params, data) + + return req +} + +const opOutputService4TestCaseOperation1 = "OperationName" + +// OutputService4TestCaseOperation1Request generates a request for the OutputService4TestCaseOperation1 operation. +func (c *OutputService4ProtocolTest) OutputService4TestCaseOperation1Request(input *OutputService4TestShapeOutputService4TestCaseOperation1Input) (req *request.Request, output *OutputService4TestShapeOutputService4TestCaseOperation1Output) { + op := &request.Operation{ + Name: opOutputService4TestCaseOperation1, + } + + if input == nil { + input = &OutputService4TestShapeOutputService4TestCaseOperation1Input{} + } + + req = c.newRequest(op, input, output) + output = &OutputService4TestShapeOutputService4TestCaseOperation1Output{} + req.Data = output + return +} + +func (c *OutputService4ProtocolTest) OutputService4TestCaseOperation1(input *OutputService4TestShapeOutputService4TestCaseOperation1Input) (*OutputService4TestShapeOutputService4TestCaseOperation1Output, error) { + req, out := c.OutputService4TestCaseOperation1Request(input) + err := req.Send() + return out, err +} + +type OutputService4TestShapeOutputService4TestCaseOperation1Input struct { + metadataOutputService4TestShapeOutputService4TestCaseOperation1Input `json:"-" xml:"-"` +} + +type metadataOutputService4TestShapeOutputService4TestCaseOperation1Input struct { + SDKShapeTraits bool `type:"structure"` +} + +type OutputService4TestShapeOutputService4TestCaseOperation1Output struct { + ListMember []*string `locationNameList:"item" type:"list"` + + metadataOutputService4TestShapeOutputService4TestCaseOperation1Output `json:"-" xml:"-"` +} + +type metadataOutputService4TestShapeOutputService4TestCaseOperation1Output struct { + SDKShapeTraits bool `type:"structure"` +} + +type OutputService5ProtocolTest struct { + *service.Service +} + +// New returns a new OutputService5ProtocolTest client. +func NewOutputService5ProtocolTest(config *aws.Config) *OutputService5ProtocolTest { + service := &service.Service{ + ServiceInfo: serviceinfo.ServiceInfo{ + Config: defaults.DefaultConfig.Merge(config), + ServiceName: "outputservice5protocoltest", + APIVersion: "", + }, + } + service.Initialize() + + // Handlers + service.Handlers.Sign.PushBack(v4.Sign) + service.Handlers.Build.PushBack(ec2query.Build) + service.Handlers.Unmarshal.PushBack(ec2query.Unmarshal) + service.Handlers.UnmarshalMeta.PushBack(ec2query.UnmarshalMeta) + service.Handlers.UnmarshalError.PushBack(ec2query.UnmarshalError) + + return &OutputService5ProtocolTest{service} +} + +// newRequest creates a new request for a OutputService5ProtocolTest operation and runs any +// custom request initialization. +func (c *OutputService5ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { + req := c.NewRequest(op, params, data) + + return req +} + +const opOutputService5TestCaseOperation1 = "OperationName" + +// OutputService5TestCaseOperation1Request generates a request for the OutputService5TestCaseOperation1 operation. +func (c *OutputService5ProtocolTest) OutputService5TestCaseOperation1Request(input *OutputService5TestShapeOutputService5TestCaseOperation1Input) (req *request.Request, output *OutputService5TestShapeOutputService5TestCaseOperation1Output) { + op := &request.Operation{ + Name: opOutputService5TestCaseOperation1, + } + + if input == nil { + input = &OutputService5TestShapeOutputService5TestCaseOperation1Input{} + } + + req = c.newRequest(op, input, output) + output = &OutputService5TestShapeOutputService5TestCaseOperation1Output{} + req.Data = output + return +} + +func (c *OutputService5ProtocolTest) OutputService5TestCaseOperation1(input *OutputService5TestShapeOutputService5TestCaseOperation1Input) (*OutputService5TestShapeOutputService5TestCaseOperation1Output, error) { + req, out := c.OutputService5TestCaseOperation1Request(input) + err := req.Send() + return out, err +} + +type OutputService5TestShapeOutputService5TestCaseOperation1Input struct { + metadataOutputService5TestShapeOutputService5TestCaseOperation1Input `json:"-" xml:"-"` +} + +type metadataOutputService5TestShapeOutputService5TestCaseOperation1Input struct { + SDKShapeTraits bool `type:"structure"` +} + +type OutputService5TestShapeOutputService5TestCaseOperation1Output struct { + ListMember []*string `type:"list" flattened:"true"` + + metadataOutputService5TestShapeOutputService5TestCaseOperation1Output `json:"-" xml:"-"` +} + +type metadataOutputService5TestShapeOutputService5TestCaseOperation1Output struct { + SDKShapeTraits bool `type:"structure"` +} + +type OutputService6ProtocolTest struct { + *service.Service +} + +// New returns a new OutputService6ProtocolTest client. +func NewOutputService6ProtocolTest(config *aws.Config) *OutputService6ProtocolTest { + service := &service.Service{ + ServiceInfo: serviceinfo.ServiceInfo{ + Config: defaults.DefaultConfig.Merge(config), + ServiceName: "outputservice6protocoltest", + APIVersion: "", + }, + } + service.Initialize() + + // Handlers + service.Handlers.Sign.PushBack(v4.Sign) + service.Handlers.Build.PushBack(ec2query.Build) + service.Handlers.Unmarshal.PushBack(ec2query.Unmarshal) + service.Handlers.UnmarshalMeta.PushBack(ec2query.UnmarshalMeta) + service.Handlers.UnmarshalError.PushBack(ec2query.UnmarshalError) + + return &OutputService6ProtocolTest{service} +} + +// newRequest creates a new request for a OutputService6ProtocolTest operation and runs any +// custom request initialization. +func (c *OutputService6ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { + req := c.NewRequest(op, params, data) + + return req +} + +const opOutputService6TestCaseOperation1 = "OperationName" + +// OutputService6TestCaseOperation1Request generates a request for the OutputService6TestCaseOperation1 operation. +func (c *OutputService6ProtocolTest) OutputService6TestCaseOperation1Request(input *OutputService6TestShapeOutputService6TestCaseOperation1Input) (req *request.Request, output *OutputService6TestShapeOutputService6TestCaseOperation1Output) { + op := &request.Operation{ + Name: opOutputService6TestCaseOperation1, + } + + if input == nil { + input = &OutputService6TestShapeOutputService6TestCaseOperation1Input{} + } + + req = c.newRequest(op, input, output) + output = &OutputService6TestShapeOutputService6TestCaseOperation1Output{} + req.Data = output + return +} + +func (c *OutputService6ProtocolTest) OutputService6TestCaseOperation1(input *OutputService6TestShapeOutputService6TestCaseOperation1Input) (*OutputService6TestShapeOutputService6TestCaseOperation1Output, error) { + req, out := c.OutputService6TestCaseOperation1Request(input) + err := req.Send() + return out, err +} + +type OutputService6TestShapeOutputService6TestCaseOperation1Input struct { + metadataOutputService6TestShapeOutputService6TestCaseOperation1Input `json:"-" xml:"-"` +} + +type metadataOutputService6TestShapeOutputService6TestCaseOperation1Input struct { + SDKShapeTraits bool `type:"structure"` +} + +type OutputService6TestShapeOutputService6TestCaseOperation1Output struct { + Map map[string]*OutputService6TestShapeStructureType `type:"map"` + + metadataOutputService6TestShapeOutputService6TestCaseOperation1Output `json:"-" xml:"-"` +} + +type metadataOutputService6TestShapeOutputService6TestCaseOperation1Output struct { + SDKShapeTraits bool `type:"structure"` +} + +type OutputService6TestShapeStructureType struct { + Foo *string `locationName:"foo" type:"string"` + + metadataOutputService6TestShapeStructureType `json:"-" xml:"-"` +} + +type metadataOutputService6TestShapeStructureType struct { + SDKShapeTraits bool `type:"structure"` +} + +type OutputService7ProtocolTest struct { + *service.Service +} + +// New returns a new OutputService7ProtocolTest client. +func NewOutputService7ProtocolTest(config *aws.Config) *OutputService7ProtocolTest { + service := &service.Service{ + ServiceInfo: serviceinfo.ServiceInfo{ + Config: defaults.DefaultConfig.Merge(config), + ServiceName: "outputservice7protocoltest", + APIVersion: "", + }, + } + service.Initialize() + + // Handlers + service.Handlers.Sign.PushBack(v4.Sign) + service.Handlers.Build.PushBack(ec2query.Build) + service.Handlers.Unmarshal.PushBack(ec2query.Unmarshal) + service.Handlers.UnmarshalMeta.PushBack(ec2query.UnmarshalMeta) + service.Handlers.UnmarshalError.PushBack(ec2query.UnmarshalError) + + return &OutputService7ProtocolTest{service} +} + +// newRequest creates a new request for a OutputService7ProtocolTest operation and runs any +// custom request initialization. +func (c *OutputService7ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { + req := c.NewRequest(op, params, data) + + return req +} + +const opOutputService7TestCaseOperation1 = "OperationName" + +// OutputService7TestCaseOperation1Request generates a request for the OutputService7TestCaseOperation1 operation. +func (c *OutputService7ProtocolTest) OutputService7TestCaseOperation1Request(input *OutputService7TestShapeOutputService7TestCaseOperation1Input) (req *request.Request, output *OutputService7TestShapeOutputService7TestCaseOperation1Output) { + op := &request.Operation{ + Name: opOutputService7TestCaseOperation1, + } + + if input == nil { + input = &OutputService7TestShapeOutputService7TestCaseOperation1Input{} + } + + req = c.newRequest(op, input, output) + output = &OutputService7TestShapeOutputService7TestCaseOperation1Output{} + req.Data = output + return +} + +func (c *OutputService7ProtocolTest) OutputService7TestCaseOperation1(input *OutputService7TestShapeOutputService7TestCaseOperation1Input) (*OutputService7TestShapeOutputService7TestCaseOperation1Output, error) { + req, out := c.OutputService7TestCaseOperation1Request(input) + err := req.Send() + return out, err +} + +type OutputService7TestShapeOutputService7TestCaseOperation1Input struct { + metadataOutputService7TestShapeOutputService7TestCaseOperation1Input `json:"-" xml:"-"` +} + +type metadataOutputService7TestShapeOutputService7TestCaseOperation1Input struct { + SDKShapeTraits bool `type:"structure"` +} + +type OutputService7TestShapeOutputService7TestCaseOperation1Output struct { + Map map[string]*string `type:"map" flattened:"true"` + + metadataOutputService7TestShapeOutputService7TestCaseOperation1Output `json:"-" xml:"-"` +} + +type metadataOutputService7TestShapeOutputService7TestCaseOperation1Output struct { + SDKShapeTraits bool `type:"structure"` +} + +type OutputService8ProtocolTest struct { + *service.Service +} + +// New returns a new OutputService8ProtocolTest client. +func NewOutputService8ProtocolTest(config *aws.Config) *OutputService8ProtocolTest { + service := &service.Service{ + ServiceInfo: serviceinfo.ServiceInfo{ + Config: defaults.DefaultConfig.Merge(config), + ServiceName: "outputservice8protocoltest", + APIVersion: "", + }, + } + service.Initialize() + + // Handlers + service.Handlers.Sign.PushBack(v4.Sign) + service.Handlers.Build.PushBack(ec2query.Build) + service.Handlers.Unmarshal.PushBack(ec2query.Unmarshal) + service.Handlers.UnmarshalMeta.PushBack(ec2query.UnmarshalMeta) + service.Handlers.UnmarshalError.PushBack(ec2query.UnmarshalError) + + return &OutputService8ProtocolTest{service} +} + +// newRequest creates a new request for a OutputService8ProtocolTest operation and runs any +// custom request initialization. +func (c *OutputService8ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { + req := c.NewRequest(op, params, data) + + return req +} + +const opOutputService8TestCaseOperation1 = "OperationName" + +// OutputService8TestCaseOperation1Request generates a request for the OutputService8TestCaseOperation1 operation. +func (c *OutputService8ProtocolTest) OutputService8TestCaseOperation1Request(input *OutputService8TestShapeOutputService8TestCaseOperation1Input) (req *request.Request, output *OutputService8TestShapeOutputService8TestCaseOperation1Output) { + op := &request.Operation{ + Name: opOutputService8TestCaseOperation1, + } + + if input == nil { + input = &OutputService8TestShapeOutputService8TestCaseOperation1Input{} + } + + req = c.newRequest(op, input, output) + output = &OutputService8TestShapeOutputService8TestCaseOperation1Output{} + req.Data = output + return +} + +func (c *OutputService8ProtocolTest) OutputService8TestCaseOperation1(input *OutputService8TestShapeOutputService8TestCaseOperation1Input) (*OutputService8TestShapeOutputService8TestCaseOperation1Output, error) { + req, out := c.OutputService8TestCaseOperation1Request(input) + err := req.Send() + return out, err +} + +type OutputService8TestShapeOutputService8TestCaseOperation1Input struct { + metadataOutputService8TestShapeOutputService8TestCaseOperation1Input `json:"-" xml:"-"` +} + +type metadataOutputService8TestShapeOutputService8TestCaseOperation1Input struct { + SDKShapeTraits bool `type:"structure"` +} + +type OutputService8TestShapeOutputService8TestCaseOperation1Output struct { + Map map[string]*string `locationNameKey:"foo" locationNameValue:"bar" type:"map" flattened:"true"` + + metadataOutputService8TestShapeOutputService8TestCaseOperation1Output `json:"-" xml:"-"` +} + +type metadataOutputService8TestShapeOutputService8TestCaseOperation1Output struct { + SDKShapeTraits bool `type:"structure"` +} + +// +// Tests begin here +// + +func TestOutputService1ProtocolTestScalarMembersCase1(t *testing.T) { + svc := NewOutputService1ProtocolTest(nil) + + buf := bytes.NewReader([]byte("myname123falsetrue1.21.3200arequest-id")) + req, out := svc.OutputService1TestCaseOperation1Request(nil) + req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}} + + // set headers + + // unmarshal response + ec2query.UnmarshalMeta(req) + ec2query.Unmarshal(req) + assert.NoError(t, req.Error) + + // assert response + assert.NotNil(t, out) // ensure out variable is used + assert.Equal(t, "a", *out.Char) + assert.Equal(t, 1.3, *out.Double) + assert.Equal(t, false, *out.FalseBool) + assert.Equal(t, 1.2, *out.Float) + assert.Equal(t, int64(200), *out.Long) + assert.Equal(t, int64(123), *out.Num) + assert.Equal(t, "myname", *out.Str) + assert.Equal(t, true, *out.TrueBool) + +} + +func TestOutputService2ProtocolTestBlobCase1(t *testing.T) { + svc := NewOutputService2ProtocolTest(nil) + + buf := bytes.NewReader([]byte("dmFsdWU=requestid")) + req, out := svc.OutputService2TestCaseOperation1Request(nil) + req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}} + + // set headers + + // unmarshal response + ec2query.UnmarshalMeta(req) + ec2query.Unmarshal(req) + assert.NoError(t, req.Error) + + // assert response + assert.NotNil(t, out) // ensure out variable is used + assert.Equal(t, "value", string(out.Blob)) + +} + +func TestOutputService3ProtocolTestListsCase1(t *testing.T) { + svc := NewOutputService3ProtocolTest(nil) + + buf := bytes.NewReader([]byte("abc123requestid")) + req, out := svc.OutputService3TestCaseOperation1Request(nil) + req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}} + + // set headers + + // unmarshal response + ec2query.UnmarshalMeta(req) + ec2query.Unmarshal(req) + assert.NoError(t, req.Error) + + // assert response + assert.NotNil(t, out) // ensure out variable is used + assert.Equal(t, "abc", *out.ListMember[0]) + assert.Equal(t, "123", *out.ListMember[1]) + +} + +func TestOutputService4ProtocolTestListWithCustomMemberNameCase1(t *testing.T) { + svc := NewOutputService4ProtocolTest(nil) + + buf := bytes.NewReader([]byte("abc123requestid")) + req, out := svc.OutputService4TestCaseOperation1Request(nil) + req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}} + + // set headers + + // unmarshal response + ec2query.UnmarshalMeta(req) + ec2query.Unmarshal(req) + assert.NoError(t, req.Error) + + // assert response + assert.NotNil(t, out) // ensure out variable is used + assert.Equal(t, "abc", *out.ListMember[0]) + assert.Equal(t, "123", *out.ListMember[1]) + +} + +func TestOutputService5ProtocolTestFlattenedListCase1(t *testing.T) { + svc := NewOutputService5ProtocolTest(nil) + + buf := bytes.NewReader([]byte("abc123requestid")) + req, out := svc.OutputService5TestCaseOperation1Request(nil) + req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}} + + // set headers + + // unmarshal response + ec2query.UnmarshalMeta(req) + ec2query.Unmarshal(req) + assert.NoError(t, req.Error) + + // assert response + assert.NotNil(t, out) // ensure out variable is used + assert.Equal(t, "abc", *out.ListMember[0]) + assert.Equal(t, "123", *out.ListMember[1]) + +} + +func TestOutputService6ProtocolTestNormalMapCase1(t *testing.T) { + svc := NewOutputService6ProtocolTest(nil) + + buf := bytes.NewReader([]byte("quxbarbazbamrequestid")) + req, out := svc.OutputService6TestCaseOperation1Request(nil) + req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}} + + // set headers + + // unmarshal response + ec2query.UnmarshalMeta(req) + ec2query.Unmarshal(req) + assert.NoError(t, req.Error) + + // assert response + assert.NotNil(t, out) // ensure out variable is used + assert.Equal(t, "bam", *out.Map["baz"].Foo) + assert.Equal(t, "bar", *out.Map["qux"].Foo) + +} + +func TestOutputService7ProtocolTestFlattenedMapCase1(t *testing.T) { + svc := NewOutputService7ProtocolTest(nil) + + buf := bytes.NewReader([]byte("quxbarbazbamrequestid")) + req, out := svc.OutputService7TestCaseOperation1Request(nil) + req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}} + + // set headers + + // unmarshal response + ec2query.UnmarshalMeta(req) + ec2query.Unmarshal(req) + assert.NoError(t, req.Error) + + // assert response + assert.NotNil(t, out) // ensure out variable is used + assert.Equal(t, "bam", *out.Map["baz"]) + assert.Equal(t, "bar", *out.Map["qux"]) + +} + +func TestOutputService8ProtocolTestNamedMapCase1(t *testing.T) { + svc := NewOutputService8ProtocolTest(nil) + + buf := bytes.NewReader([]byte("quxbarbazbamrequestid")) + req, out := svc.OutputService8TestCaseOperation1Request(nil) + req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}} + + // set headers + + // unmarshal response + ec2query.UnmarshalMeta(req) + ec2query.Unmarshal(req) + assert.NoError(t, req.Error) + + // assert response + assert.NotNil(t, out) // ensure out variable is used + assert.Equal(t, "bam", *out.Map["baz"]) + assert.Equal(t, "bar", *out.Map["qux"]) + +} diff --git a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/private/protocol/query/build.go b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/private/protocol/query/build.go new file mode 100644 index 00000000000..b6b0b54d25d --- /dev/null +++ b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/private/protocol/query/build.go @@ -0,0 +1,33 @@ +// Package query provides serialisation of AWS query requests, and responses. +package query + +//go:generate go run ../../../models/protocol_tests/generate.go ../../../models/protocol_tests/input/query.json build_test.go + +import ( + "net/url" + + "github.com/aws/aws-sdk-go/aws/awserr" + "github.com/aws/aws-sdk-go/aws/request" + "github.com/aws/aws-sdk-go/private/protocol/query/queryutil" +) + +// Build builds a request for an AWS Query service. +func Build(r *request.Request) { + body := url.Values{ + "Action": {r.Operation.Name}, + "Version": {r.Service.APIVersion}, + } + if err := queryutil.Parse(body, r.Params, false); err != nil { + r.Error = awserr.New("SerializationError", "failed encoding Query request", err) + return + } + + if r.ExpireTime == 0 { + r.HTTPRequest.Method = "POST" + r.HTTPRequest.Header.Set("Content-Type", "application/x-www-form-urlencoded; charset=utf-8") + r.SetBufferBody([]byte(body.Encode())) + } else { // This is a pre-signed request + r.HTTPRequest.Method = "GET" + r.HTTPRequest.URL.RawQuery = body.Encode() + } +} diff --git a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/private/protocol/query/build_test.go b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/private/protocol/query/build_test.go new file mode 100644 index 00000000000..824fb6c1703 --- /dev/null +++ b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/private/protocol/query/build_test.go @@ -0,0 +1,1439 @@ +package query_test + +import ( + "bytes" + "encoding/json" + "encoding/xml" + "io" + "io/ioutil" + "net/http" + "net/url" + "testing" + "time" + + "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/aws/defaults" + "github.com/aws/aws-sdk-go/aws/request" + "github.com/aws/aws-sdk-go/aws/service" + "github.com/aws/aws-sdk-go/aws/service/serviceinfo" + "github.com/aws/aws-sdk-go/awstesting" + "github.com/aws/aws-sdk-go/private/protocol/query" + "github.com/aws/aws-sdk-go/private/protocol/xml/xmlutil" + "github.com/aws/aws-sdk-go/private/signer/v4" + "github.com/aws/aws-sdk-go/private/util" + "github.com/stretchr/testify/assert" +) + +var _ bytes.Buffer // always import bytes +var _ http.Request +var _ json.Marshaler +var _ time.Time +var _ xmlutil.XMLNode +var _ xml.Attr +var _ = awstesting.GenerateAssertions +var _ = ioutil.Discard +var _ = util.Trim("") +var _ = url.Values{} +var _ = io.EOF + +type InputService1ProtocolTest struct { + *service.Service +} + +// New returns a new InputService1ProtocolTest client. +func NewInputService1ProtocolTest(config *aws.Config) *InputService1ProtocolTest { + service := &service.Service{ + ServiceInfo: serviceinfo.ServiceInfo{ + Config: defaults.DefaultConfig.Merge(config), + ServiceName: "inputservice1protocoltest", + APIVersion: "2014-01-01", + }, + } + service.Initialize() + + // Handlers + service.Handlers.Sign.PushBack(v4.Sign) + service.Handlers.Build.PushBack(query.Build) + service.Handlers.Unmarshal.PushBack(query.Unmarshal) + service.Handlers.UnmarshalMeta.PushBack(query.UnmarshalMeta) + service.Handlers.UnmarshalError.PushBack(query.UnmarshalError) + + return &InputService1ProtocolTest{service} +} + +// newRequest creates a new request for a InputService1ProtocolTest operation and runs any +// custom request initialization. +func (c *InputService1ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { + req := c.NewRequest(op, params, data) + + return req +} + +const opInputService1TestCaseOperation1 = "OperationName" + +// InputService1TestCaseOperation1Request generates a request for the InputService1TestCaseOperation1 operation. +func (c *InputService1ProtocolTest) InputService1TestCaseOperation1Request(input *InputService1TestShapeInputService1TestCaseOperation1Input) (req *request.Request, output *InputService1TestShapeInputService1TestCaseOperation1Output) { + op := &request.Operation{ + Name: opInputService1TestCaseOperation1, + } + + if input == nil { + input = &InputService1TestShapeInputService1TestCaseOperation1Input{} + } + + req = c.newRequest(op, input, output) + output = &InputService1TestShapeInputService1TestCaseOperation1Output{} + req.Data = output + return +} + +func (c *InputService1ProtocolTest) InputService1TestCaseOperation1(input *InputService1TestShapeInputService1TestCaseOperation1Input) (*InputService1TestShapeInputService1TestCaseOperation1Output, error) { + req, out := c.InputService1TestCaseOperation1Request(input) + err := req.Send() + return out, err +} + +type InputService1TestShapeInputService1TestCaseOperation1Input struct { + Bar *string `type:"string"` + + Foo *string `type:"string"` + + metadataInputService1TestShapeInputService1TestCaseOperation1Input `json:"-" xml:"-"` +} + +type metadataInputService1TestShapeInputService1TestCaseOperation1Input struct { + SDKShapeTraits bool `type:"structure"` +} + +type InputService1TestShapeInputService1TestCaseOperation1Output struct { + metadataInputService1TestShapeInputService1TestCaseOperation1Output `json:"-" xml:"-"` +} + +type metadataInputService1TestShapeInputService1TestCaseOperation1Output struct { + SDKShapeTraits bool `type:"structure"` +} + +type InputService2ProtocolTest struct { + *service.Service +} + +// New returns a new InputService2ProtocolTest client. +func NewInputService2ProtocolTest(config *aws.Config) *InputService2ProtocolTest { + service := &service.Service{ + ServiceInfo: serviceinfo.ServiceInfo{ + Config: defaults.DefaultConfig.Merge(config), + ServiceName: "inputservice2protocoltest", + APIVersion: "2014-01-01", + }, + } + service.Initialize() + + // Handlers + service.Handlers.Sign.PushBack(v4.Sign) + service.Handlers.Build.PushBack(query.Build) + service.Handlers.Unmarshal.PushBack(query.Unmarshal) + service.Handlers.UnmarshalMeta.PushBack(query.UnmarshalMeta) + service.Handlers.UnmarshalError.PushBack(query.UnmarshalError) + + return &InputService2ProtocolTest{service} +} + +// newRequest creates a new request for a InputService2ProtocolTest operation and runs any +// custom request initialization. +func (c *InputService2ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { + req := c.NewRequest(op, params, data) + + return req +} + +const opInputService2TestCaseOperation1 = "OperationName" + +// InputService2TestCaseOperation1Request generates a request for the InputService2TestCaseOperation1 operation. +func (c *InputService2ProtocolTest) InputService2TestCaseOperation1Request(input *InputService2TestShapeInputService2TestCaseOperation1Input) (req *request.Request, output *InputService2TestShapeInputService2TestCaseOperation1Output) { + op := &request.Operation{ + Name: opInputService2TestCaseOperation1, + } + + if input == nil { + input = &InputService2TestShapeInputService2TestCaseOperation1Input{} + } + + req = c.newRequest(op, input, output) + output = &InputService2TestShapeInputService2TestCaseOperation1Output{} + req.Data = output + return +} + +func (c *InputService2ProtocolTest) InputService2TestCaseOperation1(input *InputService2TestShapeInputService2TestCaseOperation1Input) (*InputService2TestShapeInputService2TestCaseOperation1Output, error) { + req, out := c.InputService2TestCaseOperation1Request(input) + err := req.Send() + return out, err +} + +type InputService2TestShapeInputService2TestCaseOperation1Input struct { + StructArg *InputService2TestShapeStructType `type:"structure"` + + metadataInputService2TestShapeInputService2TestCaseOperation1Input `json:"-" xml:"-"` +} + +type metadataInputService2TestShapeInputService2TestCaseOperation1Input struct { + SDKShapeTraits bool `type:"structure"` +} + +type InputService2TestShapeInputService2TestCaseOperation1Output struct { + metadataInputService2TestShapeInputService2TestCaseOperation1Output `json:"-" xml:"-"` +} + +type metadataInputService2TestShapeInputService2TestCaseOperation1Output struct { + SDKShapeTraits bool `type:"structure"` +} + +type InputService2TestShapeStructType struct { + ScalarArg *string `type:"string"` + + metadataInputService2TestShapeStructType `json:"-" xml:"-"` +} + +type metadataInputService2TestShapeStructType struct { + SDKShapeTraits bool `type:"structure"` +} + +type InputService3ProtocolTest struct { + *service.Service +} + +// New returns a new InputService3ProtocolTest client. +func NewInputService3ProtocolTest(config *aws.Config) *InputService3ProtocolTest { + service := &service.Service{ + ServiceInfo: serviceinfo.ServiceInfo{ + Config: defaults.DefaultConfig.Merge(config), + ServiceName: "inputservice3protocoltest", + APIVersion: "2014-01-01", + }, + } + service.Initialize() + + // Handlers + service.Handlers.Sign.PushBack(v4.Sign) + service.Handlers.Build.PushBack(query.Build) + service.Handlers.Unmarshal.PushBack(query.Unmarshal) + service.Handlers.UnmarshalMeta.PushBack(query.UnmarshalMeta) + service.Handlers.UnmarshalError.PushBack(query.UnmarshalError) + + return &InputService3ProtocolTest{service} +} + +// newRequest creates a new request for a InputService3ProtocolTest operation and runs any +// custom request initialization. +func (c *InputService3ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { + req := c.NewRequest(op, params, data) + + return req +} + +const opInputService3TestCaseOperation1 = "OperationName" + +// InputService3TestCaseOperation1Request generates a request for the InputService3TestCaseOperation1 operation. +func (c *InputService3ProtocolTest) InputService3TestCaseOperation1Request(input *InputService3TestShapeInputService3TestCaseOperation1Input) (req *request.Request, output *InputService3TestShapeInputService3TestCaseOperation1Output) { + op := &request.Operation{ + Name: opInputService3TestCaseOperation1, + } + + if input == nil { + input = &InputService3TestShapeInputService3TestCaseOperation1Input{} + } + + req = c.newRequest(op, input, output) + output = &InputService3TestShapeInputService3TestCaseOperation1Output{} + req.Data = output + return +} + +func (c *InputService3ProtocolTest) InputService3TestCaseOperation1(input *InputService3TestShapeInputService3TestCaseOperation1Input) (*InputService3TestShapeInputService3TestCaseOperation1Output, error) { + req, out := c.InputService3TestCaseOperation1Request(input) + err := req.Send() + return out, err +} + +type InputService3TestShapeInputService3TestCaseOperation1Input struct { + ListArg []*string `type:"list"` + + metadataInputService3TestShapeInputService3TestCaseOperation1Input `json:"-" xml:"-"` +} + +type metadataInputService3TestShapeInputService3TestCaseOperation1Input struct { + SDKShapeTraits bool `type:"structure"` +} + +type InputService3TestShapeInputService3TestCaseOperation1Output struct { + metadataInputService3TestShapeInputService3TestCaseOperation1Output `json:"-" xml:"-"` +} + +type metadataInputService3TestShapeInputService3TestCaseOperation1Output struct { + SDKShapeTraits bool `type:"structure"` +} + +type InputService4ProtocolTest struct { + *service.Service +} + +// New returns a new InputService4ProtocolTest client. +func NewInputService4ProtocolTest(config *aws.Config) *InputService4ProtocolTest { + service := &service.Service{ + ServiceInfo: serviceinfo.ServiceInfo{ + Config: defaults.DefaultConfig.Merge(config), + ServiceName: "inputservice4protocoltest", + APIVersion: "2014-01-01", + }, + } + service.Initialize() + + // Handlers + service.Handlers.Sign.PushBack(v4.Sign) + service.Handlers.Build.PushBack(query.Build) + service.Handlers.Unmarshal.PushBack(query.Unmarshal) + service.Handlers.UnmarshalMeta.PushBack(query.UnmarshalMeta) + service.Handlers.UnmarshalError.PushBack(query.UnmarshalError) + + return &InputService4ProtocolTest{service} +} + +// newRequest creates a new request for a InputService4ProtocolTest operation and runs any +// custom request initialization. +func (c *InputService4ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { + req := c.NewRequest(op, params, data) + + return req +} + +const opInputService4TestCaseOperation1 = "OperationName" + +// InputService4TestCaseOperation1Request generates a request for the InputService4TestCaseOperation1 operation. +func (c *InputService4ProtocolTest) InputService4TestCaseOperation1Request(input *InputService4TestShapeInputService4TestCaseOperation1Input) (req *request.Request, output *InputService4TestShapeInputService4TestCaseOperation1Output) { + op := &request.Operation{ + Name: opInputService4TestCaseOperation1, + } + + if input == nil { + input = &InputService4TestShapeInputService4TestCaseOperation1Input{} + } + + req = c.newRequest(op, input, output) + output = &InputService4TestShapeInputService4TestCaseOperation1Output{} + req.Data = output + return +} + +func (c *InputService4ProtocolTest) InputService4TestCaseOperation1(input *InputService4TestShapeInputService4TestCaseOperation1Input) (*InputService4TestShapeInputService4TestCaseOperation1Output, error) { + req, out := c.InputService4TestCaseOperation1Request(input) + err := req.Send() + return out, err +} + +type InputService4TestShapeInputService4TestCaseOperation1Input struct { + ListArg []*string `type:"list" flattened:"true"` + + ScalarArg *string `type:"string"` + + metadataInputService4TestShapeInputService4TestCaseOperation1Input `json:"-" xml:"-"` +} + +type metadataInputService4TestShapeInputService4TestCaseOperation1Input struct { + SDKShapeTraits bool `type:"structure"` +} + +type InputService4TestShapeInputService4TestCaseOperation1Output struct { + metadataInputService4TestShapeInputService4TestCaseOperation1Output `json:"-" xml:"-"` +} + +type metadataInputService4TestShapeInputService4TestCaseOperation1Output struct { + SDKShapeTraits bool `type:"structure"` +} + +type InputService5ProtocolTest struct { + *service.Service +} + +// New returns a new InputService5ProtocolTest client. +func NewInputService5ProtocolTest(config *aws.Config) *InputService5ProtocolTest { + service := &service.Service{ + ServiceInfo: serviceinfo.ServiceInfo{ + Config: defaults.DefaultConfig.Merge(config), + ServiceName: "inputservice5protocoltest", + APIVersion: "2014-01-01", + }, + } + service.Initialize() + + // Handlers + service.Handlers.Sign.PushBack(v4.Sign) + service.Handlers.Build.PushBack(query.Build) + service.Handlers.Unmarshal.PushBack(query.Unmarshal) + service.Handlers.UnmarshalMeta.PushBack(query.UnmarshalMeta) + service.Handlers.UnmarshalError.PushBack(query.UnmarshalError) + + return &InputService5ProtocolTest{service} +} + +// newRequest creates a new request for a InputService5ProtocolTest operation and runs any +// custom request initialization. +func (c *InputService5ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { + req := c.NewRequest(op, params, data) + + return req +} + +const opInputService5TestCaseOperation1 = "OperationName" + +// InputService5TestCaseOperation1Request generates a request for the InputService5TestCaseOperation1 operation. +func (c *InputService5ProtocolTest) InputService5TestCaseOperation1Request(input *InputService5TestShapeInputService5TestCaseOperation1Input) (req *request.Request, output *InputService5TestShapeInputService5TestCaseOperation1Output) { + op := &request.Operation{ + Name: opInputService5TestCaseOperation1, + } + + if input == nil { + input = &InputService5TestShapeInputService5TestCaseOperation1Input{} + } + + req = c.newRequest(op, input, output) + output = &InputService5TestShapeInputService5TestCaseOperation1Output{} + req.Data = output + return +} + +func (c *InputService5ProtocolTest) InputService5TestCaseOperation1(input *InputService5TestShapeInputService5TestCaseOperation1Input) (*InputService5TestShapeInputService5TestCaseOperation1Output, error) { + req, out := c.InputService5TestCaseOperation1Request(input) + err := req.Send() + return out, err +} + +type InputService5TestShapeInputService5TestCaseOperation1Input struct { + ListArg []*string `locationNameList:"ListArgLocation" type:"list" flattened:"true"` + + ScalarArg *string `type:"string"` + + metadataInputService5TestShapeInputService5TestCaseOperation1Input `json:"-" xml:"-"` +} + +type metadataInputService5TestShapeInputService5TestCaseOperation1Input struct { + SDKShapeTraits bool `type:"structure"` +} + +type InputService5TestShapeInputService5TestCaseOperation1Output struct { + metadataInputService5TestShapeInputService5TestCaseOperation1Output `json:"-" xml:"-"` +} + +type metadataInputService5TestShapeInputService5TestCaseOperation1Output struct { + SDKShapeTraits bool `type:"structure"` +} + +type InputService6ProtocolTest struct { + *service.Service +} + +// New returns a new InputService6ProtocolTest client. +func NewInputService6ProtocolTest(config *aws.Config) *InputService6ProtocolTest { + service := &service.Service{ + ServiceInfo: serviceinfo.ServiceInfo{ + Config: defaults.DefaultConfig.Merge(config), + ServiceName: "inputservice6protocoltest", + APIVersion: "2014-01-01", + }, + } + service.Initialize() + + // Handlers + service.Handlers.Sign.PushBack(v4.Sign) + service.Handlers.Build.PushBack(query.Build) + service.Handlers.Unmarshal.PushBack(query.Unmarshal) + service.Handlers.UnmarshalMeta.PushBack(query.UnmarshalMeta) + service.Handlers.UnmarshalError.PushBack(query.UnmarshalError) + + return &InputService6ProtocolTest{service} +} + +// newRequest creates a new request for a InputService6ProtocolTest operation and runs any +// custom request initialization. +func (c *InputService6ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { + req := c.NewRequest(op, params, data) + + return req +} + +const opInputService6TestCaseOperation1 = "OperationName" + +// InputService6TestCaseOperation1Request generates a request for the InputService6TestCaseOperation1 operation. +func (c *InputService6ProtocolTest) InputService6TestCaseOperation1Request(input *InputService6TestShapeInputService6TestCaseOperation1Input) (req *request.Request, output *InputService6TestShapeInputService6TestCaseOperation1Output) { + op := &request.Operation{ + Name: opInputService6TestCaseOperation1, + } + + if input == nil { + input = &InputService6TestShapeInputService6TestCaseOperation1Input{} + } + + req = c.newRequest(op, input, output) + output = &InputService6TestShapeInputService6TestCaseOperation1Output{} + req.Data = output + return +} + +func (c *InputService6ProtocolTest) InputService6TestCaseOperation1(input *InputService6TestShapeInputService6TestCaseOperation1Input) (*InputService6TestShapeInputService6TestCaseOperation1Output, error) { + req, out := c.InputService6TestCaseOperation1Request(input) + err := req.Send() + return out, err +} + +type InputService6TestShapeInputService6TestCaseOperation1Input struct { + MapArg map[string]*string `type:"map"` + + metadataInputService6TestShapeInputService6TestCaseOperation1Input `json:"-" xml:"-"` +} + +type metadataInputService6TestShapeInputService6TestCaseOperation1Input struct { + SDKShapeTraits bool `type:"structure"` +} + +type InputService6TestShapeInputService6TestCaseOperation1Output struct { + metadataInputService6TestShapeInputService6TestCaseOperation1Output `json:"-" xml:"-"` +} + +type metadataInputService6TestShapeInputService6TestCaseOperation1Output struct { + SDKShapeTraits bool `type:"structure"` +} + +type InputService7ProtocolTest struct { + *service.Service +} + +// New returns a new InputService7ProtocolTest client. +func NewInputService7ProtocolTest(config *aws.Config) *InputService7ProtocolTest { + service := &service.Service{ + ServiceInfo: serviceinfo.ServiceInfo{ + Config: defaults.DefaultConfig.Merge(config), + ServiceName: "inputservice7protocoltest", + APIVersion: "2014-01-01", + }, + } + service.Initialize() + + // Handlers + service.Handlers.Sign.PushBack(v4.Sign) + service.Handlers.Build.PushBack(query.Build) + service.Handlers.Unmarshal.PushBack(query.Unmarshal) + service.Handlers.UnmarshalMeta.PushBack(query.UnmarshalMeta) + service.Handlers.UnmarshalError.PushBack(query.UnmarshalError) + + return &InputService7ProtocolTest{service} +} + +// newRequest creates a new request for a InputService7ProtocolTest operation and runs any +// custom request initialization. +func (c *InputService7ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { + req := c.NewRequest(op, params, data) + + return req +} + +const opInputService7TestCaseOperation1 = "OperationName" + +// InputService7TestCaseOperation1Request generates a request for the InputService7TestCaseOperation1 operation. +func (c *InputService7ProtocolTest) InputService7TestCaseOperation1Request(input *InputService7TestShapeInputService7TestCaseOperation1Input) (req *request.Request, output *InputService7TestShapeInputService7TestCaseOperation1Output) { + op := &request.Operation{ + Name: opInputService7TestCaseOperation1, + } + + if input == nil { + input = &InputService7TestShapeInputService7TestCaseOperation1Input{} + } + + req = c.newRequest(op, input, output) + output = &InputService7TestShapeInputService7TestCaseOperation1Output{} + req.Data = output + return +} + +func (c *InputService7ProtocolTest) InputService7TestCaseOperation1(input *InputService7TestShapeInputService7TestCaseOperation1Input) (*InputService7TestShapeInputService7TestCaseOperation1Output, error) { + req, out := c.InputService7TestCaseOperation1Request(input) + err := req.Send() + return out, err +} + +type InputService7TestShapeInputService7TestCaseOperation1Input struct { + MapArg map[string]*string `locationNameKey:"TheKey" locationNameValue:"TheValue" type:"map"` + + metadataInputService7TestShapeInputService7TestCaseOperation1Input `json:"-" xml:"-"` +} + +type metadataInputService7TestShapeInputService7TestCaseOperation1Input struct { + SDKShapeTraits bool `type:"structure"` +} + +type InputService7TestShapeInputService7TestCaseOperation1Output struct { + metadataInputService7TestShapeInputService7TestCaseOperation1Output `json:"-" xml:"-"` +} + +type metadataInputService7TestShapeInputService7TestCaseOperation1Output struct { + SDKShapeTraits bool `type:"structure"` +} + +type InputService8ProtocolTest struct { + *service.Service +} + +// New returns a new InputService8ProtocolTest client. +func NewInputService8ProtocolTest(config *aws.Config) *InputService8ProtocolTest { + service := &service.Service{ + ServiceInfo: serviceinfo.ServiceInfo{ + Config: defaults.DefaultConfig.Merge(config), + ServiceName: "inputservice8protocoltest", + APIVersion: "2014-01-01", + }, + } + service.Initialize() + + // Handlers + service.Handlers.Sign.PushBack(v4.Sign) + service.Handlers.Build.PushBack(query.Build) + service.Handlers.Unmarshal.PushBack(query.Unmarshal) + service.Handlers.UnmarshalMeta.PushBack(query.UnmarshalMeta) + service.Handlers.UnmarshalError.PushBack(query.UnmarshalError) + + return &InputService8ProtocolTest{service} +} + +// newRequest creates a new request for a InputService8ProtocolTest operation and runs any +// custom request initialization. +func (c *InputService8ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { + req := c.NewRequest(op, params, data) + + return req +} + +const opInputService8TestCaseOperation1 = "OperationName" + +// InputService8TestCaseOperation1Request generates a request for the InputService8TestCaseOperation1 operation. +func (c *InputService8ProtocolTest) InputService8TestCaseOperation1Request(input *InputService8TestShapeInputService8TestCaseOperation1Input) (req *request.Request, output *InputService8TestShapeInputService8TestCaseOperation1Output) { + op := &request.Operation{ + Name: opInputService8TestCaseOperation1, + } + + if input == nil { + input = &InputService8TestShapeInputService8TestCaseOperation1Input{} + } + + req = c.newRequest(op, input, output) + output = &InputService8TestShapeInputService8TestCaseOperation1Output{} + req.Data = output + return +} + +func (c *InputService8ProtocolTest) InputService8TestCaseOperation1(input *InputService8TestShapeInputService8TestCaseOperation1Input) (*InputService8TestShapeInputService8TestCaseOperation1Output, error) { + req, out := c.InputService8TestCaseOperation1Request(input) + err := req.Send() + return out, err +} + +type InputService8TestShapeInputService8TestCaseOperation1Input struct { + BlobArg []byte `type:"blob"` + + metadataInputService8TestShapeInputService8TestCaseOperation1Input `json:"-" xml:"-"` +} + +type metadataInputService8TestShapeInputService8TestCaseOperation1Input struct { + SDKShapeTraits bool `type:"structure"` +} + +type InputService8TestShapeInputService8TestCaseOperation1Output struct { + metadataInputService8TestShapeInputService8TestCaseOperation1Output `json:"-" xml:"-"` +} + +type metadataInputService8TestShapeInputService8TestCaseOperation1Output struct { + SDKShapeTraits bool `type:"structure"` +} + +type InputService9ProtocolTest struct { + *service.Service +} + +// New returns a new InputService9ProtocolTest client. +func NewInputService9ProtocolTest(config *aws.Config) *InputService9ProtocolTest { + service := &service.Service{ + ServiceInfo: serviceinfo.ServiceInfo{ + Config: defaults.DefaultConfig.Merge(config), + ServiceName: "inputservice9protocoltest", + APIVersion: "2014-01-01", + }, + } + service.Initialize() + + // Handlers + service.Handlers.Sign.PushBack(v4.Sign) + service.Handlers.Build.PushBack(query.Build) + service.Handlers.Unmarshal.PushBack(query.Unmarshal) + service.Handlers.UnmarshalMeta.PushBack(query.UnmarshalMeta) + service.Handlers.UnmarshalError.PushBack(query.UnmarshalError) + + return &InputService9ProtocolTest{service} +} + +// newRequest creates a new request for a InputService9ProtocolTest operation and runs any +// custom request initialization. +func (c *InputService9ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { + req := c.NewRequest(op, params, data) + + return req +} + +const opInputService9TestCaseOperation1 = "OperationName" + +// InputService9TestCaseOperation1Request generates a request for the InputService9TestCaseOperation1 operation. +func (c *InputService9ProtocolTest) InputService9TestCaseOperation1Request(input *InputService9TestShapeInputService9TestCaseOperation1Input) (req *request.Request, output *InputService9TestShapeInputService9TestCaseOperation1Output) { + op := &request.Operation{ + Name: opInputService9TestCaseOperation1, + } + + if input == nil { + input = &InputService9TestShapeInputService9TestCaseOperation1Input{} + } + + req = c.newRequest(op, input, output) + output = &InputService9TestShapeInputService9TestCaseOperation1Output{} + req.Data = output + return +} + +func (c *InputService9ProtocolTest) InputService9TestCaseOperation1(input *InputService9TestShapeInputService9TestCaseOperation1Input) (*InputService9TestShapeInputService9TestCaseOperation1Output, error) { + req, out := c.InputService9TestCaseOperation1Request(input) + err := req.Send() + return out, err +} + +type InputService9TestShapeInputService9TestCaseOperation1Input struct { + TimeArg *time.Time `type:"timestamp" timestampFormat:"iso8601"` + + metadataInputService9TestShapeInputService9TestCaseOperation1Input `json:"-" xml:"-"` +} + +type metadataInputService9TestShapeInputService9TestCaseOperation1Input struct { + SDKShapeTraits bool `type:"structure"` +} + +type InputService9TestShapeInputService9TestCaseOperation1Output struct { + metadataInputService9TestShapeInputService9TestCaseOperation1Output `json:"-" xml:"-"` +} + +type metadataInputService9TestShapeInputService9TestCaseOperation1Output struct { + SDKShapeTraits bool `type:"structure"` +} + +type InputService10ProtocolTest struct { + *service.Service +} + +// New returns a new InputService10ProtocolTest client. +func NewInputService10ProtocolTest(config *aws.Config) *InputService10ProtocolTest { + service := &service.Service{ + ServiceInfo: serviceinfo.ServiceInfo{ + Config: defaults.DefaultConfig.Merge(config), + ServiceName: "inputservice10protocoltest", + APIVersion: "2014-01-01", + }, + } + service.Initialize() + + // Handlers + service.Handlers.Sign.PushBack(v4.Sign) + service.Handlers.Build.PushBack(query.Build) + service.Handlers.Unmarshal.PushBack(query.Unmarshal) + service.Handlers.UnmarshalMeta.PushBack(query.UnmarshalMeta) + service.Handlers.UnmarshalError.PushBack(query.UnmarshalError) + + return &InputService10ProtocolTest{service} +} + +// newRequest creates a new request for a InputService10ProtocolTest operation and runs any +// custom request initialization. +func (c *InputService10ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { + req := c.NewRequest(op, params, data) + + return req +} + +const opInputService10TestCaseOperation1 = "OperationName" + +// InputService10TestCaseOperation1Request generates a request for the InputService10TestCaseOperation1 operation. +func (c *InputService10ProtocolTest) InputService10TestCaseOperation1Request(input *InputService10TestShapeInputShape) (req *request.Request, output *InputService10TestShapeInputService10TestCaseOperation1Output) { + op := &request.Operation{ + Name: opInputService10TestCaseOperation1, + } + + if input == nil { + input = &InputService10TestShapeInputShape{} + } + + req = c.newRequest(op, input, output) + output = &InputService10TestShapeInputService10TestCaseOperation1Output{} + req.Data = output + return +} + +func (c *InputService10ProtocolTest) InputService10TestCaseOperation1(input *InputService10TestShapeInputShape) (*InputService10TestShapeInputService10TestCaseOperation1Output, error) { + req, out := c.InputService10TestCaseOperation1Request(input) + err := req.Send() + return out, err +} + +const opInputService10TestCaseOperation2 = "OperationName" + +// InputService10TestCaseOperation2Request generates a request for the InputService10TestCaseOperation2 operation. +func (c *InputService10ProtocolTest) InputService10TestCaseOperation2Request(input *InputService10TestShapeInputShape) (req *request.Request, output *InputService10TestShapeInputService10TestCaseOperation2Output) { + op := &request.Operation{ + Name: opInputService10TestCaseOperation2, + } + + if input == nil { + input = &InputService10TestShapeInputShape{} + } + + req = c.newRequest(op, input, output) + output = &InputService10TestShapeInputService10TestCaseOperation2Output{} + req.Data = output + return +} + +func (c *InputService10ProtocolTest) InputService10TestCaseOperation2(input *InputService10TestShapeInputShape) (*InputService10TestShapeInputService10TestCaseOperation2Output, error) { + req, out := c.InputService10TestCaseOperation2Request(input) + err := req.Send() + return out, err +} + +const opInputService10TestCaseOperation3 = "OperationName" + +// InputService10TestCaseOperation3Request generates a request for the InputService10TestCaseOperation3 operation. +func (c *InputService10ProtocolTest) InputService10TestCaseOperation3Request(input *InputService10TestShapeInputShape) (req *request.Request, output *InputService10TestShapeInputService10TestCaseOperation3Output) { + op := &request.Operation{ + Name: opInputService10TestCaseOperation3, + } + + if input == nil { + input = &InputService10TestShapeInputShape{} + } + + req = c.newRequest(op, input, output) + output = &InputService10TestShapeInputService10TestCaseOperation3Output{} + req.Data = output + return +} + +func (c *InputService10ProtocolTest) InputService10TestCaseOperation3(input *InputService10TestShapeInputShape) (*InputService10TestShapeInputService10TestCaseOperation3Output, error) { + req, out := c.InputService10TestCaseOperation3Request(input) + err := req.Send() + return out, err +} + +const opInputService10TestCaseOperation4 = "OperationName" + +// InputService10TestCaseOperation4Request generates a request for the InputService10TestCaseOperation4 operation. +func (c *InputService10ProtocolTest) InputService10TestCaseOperation4Request(input *InputService10TestShapeInputShape) (req *request.Request, output *InputService10TestShapeInputService10TestCaseOperation4Output) { + op := &request.Operation{ + Name: opInputService10TestCaseOperation4, + } + + if input == nil { + input = &InputService10TestShapeInputShape{} + } + + req = c.newRequest(op, input, output) + output = &InputService10TestShapeInputService10TestCaseOperation4Output{} + req.Data = output + return +} + +func (c *InputService10ProtocolTest) InputService10TestCaseOperation4(input *InputService10TestShapeInputShape) (*InputService10TestShapeInputService10TestCaseOperation4Output, error) { + req, out := c.InputService10TestCaseOperation4Request(input) + err := req.Send() + return out, err +} + +const opInputService10TestCaseOperation5 = "OperationName" + +// InputService10TestCaseOperation5Request generates a request for the InputService10TestCaseOperation5 operation. +func (c *InputService10ProtocolTest) InputService10TestCaseOperation5Request(input *InputService10TestShapeInputShape) (req *request.Request, output *InputService10TestShapeInputService10TestCaseOperation5Output) { + op := &request.Operation{ + Name: opInputService10TestCaseOperation5, + } + + if input == nil { + input = &InputService10TestShapeInputShape{} + } + + req = c.newRequest(op, input, output) + output = &InputService10TestShapeInputService10TestCaseOperation5Output{} + req.Data = output + return +} + +func (c *InputService10ProtocolTest) InputService10TestCaseOperation5(input *InputService10TestShapeInputShape) (*InputService10TestShapeInputService10TestCaseOperation5Output, error) { + req, out := c.InputService10TestCaseOperation5Request(input) + err := req.Send() + return out, err +} + +const opInputService10TestCaseOperation6 = "OperationName" + +// InputService10TestCaseOperation6Request generates a request for the InputService10TestCaseOperation6 operation. +func (c *InputService10ProtocolTest) InputService10TestCaseOperation6Request(input *InputService10TestShapeInputShape) (req *request.Request, output *InputService10TestShapeInputService10TestCaseOperation6Output) { + op := &request.Operation{ + Name: opInputService10TestCaseOperation6, + } + + if input == nil { + input = &InputService10TestShapeInputShape{} + } + + req = c.newRequest(op, input, output) + output = &InputService10TestShapeInputService10TestCaseOperation6Output{} + req.Data = output + return +} + +func (c *InputService10ProtocolTest) InputService10TestCaseOperation6(input *InputService10TestShapeInputShape) (*InputService10TestShapeInputService10TestCaseOperation6Output, error) { + req, out := c.InputService10TestCaseOperation6Request(input) + err := req.Send() + return out, err +} + +type InputService10TestShapeInputService10TestCaseOperation1Output struct { + metadataInputService10TestShapeInputService10TestCaseOperation1Output `json:"-" xml:"-"` +} + +type metadataInputService10TestShapeInputService10TestCaseOperation1Output struct { + SDKShapeTraits bool `type:"structure"` +} + +type InputService10TestShapeInputService10TestCaseOperation2Output struct { + metadataInputService10TestShapeInputService10TestCaseOperation2Output `json:"-" xml:"-"` +} + +type metadataInputService10TestShapeInputService10TestCaseOperation2Output struct { + SDKShapeTraits bool `type:"structure"` +} + +type InputService10TestShapeInputService10TestCaseOperation3Output struct { + metadataInputService10TestShapeInputService10TestCaseOperation3Output `json:"-" xml:"-"` +} + +type metadataInputService10TestShapeInputService10TestCaseOperation3Output struct { + SDKShapeTraits bool `type:"structure"` +} + +type InputService10TestShapeInputService10TestCaseOperation4Output struct { + metadataInputService10TestShapeInputService10TestCaseOperation4Output `json:"-" xml:"-"` +} + +type metadataInputService10TestShapeInputService10TestCaseOperation4Output struct { + SDKShapeTraits bool `type:"structure"` +} + +type InputService10TestShapeInputService10TestCaseOperation5Output struct { + metadataInputService10TestShapeInputService10TestCaseOperation5Output `json:"-" xml:"-"` +} + +type metadataInputService10TestShapeInputService10TestCaseOperation5Output struct { + SDKShapeTraits bool `type:"structure"` +} + +type InputService10TestShapeInputService10TestCaseOperation6Output struct { + metadataInputService10TestShapeInputService10TestCaseOperation6Output `json:"-" xml:"-"` +} + +type metadataInputService10TestShapeInputService10TestCaseOperation6Output struct { + SDKShapeTraits bool `type:"structure"` +} + +type InputService10TestShapeInputShape struct { + RecursiveStruct *InputService10TestShapeRecursiveStructType `type:"structure"` + + metadataInputService10TestShapeInputShape `json:"-" xml:"-"` +} + +type metadataInputService10TestShapeInputShape struct { + SDKShapeTraits bool `type:"structure"` +} + +type InputService10TestShapeRecursiveStructType struct { + NoRecurse *string `type:"string"` + + RecursiveList []*InputService10TestShapeRecursiveStructType `type:"list"` + + RecursiveMap map[string]*InputService10TestShapeRecursiveStructType `type:"map"` + + RecursiveStruct *InputService10TestShapeRecursiveStructType `type:"structure"` + + metadataInputService10TestShapeRecursiveStructType `json:"-" xml:"-"` +} + +type metadataInputService10TestShapeRecursiveStructType struct { + SDKShapeTraits bool `type:"structure"` +} + +// +// Tests begin here +// + +func TestInputService1ProtocolTestScalarMembersCase1(t *testing.T) { + svc := NewInputService1ProtocolTest(nil) + svc.Endpoint = "https://test" + + input := &InputService1TestShapeInputService1TestCaseOperation1Input{ + Bar: aws.String("val2"), + Foo: aws.String("val1"), + } + req, _ := svc.InputService1TestCaseOperation1Request(input) + r := req.HTTPRequest + + // build request + query.Build(req) + assert.NoError(t, req.Error) + + // assert body + assert.NotNil(t, r.Body) + body, _ := ioutil.ReadAll(r.Body) + awstesting.AssertQuery(t, `Action=OperationName&Bar=val2&Foo=val1&Version=2014-01-01`, util.Trim(string(body))) + + // assert URL + awstesting.AssertURL(t, "https://test/", r.URL.String()) + + // assert headers + +} + +func TestInputService2ProtocolTestNestedStructureMembersCase1(t *testing.T) { + svc := NewInputService2ProtocolTest(nil) + svc.Endpoint = "https://test" + + input := &InputService2TestShapeInputService2TestCaseOperation1Input{ + StructArg: &InputService2TestShapeStructType{ + ScalarArg: aws.String("foo"), + }, + } + req, _ := svc.InputService2TestCaseOperation1Request(input) + r := req.HTTPRequest + + // build request + query.Build(req) + assert.NoError(t, req.Error) + + // assert body + assert.NotNil(t, r.Body) + body, _ := ioutil.ReadAll(r.Body) + awstesting.AssertQuery(t, `Action=OperationName&StructArg.ScalarArg=foo&Version=2014-01-01`, util.Trim(string(body))) + + // assert URL + awstesting.AssertURL(t, "https://test/", r.URL.String()) + + // assert headers + +} + +func TestInputService3ProtocolTestListTypesCase1(t *testing.T) { + svc := NewInputService3ProtocolTest(nil) + svc.Endpoint = "https://test" + + input := &InputService3TestShapeInputService3TestCaseOperation1Input{ + ListArg: []*string{ + aws.String("foo"), + aws.String("bar"), + aws.String("baz"), + }, + } + req, _ := svc.InputService3TestCaseOperation1Request(input) + r := req.HTTPRequest + + // build request + query.Build(req) + assert.NoError(t, req.Error) + + // assert body + assert.NotNil(t, r.Body) + body, _ := ioutil.ReadAll(r.Body) + awstesting.AssertQuery(t, `Action=OperationName&ListArg.member.1=foo&ListArg.member.2=bar&ListArg.member.3=baz&Version=2014-01-01`, util.Trim(string(body))) + + // assert URL + awstesting.AssertURL(t, "https://test/", r.URL.String()) + + // assert headers + +} + +func TestInputService4ProtocolTestFlattenedListCase1(t *testing.T) { + svc := NewInputService4ProtocolTest(nil) + svc.Endpoint = "https://test" + + input := &InputService4TestShapeInputService4TestCaseOperation1Input{ + ListArg: []*string{ + aws.String("a"), + aws.String("b"), + aws.String("c"), + }, + ScalarArg: aws.String("foo"), + } + req, _ := svc.InputService4TestCaseOperation1Request(input) + r := req.HTTPRequest + + // build request + query.Build(req) + assert.NoError(t, req.Error) + + // assert body + assert.NotNil(t, r.Body) + body, _ := ioutil.ReadAll(r.Body) + awstesting.AssertQuery(t, `Action=OperationName&ListArg.1=a&ListArg.2=b&ListArg.3=c&ScalarArg=foo&Version=2014-01-01`, util.Trim(string(body))) + + // assert URL + awstesting.AssertURL(t, "https://test/", r.URL.String()) + + // assert headers + +} + +func TestInputService5ProtocolTestFlattenedListWithLocationNameCase1(t *testing.T) { + svc := NewInputService5ProtocolTest(nil) + svc.Endpoint = "https://test" + + input := &InputService5TestShapeInputService5TestCaseOperation1Input{ + ListArg: []*string{ + aws.String("a"), + aws.String("b"), + aws.String("c"), + }, + ScalarArg: aws.String("foo"), + } + req, _ := svc.InputService5TestCaseOperation1Request(input) + r := req.HTTPRequest + + // build request + query.Build(req) + assert.NoError(t, req.Error) + + // assert body + assert.NotNil(t, r.Body) + body, _ := ioutil.ReadAll(r.Body) + awstesting.AssertQuery(t, `Action=OperationName&ListArgLocation.1=a&ListArgLocation.2=b&ListArgLocation.3=c&ScalarArg=foo&Version=2014-01-01`, util.Trim(string(body))) + + // assert URL + awstesting.AssertURL(t, "https://test/", r.URL.String()) + + // assert headers + +} + +func TestInputService6ProtocolTestSerializeMapTypeCase1(t *testing.T) { + svc := NewInputService6ProtocolTest(nil) + svc.Endpoint = "https://test" + + input := &InputService6TestShapeInputService6TestCaseOperation1Input{ + MapArg: map[string]*string{ + "key1": aws.String("val1"), + "key2": aws.String("val2"), + }, + } + req, _ := svc.InputService6TestCaseOperation1Request(input) + r := req.HTTPRequest + + // build request + query.Build(req) + assert.NoError(t, req.Error) + + // assert body + assert.NotNil(t, r.Body) + body, _ := ioutil.ReadAll(r.Body) + awstesting.AssertQuery(t, `Action=OperationName&MapArg.entry.1.key=key1&MapArg.entry.1.value=val1&MapArg.entry.2.key=key2&MapArg.entry.2.value=val2&Version=2014-01-01`, util.Trim(string(body))) + + // assert URL + awstesting.AssertURL(t, "https://test/", r.URL.String()) + + // assert headers + +} + +func TestInputService7ProtocolTestSerializeMapTypeWithLocationNameCase1(t *testing.T) { + svc := NewInputService7ProtocolTest(nil) + svc.Endpoint = "https://test" + + input := &InputService7TestShapeInputService7TestCaseOperation1Input{ + MapArg: map[string]*string{ + "key1": aws.String("val1"), + "key2": aws.String("val2"), + }, + } + req, _ := svc.InputService7TestCaseOperation1Request(input) + r := req.HTTPRequest + + // build request + query.Build(req) + assert.NoError(t, req.Error) + + // assert body + assert.NotNil(t, r.Body) + body, _ := ioutil.ReadAll(r.Body) + awstesting.AssertQuery(t, `Action=OperationName&MapArg.entry.1.TheKey=key1&MapArg.entry.1.TheValue=val1&MapArg.entry.2.TheKey=key2&MapArg.entry.2.TheValue=val2&Version=2014-01-01`, util.Trim(string(body))) + + // assert URL + awstesting.AssertURL(t, "https://test/", r.URL.String()) + + // assert headers + +} + +func TestInputService8ProtocolTestBase64EncodedBlobsCase1(t *testing.T) { + svc := NewInputService8ProtocolTest(nil) + svc.Endpoint = "https://test" + + input := &InputService8TestShapeInputService8TestCaseOperation1Input{ + BlobArg: []byte("foo"), + } + req, _ := svc.InputService8TestCaseOperation1Request(input) + r := req.HTTPRequest + + // build request + query.Build(req) + assert.NoError(t, req.Error) + + // assert body + assert.NotNil(t, r.Body) + body, _ := ioutil.ReadAll(r.Body) + awstesting.AssertQuery(t, `Action=OperationName&BlobArg=Zm9v&Version=2014-01-01`, util.Trim(string(body))) + + // assert URL + awstesting.AssertURL(t, "https://test/", r.URL.String()) + + // assert headers + +} + +func TestInputService9ProtocolTestTimestampValuesCase1(t *testing.T) { + svc := NewInputService9ProtocolTest(nil) + svc.Endpoint = "https://test" + + input := &InputService9TestShapeInputService9TestCaseOperation1Input{ + TimeArg: aws.Time(time.Unix(1422172800, 0)), + } + req, _ := svc.InputService9TestCaseOperation1Request(input) + r := req.HTTPRequest + + // build request + query.Build(req) + assert.NoError(t, req.Error) + + // assert body + assert.NotNil(t, r.Body) + body, _ := ioutil.ReadAll(r.Body) + awstesting.AssertQuery(t, `Action=OperationName&TimeArg=2015-01-25T08%3A00%3A00Z&Version=2014-01-01`, util.Trim(string(body))) + + // assert URL + awstesting.AssertURL(t, "https://test/", r.URL.String()) + + // assert headers + +} + +func TestInputService10ProtocolTestRecursiveShapesCase1(t *testing.T) { + svc := NewInputService10ProtocolTest(nil) + svc.Endpoint = "https://test" + + input := &InputService10TestShapeInputShape{ + RecursiveStruct: &InputService10TestShapeRecursiveStructType{ + NoRecurse: aws.String("foo"), + }, + } + req, _ := svc.InputService10TestCaseOperation1Request(input) + r := req.HTTPRequest + + // build request + query.Build(req) + assert.NoError(t, req.Error) + + // assert body + assert.NotNil(t, r.Body) + body, _ := ioutil.ReadAll(r.Body) + awstesting.AssertQuery(t, `Action=OperationName&RecursiveStruct.NoRecurse=foo&Version=2014-01-01`, util.Trim(string(body))) + + // assert URL + awstesting.AssertURL(t, "https://test/", r.URL.String()) + + // assert headers + +} + +func TestInputService10ProtocolTestRecursiveShapesCase2(t *testing.T) { + svc := NewInputService10ProtocolTest(nil) + svc.Endpoint = "https://test" + + input := &InputService10TestShapeInputShape{ + RecursiveStruct: &InputService10TestShapeRecursiveStructType{ + RecursiveStruct: &InputService10TestShapeRecursiveStructType{ + NoRecurse: aws.String("foo"), + }, + }, + } + req, _ := svc.InputService10TestCaseOperation2Request(input) + r := req.HTTPRequest + + // build request + query.Build(req) + assert.NoError(t, req.Error) + + // assert body + assert.NotNil(t, r.Body) + body, _ := ioutil.ReadAll(r.Body) + awstesting.AssertQuery(t, `Action=OperationName&RecursiveStruct.RecursiveStruct.NoRecurse=foo&Version=2014-01-01`, util.Trim(string(body))) + + // assert URL + awstesting.AssertURL(t, "https://test/", r.URL.String()) + + // assert headers + +} + +func TestInputService10ProtocolTestRecursiveShapesCase3(t *testing.T) { + svc := NewInputService10ProtocolTest(nil) + svc.Endpoint = "https://test" + + input := &InputService10TestShapeInputShape{ + RecursiveStruct: &InputService10TestShapeRecursiveStructType{ + RecursiveStruct: &InputService10TestShapeRecursiveStructType{ + RecursiveStruct: &InputService10TestShapeRecursiveStructType{ + RecursiveStruct: &InputService10TestShapeRecursiveStructType{ + NoRecurse: aws.String("foo"), + }, + }, + }, + }, + } + req, _ := svc.InputService10TestCaseOperation3Request(input) + r := req.HTTPRequest + + // build request + query.Build(req) + assert.NoError(t, req.Error) + + // assert body + assert.NotNil(t, r.Body) + body, _ := ioutil.ReadAll(r.Body) + awstesting.AssertQuery(t, `Action=OperationName&RecursiveStruct.RecursiveStruct.RecursiveStruct.RecursiveStruct.NoRecurse=foo&Version=2014-01-01`, util.Trim(string(body))) + + // assert URL + awstesting.AssertURL(t, "https://test/", r.URL.String()) + + // assert headers + +} + +func TestInputService10ProtocolTestRecursiveShapesCase4(t *testing.T) { + svc := NewInputService10ProtocolTest(nil) + svc.Endpoint = "https://test" + + input := &InputService10TestShapeInputShape{ + RecursiveStruct: &InputService10TestShapeRecursiveStructType{ + RecursiveList: []*InputService10TestShapeRecursiveStructType{ + { + NoRecurse: aws.String("foo"), + }, + { + NoRecurse: aws.String("bar"), + }, + }, + }, + } + req, _ := svc.InputService10TestCaseOperation4Request(input) + r := req.HTTPRequest + + // build request + query.Build(req) + assert.NoError(t, req.Error) + + // assert body + assert.NotNil(t, r.Body) + body, _ := ioutil.ReadAll(r.Body) + awstesting.AssertQuery(t, `Action=OperationName&RecursiveStruct.RecursiveList.member.1.NoRecurse=foo&RecursiveStruct.RecursiveList.member.2.NoRecurse=bar&Version=2014-01-01`, util.Trim(string(body))) + + // assert URL + awstesting.AssertURL(t, "https://test/", r.URL.String()) + + // assert headers + +} + +func TestInputService10ProtocolTestRecursiveShapesCase5(t *testing.T) { + svc := NewInputService10ProtocolTest(nil) + svc.Endpoint = "https://test" + + input := &InputService10TestShapeInputShape{ + RecursiveStruct: &InputService10TestShapeRecursiveStructType{ + RecursiveList: []*InputService10TestShapeRecursiveStructType{ + { + NoRecurse: aws.String("foo"), + }, + { + RecursiveStruct: &InputService10TestShapeRecursiveStructType{ + NoRecurse: aws.String("bar"), + }, + }, + }, + }, + } + req, _ := svc.InputService10TestCaseOperation5Request(input) + r := req.HTTPRequest + + // build request + query.Build(req) + assert.NoError(t, req.Error) + + // assert body + assert.NotNil(t, r.Body) + body, _ := ioutil.ReadAll(r.Body) + awstesting.AssertQuery(t, `Action=OperationName&RecursiveStruct.RecursiveList.member.1.NoRecurse=foo&RecursiveStruct.RecursiveList.member.2.RecursiveStruct.NoRecurse=bar&Version=2014-01-01`, util.Trim(string(body))) + + // assert URL + awstesting.AssertURL(t, "https://test/", r.URL.String()) + + // assert headers + +} + +func TestInputService10ProtocolTestRecursiveShapesCase6(t *testing.T) { + svc := NewInputService10ProtocolTest(nil) + svc.Endpoint = "https://test" + + input := &InputService10TestShapeInputShape{ + RecursiveStruct: &InputService10TestShapeRecursiveStructType{ + RecursiveMap: map[string]*InputService10TestShapeRecursiveStructType{ + "bar": { + NoRecurse: aws.String("bar"), + }, + "foo": { + NoRecurse: aws.String("foo"), + }, + }, + }, + } + req, _ := svc.InputService10TestCaseOperation6Request(input) + r := req.HTTPRequest + + // build request + query.Build(req) + assert.NoError(t, req.Error) + + // assert body + assert.NotNil(t, r.Body) + body, _ := ioutil.ReadAll(r.Body) + awstesting.AssertQuery(t, `Action=OperationName&RecursiveStruct.RecursiveMap.entry.1.key=foo&RecursiveStruct.RecursiveMap.entry.1.value.NoRecurse=foo&RecursiveStruct.RecursiveMap.entry.2.key=bar&RecursiveStruct.RecursiveMap.entry.2.value.NoRecurse=bar&Version=2014-01-01`, util.Trim(string(body))) + + // assert URL + awstesting.AssertURL(t, "https://test/", r.URL.String()) + + // assert headers + +} diff --git a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/private/protocol/query/queryutil/queryutil.go b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/private/protocol/query/queryutil/queryutil.go new file mode 100644 index 00000000000..3b417a89f71 --- /dev/null +++ b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/private/protocol/query/queryutil/queryutil.go @@ -0,0 +1,223 @@ +package queryutil + +import ( + "encoding/base64" + "fmt" + "net/url" + "reflect" + "sort" + "strconv" + "strings" + "time" +) + +// Parse parses an object i and fills a url.Values object. The isEC2 flag +// indicates if this is the EC2 Query sub-protocol. +func Parse(body url.Values, i interface{}, isEC2 bool) error { + q := queryParser{isEC2: isEC2} + return q.parseValue(body, reflect.ValueOf(i), "", "") +} + +func elemOf(value reflect.Value) reflect.Value { + for value.Kind() == reflect.Ptr { + value = value.Elem() + } + return value +} + +type queryParser struct { + isEC2 bool +} + +func (q *queryParser) parseValue(v url.Values, value reflect.Value, prefix string, tag reflect.StructTag) error { + value = elemOf(value) + + // no need to handle zero values + if !value.IsValid() { + return nil + } + + t := tag.Get("type") + if t == "" { + switch value.Kind() { + case reflect.Struct: + t = "structure" + case reflect.Slice: + t = "list" + case reflect.Map: + t = "map" + } + } + + switch t { + case "structure": + return q.parseStruct(v, value, prefix) + case "list": + return q.parseList(v, value, prefix, tag) + case "map": + return q.parseMap(v, value, prefix, tag) + default: + return q.parseScalar(v, value, prefix, tag) + } +} + +func (q *queryParser) parseStruct(v url.Values, value reflect.Value, prefix string) error { + if !value.IsValid() { + return nil + } + + t := value.Type() + for i := 0; i < value.NumField(); i++ { + if c := t.Field(i).Name[0:1]; strings.ToLower(c) == c { + continue // ignore unexported fields + } + + value := elemOf(value.Field(i)) + field := t.Field(i) + var name string + + if q.isEC2 { + name = field.Tag.Get("queryName") + } + if name == "" { + if field.Tag.Get("flattened") != "" && field.Tag.Get("locationNameList") != "" { + name = field.Tag.Get("locationNameList") + } else if locName := field.Tag.Get("locationName"); locName != "" { + name = locName + } + if name != "" && q.isEC2 { + name = strings.ToUpper(name[0:1]) + name[1:] + } + } + if name == "" { + name = field.Name + } + + if prefix != "" { + name = prefix + "." + name + } + + if err := q.parseValue(v, value, name, field.Tag); err != nil { + return err + } + } + return nil +} + +func (q *queryParser) parseList(v url.Values, value reflect.Value, prefix string, tag reflect.StructTag) error { + // If it's empty, generate an empty value + if !value.IsNil() && value.Len() == 0 { + v.Set(prefix, "") + return nil + } + + // check for unflattened list member + if !q.isEC2 && tag.Get("flattened") == "" { + prefix += ".member" + } + + for i := 0; i < value.Len(); i++ { + slicePrefix := prefix + if slicePrefix == "" { + slicePrefix = strconv.Itoa(i + 1) + } else { + slicePrefix = slicePrefix + "." + strconv.Itoa(i+1) + } + if err := q.parseValue(v, value.Index(i), slicePrefix, ""); err != nil { + return err + } + } + return nil +} + +func (q *queryParser) parseMap(v url.Values, value reflect.Value, prefix string, tag reflect.StructTag) error { + // If it's empty, generate an empty value + if !value.IsNil() && value.Len() == 0 { + v.Set(prefix, "") + return nil + } + + // check for unflattened list member + if !q.isEC2 && tag.Get("flattened") == "" { + prefix += ".entry" + } + + // sort keys for improved serialization consistency. + // this is not strictly necessary for protocol support. + mapKeyValues := value.MapKeys() + mapKeys := map[string]reflect.Value{} + mapKeyNames := make([]string, len(mapKeyValues)) + for i, mapKey := range mapKeyValues { + name := mapKey.String() + mapKeys[name] = mapKey + mapKeyNames[i] = name + } + sort.Strings(mapKeyNames) + + for i, mapKeyName := range mapKeyNames { + mapKey := mapKeys[mapKeyName] + mapValue := value.MapIndex(mapKey) + + kname := tag.Get("locationNameKey") + if kname == "" { + kname = "key" + } + vname := tag.Get("locationNameValue") + if vname == "" { + vname = "value" + } + + // serialize key + var keyName string + if prefix == "" { + keyName = strconv.Itoa(i+1) + "." + kname + } else { + keyName = prefix + "." + strconv.Itoa(i+1) + "." + kname + } + + if err := q.parseValue(v, mapKey, keyName, ""); err != nil { + return err + } + + // serialize value + var valueName string + if prefix == "" { + valueName = strconv.Itoa(i+1) + "." + vname + } else { + valueName = prefix + "." + strconv.Itoa(i+1) + "." + vname + } + + if err := q.parseValue(v, mapValue, valueName, ""); err != nil { + return err + } + } + + return nil +} + +func (q *queryParser) parseScalar(v url.Values, r reflect.Value, name string, tag reflect.StructTag) error { + switch value := r.Interface().(type) { + case string: + v.Set(name, value) + case []byte: + if !r.IsNil() { + v.Set(name, base64.StdEncoding.EncodeToString(value)) + } + case bool: + v.Set(name, strconv.FormatBool(value)) + case int64: + v.Set(name, strconv.FormatInt(value, 10)) + case int: + v.Set(name, strconv.Itoa(value)) + case float64: + v.Set(name, strconv.FormatFloat(value, 'f', -1, 64)) + case float32: + v.Set(name, strconv.FormatFloat(float64(value), 'f', -1, 32)) + case time.Time: + const ISO8601UTC = "2006-01-02T15:04:05Z" + v.Set(name, value.UTC().Format(ISO8601UTC)) + default: + return fmt.Errorf("unsupported value for param %s: %v (%s)", name, r.Interface(), r.Type().Name()) + } + return nil +} diff --git a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/private/protocol/query/unmarshal.go b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/private/protocol/query/unmarshal.go new file mode 100644 index 00000000000..1fcab1d1a13 --- /dev/null +++ b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/private/protocol/query/unmarshal.go @@ -0,0 +1,29 @@ +package query + +//go:generate go run ../../../models/protocol_tests/generate.go ../../../models/protocol_tests/output/query.json unmarshal_test.go + +import ( + "encoding/xml" + + "github.com/aws/aws-sdk-go/aws/awserr" + "github.com/aws/aws-sdk-go/aws/request" + "github.com/aws/aws-sdk-go/private/protocol/xml/xmlutil" +) + +// Unmarshal unmarshals a response for an AWS Query service. +func Unmarshal(r *request.Request) { + defer r.HTTPResponse.Body.Close() + if r.DataFilled() { + decoder := xml.NewDecoder(r.HTTPResponse.Body) + err := xmlutil.UnmarshalXML(r.Data, decoder, r.Operation.Name+"Result") + if err != nil { + r.Error = awserr.New("SerializationError", "failed decoding Query response", err) + return + } + } +} + +// UnmarshalMeta unmarshals header response values for an AWS Query service. +func UnmarshalMeta(r *request.Request) { + // TODO implement unmarshaling of request IDs +} diff --git a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/private/protocol/query/unmarshal_error.go b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/private/protocol/query/unmarshal_error.go new file mode 100644 index 00000000000..08609d92088 --- /dev/null +++ b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/private/protocol/query/unmarshal_error.go @@ -0,0 +1,33 @@ +package query + +import ( + "encoding/xml" + "io" + + "github.com/aws/aws-sdk-go/aws/awserr" + "github.com/aws/aws-sdk-go/aws/request" +) + +type xmlErrorResponse struct { + XMLName xml.Name `xml:"ErrorResponse"` + Code string `xml:"Error>Code"` + Message string `xml:"Error>Message"` + RequestID string `xml:"RequestId"` +} + +// UnmarshalError unmarshals an error response for an AWS Query service. +func UnmarshalError(r *request.Request) { + defer r.HTTPResponse.Body.Close() + + resp := &xmlErrorResponse{} + err := xml.NewDecoder(r.HTTPResponse.Body).Decode(resp) + if err != nil && err != io.EOF { + r.Error = awserr.New("SerializationError", "failed to decode query XML error response", err) + } else { + r.Error = awserr.NewRequestFailure( + awserr.New(resp.Code, resp.Message, nil), + r.HTTPResponse.StatusCode, + resp.RequestID, + ) + } +} diff --git a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/private/protocol/query/unmarshal_test.go b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/private/protocol/query/unmarshal_test.go new file mode 100644 index 00000000000..a3d08a1a2f0 --- /dev/null +++ b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/private/protocol/query/unmarshal_test.go @@ -0,0 +1,1452 @@ +package query_test + +import ( + "bytes" + "encoding/json" + "encoding/xml" + "io" + "io/ioutil" + "net/http" + "net/url" + "testing" + "time" + + "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/aws/defaults" + "github.com/aws/aws-sdk-go/aws/request" + "github.com/aws/aws-sdk-go/aws/service" + "github.com/aws/aws-sdk-go/aws/service/serviceinfo" + "github.com/aws/aws-sdk-go/awstesting" + "github.com/aws/aws-sdk-go/private/protocol/query" + "github.com/aws/aws-sdk-go/private/protocol/xml/xmlutil" + "github.com/aws/aws-sdk-go/private/signer/v4" + "github.com/aws/aws-sdk-go/private/util" + "github.com/stretchr/testify/assert" +) + +var _ bytes.Buffer // always import bytes +var _ http.Request +var _ json.Marshaler +var _ time.Time +var _ xmlutil.XMLNode +var _ xml.Attr +var _ = awstesting.GenerateAssertions +var _ = ioutil.Discard +var _ = util.Trim("") +var _ = url.Values{} +var _ = io.EOF + +type OutputService1ProtocolTest struct { + *service.Service +} + +// New returns a new OutputService1ProtocolTest client. +func NewOutputService1ProtocolTest(config *aws.Config) *OutputService1ProtocolTest { + service := &service.Service{ + ServiceInfo: serviceinfo.ServiceInfo{ + Config: defaults.DefaultConfig.Merge(config), + ServiceName: "outputservice1protocoltest", + APIVersion: "", + }, + } + service.Initialize() + + // Handlers + service.Handlers.Sign.PushBack(v4.Sign) + service.Handlers.Build.PushBack(query.Build) + service.Handlers.Unmarshal.PushBack(query.Unmarshal) + service.Handlers.UnmarshalMeta.PushBack(query.UnmarshalMeta) + service.Handlers.UnmarshalError.PushBack(query.UnmarshalError) + + return &OutputService1ProtocolTest{service} +} + +// newRequest creates a new request for a OutputService1ProtocolTest operation and runs any +// custom request initialization. +func (c *OutputService1ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { + req := c.NewRequest(op, params, data) + + return req +} + +const opOutputService1TestCaseOperation1 = "OperationName" + +// OutputService1TestCaseOperation1Request generates a request for the OutputService1TestCaseOperation1 operation. +func (c *OutputService1ProtocolTest) OutputService1TestCaseOperation1Request(input *OutputService1TestShapeOutputService1TestCaseOperation1Input) (req *request.Request, output *OutputService1TestShapeOutputService1TestCaseOperation1Output) { + op := &request.Operation{ + Name: opOutputService1TestCaseOperation1, + } + + if input == nil { + input = &OutputService1TestShapeOutputService1TestCaseOperation1Input{} + } + + req = c.newRequest(op, input, output) + output = &OutputService1TestShapeOutputService1TestCaseOperation1Output{} + req.Data = output + return +} + +func (c *OutputService1ProtocolTest) OutputService1TestCaseOperation1(input *OutputService1TestShapeOutputService1TestCaseOperation1Input) (*OutputService1TestShapeOutputService1TestCaseOperation1Output, error) { + req, out := c.OutputService1TestCaseOperation1Request(input) + err := req.Send() + return out, err +} + +type OutputService1TestShapeOutputService1TestCaseOperation1Input struct { + metadataOutputService1TestShapeOutputService1TestCaseOperation1Input `json:"-" xml:"-"` +} + +type metadataOutputService1TestShapeOutputService1TestCaseOperation1Input struct { + SDKShapeTraits bool `type:"structure"` +} + +type OutputService1TestShapeOutputService1TestCaseOperation1Output struct { + Char *string `type:"character"` + + Double *float64 `type:"double"` + + FalseBool *bool `type:"boolean"` + + Float *float64 `type:"float"` + + Long *int64 `type:"long"` + + Num *int64 `locationName:"FooNum" type:"integer"` + + Str *string `type:"string"` + + Timestamp *time.Time `type:"timestamp" timestampFormat:"iso8601"` + + TrueBool *bool `type:"boolean"` + + metadataOutputService1TestShapeOutputService1TestCaseOperation1Output `json:"-" xml:"-"` +} + +type metadataOutputService1TestShapeOutputService1TestCaseOperation1Output struct { + SDKShapeTraits bool `type:"structure"` +} + +type OutputService2ProtocolTest struct { + *service.Service +} + +// New returns a new OutputService2ProtocolTest client. +func NewOutputService2ProtocolTest(config *aws.Config) *OutputService2ProtocolTest { + service := &service.Service{ + ServiceInfo: serviceinfo.ServiceInfo{ + Config: defaults.DefaultConfig.Merge(config), + ServiceName: "outputservice2protocoltest", + APIVersion: "", + }, + } + service.Initialize() + + // Handlers + service.Handlers.Sign.PushBack(v4.Sign) + service.Handlers.Build.PushBack(query.Build) + service.Handlers.Unmarshal.PushBack(query.Unmarshal) + service.Handlers.UnmarshalMeta.PushBack(query.UnmarshalMeta) + service.Handlers.UnmarshalError.PushBack(query.UnmarshalError) + + return &OutputService2ProtocolTest{service} +} + +// newRequest creates a new request for a OutputService2ProtocolTest operation and runs any +// custom request initialization. +func (c *OutputService2ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { + req := c.NewRequest(op, params, data) + + return req +} + +const opOutputService2TestCaseOperation1 = "OperationName" + +// OutputService2TestCaseOperation1Request generates a request for the OutputService2TestCaseOperation1 operation. +func (c *OutputService2ProtocolTest) OutputService2TestCaseOperation1Request(input *OutputService2TestShapeOutputService2TestCaseOperation1Input) (req *request.Request, output *OutputService2TestShapeOutputService2TestCaseOperation1Output) { + op := &request.Operation{ + Name: opOutputService2TestCaseOperation1, + } + + if input == nil { + input = &OutputService2TestShapeOutputService2TestCaseOperation1Input{} + } + + req = c.newRequest(op, input, output) + output = &OutputService2TestShapeOutputService2TestCaseOperation1Output{} + req.Data = output + return +} + +func (c *OutputService2ProtocolTest) OutputService2TestCaseOperation1(input *OutputService2TestShapeOutputService2TestCaseOperation1Input) (*OutputService2TestShapeOutputService2TestCaseOperation1Output, error) { + req, out := c.OutputService2TestCaseOperation1Request(input) + err := req.Send() + return out, err +} + +type OutputService2TestShapeOutputService2TestCaseOperation1Input struct { + metadataOutputService2TestShapeOutputService2TestCaseOperation1Input `json:"-" xml:"-"` +} + +type metadataOutputService2TestShapeOutputService2TestCaseOperation1Input struct { + SDKShapeTraits bool `type:"structure"` +} + +type OutputService2TestShapeOutputService2TestCaseOperation1Output struct { + Num *int64 `type:"integer"` + + Str *string `type:"string"` + + metadataOutputService2TestShapeOutputService2TestCaseOperation1Output `json:"-" xml:"-"` +} + +type metadataOutputService2TestShapeOutputService2TestCaseOperation1Output struct { + SDKShapeTraits bool `type:"structure"` +} + +type OutputService3ProtocolTest struct { + *service.Service +} + +// New returns a new OutputService3ProtocolTest client. +func NewOutputService3ProtocolTest(config *aws.Config) *OutputService3ProtocolTest { + service := &service.Service{ + ServiceInfo: serviceinfo.ServiceInfo{ + Config: defaults.DefaultConfig.Merge(config), + ServiceName: "outputservice3protocoltest", + APIVersion: "", + }, + } + service.Initialize() + + // Handlers + service.Handlers.Sign.PushBack(v4.Sign) + service.Handlers.Build.PushBack(query.Build) + service.Handlers.Unmarshal.PushBack(query.Unmarshal) + service.Handlers.UnmarshalMeta.PushBack(query.UnmarshalMeta) + service.Handlers.UnmarshalError.PushBack(query.UnmarshalError) + + return &OutputService3ProtocolTest{service} +} + +// newRequest creates a new request for a OutputService3ProtocolTest operation and runs any +// custom request initialization. +func (c *OutputService3ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { + req := c.NewRequest(op, params, data) + + return req +} + +const opOutputService3TestCaseOperation1 = "OperationName" + +// OutputService3TestCaseOperation1Request generates a request for the OutputService3TestCaseOperation1 operation. +func (c *OutputService3ProtocolTest) OutputService3TestCaseOperation1Request(input *OutputService3TestShapeOutputService3TestCaseOperation1Input) (req *request.Request, output *OutputService3TestShapeOutputService3TestCaseOperation1Output) { + op := &request.Operation{ + Name: opOutputService3TestCaseOperation1, + } + + if input == nil { + input = &OutputService3TestShapeOutputService3TestCaseOperation1Input{} + } + + req = c.newRequest(op, input, output) + output = &OutputService3TestShapeOutputService3TestCaseOperation1Output{} + req.Data = output + return +} + +func (c *OutputService3ProtocolTest) OutputService3TestCaseOperation1(input *OutputService3TestShapeOutputService3TestCaseOperation1Input) (*OutputService3TestShapeOutputService3TestCaseOperation1Output, error) { + req, out := c.OutputService3TestCaseOperation1Request(input) + err := req.Send() + return out, err +} + +type OutputService3TestShapeOutputService3TestCaseOperation1Input struct { + metadataOutputService3TestShapeOutputService3TestCaseOperation1Input `json:"-" xml:"-"` +} + +type metadataOutputService3TestShapeOutputService3TestCaseOperation1Input struct { + SDKShapeTraits bool `type:"structure"` +} + +type OutputService3TestShapeOutputService3TestCaseOperation1Output struct { + Blob []byte `type:"blob"` + + metadataOutputService3TestShapeOutputService3TestCaseOperation1Output `json:"-" xml:"-"` +} + +type metadataOutputService3TestShapeOutputService3TestCaseOperation1Output struct { + SDKShapeTraits bool `type:"structure"` +} + +type OutputService4ProtocolTest struct { + *service.Service +} + +// New returns a new OutputService4ProtocolTest client. +func NewOutputService4ProtocolTest(config *aws.Config) *OutputService4ProtocolTest { + service := &service.Service{ + ServiceInfo: serviceinfo.ServiceInfo{ + Config: defaults.DefaultConfig.Merge(config), + ServiceName: "outputservice4protocoltest", + APIVersion: "", + }, + } + service.Initialize() + + // Handlers + service.Handlers.Sign.PushBack(v4.Sign) + service.Handlers.Build.PushBack(query.Build) + service.Handlers.Unmarshal.PushBack(query.Unmarshal) + service.Handlers.UnmarshalMeta.PushBack(query.UnmarshalMeta) + service.Handlers.UnmarshalError.PushBack(query.UnmarshalError) + + return &OutputService4ProtocolTest{service} +} + +// newRequest creates a new request for a OutputService4ProtocolTest operation and runs any +// custom request initialization. +func (c *OutputService4ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { + req := c.NewRequest(op, params, data) + + return req +} + +const opOutputService4TestCaseOperation1 = "OperationName" + +// OutputService4TestCaseOperation1Request generates a request for the OutputService4TestCaseOperation1 operation. +func (c *OutputService4ProtocolTest) OutputService4TestCaseOperation1Request(input *OutputService4TestShapeOutputService4TestCaseOperation1Input) (req *request.Request, output *OutputService4TestShapeOutputService4TestCaseOperation1Output) { + op := &request.Operation{ + Name: opOutputService4TestCaseOperation1, + } + + if input == nil { + input = &OutputService4TestShapeOutputService4TestCaseOperation1Input{} + } + + req = c.newRequest(op, input, output) + output = &OutputService4TestShapeOutputService4TestCaseOperation1Output{} + req.Data = output + return +} + +func (c *OutputService4ProtocolTest) OutputService4TestCaseOperation1(input *OutputService4TestShapeOutputService4TestCaseOperation1Input) (*OutputService4TestShapeOutputService4TestCaseOperation1Output, error) { + req, out := c.OutputService4TestCaseOperation1Request(input) + err := req.Send() + return out, err +} + +type OutputService4TestShapeOutputService4TestCaseOperation1Input struct { + metadataOutputService4TestShapeOutputService4TestCaseOperation1Input `json:"-" xml:"-"` +} + +type metadataOutputService4TestShapeOutputService4TestCaseOperation1Input struct { + SDKShapeTraits bool `type:"structure"` +} + +type OutputService4TestShapeOutputService4TestCaseOperation1Output struct { + ListMember []*string `type:"list"` + + metadataOutputService4TestShapeOutputService4TestCaseOperation1Output `json:"-" xml:"-"` +} + +type metadataOutputService4TestShapeOutputService4TestCaseOperation1Output struct { + SDKShapeTraits bool `type:"structure"` +} + +type OutputService5ProtocolTest struct { + *service.Service +} + +// New returns a new OutputService5ProtocolTest client. +func NewOutputService5ProtocolTest(config *aws.Config) *OutputService5ProtocolTest { + service := &service.Service{ + ServiceInfo: serviceinfo.ServiceInfo{ + Config: defaults.DefaultConfig.Merge(config), + ServiceName: "outputservice5protocoltest", + APIVersion: "", + }, + } + service.Initialize() + + // Handlers + service.Handlers.Sign.PushBack(v4.Sign) + service.Handlers.Build.PushBack(query.Build) + service.Handlers.Unmarshal.PushBack(query.Unmarshal) + service.Handlers.UnmarshalMeta.PushBack(query.UnmarshalMeta) + service.Handlers.UnmarshalError.PushBack(query.UnmarshalError) + + return &OutputService5ProtocolTest{service} +} + +// newRequest creates a new request for a OutputService5ProtocolTest operation and runs any +// custom request initialization. +func (c *OutputService5ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { + req := c.NewRequest(op, params, data) + + return req +} + +const opOutputService5TestCaseOperation1 = "OperationName" + +// OutputService5TestCaseOperation1Request generates a request for the OutputService5TestCaseOperation1 operation. +func (c *OutputService5ProtocolTest) OutputService5TestCaseOperation1Request(input *OutputService5TestShapeOutputService5TestCaseOperation1Input) (req *request.Request, output *OutputService5TestShapeOutputService5TestCaseOperation1Output) { + op := &request.Operation{ + Name: opOutputService5TestCaseOperation1, + } + + if input == nil { + input = &OutputService5TestShapeOutputService5TestCaseOperation1Input{} + } + + req = c.newRequest(op, input, output) + output = &OutputService5TestShapeOutputService5TestCaseOperation1Output{} + req.Data = output + return +} + +func (c *OutputService5ProtocolTest) OutputService5TestCaseOperation1(input *OutputService5TestShapeOutputService5TestCaseOperation1Input) (*OutputService5TestShapeOutputService5TestCaseOperation1Output, error) { + req, out := c.OutputService5TestCaseOperation1Request(input) + err := req.Send() + return out, err +} + +type OutputService5TestShapeOutputService5TestCaseOperation1Input struct { + metadataOutputService5TestShapeOutputService5TestCaseOperation1Input `json:"-" xml:"-"` +} + +type metadataOutputService5TestShapeOutputService5TestCaseOperation1Input struct { + SDKShapeTraits bool `type:"structure"` +} + +type OutputService5TestShapeOutputService5TestCaseOperation1Output struct { + ListMember []*string `locationNameList:"item" type:"list"` + + metadataOutputService5TestShapeOutputService5TestCaseOperation1Output `json:"-" xml:"-"` +} + +type metadataOutputService5TestShapeOutputService5TestCaseOperation1Output struct { + SDKShapeTraits bool `type:"structure"` +} + +type OutputService6ProtocolTest struct { + *service.Service +} + +// New returns a new OutputService6ProtocolTest client. +func NewOutputService6ProtocolTest(config *aws.Config) *OutputService6ProtocolTest { + service := &service.Service{ + ServiceInfo: serviceinfo.ServiceInfo{ + Config: defaults.DefaultConfig.Merge(config), + ServiceName: "outputservice6protocoltest", + APIVersion: "", + }, + } + service.Initialize() + + // Handlers + service.Handlers.Sign.PushBack(v4.Sign) + service.Handlers.Build.PushBack(query.Build) + service.Handlers.Unmarshal.PushBack(query.Unmarshal) + service.Handlers.UnmarshalMeta.PushBack(query.UnmarshalMeta) + service.Handlers.UnmarshalError.PushBack(query.UnmarshalError) + + return &OutputService6ProtocolTest{service} +} + +// newRequest creates a new request for a OutputService6ProtocolTest operation and runs any +// custom request initialization. +func (c *OutputService6ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { + req := c.NewRequest(op, params, data) + + return req +} + +const opOutputService6TestCaseOperation1 = "OperationName" + +// OutputService6TestCaseOperation1Request generates a request for the OutputService6TestCaseOperation1 operation. +func (c *OutputService6ProtocolTest) OutputService6TestCaseOperation1Request(input *OutputService6TestShapeOutputService6TestCaseOperation1Input) (req *request.Request, output *OutputService6TestShapeOutputService6TestCaseOperation1Output) { + op := &request.Operation{ + Name: opOutputService6TestCaseOperation1, + } + + if input == nil { + input = &OutputService6TestShapeOutputService6TestCaseOperation1Input{} + } + + req = c.newRequest(op, input, output) + output = &OutputService6TestShapeOutputService6TestCaseOperation1Output{} + req.Data = output + return +} + +func (c *OutputService6ProtocolTest) OutputService6TestCaseOperation1(input *OutputService6TestShapeOutputService6TestCaseOperation1Input) (*OutputService6TestShapeOutputService6TestCaseOperation1Output, error) { + req, out := c.OutputService6TestCaseOperation1Request(input) + err := req.Send() + return out, err +} + +type OutputService6TestShapeOutputService6TestCaseOperation1Input struct { + metadataOutputService6TestShapeOutputService6TestCaseOperation1Input `json:"-" xml:"-"` +} + +type metadataOutputService6TestShapeOutputService6TestCaseOperation1Input struct { + SDKShapeTraits bool `type:"structure"` +} + +type OutputService6TestShapeOutputService6TestCaseOperation1Output struct { + ListMember []*string `type:"list" flattened:"true"` + + metadataOutputService6TestShapeOutputService6TestCaseOperation1Output `json:"-" xml:"-"` +} + +type metadataOutputService6TestShapeOutputService6TestCaseOperation1Output struct { + SDKShapeTraits bool `type:"structure"` +} + +type OutputService7ProtocolTest struct { + *service.Service +} + +// New returns a new OutputService7ProtocolTest client. +func NewOutputService7ProtocolTest(config *aws.Config) *OutputService7ProtocolTest { + service := &service.Service{ + ServiceInfo: serviceinfo.ServiceInfo{ + Config: defaults.DefaultConfig.Merge(config), + ServiceName: "outputservice7protocoltest", + APIVersion: "", + }, + } + service.Initialize() + + // Handlers + service.Handlers.Sign.PushBack(v4.Sign) + service.Handlers.Build.PushBack(query.Build) + service.Handlers.Unmarshal.PushBack(query.Unmarshal) + service.Handlers.UnmarshalMeta.PushBack(query.UnmarshalMeta) + service.Handlers.UnmarshalError.PushBack(query.UnmarshalError) + + return &OutputService7ProtocolTest{service} +} + +// newRequest creates a new request for a OutputService7ProtocolTest operation and runs any +// custom request initialization. +func (c *OutputService7ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { + req := c.NewRequest(op, params, data) + + return req +} + +const opOutputService7TestCaseOperation1 = "OperationName" + +// OutputService7TestCaseOperation1Request generates a request for the OutputService7TestCaseOperation1 operation. +func (c *OutputService7ProtocolTest) OutputService7TestCaseOperation1Request(input *OutputService7TestShapeOutputService7TestCaseOperation1Input) (req *request.Request, output *OutputService7TestShapeOutputService7TestCaseOperation1Output) { + op := &request.Operation{ + Name: opOutputService7TestCaseOperation1, + } + + if input == nil { + input = &OutputService7TestShapeOutputService7TestCaseOperation1Input{} + } + + req = c.newRequest(op, input, output) + output = &OutputService7TestShapeOutputService7TestCaseOperation1Output{} + req.Data = output + return +} + +func (c *OutputService7ProtocolTest) OutputService7TestCaseOperation1(input *OutputService7TestShapeOutputService7TestCaseOperation1Input) (*OutputService7TestShapeOutputService7TestCaseOperation1Output, error) { + req, out := c.OutputService7TestCaseOperation1Request(input) + err := req.Send() + return out, err +} + +type OutputService7TestShapeOutputService7TestCaseOperation1Input struct { + metadataOutputService7TestShapeOutputService7TestCaseOperation1Input `json:"-" xml:"-"` +} + +type metadataOutputService7TestShapeOutputService7TestCaseOperation1Input struct { + SDKShapeTraits bool `type:"structure"` +} + +type OutputService7TestShapeOutputService7TestCaseOperation1Output struct { + ListMember []*string `type:"list" flattened:"true"` + + metadataOutputService7TestShapeOutputService7TestCaseOperation1Output `json:"-" xml:"-"` +} + +type metadataOutputService7TestShapeOutputService7TestCaseOperation1Output struct { + SDKShapeTraits bool `type:"structure"` +} + +type OutputService8ProtocolTest struct { + *service.Service +} + +// New returns a new OutputService8ProtocolTest client. +func NewOutputService8ProtocolTest(config *aws.Config) *OutputService8ProtocolTest { + service := &service.Service{ + ServiceInfo: serviceinfo.ServiceInfo{ + Config: defaults.DefaultConfig.Merge(config), + ServiceName: "outputservice8protocoltest", + APIVersion: "", + }, + } + service.Initialize() + + // Handlers + service.Handlers.Sign.PushBack(v4.Sign) + service.Handlers.Build.PushBack(query.Build) + service.Handlers.Unmarshal.PushBack(query.Unmarshal) + service.Handlers.UnmarshalMeta.PushBack(query.UnmarshalMeta) + service.Handlers.UnmarshalError.PushBack(query.UnmarshalError) + + return &OutputService8ProtocolTest{service} +} + +// newRequest creates a new request for a OutputService8ProtocolTest operation and runs any +// custom request initialization. +func (c *OutputService8ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { + req := c.NewRequest(op, params, data) + + return req +} + +const opOutputService8TestCaseOperation1 = "OperationName" + +// OutputService8TestCaseOperation1Request generates a request for the OutputService8TestCaseOperation1 operation. +func (c *OutputService8ProtocolTest) OutputService8TestCaseOperation1Request(input *OutputService8TestShapeOutputService8TestCaseOperation1Input) (req *request.Request, output *OutputService8TestShapeOutputService8TestCaseOperation1Output) { + op := &request.Operation{ + Name: opOutputService8TestCaseOperation1, + } + + if input == nil { + input = &OutputService8TestShapeOutputService8TestCaseOperation1Input{} + } + + req = c.newRequest(op, input, output) + output = &OutputService8TestShapeOutputService8TestCaseOperation1Output{} + req.Data = output + return +} + +func (c *OutputService8ProtocolTest) OutputService8TestCaseOperation1(input *OutputService8TestShapeOutputService8TestCaseOperation1Input) (*OutputService8TestShapeOutputService8TestCaseOperation1Output, error) { + req, out := c.OutputService8TestCaseOperation1Request(input) + err := req.Send() + return out, err +} + +type OutputService8TestShapeOutputService8TestCaseOperation1Input struct { + metadataOutputService8TestShapeOutputService8TestCaseOperation1Input `json:"-" xml:"-"` +} + +type metadataOutputService8TestShapeOutputService8TestCaseOperation1Input struct { + SDKShapeTraits bool `type:"structure"` +} + +type OutputService8TestShapeOutputService8TestCaseOperation1Output struct { + List []*OutputService8TestShapeStructureShape `type:"list"` + + metadataOutputService8TestShapeOutputService8TestCaseOperation1Output `json:"-" xml:"-"` +} + +type metadataOutputService8TestShapeOutputService8TestCaseOperation1Output struct { + SDKShapeTraits bool `type:"structure"` +} + +type OutputService8TestShapeStructureShape struct { + Bar *string `type:"string"` + + Baz *string `type:"string"` + + Foo *string `type:"string"` + + metadataOutputService8TestShapeStructureShape `json:"-" xml:"-"` +} + +type metadataOutputService8TestShapeStructureShape struct { + SDKShapeTraits bool `type:"structure"` +} + +type OutputService9ProtocolTest struct { + *service.Service +} + +// New returns a new OutputService9ProtocolTest client. +func NewOutputService9ProtocolTest(config *aws.Config) *OutputService9ProtocolTest { + service := &service.Service{ + ServiceInfo: serviceinfo.ServiceInfo{ + Config: defaults.DefaultConfig.Merge(config), + ServiceName: "outputservice9protocoltest", + APIVersion: "", + }, + } + service.Initialize() + + // Handlers + service.Handlers.Sign.PushBack(v4.Sign) + service.Handlers.Build.PushBack(query.Build) + service.Handlers.Unmarshal.PushBack(query.Unmarshal) + service.Handlers.UnmarshalMeta.PushBack(query.UnmarshalMeta) + service.Handlers.UnmarshalError.PushBack(query.UnmarshalError) + + return &OutputService9ProtocolTest{service} +} + +// newRequest creates a new request for a OutputService9ProtocolTest operation and runs any +// custom request initialization. +func (c *OutputService9ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { + req := c.NewRequest(op, params, data) + + return req +} + +const opOutputService9TestCaseOperation1 = "OperationName" + +// OutputService9TestCaseOperation1Request generates a request for the OutputService9TestCaseOperation1 operation. +func (c *OutputService9ProtocolTest) OutputService9TestCaseOperation1Request(input *OutputService9TestShapeOutputService9TestCaseOperation1Input) (req *request.Request, output *OutputService9TestShapeOutputService9TestCaseOperation1Output) { + op := &request.Operation{ + Name: opOutputService9TestCaseOperation1, + } + + if input == nil { + input = &OutputService9TestShapeOutputService9TestCaseOperation1Input{} + } + + req = c.newRequest(op, input, output) + output = &OutputService9TestShapeOutputService9TestCaseOperation1Output{} + req.Data = output + return +} + +func (c *OutputService9ProtocolTest) OutputService9TestCaseOperation1(input *OutputService9TestShapeOutputService9TestCaseOperation1Input) (*OutputService9TestShapeOutputService9TestCaseOperation1Output, error) { + req, out := c.OutputService9TestCaseOperation1Request(input) + err := req.Send() + return out, err +} + +type OutputService9TestShapeOutputService9TestCaseOperation1Input struct { + metadataOutputService9TestShapeOutputService9TestCaseOperation1Input `json:"-" xml:"-"` +} + +type metadataOutputService9TestShapeOutputService9TestCaseOperation1Input struct { + SDKShapeTraits bool `type:"structure"` +} + +type OutputService9TestShapeOutputService9TestCaseOperation1Output struct { + List []*OutputService9TestShapeStructureShape `type:"list" flattened:"true"` + + metadataOutputService9TestShapeOutputService9TestCaseOperation1Output `json:"-" xml:"-"` +} + +type metadataOutputService9TestShapeOutputService9TestCaseOperation1Output struct { + SDKShapeTraits bool `type:"structure"` +} + +type OutputService9TestShapeStructureShape struct { + Bar *string `type:"string"` + + Baz *string `type:"string"` + + Foo *string `type:"string"` + + metadataOutputService9TestShapeStructureShape `json:"-" xml:"-"` +} + +type metadataOutputService9TestShapeStructureShape struct { + SDKShapeTraits bool `type:"structure"` +} + +type OutputService10ProtocolTest struct { + *service.Service +} + +// New returns a new OutputService10ProtocolTest client. +func NewOutputService10ProtocolTest(config *aws.Config) *OutputService10ProtocolTest { + service := &service.Service{ + ServiceInfo: serviceinfo.ServiceInfo{ + Config: defaults.DefaultConfig.Merge(config), + ServiceName: "outputservice10protocoltest", + APIVersion: "", + }, + } + service.Initialize() + + // Handlers + service.Handlers.Sign.PushBack(v4.Sign) + service.Handlers.Build.PushBack(query.Build) + service.Handlers.Unmarshal.PushBack(query.Unmarshal) + service.Handlers.UnmarshalMeta.PushBack(query.UnmarshalMeta) + service.Handlers.UnmarshalError.PushBack(query.UnmarshalError) + + return &OutputService10ProtocolTest{service} +} + +// newRequest creates a new request for a OutputService10ProtocolTest operation and runs any +// custom request initialization. +func (c *OutputService10ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { + req := c.NewRequest(op, params, data) + + return req +} + +const opOutputService10TestCaseOperation1 = "OperationName" + +// OutputService10TestCaseOperation1Request generates a request for the OutputService10TestCaseOperation1 operation. +func (c *OutputService10ProtocolTest) OutputService10TestCaseOperation1Request(input *OutputService10TestShapeOutputService10TestCaseOperation1Input) (req *request.Request, output *OutputService10TestShapeOutputService10TestCaseOperation1Output) { + op := &request.Operation{ + Name: opOutputService10TestCaseOperation1, + } + + if input == nil { + input = &OutputService10TestShapeOutputService10TestCaseOperation1Input{} + } + + req = c.newRequest(op, input, output) + output = &OutputService10TestShapeOutputService10TestCaseOperation1Output{} + req.Data = output + return +} + +func (c *OutputService10ProtocolTest) OutputService10TestCaseOperation1(input *OutputService10TestShapeOutputService10TestCaseOperation1Input) (*OutputService10TestShapeOutputService10TestCaseOperation1Output, error) { + req, out := c.OutputService10TestCaseOperation1Request(input) + err := req.Send() + return out, err +} + +type OutputService10TestShapeOutputService10TestCaseOperation1Input struct { + metadataOutputService10TestShapeOutputService10TestCaseOperation1Input `json:"-" xml:"-"` +} + +type metadataOutputService10TestShapeOutputService10TestCaseOperation1Input struct { + SDKShapeTraits bool `type:"structure"` +} + +type OutputService10TestShapeOutputService10TestCaseOperation1Output struct { + List []*string `locationNameList:"NamedList" type:"list" flattened:"true"` + + metadataOutputService10TestShapeOutputService10TestCaseOperation1Output `json:"-" xml:"-"` +} + +type metadataOutputService10TestShapeOutputService10TestCaseOperation1Output struct { + SDKShapeTraits bool `type:"structure"` +} + +type OutputService11ProtocolTest struct { + *service.Service +} + +// New returns a new OutputService11ProtocolTest client. +func NewOutputService11ProtocolTest(config *aws.Config) *OutputService11ProtocolTest { + service := &service.Service{ + ServiceInfo: serviceinfo.ServiceInfo{ + Config: defaults.DefaultConfig.Merge(config), + ServiceName: "outputservice11protocoltest", + APIVersion: "", + }, + } + service.Initialize() + + // Handlers + service.Handlers.Sign.PushBack(v4.Sign) + service.Handlers.Build.PushBack(query.Build) + service.Handlers.Unmarshal.PushBack(query.Unmarshal) + service.Handlers.UnmarshalMeta.PushBack(query.UnmarshalMeta) + service.Handlers.UnmarshalError.PushBack(query.UnmarshalError) + + return &OutputService11ProtocolTest{service} +} + +// newRequest creates a new request for a OutputService11ProtocolTest operation and runs any +// custom request initialization. +func (c *OutputService11ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { + req := c.NewRequest(op, params, data) + + return req +} + +const opOutputService11TestCaseOperation1 = "OperationName" + +// OutputService11TestCaseOperation1Request generates a request for the OutputService11TestCaseOperation1 operation. +func (c *OutputService11ProtocolTest) OutputService11TestCaseOperation1Request(input *OutputService11TestShapeOutputService11TestCaseOperation1Input) (req *request.Request, output *OutputService11TestShapeOutputService11TestCaseOperation1Output) { + op := &request.Operation{ + Name: opOutputService11TestCaseOperation1, + } + + if input == nil { + input = &OutputService11TestShapeOutputService11TestCaseOperation1Input{} + } + + req = c.newRequest(op, input, output) + output = &OutputService11TestShapeOutputService11TestCaseOperation1Output{} + req.Data = output + return +} + +func (c *OutputService11ProtocolTest) OutputService11TestCaseOperation1(input *OutputService11TestShapeOutputService11TestCaseOperation1Input) (*OutputService11TestShapeOutputService11TestCaseOperation1Output, error) { + req, out := c.OutputService11TestCaseOperation1Request(input) + err := req.Send() + return out, err +} + +type OutputService11TestShapeOutputService11TestCaseOperation1Input struct { + metadataOutputService11TestShapeOutputService11TestCaseOperation1Input `json:"-" xml:"-"` +} + +type metadataOutputService11TestShapeOutputService11TestCaseOperation1Input struct { + SDKShapeTraits bool `type:"structure"` +} + +type OutputService11TestShapeOutputService11TestCaseOperation1Output struct { + Map map[string]*OutputService11TestShapeStructType `type:"map"` + + metadataOutputService11TestShapeOutputService11TestCaseOperation1Output `json:"-" xml:"-"` +} + +type metadataOutputService11TestShapeOutputService11TestCaseOperation1Output struct { + SDKShapeTraits bool `type:"structure"` +} + +type OutputService11TestShapeStructType struct { + Foo *string `locationName:"foo" type:"string"` + + metadataOutputService11TestShapeStructType `json:"-" xml:"-"` +} + +type metadataOutputService11TestShapeStructType struct { + SDKShapeTraits bool `type:"structure"` +} + +type OutputService12ProtocolTest struct { + *service.Service +} + +// New returns a new OutputService12ProtocolTest client. +func NewOutputService12ProtocolTest(config *aws.Config) *OutputService12ProtocolTest { + service := &service.Service{ + ServiceInfo: serviceinfo.ServiceInfo{ + Config: defaults.DefaultConfig.Merge(config), + ServiceName: "outputservice12protocoltest", + APIVersion: "", + }, + } + service.Initialize() + + // Handlers + service.Handlers.Sign.PushBack(v4.Sign) + service.Handlers.Build.PushBack(query.Build) + service.Handlers.Unmarshal.PushBack(query.Unmarshal) + service.Handlers.UnmarshalMeta.PushBack(query.UnmarshalMeta) + service.Handlers.UnmarshalError.PushBack(query.UnmarshalError) + + return &OutputService12ProtocolTest{service} +} + +// newRequest creates a new request for a OutputService12ProtocolTest operation and runs any +// custom request initialization. +func (c *OutputService12ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { + req := c.NewRequest(op, params, data) + + return req +} + +const opOutputService12TestCaseOperation1 = "OperationName" + +// OutputService12TestCaseOperation1Request generates a request for the OutputService12TestCaseOperation1 operation. +func (c *OutputService12ProtocolTest) OutputService12TestCaseOperation1Request(input *OutputService12TestShapeOutputService12TestCaseOperation1Input) (req *request.Request, output *OutputService12TestShapeOutputService12TestCaseOperation1Output) { + op := &request.Operation{ + Name: opOutputService12TestCaseOperation1, + } + + if input == nil { + input = &OutputService12TestShapeOutputService12TestCaseOperation1Input{} + } + + req = c.newRequest(op, input, output) + output = &OutputService12TestShapeOutputService12TestCaseOperation1Output{} + req.Data = output + return +} + +func (c *OutputService12ProtocolTest) OutputService12TestCaseOperation1(input *OutputService12TestShapeOutputService12TestCaseOperation1Input) (*OutputService12TestShapeOutputService12TestCaseOperation1Output, error) { + req, out := c.OutputService12TestCaseOperation1Request(input) + err := req.Send() + return out, err +} + +type OutputService12TestShapeOutputService12TestCaseOperation1Input struct { + metadataOutputService12TestShapeOutputService12TestCaseOperation1Input `json:"-" xml:"-"` +} + +type metadataOutputService12TestShapeOutputService12TestCaseOperation1Input struct { + SDKShapeTraits bool `type:"structure"` +} + +type OutputService12TestShapeOutputService12TestCaseOperation1Output struct { + Map map[string]*string `type:"map" flattened:"true"` + + metadataOutputService12TestShapeOutputService12TestCaseOperation1Output `json:"-" xml:"-"` +} + +type metadataOutputService12TestShapeOutputService12TestCaseOperation1Output struct { + SDKShapeTraits bool `type:"structure"` +} + +type OutputService13ProtocolTest struct { + *service.Service +} + +// New returns a new OutputService13ProtocolTest client. +func NewOutputService13ProtocolTest(config *aws.Config) *OutputService13ProtocolTest { + service := &service.Service{ + ServiceInfo: serviceinfo.ServiceInfo{ + Config: defaults.DefaultConfig.Merge(config), + ServiceName: "outputservice13protocoltest", + APIVersion: "", + }, + } + service.Initialize() + + // Handlers + service.Handlers.Sign.PushBack(v4.Sign) + service.Handlers.Build.PushBack(query.Build) + service.Handlers.Unmarshal.PushBack(query.Unmarshal) + service.Handlers.UnmarshalMeta.PushBack(query.UnmarshalMeta) + service.Handlers.UnmarshalError.PushBack(query.UnmarshalError) + + return &OutputService13ProtocolTest{service} +} + +// newRequest creates a new request for a OutputService13ProtocolTest operation and runs any +// custom request initialization. +func (c *OutputService13ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { + req := c.NewRequest(op, params, data) + + return req +} + +const opOutputService13TestCaseOperation1 = "OperationName" + +// OutputService13TestCaseOperation1Request generates a request for the OutputService13TestCaseOperation1 operation. +func (c *OutputService13ProtocolTest) OutputService13TestCaseOperation1Request(input *OutputService13TestShapeOutputService13TestCaseOperation1Input) (req *request.Request, output *OutputService13TestShapeOutputService13TestCaseOperation1Output) { + op := &request.Operation{ + Name: opOutputService13TestCaseOperation1, + } + + if input == nil { + input = &OutputService13TestShapeOutputService13TestCaseOperation1Input{} + } + + req = c.newRequest(op, input, output) + output = &OutputService13TestShapeOutputService13TestCaseOperation1Output{} + req.Data = output + return +} + +func (c *OutputService13ProtocolTest) OutputService13TestCaseOperation1(input *OutputService13TestShapeOutputService13TestCaseOperation1Input) (*OutputService13TestShapeOutputService13TestCaseOperation1Output, error) { + req, out := c.OutputService13TestCaseOperation1Request(input) + err := req.Send() + return out, err +} + +type OutputService13TestShapeOutputService13TestCaseOperation1Input struct { + metadataOutputService13TestShapeOutputService13TestCaseOperation1Input `json:"-" xml:"-"` +} + +type metadataOutputService13TestShapeOutputService13TestCaseOperation1Input struct { + SDKShapeTraits bool `type:"structure"` +} + +type OutputService13TestShapeOutputService13TestCaseOperation1Output struct { + Map map[string]*string `locationName:"Attribute" locationNameKey:"Name" locationNameValue:"Value" type:"map" flattened:"true"` + + metadataOutputService13TestShapeOutputService13TestCaseOperation1Output `json:"-" xml:"-"` +} + +type metadataOutputService13TestShapeOutputService13TestCaseOperation1Output struct { + SDKShapeTraits bool `type:"structure"` +} + +type OutputService14ProtocolTest struct { + *service.Service +} + +// New returns a new OutputService14ProtocolTest client. +func NewOutputService14ProtocolTest(config *aws.Config) *OutputService14ProtocolTest { + service := &service.Service{ + ServiceInfo: serviceinfo.ServiceInfo{ + Config: defaults.DefaultConfig.Merge(config), + ServiceName: "outputservice14protocoltest", + APIVersion: "", + }, + } + service.Initialize() + + // Handlers + service.Handlers.Sign.PushBack(v4.Sign) + service.Handlers.Build.PushBack(query.Build) + service.Handlers.Unmarshal.PushBack(query.Unmarshal) + service.Handlers.UnmarshalMeta.PushBack(query.UnmarshalMeta) + service.Handlers.UnmarshalError.PushBack(query.UnmarshalError) + + return &OutputService14ProtocolTest{service} +} + +// newRequest creates a new request for a OutputService14ProtocolTest operation and runs any +// custom request initialization. +func (c *OutputService14ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { + req := c.NewRequest(op, params, data) + + return req +} + +const opOutputService14TestCaseOperation1 = "OperationName" + +// OutputService14TestCaseOperation1Request generates a request for the OutputService14TestCaseOperation1 operation. +func (c *OutputService14ProtocolTest) OutputService14TestCaseOperation1Request(input *OutputService14TestShapeOutputService14TestCaseOperation1Input) (req *request.Request, output *OutputService14TestShapeOutputService14TestCaseOperation1Output) { + op := &request.Operation{ + Name: opOutputService14TestCaseOperation1, + } + + if input == nil { + input = &OutputService14TestShapeOutputService14TestCaseOperation1Input{} + } + + req = c.newRequest(op, input, output) + output = &OutputService14TestShapeOutputService14TestCaseOperation1Output{} + req.Data = output + return +} + +func (c *OutputService14ProtocolTest) OutputService14TestCaseOperation1(input *OutputService14TestShapeOutputService14TestCaseOperation1Input) (*OutputService14TestShapeOutputService14TestCaseOperation1Output, error) { + req, out := c.OutputService14TestCaseOperation1Request(input) + err := req.Send() + return out, err +} + +type OutputService14TestShapeOutputService14TestCaseOperation1Input struct { + metadataOutputService14TestShapeOutputService14TestCaseOperation1Input `json:"-" xml:"-"` +} + +type metadataOutputService14TestShapeOutputService14TestCaseOperation1Input struct { + SDKShapeTraits bool `type:"structure"` +} + +type OutputService14TestShapeOutputService14TestCaseOperation1Output struct { + Map map[string]*string `locationNameKey:"foo" locationNameValue:"bar" type:"map" flattened:"true"` + + metadataOutputService14TestShapeOutputService14TestCaseOperation1Output `json:"-" xml:"-"` +} + +type metadataOutputService14TestShapeOutputService14TestCaseOperation1Output struct { + SDKShapeTraits bool `type:"structure"` +} + +// +// Tests begin here +// + +func TestOutputService1ProtocolTestScalarMembersCase1(t *testing.T) { + svc := NewOutputService1ProtocolTest(nil) + + buf := bytes.NewReader([]byte("myname123falsetrue1.21.3200a2015-01-25T08:00:00Zrequest-id")) + req, out := svc.OutputService1TestCaseOperation1Request(nil) + req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}} + + // set headers + + // unmarshal response + query.UnmarshalMeta(req) + query.Unmarshal(req) + assert.NoError(t, req.Error) + + // assert response + assert.NotNil(t, out) // ensure out variable is used + assert.Equal(t, "a", *out.Char) + assert.Equal(t, 1.3, *out.Double) + assert.Equal(t, false, *out.FalseBool) + assert.Equal(t, 1.2, *out.Float) + assert.Equal(t, int64(200), *out.Long) + assert.Equal(t, int64(123), *out.Num) + assert.Equal(t, "myname", *out.Str) + assert.Equal(t, time.Unix(1.4221728e+09, 0).UTC().String(), out.Timestamp.String()) + assert.Equal(t, true, *out.TrueBool) + +} + +func TestOutputService2ProtocolTestNotAllMembersInResponseCase1(t *testing.T) { + svc := NewOutputService2ProtocolTest(nil) + + buf := bytes.NewReader([]byte("mynamerequest-id")) + req, out := svc.OutputService2TestCaseOperation1Request(nil) + req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}} + + // set headers + + // unmarshal response + query.UnmarshalMeta(req) + query.Unmarshal(req) + assert.NoError(t, req.Error) + + // assert response + assert.NotNil(t, out) // ensure out variable is used + assert.Equal(t, "myname", *out.Str) + +} + +func TestOutputService3ProtocolTestBlobCase1(t *testing.T) { + svc := NewOutputService3ProtocolTest(nil) + + buf := bytes.NewReader([]byte("dmFsdWU=requestid")) + req, out := svc.OutputService3TestCaseOperation1Request(nil) + req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}} + + // set headers + + // unmarshal response + query.UnmarshalMeta(req) + query.Unmarshal(req) + assert.NoError(t, req.Error) + + // assert response + assert.NotNil(t, out) // ensure out variable is used + assert.Equal(t, "value", string(out.Blob)) + +} + +func TestOutputService4ProtocolTestListsCase1(t *testing.T) { + svc := NewOutputService4ProtocolTest(nil) + + buf := bytes.NewReader([]byte("abc123requestid")) + req, out := svc.OutputService4TestCaseOperation1Request(nil) + req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}} + + // set headers + + // unmarshal response + query.UnmarshalMeta(req) + query.Unmarshal(req) + assert.NoError(t, req.Error) + + // assert response + assert.NotNil(t, out) // ensure out variable is used + assert.Equal(t, "abc", *out.ListMember[0]) + assert.Equal(t, "123", *out.ListMember[1]) + +} + +func TestOutputService5ProtocolTestListWithCustomMemberNameCase1(t *testing.T) { + svc := NewOutputService5ProtocolTest(nil) + + buf := bytes.NewReader([]byte("abc123requestid")) + req, out := svc.OutputService5TestCaseOperation1Request(nil) + req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}} + + // set headers + + // unmarshal response + query.UnmarshalMeta(req) + query.Unmarshal(req) + assert.NoError(t, req.Error) + + // assert response + assert.NotNil(t, out) // ensure out variable is used + assert.Equal(t, "abc", *out.ListMember[0]) + assert.Equal(t, "123", *out.ListMember[1]) + +} + +func TestOutputService6ProtocolTestFlattenedListCase1(t *testing.T) { + svc := NewOutputService6ProtocolTest(nil) + + buf := bytes.NewReader([]byte("abc123requestid")) + req, out := svc.OutputService6TestCaseOperation1Request(nil) + req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}} + + // set headers + + // unmarshal response + query.UnmarshalMeta(req) + query.Unmarshal(req) + assert.NoError(t, req.Error) + + // assert response + assert.NotNil(t, out) // ensure out variable is used + assert.Equal(t, "abc", *out.ListMember[0]) + assert.Equal(t, "123", *out.ListMember[1]) + +} + +func TestOutputService7ProtocolTestFlattenedSingleElementListCase1(t *testing.T) { + svc := NewOutputService7ProtocolTest(nil) + + buf := bytes.NewReader([]byte("abcrequestid")) + req, out := svc.OutputService7TestCaseOperation1Request(nil) + req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}} + + // set headers + + // unmarshal response + query.UnmarshalMeta(req) + query.Unmarshal(req) + assert.NoError(t, req.Error) + + // assert response + assert.NotNil(t, out) // ensure out variable is used + assert.Equal(t, "abc", *out.ListMember[0]) + +} + +func TestOutputService8ProtocolTestListOfStructuresCase1(t *testing.T) { + svc := NewOutputService8ProtocolTest(nil) + + buf := bytes.NewReader([]byte("firstfoofirstbarfirstbazsecondfoosecondbarsecondbazrequestid")) + req, out := svc.OutputService8TestCaseOperation1Request(nil) + req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}} + + // set headers + + // unmarshal response + query.UnmarshalMeta(req) + query.Unmarshal(req) + assert.NoError(t, req.Error) + + // assert response + assert.NotNil(t, out) // ensure out variable is used + assert.Equal(t, "firstbar", *out.List[0].Bar) + assert.Equal(t, "firstbaz", *out.List[0].Baz) + assert.Equal(t, "firstfoo", *out.List[0].Foo) + assert.Equal(t, "secondbar", *out.List[1].Bar) + assert.Equal(t, "secondbaz", *out.List[1].Baz) + assert.Equal(t, "secondfoo", *out.List[1].Foo) + +} + +func TestOutputService9ProtocolTestFlattenedListOfStructuresCase1(t *testing.T) { + svc := NewOutputService9ProtocolTest(nil) + + buf := bytes.NewReader([]byte("firstfoofirstbarfirstbazsecondfoosecondbarsecondbazrequestid")) + req, out := svc.OutputService9TestCaseOperation1Request(nil) + req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}} + + // set headers + + // unmarshal response + query.UnmarshalMeta(req) + query.Unmarshal(req) + assert.NoError(t, req.Error) + + // assert response + assert.NotNil(t, out) // ensure out variable is used + assert.Equal(t, "firstbar", *out.List[0].Bar) + assert.Equal(t, "firstbaz", *out.List[0].Baz) + assert.Equal(t, "firstfoo", *out.List[0].Foo) + assert.Equal(t, "secondbar", *out.List[1].Bar) + assert.Equal(t, "secondbaz", *out.List[1].Baz) + assert.Equal(t, "secondfoo", *out.List[1].Foo) + +} + +func TestOutputService10ProtocolTestFlattenedListWithLocationNameCase1(t *testing.T) { + svc := NewOutputService10ProtocolTest(nil) + + buf := bytes.NewReader([]byte("abrequestid")) + req, out := svc.OutputService10TestCaseOperation1Request(nil) + req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}} + + // set headers + + // unmarshal response + query.UnmarshalMeta(req) + query.Unmarshal(req) + assert.NoError(t, req.Error) + + // assert response + assert.NotNil(t, out) // ensure out variable is used + assert.Equal(t, "a", *out.List[0]) + assert.Equal(t, "b", *out.List[1]) + +} + +func TestOutputService11ProtocolTestNormalMapCase1(t *testing.T) { + svc := NewOutputService11ProtocolTest(nil) + + buf := bytes.NewReader([]byte("quxbarbazbamrequestid")) + req, out := svc.OutputService11TestCaseOperation1Request(nil) + req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}} + + // set headers + + // unmarshal response + query.UnmarshalMeta(req) + query.Unmarshal(req) + assert.NoError(t, req.Error) + + // assert response + assert.NotNil(t, out) // ensure out variable is used + assert.Equal(t, "bam", *out.Map["baz"].Foo) + assert.Equal(t, "bar", *out.Map["qux"].Foo) + +} + +func TestOutputService12ProtocolTestFlattenedMapCase1(t *testing.T) { + svc := NewOutputService12ProtocolTest(nil) + + buf := bytes.NewReader([]byte("quxbarbazbamrequestid")) + req, out := svc.OutputService12TestCaseOperation1Request(nil) + req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}} + + // set headers + + // unmarshal response + query.UnmarshalMeta(req) + query.Unmarshal(req) + assert.NoError(t, req.Error) + + // assert response + assert.NotNil(t, out) // ensure out variable is used + assert.Equal(t, "bam", *out.Map["baz"]) + assert.Equal(t, "bar", *out.Map["qux"]) + +} + +func TestOutputService13ProtocolTestFlattenedMapInShapeDefinitionCase1(t *testing.T) { + svc := NewOutputService13ProtocolTest(nil) + + buf := bytes.NewReader([]byte("quxbarrequestid")) + req, out := svc.OutputService13TestCaseOperation1Request(nil) + req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}} + + // set headers + + // unmarshal response + query.UnmarshalMeta(req) + query.Unmarshal(req) + assert.NoError(t, req.Error) + + // assert response + assert.NotNil(t, out) // ensure out variable is used + assert.Equal(t, "bar", *out.Map["qux"]) + +} + +func TestOutputService14ProtocolTestNamedMapCase1(t *testing.T) { + svc := NewOutputService14ProtocolTest(nil) + + buf := bytes.NewReader([]byte("quxbarbazbamrequestid")) + req, out := svc.OutputService14TestCaseOperation1Request(nil) + req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}} + + // set headers + + // unmarshal response + query.UnmarshalMeta(req) + query.Unmarshal(req) + assert.NoError(t, req.Error) + + // assert response + assert.NotNil(t, out) // ensure out variable is used + assert.Equal(t, "bam", *out.Map["baz"]) + assert.Equal(t, "bar", *out.Map["qux"]) + +} diff --git a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/private/protocol/rest/build.go b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/private/protocol/rest/build.go new file mode 100644 index 00000000000..87352bc60de --- /dev/null +++ b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/private/protocol/rest/build.go @@ -0,0 +1,254 @@ +// Package rest provides RESTful serialization of AWS requests and responses. +package rest + +import ( + "bytes" + "encoding/base64" + "fmt" + "io" + "net/http" + "net/url" + "path" + "reflect" + "strconv" + "strings" + "time" + + "github.com/aws/aws-sdk-go/aws/awserr" + "github.com/aws/aws-sdk-go/aws/request" +) + +// RFC822 returns an RFC822 formatted timestamp for AWS protocols +const RFC822 = "Mon, 2 Jan 2006 15:04:05 GMT" + +// Whether the byte value can be sent without escaping in AWS URLs +var noEscape [256]bool + +var errValueNotSet = fmt.Errorf("value not set") + +func init() { + for i := 0; i < len(noEscape); i++ { + // AWS expects every character except these to be escaped + noEscape[i] = (i >= 'A' && i <= 'Z') || + (i >= 'a' && i <= 'z') || + (i >= '0' && i <= '9') || + i == '-' || + i == '.' || + i == '_' || + i == '~' + } +} + +// Build builds the REST component of a service request. +func Build(r *request.Request) { + if r.ParamsFilled() { + v := reflect.ValueOf(r.Params).Elem() + buildLocationElements(r, v) + buildBody(r, v) + } +} + +func buildLocationElements(r *request.Request, v reflect.Value) { + query := r.HTTPRequest.URL.Query() + + for i := 0; i < v.NumField(); i++ { + m := v.Field(i) + if n := v.Type().Field(i).Name; n[0:1] == strings.ToLower(n[0:1]) { + continue + } + + if m.IsValid() { + field := v.Type().Field(i) + name := field.Tag.Get("locationName") + if name == "" { + name = field.Name + } + if m.Kind() == reflect.Ptr { + m = m.Elem() + } + if !m.IsValid() { + continue + } + + var err error + switch field.Tag.Get("location") { + case "headers": // header maps + err = buildHeaderMap(&r.HTTPRequest.Header, m, field.Tag.Get("locationName")) + case "header": + err = buildHeader(&r.HTTPRequest.Header, m, name) + case "uri": + err = buildURI(r.HTTPRequest.URL, m, name) + case "querystring": + err = buildQueryString(query, m, name) + } + r.Error = err + } + if r.Error != nil { + return + } + } + + r.HTTPRequest.URL.RawQuery = query.Encode() + updatePath(r.HTTPRequest.URL, r.HTTPRequest.URL.Path) +} + +func buildBody(r *request.Request, v reflect.Value) { + if field, ok := v.Type().FieldByName("SDKShapeTraits"); ok { + if payloadName := field.Tag.Get("payload"); payloadName != "" { + pfield, _ := v.Type().FieldByName(payloadName) + if ptag := pfield.Tag.Get("type"); ptag != "" && ptag != "structure" { + payload := reflect.Indirect(v.FieldByName(payloadName)) + if payload.IsValid() && payload.Interface() != nil { + switch reader := payload.Interface().(type) { + case io.ReadSeeker: + r.SetReaderBody(reader) + case []byte: + r.SetBufferBody(reader) + case string: + r.SetStringBody(reader) + default: + r.Error = awserr.New("SerializationError", + "failed to encode REST request", + fmt.Errorf("unknown payload type %s", payload.Type())) + } + } + } + } + } +} + +func buildHeader(header *http.Header, v reflect.Value, name string) error { + str, err := convertType(v) + if err == errValueNotSet { + return nil + } else if err != nil { + return awserr.New("SerializationError", "failed to encode REST request", err) + } + + header.Add(name, str) + + return nil +} + +func buildHeaderMap(header *http.Header, v reflect.Value, prefix string) error { + for _, key := range v.MapKeys() { + str, err := convertType(v.MapIndex(key)) + if err == errValueNotSet { + continue + } else if err != nil { + return awserr.New("SerializationError", "failed to encode REST request", err) + + } + + header.Add(prefix+key.String(), str) + } + return nil +} + +func buildURI(u *url.URL, v reflect.Value, name string) error { + value, err := convertType(v) + if err == errValueNotSet { + return nil + } else if err != nil { + return awserr.New("SerializationError", "failed to encode REST request", err) + } + + uri := u.Path + uri = strings.Replace(uri, "{"+name+"}", EscapePath(value, true), -1) + uri = strings.Replace(uri, "{"+name+"+}", EscapePath(value, false), -1) + u.Path = uri + + return nil +} + +func buildQueryString(query url.Values, v reflect.Value, name string) error { + switch value := v.Interface().(type) { + case []*string: + for _, item := range value { + query.Add(name, *item) + } + case map[string]*string: + for key, item := range value { + query.Add(key, *item) + } + case map[string][]*string: + for key, items := range value { + for _, item := range items { + query.Add(key, *item) + } + } + default: + str, err := convertType(v) + if err == errValueNotSet { + return nil + } else if err != nil { + return awserr.New("SerializationError", "failed to encode REST request", err) + } + query.Set(name, str) + } + + return nil +} + +func updatePath(url *url.URL, urlPath string) { + scheme, query := url.Scheme, url.RawQuery + + hasSlash := strings.HasSuffix(urlPath, "/") + + // clean up path + urlPath = path.Clean(urlPath) + if hasSlash && !strings.HasSuffix(urlPath, "/") { + urlPath += "/" + } + + // get formatted URL minus scheme so we can build this into Opaque + url.Scheme, url.Path, url.RawQuery = "", "", "" + s := url.String() + url.Scheme = scheme + url.RawQuery = query + + // build opaque URI + url.Opaque = s + urlPath +} + +// EscapePath escapes part of a URL path in Amazon style +func EscapePath(path string, encodeSep bool) string { + var buf bytes.Buffer + for i := 0; i < len(path); i++ { + c := path[i] + if noEscape[c] || (c == '/' && !encodeSep) { + buf.WriteByte(c) + } else { + buf.WriteByte('%') + buf.WriteString(strings.ToUpper(strconv.FormatUint(uint64(c), 16))) + } + } + return buf.String() +} + +func convertType(v reflect.Value) (string, error) { + v = reflect.Indirect(v) + if !v.IsValid() { + return "", errValueNotSet + } + + var str string + switch value := v.Interface().(type) { + case string: + str = value + case []byte: + str = base64.StdEncoding.EncodeToString(value) + case bool: + str = strconv.FormatBool(value) + case int64: + str = strconv.FormatInt(value, 10) + case float64: + str = strconv.FormatFloat(value, 'f', -1, 64) + case time.Time: + str = value.UTC().Format(RFC822) + default: + err := fmt.Errorf("Unsupported value for param %v (%s)", v.Interface(), v.Type()) + return "", err + } + return str, nil +} diff --git a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/private/protocol/rest/payload.go b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/private/protocol/rest/payload.go new file mode 100644 index 00000000000..1f603bb719f --- /dev/null +++ b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/private/protocol/rest/payload.go @@ -0,0 +1,45 @@ +package rest + +import "reflect" + +// PayloadMember returns the payload field member of i if there is one, or nil. +func PayloadMember(i interface{}) interface{} { + if i == nil { + return nil + } + + v := reflect.ValueOf(i).Elem() + if !v.IsValid() { + return nil + } + if field, ok := v.Type().FieldByName("SDKShapeTraits"); ok { + if payloadName := field.Tag.Get("payload"); payloadName != "" { + field, _ := v.Type().FieldByName(payloadName) + if field.Tag.Get("type") != "structure" { + return nil + } + + payload := v.FieldByName(payloadName) + if payload.IsValid() || (payload.Kind() == reflect.Ptr && !payload.IsNil()) { + return payload.Interface() + } + } + } + return nil +} + +// PayloadType returns the type of a payload field member of i if there is one, or "". +func PayloadType(i interface{}) string { + v := reflect.Indirect(reflect.ValueOf(i)) + if !v.IsValid() { + return "" + } + if field, ok := v.Type().FieldByName("SDKShapeTraits"); ok { + if payloadName := field.Tag.Get("payload"); payloadName != "" { + if member, ok := v.Type().FieldByName(payloadName); ok { + return member.Tag.Get("type") + } + } + } + return "" +} diff --git a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/private/protocol/rest/unmarshal.go b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/private/protocol/rest/unmarshal.go new file mode 100644 index 00000000000..06d9accbacb --- /dev/null +++ b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/private/protocol/rest/unmarshal.go @@ -0,0 +1,183 @@ +package rest + +import ( + "encoding/base64" + "fmt" + "io/ioutil" + "net/http" + "reflect" + "strconv" + "strings" + "time" + + "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/aws/awserr" + "github.com/aws/aws-sdk-go/aws/request" +) + +// Unmarshal unmarshals the REST component of a response in a REST service. +func Unmarshal(r *request.Request) { + if r.DataFilled() { + v := reflect.Indirect(reflect.ValueOf(r.Data)) + unmarshalBody(r, v) + } +} + +// UnmarshalMeta unmarshals the REST metadata of a response in a REST service +func UnmarshalMeta(r *request.Request) { + r.RequestID = r.HTTPResponse.Header.Get("X-Amzn-Requestid") + if r.DataFilled() { + v := reflect.Indirect(reflect.ValueOf(r.Data)) + unmarshalLocationElements(r, v) + } +} + +func unmarshalBody(r *request.Request, v reflect.Value) { + if field, ok := v.Type().FieldByName("SDKShapeTraits"); ok { + if payloadName := field.Tag.Get("payload"); payloadName != "" { + pfield, _ := v.Type().FieldByName(payloadName) + if ptag := pfield.Tag.Get("type"); ptag != "" && ptag != "structure" { + payload := v.FieldByName(payloadName) + if payload.IsValid() { + switch payload.Interface().(type) { + case []byte: + b, err := ioutil.ReadAll(r.HTTPResponse.Body) + if err != nil { + r.Error = awserr.New("SerializationError", "failed to decode REST response", err) + } else { + payload.Set(reflect.ValueOf(b)) + } + case *string: + b, err := ioutil.ReadAll(r.HTTPResponse.Body) + if err != nil { + r.Error = awserr.New("SerializationError", "failed to decode REST response", err) + } else { + str := string(b) + payload.Set(reflect.ValueOf(&str)) + } + default: + switch payload.Type().String() { + case "io.ReadSeeker": + payload.Set(reflect.ValueOf(aws.ReadSeekCloser(r.HTTPResponse.Body))) + case "aws.ReadSeekCloser", "io.ReadCloser": + payload.Set(reflect.ValueOf(r.HTTPResponse.Body)) + default: + r.Error = awserr.New("SerializationError", + "failed to decode REST response", + fmt.Errorf("unknown payload type %s", payload.Type())) + } + } + } + } + } + } +} + +func unmarshalLocationElements(r *request.Request, v reflect.Value) { + for i := 0; i < v.NumField(); i++ { + m, field := v.Field(i), v.Type().Field(i) + if n := field.Name; n[0:1] == strings.ToLower(n[0:1]) { + continue + } + + if m.IsValid() { + name := field.Tag.Get("locationName") + if name == "" { + name = field.Name + } + + switch field.Tag.Get("location") { + case "statusCode": + unmarshalStatusCode(m, r.HTTPResponse.StatusCode) + case "header": + err := unmarshalHeader(m, r.HTTPResponse.Header.Get(name)) + if err != nil { + r.Error = awserr.New("SerializationError", "failed to decode REST response", err) + break + } + case "headers": + prefix := field.Tag.Get("locationName") + err := unmarshalHeaderMap(m, r.HTTPResponse.Header, prefix) + if err != nil { + r.Error = awserr.New("SerializationError", "failed to decode REST response", err) + break + } + } + } + if r.Error != nil { + return + } + } +} + +func unmarshalStatusCode(v reflect.Value, statusCode int) { + if !v.IsValid() { + return + } + + switch v.Interface().(type) { + case *int64: + s := int64(statusCode) + v.Set(reflect.ValueOf(&s)) + } +} + +func unmarshalHeaderMap(r reflect.Value, headers http.Header, prefix string) error { + switch r.Interface().(type) { + case map[string]*string: // we only support string map value types + out := map[string]*string{} + for k, v := range headers { + k = http.CanonicalHeaderKey(k) + if strings.HasPrefix(strings.ToLower(k), strings.ToLower(prefix)) { + out[k[len(prefix):]] = &v[0] + } + } + r.Set(reflect.ValueOf(out)) + } + return nil +} + +func unmarshalHeader(v reflect.Value, header string) error { + if !v.IsValid() || (header == "" && v.Elem().Kind() != reflect.String) { + return nil + } + + switch v.Interface().(type) { + case *string: + v.Set(reflect.ValueOf(&header)) + case []byte: + b, err := base64.StdEncoding.DecodeString(header) + if err != nil { + return err + } + v.Set(reflect.ValueOf(&b)) + case *bool: + b, err := strconv.ParseBool(header) + if err != nil { + return err + } + v.Set(reflect.ValueOf(&b)) + case *int64: + i, err := strconv.ParseInt(header, 10, 64) + if err != nil { + return err + } + v.Set(reflect.ValueOf(&i)) + case *float64: + f, err := strconv.ParseFloat(header, 64) + if err != nil { + return err + } + v.Set(reflect.ValueOf(&f)) + case *time.Time: + t, err := time.Parse(RFC822, header) + if err != nil { + return err + } + v.Set(reflect.ValueOf(&t)) + default: + err := fmt.Errorf("Unsupported value for param %v (%s)", v.Interface(), v.Type()) + return err + } + return nil +} diff --git a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/private/protocol/xml/xmlutil/build.go b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/private/protocol/xml/xmlutil/build.go new file mode 100644 index 00000000000..d3db250231b --- /dev/null +++ b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/private/protocol/xml/xmlutil/build.go @@ -0,0 +1,287 @@ +// Package xmlutil provides XML serialisation of AWS requests and responses. +package xmlutil + +import ( + "encoding/base64" + "encoding/xml" + "fmt" + "reflect" + "sort" + "strconv" + "strings" + "time" +) + +// BuildXML will serialize params into an xml.Encoder. +// Error will be returned if the serialization of any of the params or nested values fails. +func BuildXML(params interface{}, e *xml.Encoder) error { + b := xmlBuilder{encoder: e, namespaces: map[string]string{}} + root := NewXMLElement(xml.Name{}) + if err := b.buildValue(reflect.ValueOf(params), root, ""); err != nil { + return err + } + for _, c := range root.Children { + for _, v := range c { + return StructToXML(e, v, false) + } + } + return nil +} + +// Returns the reflection element of a value, if it is a pointer. +func elemOf(value reflect.Value) reflect.Value { + for value.Kind() == reflect.Ptr { + value = value.Elem() + } + return value +} + +// A xmlBuilder serializes values from Go code to XML +type xmlBuilder struct { + encoder *xml.Encoder + namespaces map[string]string +} + +// buildValue generic XMLNode builder for any type. Will build value for their specific type +// struct, list, map, scalar. +// +// Also takes a "type" tag value to set what type a value should be converted to XMLNode as. If +// type is not provided reflect will be used to determine the value's type. +func (b *xmlBuilder) buildValue(value reflect.Value, current *XMLNode, tag reflect.StructTag) error { + value = elemOf(value) + if !value.IsValid() { // no need to handle zero values + return nil + } else if tag.Get("location") != "" { // don't handle non-body location values + return nil + } + + t := tag.Get("type") + if t == "" { + switch value.Kind() { + case reflect.Struct: + t = "structure" + case reflect.Slice: + t = "list" + case reflect.Map: + t = "map" + } + } + + switch t { + case "structure": + if field, ok := value.Type().FieldByName("SDKShapeTraits"); ok { + tag = tag + reflect.StructTag(" ") + field.Tag + } + return b.buildStruct(value, current, tag) + case "list": + return b.buildList(value, current, tag) + case "map": + return b.buildMap(value, current, tag) + default: + return b.buildScalar(value, current, tag) + } +} + +// buildStruct adds a struct and its fields to the current XMLNode. All fields any any nested +// types are converted to XMLNodes also. +func (b *xmlBuilder) buildStruct(value reflect.Value, current *XMLNode, tag reflect.StructTag) error { + if !value.IsValid() { + return nil + } + + fieldAdded := false + + // unwrap payloads + if payload := tag.Get("payload"); payload != "" { + field, _ := value.Type().FieldByName(payload) + tag = field.Tag + value = elemOf(value.FieldByName(payload)) + + if !value.IsValid() { + return nil + } + } + + child := NewXMLElement(xml.Name{Local: tag.Get("locationName")}) + + // there is an xmlNamespace associated with this struct + if prefix, uri := tag.Get("xmlPrefix"), tag.Get("xmlURI"); uri != "" { + ns := xml.Attr{ + Name: xml.Name{Local: "xmlns"}, + Value: uri, + } + if prefix != "" { + b.namespaces[prefix] = uri // register the namespace + ns.Name.Local = "xmlns:" + prefix + } + + child.Attr = append(child.Attr, ns) + } + + t := value.Type() + for i := 0; i < value.NumField(); i++ { + if c := t.Field(i).Name[0:1]; strings.ToLower(c) == c { + continue // ignore unexported fields + } + + member := elemOf(value.Field(i)) + field := t.Field(i) + mTag := field.Tag + + if mTag.Get("location") != "" { // skip non-body members + continue + } + + memberName := mTag.Get("locationName") + if memberName == "" { + memberName = field.Name + mTag = reflect.StructTag(string(mTag) + ` locationName:"` + memberName + `"`) + } + if err := b.buildValue(member, child, mTag); err != nil { + return err + } + + fieldAdded = true + } + + if fieldAdded { // only append this child if we have one ore more valid members + current.AddChild(child) + } + + return nil +} + +// buildList adds the value's list items to the current XMLNode as children nodes. All +// nested values in the list are converted to XMLNodes also. +func (b *xmlBuilder) buildList(value reflect.Value, current *XMLNode, tag reflect.StructTag) error { + if value.IsNil() { // don't build omitted lists + return nil + } + + // check for unflattened list member + flattened := tag.Get("flattened") != "" + + xname := xml.Name{Local: tag.Get("locationName")} + if flattened { + for i := 0; i < value.Len(); i++ { + child := NewXMLElement(xname) + current.AddChild(child) + if err := b.buildValue(value.Index(i), child, ""); err != nil { + return err + } + } + } else { + list := NewXMLElement(xname) + current.AddChild(list) + + for i := 0; i < value.Len(); i++ { + iname := tag.Get("locationNameList") + if iname == "" { + iname = "member" + } + + child := NewXMLElement(xml.Name{Local: iname}) + list.AddChild(child) + if err := b.buildValue(value.Index(i), child, ""); err != nil { + return err + } + } + } + + return nil +} + +// buildMap adds the value's key/value pairs to the current XMLNode as children nodes. All +// nested values in the map are converted to XMLNodes also. +// +// Error will be returned if it is unable to build the map's values into XMLNodes +func (b *xmlBuilder) buildMap(value reflect.Value, current *XMLNode, tag reflect.StructTag) error { + if value.IsNil() { // don't build omitted maps + return nil + } + + maproot := NewXMLElement(xml.Name{Local: tag.Get("locationName")}) + current.AddChild(maproot) + current = maproot + + kname, vname := "key", "value" + if n := tag.Get("locationNameKey"); n != "" { + kname = n + } + if n := tag.Get("locationNameValue"); n != "" { + vname = n + } + + // sorting is not required for compliance, but it makes testing easier + keys := make([]string, value.Len()) + for i, k := range value.MapKeys() { + keys[i] = k.String() + } + sort.Strings(keys) + + for _, k := range keys { + v := value.MapIndex(reflect.ValueOf(k)) + + mapcur := current + if tag.Get("flattened") == "" { // add "entry" tag to non-flat maps + child := NewXMLElement(xml.Name{Local: "entry"}) + mapcur.AddChild(child) + mapcur = child + } + + kchild := NewXMLElement(xml.Name{Local: kname}) + kchild.Text = k + vchild := NewXMLElement(xml.Name{Local: vname}) + mapcur.AddChild(kchild) + mapcur.AddChild(vchild) + + if err := b.buildValue(v, vchild, ""); err != nil { + return err + } + } + + return nil +} + +// buildScalar will convert the value into a string and append it as a attribute or child +// of the current XMLNode. +// +// The value will be added as an attribute if tag contains a "xmlAttribute" attribute value. +// +// Error will be returned if the value type is unsupported. +func (b *xmlBuilder) buildScalar(value reflect.Value, current *XMLNode, tag reflect.StructTag) error { + var str string + switch converted := value.Interface().(type) { + case string: + str = converted + case []byte: + if !value.IsNil() { + str = base64.StdEncoding.EncodeToString(converted) + } + case bool: + str = strconv.FormatBool(converted) + case int64: + str = strconv.FormatInt(converted, 10) + case int: + str = strconv.Itoa(converted) + case float64: + str = strconv.FormatFloat(converted, 'f', -1, 64) + case float32: + str = strconv.FormatFloat(float64(converted), 'f', -1, 32) + case time.Time: + const ISO8601UTC = "2006-01-02T15:04:05Z" + str = converted.UTC().Format(ISO8601UTC) + default: + return fmt.Errorf("unsupported value for param %s: %v (%s)", + tag.Get("locationName"), value.Interface(), value.Type().Name()) + } + + xname := xml.Name{Local: tag.Get("locationName")} + if tag.Get("xmlAttribute") != "" { // put into current node's attribute list + attr := xml.Attr{Name: xname, Value: str} + current.Attr = append(current.Attr, attr) + } else { // regular text node + current.AddChild(&XMLNode{Name: xname, Text: str}) + } + return nil +} diff --git a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/private/protocol/xml/xmlutil/unmarshal.go b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/private/protocol/xml/xmlutil/unmarshal.go new file mode 100644 index 00000000000..5e4fe210b36 --- /dev/null +++ b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/private/protocol/xml/xmlutil/unmarshal.go @@ -0,0 +1,260 @@ +package xmlutil + +import ( + "encoding/base64" + "encoding/xml" + "fmt" + "io" + "reflect" + "strconv" + "strings" + "time" +) + +// UnmarshalXML deserializes an xml.Decoder into the container v. V +// needs to match the shape of the XML expected to be decoded. +// If the shape doesn't match unmarshaling will fail. +func UnmarshalXML(v interface{}, d *xml.Decoder, wrapper string) error { + n, _ := XMLToStruct(d, nil) + if n.Children != nil { + for _, root := range n.Children { + for _, c := range root { + if wrappedChild, ok := c.Children[wrapper]; ok { + c = wrappedChild[0] // pull out wrapped element + } + + err := parse(reflect.ValueOf(v), c, "") + if err != nil { + if err == io.EOF { + return nil + } + return err + } + } + } + return nil + } + return nil +} + +// parse deserializes any value from the XMLNode. The type tag is used to infer the type, or reflect +// will be used to determine the type from r. +func parse(r reflect.Value, node *XMLNode, tag reflect.StructTag) error { + rtype := r.Type() + if rtype.Kind() == reflect.Ptr { + rtype = rtype.Elem() // check kind of actual element type + } + + t := tag.Get("type") + if t == "" { + switch rtype.Kind() { + case reflect.Struct: + t = "structure" + case reflect.Slice: + t = "list" + case reflect.Map: + t = "map" + } + } + + switch t { + case "structure": + if field, ok := rtype.FieldByName("SDKShapeTraits"); ok { + tag = field.Tag + } + return parseStruct(r, node, tag) + case "list": + return parseList(r, node, tag) + case "map": + return parseMap(r, node, tag) + default: + return parseScalar(r, node, tag) + } +} + +// parseStruct deserializes a structure and its fields from an XMLNode. Any nested +// types in the structure will also be deserialized. +func parseStruct(r reflect.Value, node *XMLNode, tag reflect.StructTag) error { + t := r.Type() + if r.Kind() == reflect.Ptr { + if r.IsNil() { // create the structure if it's nil + s := reflect.New(r.Type().Elem()) + r.Set(s) + r = s + } + + r = r.Elem() + t = t.Elem() + } + + // unwrap any payloads + if payload := tag.Get("payload"); payload != "" { + field, _ := t.FieldByName(payload) + return parseStruct(r.FieldByName(payload), node, field.Tag) + } + + for i := 0; i < t.NumField(); i++ { + field := t.Field(i) + if c := field.Name[0:1]; strings.ToLower(c) == c { + continue // ignore unexported fields + } + + // figure out what this field is called + name := field.Name + if field.Tag.Get("flattened") != "" && field.Tag.Get("locationNameList") != "" { + name = field.Tag.Get("locationNameList") + } else if locName := field.Tag.Get("locationName"); locName != "" { + name = locName + } + + // try to find the field by name in elements + elems := node.Children[name] + + if elems == nil { // try to find the field in attributes + for _, a := range node.Attr { + if name == a.Name.Local { + // turn this into a text node for de-serializing + elems = []*XMLNode{{Text: a.Value}} + } + } + } + + member := r.FieldByName(field.Name) + for _, elem := range elems { + err := parse(member, elem, field.Tag) + if err != nil { + return err + } + } + } + return nil +} + +// parseList deserializes a list of values from an XML node. Each list entry +// will also be deserialized. +func parseList(r reflect.Value, node *XMLNode, tag reflect.StructTag) error { + t := r.Type() + + if tag.Get("flattened") == "" { // look at all item entries + mname := "member" + if name := tag.Get("locationNameList"); name != "" { + mname = name + } + + if Children, ok := node.Children[mname]; ok { + if r.IsNil() { + r.Set(reflect.MakeSlice(t, len(Children), len(Children))) + } + + for i, c := range Children { + err := parse(r.Index(i), c, "") + if err != nil { + return err + } + } + } + } else { // flattened list means this is a single element + if r.IsNil() { + r.Set(reflect.MakeSlice(t, 0, 0)) + } + + childR := reflect.Zero(t.Elem()) + r.Set(reflect.Append(r, childR)) + err := parse(r.Index(r.Len()-1), node, "") + if err != nil { + return err + } + } + + return nil +} + +// parseMap deserializes a map from an XMLNode. The direct children of the XMLNode +// will also be deserialized as map entries. +func parseMap(r reflect.Value, node *XMLNode, tag reflect.StructTag) error { + if r.IsNil() { + r.Set(reflect.MakeMap(r.Type())) + } + + if tag.Get("flattened") == "" { // look at all child entries + for _, entry := range node.Children["entry"] { + parseMapEntry(r, entry, tag) + } + } else { // this element is itself an entry + parseMapEntry(r, node, tag) + } + + return nil +} + +// parseMapEntry deserializes a map entry from a XML node. +func parseMapEntry(r reflect.Value, node *XMLNode, tag reflect.StructTag) error { + kname, vname := "key", "value" + if n := tag.Get("locationNameKey"); n != "" { + kname = n + } + if n := tag.Get("locationNameValue"); n != "" { + vname = n + } + + keys, ok := node.Children[kname] + values := node.Children[vname] + if ok { + for i, key := range keys { + keyR := reflect.ValueOf(key.Text) + value := values[i] + valueR := reflect.New(r.Type().Elem()).Elem() + + parse(valueR, value, "") + r.SetMapIndex(keyR, valueR) + } + } + return nil +} + +// parseScaller deserializes an XMLNode value into a concrete type based on the +// interface type of r. +// +// Error is returned if the deserialization fails due to invalid type conversion, +// or unsupported interface type. +func parseScalar(r reflect.Value, node *XMLNode, tag reflect.StructTag) error { + switch r.Interface().(type) { + case *string: + r.Set(reflect.ValueOf(&node.Text)) + return nil + case []byte: + b, err := base64.StdEncoding.DecodeString(node.Text) + if err != nil { + return err + } + r.Set(reflect.ValueOf(b)) + case *bool: + v, err := strconv.ParseBool(node.Text) + if err != nil { + return err + } + r.Set(reflect.ValueOf(&v)) + case *int64: + v, err := strconv.ParseInt(node.Text, 10, 64) + if err != nil { + return err + } + r.Set(reflect.ValueOf(&v)) + case *float64: + v, err := strconv.ParseFloat(node.Text, 64) + if err != nil { + return err + } + r.Set(reflect.ValueOf(&v)) + case *time.Time: + const ISO8601UTC = "2006-01-02T15:04:05Z" + t, err := time.Parse(ISO8601UTC, node.Text) + if err != nil { + return err + } + r.Set(reflect.ValueOf(&t)) + default: + return fmt.Errorf("unsupported value: %v (%s)", r.Interface(), r.Type()) + } + return nil +} diff --git a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/private/protocol/xml/xmlutil/xml_to_struct.go b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/private/protocol/xml/xmlutil/xml_to_struct.go new file mode 100644 index 00000000000..72c198a9d8d --- /dev/null +++ b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/private/protocol/xml/xmlutil/xml_to_struct.go @@ -0,0 +1,105 @@ +package xmlutil + +import ( + "encoding/xml" + "io" + "sort" +) + +// A XMLNode contains the values to be encoded or decoded. +type XMLNode struct { + Name xml.Name `json:",omitempty"` + Children map[string][]*XMLNode `json:",omitempty"` + Text string `json:",omitempty"` + Attr []xml.Attr `json:",omitempty"` +} + +// NewXMLElement returns a pointer to a new XMLNode initialized to default values. +func NewXMLElement(name xml.Name) *XMLNode { + return &XMLNode{ + Name: name, + Children: map[string][]*XMLNode{}, + Attr: []xml.Attr{}, + } +} + +// AddChild adds child to the XMLNode. +func (n *XMLNode) AddChild(child *XMLNode) { + if _, ok := n.Children[child.Name.Local]; !ok { + n.Children[child.Name.Local] = []*XMLNode{} + } + n.Children[child.Name.Local] = append(n.Children[child.Name.Local], child) +} + +// XMLToStruct converts a xml.Decoder stream to XMLNode with nested values. +func XMLToStruct(d *xml.Decoder, s *xml.StartElement) (*XMLNode, error) { + out := &XMLNode{} + for { + tok, err := d.Token() + if tok == nil || err == io.EOF { + break + } + if err != nil { + return out, err + } + + switch typed := tok.(type) { + case xml.CharData: + out.Text = string(typed.Copy()) + case xml.StartElement: + el := typed.Copy() + out.Attr = el.Attr + if out.Children == nil { + out.Children = map[string][]*XMLNode{} + } + + name := typed.Name.Local + slice := out.Children[name] + if slice == nil { + slice = []*XMLNode{} + } + node, e := XMLToStruct(d, &el) + if e != nil { + return out, e + } + node.Name = typed.Name + slice = append(slice, node) + out.Children[name] = slice + case xml.EndElement: + if s != nil && s.Name.Local == typed.Name.Local { // matching end token + return out, nil + } + } + } + return out, nil +} + +// StructToXML writes an XMLNode to a xml.Encoder as tokens. +func StructToXML(e *xml.Encoder, node *XMLNode, sorted bool) error { + e.EncodeToken(xml.StartElement{Name: node.Name, Attr: node.Attr}) + + if node.Text != "" { + e.EncodeToken(xml.CharData([]byte(node.Text))) + } else if sorted { + sortedNames := []string{} + for k := range node.Children { + sortedNames = append(sortedNames, k) + } + sort.Strings(sortedNames) + + for _, k := range sortedNames { + for _, v := range node.Children[k] { + StructToXML(e, v, sorted) + } + } + } else { + for _, c := range node.Children { + for _, v := range c { + StructToXML(e, v, sorted) + } + } + } + + e.EncodeToken(xml.EndElement{Name: node.Name}) + return e.Flush() +} diff --git a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/private/signer/v4/functional_test.go b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/private/signer/v4/functional_test.go new file mode 100644 index 00000000000..e7e7bd521d2 --- /dev/null +++ b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/private/signer/v4/functional_test.go @@ -0,0 +1,43 @@ +package v4_test + +import ( + "net/url" + "testing" + "time" + + "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/awstesting/unit" + "github.com/aws/aws-sdk-go/service/s3" + "github.com/stretchr/testify/assert" +) + +var _ = unit.Imported + +func TestPresignHandler(t *testing.T) { + svc := s3.New(nil) + req, _ := svc.PutObjectRequest(&s3.PutObjectInput{ + Bucket: aws.String("bucket"), + Key: aws.String("key"), + ContentDisposition: aws.String("a+b c$d"), + ACL: aws.String("public-read"), + }) + req.Time = time.Unix(0, 0) + urlstr, err := req.Presign(5 * time.Minute) + + assert.NoError(t, err) + + expectedDate := "19700101T000000Z" + expectedHeaders := "host;x-amz-acl" + expectedSig := "7edcb4e3a1bf12f4989018d75acbe3a7f03df24bd6f3112602d59fc551f0e4e2" + expectedCred := "AKID/19700101/mock-region/s3/aws4_request" + + u, _ := url.Parse(urlstr) + urlQ := u.Query() + assert.Equal(t, expectedSig, urlQ.Get("X-Amz-Signature")) + assert.Equal(t, expectedCred, urlQ.Get("X-Amz-Credential")) + assert.Equal(t, expectedHeaders, urlQ.Get("X-Amz-SignedHeaders")) + assert.Equal(t, expectedDate, urlQ.Get("X-Amz-Date")) + assert.Equal(t, "300", urlQ.Get("X-Amz-Expires")) + + assert.NotContains(t, urlstr, "+") // + encoded as %20 +} diff --git a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/private/signer/v4/v4.go b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/private/signer/v4/v4.go new file mode 100644 index 00000000000..ac7adfc959d --- /dev/null +++ b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/private/signer/v4/v4.go @@ -0,0 +1,365 @@ +// Package v4 implements signing for AWS V4 signer +package v4 + +import ( + "crypto/hmac" + "crypto/sha256" + "encoding/hex" + "fmt" + "io" + "net/http" + "net/url" + "sort" + "strconv" + "strings" + "time" + + "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/aws/credentials" + "github.com/aws/aws-sdk-go/aws/request" + "github.com/aws/aws-sdk-go/private/protocol/rest" +) + +const ( + authHeaderPrefix = "AWS4-HMAC-SHA256" + timeFormat = "20060102T150405Z" + shortTimeFormat = "20060102" +) + +var ignoredHeaders = map[string]bool{ + "Authorization": true, + "Content-Type": true, + "Content-Length": true, + "User-Agent": true, +} + +type signer struct { + Request *http.Request + Time time.Time + ExpireTime time.Duration + ServiceName string + Region string + CredValues credentials.Value + Credentials *credentials.Credentials + Query url.Values + Body io.ReadSeeker + Debug aws.LogLevelType + Logger aws.Logger + + isPresign bool + formattedTime string + formattedShortTime string + + signedHeaders string + canonicalHeaders string + canonicalString string + credentialString string + stringToSign string + signature string + authorization string +} + +// Sign requests with signature version 4. +// +// Will sign the requests with the service config's Credentials object +// Signing is skipped if the credentials is the credentials.AnonymousCredentials +// object. +func Sign(req *request.Request) { + // If the request does not need to be signed ignore the signing of the + // request if the AnonymousCredentials object is used. + if req.Service.Config.Credentials == credentials.AnonymousCredentials { + return + } + + region := req.Service.SigningRegion + if region == "" { + region = aws.StringValue(req.Service.Config.Region) + } + + name := req.Service.SigningName + if name == "" { + name = req.Service.ServiceName + } + + s := signer{ + Request: req.HTTPRequest, + Time: req.Time, + ExpireTime: req.ExpireTime, + Query: req.HTTPRequest.URL.Query(), + Body: req.Body, + ServiceName: name, + Region: region, + Credentials: req.Service.Config.Credentials, + Debug: req.Service.Config.LogLevel.Value(), + Logger: req.Service.Config.Logger, + } + + req.Error = s.sign() +} + +func (v4 *signer) sign() error { + if v4.ExpireTime != 0 { + v4.isPresign = true + } + + if v4.isRequestSigned() { + if !v4.Credentials.IsExpired() { + // If the request is already signed, and the credentials have not + // expired yet ignore the signing request. + return nil + } + + // The credentials have expired for this request. The current signing + // is invalid, and needs to be request because the request will fail. + if v4.isPresign { + v4.removePresign() + // Update the request's query string to ensure the values stays in + // sync in the case retrieving the new credentials fails. + v4.Request.URL.RawQuery = v4.Query.Encode() + } + } + + var err error + v4.CredValues, err = v4.Credentials.Get() + if err != nil { + return err + } + + if v4.isPresign { + v4.Query.Set("X-Amz-Algorithm", authHeaderPrefix) + if v4.CredValues.SessionToken != "" { + v4.Query.Set("X-Amz-Security-Token", v4.CredValues.SessionToken) + } else { + v4.Query.Del("X-Amz-Security-Token") + } + } else if v4.CredValues.SessionToken != "" { + v4.Request.Header.Set("X-Amz-Security-Token", v4.CredValues.SessionToken) + } + + v4.build() + + if v4.Debug.Matches(aws.LogDebugWithSigning) { + v4.logSigningInfo() + } + + return nil +} + +const logSignInfoMsg = `DEBUG: Request Signiture: +---[ CANONICAL STRING ]----------------------------- +%s +---[ STRING TO SIGN ]-------------------------------- +%s%s +-----------------------------------------------------` +const logSignedURLMsg = ` +---[ SIGNED URL ]------------------------------------ +%s` + +func (v4 *signer) logSigningInfo() { + signedURLMsg := "" + if v4.isPresign { + signedURLMsg = fmt.Sprintf(logSignedURLMsg, v4.Request.URL.String()) + } + msg := fmt.Sprintf(logSignInfoMsg, v4.canonicalString, v4.stringToSign, signedURLMsg) + v4.Logger.Log(msg) +} + +func (v4 *signer) build() { + v4.buildTime() // no depends + v4.buildCredentialString() // no depends + if v4.isPresign { + v4.buildQuery() // no depends + } + v4.buildCanonicalHeaders() // depends on cred string + v4.buildCanonicalString() // depends on canon headers / signed headers + v4.buildStringToSign() // depends on canon string + v4.buildSignature() // depends on string to sign + + if v4.isPresign { + v4.Request.URL.RawQuery += "&X-Amz-Signature=" + v4.signature + } else { + parts := []string{ + authHeaderPrefix + " Credential=" + v4.CredValues.AccessKeyID + "/" + v4.credentialString, + "SignedHeaders=" + v4.signedHeaders, + "Signature=" + v4.signature, + } + v4.Request.Header.Set("Authorization", strings.Join(parts, ", ")) + } +} + +func (v4 *signer) buildTime() { + v4.formattedTime = v4.Time.UTC().Format(timeFormat) + v4.formattedShortTime = v4.Time.UTC().Format(shortTimeFormat) + + if v4.isPresign { + duration := int64(v4.ExpireTime / time.Second) + v4.Query.Set("X-Amz-Date", v4.formattedTime) + v4.Query.Set("X-Amz-Expires", strconv.FormatInt(duration, 10)) + } else { + v4.Request.Header.Set("X-Amz-Date", v4.formattedTime) + } +} + +func (v4 *signer) buildCredentialString() { + v4.credentialString = strings.Join([]string{ + v4.formattedShortTime, + v4.Region, + v4.ServiceName, + "aws4_request", + }, "/") + + if v4.isPresign { + v4.Query.Set("X-Amz-Credential", v4.CredValues.AccessKeyID+"/"+v4.credentialString) + } +} + +func (v4 *signer) buildQuery() { + for k, h := range v4.Request.Header { + if strings.HasPrefix(http.CanonicalHeaderKey(k), "X-Amz-") { + continue // never hoist x-amz-* headers, they must be signed + } + if _, ok := ignoredHeaders[http.CanonicalHeaderKey(k)]; ok { + continue // never hoist ignored headers + } + + v4.Request.Header.Del(k) + v4.Query.Del(k) + for _, v := range h { + v4.Query.Add(k, v) + } + } +} + +func (v4 *signer) buildCanonicalHeaders() { + var headers []string + headers = append(headers, "host") + for k := range v4.Request.Header { + if _, ok := ignoredHeaders[http.CanonicalHeaderKey(k)]; ok { + continue // ignored header + } + headers = append(headers, strings.ToLower(k)) + } + sort.Strings(headers) + + v4.signedHeaders = strings.Join(headers, ";") + + if v4.isPresign { + v4.Query.Set("X-Amz-SignedHeaders", v4.signedHeaders) + } + + headerValues := make([]string, len(headers)) + for i, k := range headers { + if k == "host" { + headerValues[i] = "host:" + v4.Request.URL.Host + } else { + headerValues[i] = k + ":" + + strings.Join(v4.Request.Header[http.CanonicalHeaderKey(k)], ",") + } + } + + v4.canonicalHeaders = strings.Join(headerValues, "\n") +} + +func (v4 *signer) buildCanonicalString() { + v4.Request.URL.RawQuery = strings.Replace(v4.Query.Encode(), "+", "%20", -1) + uri := v4.Request.URL.Opaque + if uri != "" { + uri = "/" + strings.Join(strings.Split(uri, "/")[3:], "/") + } else { + uri = v4.Request.URL.Path + } + if uri == "" { + uri = "/" + } + + if v4.ServiceName != "s3" { + uri = rest.EscapePath(uri, false) + } + + v4.canonicalString = strings.Join([]string{ + v4.Request.Method, + uri, + v4.Request.URL.RawQuery, + v4.canonicalHeaders + "\n", + v4.signedHeaders, + v4.bodyDigest(), + }, "\n") +} + +func (v4 *signer) buildStringToSign() { + v4.stringToSign = strings.Join([]string{ + authHeaderPrefix, + v4.formattedTime, + v4.credentialString, + hex.EncodeToString(makeSha256([]byte(v4.canonicalString))), + }, "\n") +} + +func (v4 *signer) buildSignature() { + secret := v4.CredValues.SecretAccessKey + date := makeHmac([]byte("AWS4"+secret), []byte(v4.formattedShortTime)) + region := makeHmac(date, []byte(v4.Region)) + service := makeHmac(region, []byte(v4.ServiceName)) + credentials := makeHmac(service, []byte("aws4_request")) + signature := makeHmac(credentials, []byte(v4.stringToSign)) + v4.signature = hex.EncodeToString(signature) +} + +func (v4 *signer) bodyDigest() string { + hash := v4.Request.Header.Get("X-Amz-Content-Sha256") + if hash == "" { + if v4.isPresign && v4.ServiceName == "s3" { + hash = "UNSIGNED-PAYLOAD" + } else if v4.Body == nil { + hash = hex.EncodeToString(makeSha256([]byte{})) + } else { + hash = hex.EncodeToString(makeSha256Reader(v4.Body)) + } + v4.Request.Header.Add("X-Amz-Content-Sha256", hash) + } + return hash +} + +// isRequestSigned returns if the request is currently signed or presigned +func (v4 *signer) isRequestSigned() bool { + if v4.isPresign && v4.Query.Get("X-Amz-Signature") != "" { + return true + } + if v4.Request.Header.Get("Authorization") != "" { + return true + } + + return false +} + +// unsign removes signing flags for both signed and presigned requests. +func (v4 *signer) removePresign() { + v4.Query.Del("X-Amz-Algorithm") + v4.Query.Del("X-Amz-Signature") + v4.Query.Del("X-Amz-Security-Token") + v4.Query.Del("X-Amz-Date") + v4.Query.Del("X-Amz-Expires") + v4.Query.Del("X-Amz-Credential") + v4.Query.Del("X-Amz-SignedHeaders") +} + +func makeHmac(key []byte, data []byte) []byte { + hash := hmac.New(sha256.New, key) + hash.Write(data) + return hash.Sum(nil) +} + +func makeSha256(data []byte) []byte { + hash := sha256.New() + hash.Write(data) + return hash.Sum(nil) +} + +func makeSha256Reader(reader io.ReadSeeker) []byte { + hash := sha256.New() + start, _ := reader.Seek(0, 1) + defer reader.Seek(start, 0) + + io.Copy(hash, reader) + return hash.Sum(nil) +} diff --git a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/private/signer/v4/v4_test.go b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/private/signer/v4/v4_test.go new file mode 100644 index 00000000000..0ba9ff25f73 --- /dev/null +++ b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/private/signer/v4/v4_test.go @@ -0,0 +1,247 @@ +package v4 + +import ( + "net/http" + "strings" + "testing" + "time" + + "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/aws/credentials" + "github.com/aws/aws-sdk-go/aws/request" + "github.com/aws/aws-sdk-go/aws/service" + "github.com/stretchr/testify/assert" +) + +func buildSigner(serviceName string, region string, signTime time.Time, expireTime time.Duration, body string) signer { + endpoint := "https://" + serviceName + "." + region + ".amazonaws.com" + reader := strings.NewReader(body) + req, _ := http.NewRequest("POST", endpoint, reader) + req.URL.Opaque = "//example.org/bucket/key-._~,!@#$%^&*()" + req.Header.Add("X-Amz-Target", "prefix.Operation") + req.Header.Add("Content-Type", "application/x-amz-json-1.0") + req.Header.Add("Content-Length", string(len(body))) + req.Header.Add("X-Amz-Meta-Other-Header", "some-value=!@#$%^&* (+)") + + return signer{ + Request: req, + Time: signTime, + ExpireTime: expireTime, + Query: req.URL.Query(), + Body: reader, + ServiceName: serviceName, + Region: region, + Credentials: credentials.NewStaticCredentials("AKID", "SECRET", "SESSION"), + } +} + +func removeWS(text string) string { + text = strings.Replace(text, " ", "", -1) + text = strings.Replace(text, "\n", "", -1) + text = strings.Replace(text, "\t", "", -1) + return text +} + +func assertEqual(t *testing.T, expected, given string) { + if removeWS(expected) != removeWS(given) { + t.Errorf("\nExpected: %s\nGiven: %s", expected, given) + } +} + +func TestPresignRequest(t *testing.T) { + signer := buildSigner("dynamodb", "us-east-1", time.Unix(0, 0), 300*time.Second, "{}") + signer.sign() + + expectedDate := "19700101T000000Z" + expectedHeaders := "host;x-amz-meta-other-header;x-amz-target" + expectedSig := "5eeedebf6f995145ce56daa02902d10485246d3defb34f97b973c1f40ab82d36" + expectedCred := "AKID/19700101/us-east-1/dynamodb/aws4_request" + + q := signer.Request.URL.Query() + assert.Equal(t, expectedSig, q.Get("X-Amz-Signature")) + assert.Equal(t, expectedCred, q.Get("X-Amz-Credential")) + assert.Equal(t, expectedHeaders, q.Get("X-Amz-SignedHeaders")) + assert.Equal(t, expectedDate, q.Get("X-Amz-Date")) +} + +func TestSignRequest(t *testing.T) { + signer := buildSigner("dynamodb", "us-east-1", time.Unix(0, 0), 0, "{}") + signer.sign() + + expectedDate := "19700101T000000Z" + expectedSig := "AWS4-HMAC-SHA256 Credential=AKID/19700101/us-east-1/dynamodb/aws4_request, SignedHeaders=host;x-amz-date;x-amz-meta-other-header;x-amz-security-token;x-amz-target, Signature=69ada33fec48180dab153576e4dd80c4e04124f80dda3eccfed8a67c2b91ed5e" + + q := signer.Request.Header + assert.Equal(t, expectedSig, q.Get("Authorization")) + assert.Equal(t, expectedDate, q.Get("X-Amz-Date")) +} + +func TestSignEmptyBody(t *testing.T) { + signer := buildSigner("dynamodb", "us-east-1", time.Now(), 0, "") + signer.Body = nil + signer.sign() + hash := signer.Request.Header.Get("X-Amz-Content-Sha256") + assert.Equal(t, "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", hash) +} + +func TestSignBody(t *testing.T) { + signer := buildSigner("dynamodb", "us-east-1", time.Now(), 0, "hello") + signer.sign() + hash := signer.Request.Header.Get("X-Amz-Content-Sha256") + assert.Equal(t, "2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824", hash) +} + +func TestSignSeekedBody(t *testing.T) { + signer := buildSigner("dynamodb", "us-east-1", time.Now(), 0, " hello") + signer.Body.Read(make([]byte, 3)) // consume first 3 bytes so body is now "hello" + signer.sign() + hash := signer.Request.Header.Get("X-Amz-Content-Sha256") + assert.Equal(t, "2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824", hash) + + start, _ := signer.Body.Seek(0, 1) + assert.Equal(t, int64(3), start) +} + +func TestPresignEmptyBodyS3(t *testing.T) { + signer := buildSigner("s3", "us-east-1", time.Now(), 5*time.Minute, "hello") + signer.sign() + hash := signer.Request.Header.Get("X-Amz-Content-Sha256") + assert.Equal(t, "UNSIGNED-PAYLOAD", hash) +} + +func TestSignPrecomputedBodyChecksum(t *testing.T) { + signer := buildSigner("dynamodb", "us-east-1", time.Now(), 0, "hello") + signer.Request.Header.Set("X-Amz-Content-Sha256", "PRECOMPUTED") + signer.sign() + hash := signer.Request.Header.Get("X-Amz-Content-Sha256") + assert.Equal(t, "PRECOMPUTED", hash) +} + +func TestAnonymousCredentials(t *testing.T) { + svc := service.New(&aws.Config{Credentials: credentials.AnonymousCredentials}) + r := svc.NewRequest( + &request.Operation{ + Name: "BatchGetItem", + HTTPMethod: "POST", + HTTPPath: "/", + }, + nil, + nil, + ) + Sign(r) + + urlQ := r.HTTPRequest.URL.Query() + assert.Empty(t, urlQ.Get("X-Amz-Signature")) + assert.Empty(t, urlQ.Get("X-Amz-Credential")) + assert.Empty(t, urlQ.Get("X-Amz-SignedHeaders")) + assert.Empty(t, urlQ.Get("X-Amz-Date")) + + hQ := r.HTTPRequest.Header + assert.Empty(t, hQ.Get("Authorization")) + assert.Empty(t, hQ.Get("X-Amz-Date")) +} + +func TestIgnoreResignRequestWithValidCreds(t *testing.T) { + svc := service.New(&aws.Config{ + Credentials: credentials.NewStaticCredentials("AKID", "SECRET", "SESSION"), + Region: aws.String("us-west-2"), + }) + r := svc.NewRequest( + &request.Operation{ + Name: "BatchGetItem", + HTTPMethod: "POST", + HTTPPath: "/", + }, + nil, + nil, + ) + + Sign(r) + sig := r.HTTPRequest.Header.Get("Authorization") + + Sign(r) + assert.Equal(t, sig, r.HTTPRequest.Header.Get("Authorization")) +} + +func TestIgnorePreResignRequestWithValidCreds(t *testing.T) { + svc := service.New(&aws.Config{ + Credentials: credentials.NewStaticCredentials("AKID", "SECRET", "SESSION"), + Region: aws.String("us-west-2"), + }) + r := svc.NewRequest( + &request.Operation{ + Name: "BatchGetItem", + HTTPMethod: "POST", + HTTPPath: "/", + }, + nil, + nil, + ) + r.ExpireTime = time.Minute * 10 + + Sign(r) + sig := r.HTTPRequest.Header.Get("X-Amz-Signature") + + Sign(r) + assert.Equal(t, sig, r.HTTPRequest.Header.Get("X-Amz-Signature")) +} + +func TestResignRequestExpiredCreds(t *testing.T) { + creds := credentials.NewStaticCredentials("AKID", "SECRET", "SESSION") + svc := service.New(&aws.Config{Credentials: creds}) + r := svc.NewRequest( + &request.Operation{ + Name: "BatchGetItem", + HTTPMethod: "POST", + HTTPPath: "/", + }, + nil, + nil, + ) + Sign(r) + querySig := r.HTTPRequest.Header.Get("Authorization") + + creds.Expire() + + Sign(r) + assert.NotEqual(t, querySig, r.HTTPRequest.Header.Get("Authorization")) +} + +func TestPreResignRequestExpiredCreds(t *testing.T) { + provider := &credentials.StaticProvider{credentials.Value{"AKID", "SECRET", "SESSION"}} + creds := credentials.NewCredentials(provider) + svc := service.New(&aws.Config{Credentials: creds}) + r := svc.NewRequest( + &request.Operation{ + Name: "BatchGetItem", + HTTPMethod: "POST", + HTTPPath: "/", + }, + nil, + nil, + ) + r.ExpireTime = time.Minute * 10 + + Sign(r) + querySig := r.HTTPRequest.URL.Query().Get("X-Amz-Signature") + + creds.Expire() + r.Time = time.Now().Add(time.Hour * 48) + + Sign(r) + assert.NotEqual(t, querySig, r.HTTPRequest.URL.Query().Get("X-Amz-Signature")) +} + +func BenchmarkPresignRequest(b *testing.B) { + signer := buildSigner("dynamodb", "us-east-1", time.Now(), 300*time.Second, "{}") + for i := 0; i < b.N; i++ { + signer.sign() + } +} + +func BenchmarkSignRequest(b *testing.B) { + signer := buildSigner("dynamodb", "us-east-1", time.Now(), 0, "{}") + for i := 0; i < b.N; i++ { + signer.sign() + } +} diff --git a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/service/cloudwatch/api.go b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/service/cloudwatch/api.go index d5a92f6d62b..94df50a7c96 100644 --- a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/service/cloudwatch/api.go +++ b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/service/cloudwatch/api.go @@ -6,15 +6,15 @@ package cloudwatch import ( "time" - "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/aws/awsutil" + "github.com/aws/aws-sdk-go/aws/request" ) const opDeleteAlarms = "DeleteAlarms" // DeleteAlarmsRequest generates a request for the DeleteAlarms operation. -func (c *CloudWatch) DeleteAlarmsRequest(input *DeleteAlarmsInput) (req *aws.Request, output *DeleteAlarmsOutput) { - op := &aws.Operation{ +func (c *CloudWatch) DeleteAlarmsRequest(input *DeleteAlarmsInput) (req *request.Request, output *DeleteAlarmsOutput) { + op := &request.Operation{ Name: opDeleteAlarms, HTTPMethod: "POST", HTTPPath: "/", @@ -40,12 +40,12 @@ func (c *CloudWatch) DeleteAlarms(input *DeleteAlarmsInput) (*DeleteAlarmsOutput const opDescribeAlarmHistory = "DescribeAlarmHistory" // DescribeAlarmHistoryRequest generates a request for the DescribeAlarmHistory operation. -func (c *CloudWatch) DescribeAlarmHistoryRequest(input *DescribeAlarmHistoryInput) (req *aws.Request, output *DescribeAlarmHistoryOutput) { - op := &aws.Operation{ +func (c *CloudWatch) DescribeAlarmHistoryRequest(input *DescribeAlarmHistoryInput) (req *request.Request, output *DescribeAlarmHistoryOutput) { + op := &request.Operation{ Name: opDescribeAlarmHistory, HTTPMethod: "POST", HTTPPath: "/", - Paginator: &aws.Paginator{ + Paginator: &request.Paginator{ InputTokens: []string{"NextToken"}, OutputTokens: []string{"NextToken"}, LimitToken: "MaxRecords", @@ -82,12 +82,12 @@ func (c *CloudWatch) DescribeAlarmHistoryPages(input *DescribeAlarmHistoryInput, const opDescribeAlarms = "DescribeAlarms" // DescribeAlarmsRequest generates a request for the DescribeAlarms operation. -func (c *CloudWatch) DescribeAlarmsRequest(input *DescribeAlarmsInput) (req *aws.Request, output *DescribeAlarmsOutput) { - op := &aws.Operation{ +func (c *CloudWatch) DescribeAlarmsRequest(input *DescribeAlarmsInput) (req *request.Request, output *DescribeAlarmsOutput) { + op := &request.Operation{ Name: opDescribeAlarms, HTTPMethod: "POST", HTTPPath: "/", - Paginator: &aws.Paginator{ + Paginator: &request.Paginator{ InputTokens: []string{"NextToken"}, OutputTokens: []string{"NextToken"}, LimitToken: "MaxRecords", @@ -124,8 +124,8 @@ func (c *CloudWatch) DescribeAlarmsPages(input *DescribeAlarmsInput, fn func(p * const opDescribeAlarmsForMetric = "DescribeAlarmsForMetric" // DescribeAlarmsForMetricRequest generates a request for the DescribeAlarmsForMetric operation. -func (c *CloudWatch) DescribeAlarmsForMetricRequest(input *DescribeAlarmsForMetricInput) (req *aws.Request, output *DescribeAlarmsForMetricOutput) { - op := &aws.Operation{ +func (c *CloudWatch) DescribeAlarmsForMetricRequest(input *DescribeAlarmsForMetricInput) (req *request.Request, output *DescribeAlarmsForMetricOutput) { + op := &request.Operation{ Name: opDescribeAlarmsForMetric, HTTPMethod: "POST", HTTPPath: "/", @@ -152,8 +152,8 @@ func (c *CloudWatch) DescribeAlarmsForMetric(input *DescribeAlarmsForMetricInput const opDisableAlarmActions = "DisableAlarmActions" // DisableAlarmActionsRequest generates a request for the DisableAlarmActions operation. -func (c *CloudWatch) DisableAlarmActionsRequest(input *DisableAlarmActionsInput) (req *aws.Request, output *DisableAlarmActionsOutput) { - op := &aws.Operation{ +func (c *CloudWatch) DisableAlarmActionsRequest(input *DisableAlarmActionsInput) (req *request.Request, output *DisableAlarmActionsOutput) { + op := &request.Operation{ Name: opDisableAlarmActions, HTTPMethod: "POST", HTTPPath: "/", @@ -180,8 +180,8 @@ func (c *CloudWatch) DisableAlarmActions(input *DisableAlarmActionsInput) (*Disa const opEnableAlarmActions = "EnableAlarmActions" // EnableAlarmActionsRequest generates a request for the EnableAlarmActions operation. -func (c *CloudWatch) EnableAlarmActionsRequest(input *EnableAlarmActionsInput) (req *aws.Request, output *EnableAlarmActionsOutput) { - op := &aws.Operation{ +func (c *CloudWatch) EnableAlarmActionsRequest(input *EnableAlarmActionsInput) (req *request.Request, output *EnableAlarmActionsOutput) { + op := &request.Operation{ Name: opEnableAlarmActions, HTTPMethod: "POST", HTTPPath: "/", @@ -207,8 +207,8 @@ func (c *CloudWatch) EnableAlarmActions(input *EnableAlarmActionsInput) (*Enable const opGetMetricStatistics = "GetMetricStatistics" // GetMetricStatisticsRequest generates a request for the GetMetricStatistics operation. -func (c *CloudWatch) GetMetricStatisticsRequest(input *GetMetricStatisticsInput) (req *aws.Request, output *GetMetricStatisticsOutput) { - op := &aws.Operation{ +func (c *CloudWatch) GetMetricStatisticsRequest(input *GetMetricStatisticsInput) (req *request.Request, output *GetMetricStatisticsOutput) { + op := &request.Operation{ Name: opGetMetricStatistics, HTTPMethod: "POST", HTTPPath: "/", @@ -259,12 +259,12 @@ func (c *CloudWatch) GetMetricStatistics(input *GetMetricStatisticsInput) (*GetM const opListMetrics = "ListMetrics" // ListMetricsRequest generates a request for the ListMetrics operation. -func (c *CloudWatch) ListMetricsRequest(input *ListMetricsInput) (req *aws.Request, output *ListMetricsOutput) { - op := &aws.Operation{ +func (c *CloudWatch) ListMetricsRequest(input *ListMetricsInput) (req *request.Request, output *ListMetricsOutput) { + op := &request.Operation{ Name: opListMetrics, HTTPMethod: "POST", HTTPPath: "/", - Paginator: &aws.Paginator{ + Paginator: &request.Paginator{ InputTokens: []string{"NextToken"}, OutputTokens: []string{"NextToken"}, LimitToken: "", @@ -301,8 +301,8 @@ func (c *CloudWatch) ListMetricsPages(input *ListMetricsInput, fn func(p *ListMe const opPutMetricAlarm = "PutMetricAlarm" // PutMetricAlarmRequest generates a request for the PutMetricAlarm operation. -func (c *CloudWatch) PutMetricAlarmRequest(input *PutMetricAlarmInput) (req *aws.Request, output *PutMetricAlarmOutput) { - op := &aws.Operation{ +func (c *CloudWatch) PutMetricAlarmRequest(input *PutMetricAlarmInput) (req *request.Request, output *PutMetricAlarmOutput) { + op := &request.Operation{ Name: opPutMetricAlarm, HTTPMethod: "POST", HTTPPath: "/", @@ -334,8 +334,8 @@ func (c *CloudWatch) PutMetricAlarm(input *PutMetricAlarmInput) (*PutMetricAlarm const opPutMetricData = "PutMetricData" // PutMetricDataRequest generates a request for the PutMetricData operation. -func (c *CloudWatch) PutMetricDataRequest(input *PutMetricDataInput) (req *aws.Request, output *PutMetricDataOutput) { - op := &aws.Operation{ +func (c *CloudWatch) PutMetricDataRequest(input *PutMetricDataInput) (req *request.Request, output *PutMetricDataOutput) { + op := &request.Operation{ Name: opPutMetricData, HTTPMethod: "POST", HTTPPath: "/", @@ -374,8 +374,8 @@ func (c *CloudWatch) PutMetricData(input *PutMetricDataInput) (*PutMetricDataOut const opSetAlarmState = "SetAlarmState" // SetAlarmStateRequest generates a request for the SetAlarmState operation. -func (c *CloudWatch) SetAlarmStateRequest(input *SetAlarmStateInput) (req *aws.Request, output *SetAlarmStateOutput) { - op := &aws.Operation{ +func (c *CloudWatch) SetAlarmStateRequest(input *SetAlarmStateInput) (req *request.Request, output *SetAlarmStateOutput) { + op := &request.Operation{ Name: opSetAlarmState, HTTPMethod: "POST", HTTPPath: "/", @@ -406,16 +406,16 @@ func (c *CloudWatch) SetAlarmState(input *SetAlarmStateInput) (*SetAlarmStateOut // returns this data type as part of the DescribeAlarmHistoryResult data type. type AlarmHistoryItem struct { // The descriptive name for the alarm. - AlarmName *string `type:"string"` + AlarmName *string `min:"1" type:"string"` // Machine-readable data about the alarm in JSON format. - HistoryData *string `type:"string"` + HistoryData *string `min:"1" type:"string"` // The type of alarm history item. HistoryItemType *string `type:"string" enum:"HistoryItemType"` // A human-readable summary of the alarm history. - HistorySummary *string `type:"string"` + HistorySummary *string `min:"1" type:"string"` // The time stamp for the alarm history item. Amazon CloudWatch uses Coordinated // Universal Time (UTC) when returning time stamps, which do not accommodate @@ -528,7 +528,7 @@ func (s DeleteAlarmsOutput) GoString() string { type DescribeAlarmHistoryInput struct { // The name of the alarm. - AlarmName *string `type:"string"` + AlarmName *string `min:"1" type:"string"` // The ending date to retrieve alarm history. EndDate *time.Time `type:"timestamp" timestampFormat:"iso8601"` @@ -537,7 +537,7 @@ type DescribeAlarmHistoryInput struct { HistoryItemType *string `type:"string" enum:"HistoryItemType"` // The maximum number of alarm history records to retrieve. - MaxRecords *int64 `type:"integer"` + MaxRecords *int64 `min:"1" type:"integer"` // The token returned by a previous call to indicate that there is more data // available. @@ -593,13 +593,13 @@ type DescribeAlarmsForMetricInput struct { Dimensions []*Dimension `type:"list"` // The name of the metric. - MetricName *string `type:"string" required:"true"` + MetricName *string `min:"1" type:"string" required:"true"` // The namespace of the metric. - Namespace *string `type:"string" required:"true"` + Namespace *string `min:"1" type:"string" required:"true"` // The period in seconds over which the statistic is applied. - Period *int64 `type:"integer"` + Period *int64 `min:"60" type:"integer"` // The statistic for the metric. Statistic *string `type:"string" enum:"Statistic"` @@ -648,17 +648,17 @@ func (s DescribeAlarmsForMetricOutput) GoString() string { type DescribeAlarmsInput struct { // The action name prefix. - ActionPrefix *string `type:"string"` + ActionPrefix *string `min:"1" type:"string"` // The alarm name prefix. AlarmNames cannot be specified if this parameter is // specified. - AlarmNamePrefix *string `type:"string"` + AlarmNamePrefix *string `min:"1" type:"string"` // A list of alarm names to retrieve information for. AlarmNames []*string `type:"list"` // The maximum number of alarm descriptions to retrieve. - MaxRecords *int64 `type:"integer"` + MaxRecords *int64 `min:"1" type:"integer"` // The token returned by a previous call to indicate that there is more data // available. @@ -715,10 +715,10 @@ func (s DescribeAlarmsOutput) GoString() string { // For examples that use one or more dimensions, see PutMetricData. type Dimension struct { // The name of the dimension. - Name *string `type:"string" required:"true"` + Name *string `min:"1" type:"string" required:"true"` // The value representing the dimension measurement - Value *string `type:"string" required:"true"` + Value *string `min:"1" type:"string" required:"true"` metadataDimension `json:"-" xml:"-"` } @@ -740,10 +740,10 @@ func (s Dimension) GoString() string { // The DimensionFilter data type is used to filter ListMetrics results. type DimensionFilter struct { // The dimension name to be matched. - Name *string `type:"string" required:"true"` + Name *string `min:"1" type:"string" required:"true"` // The value of the dimension to be matched. - Value *string `type:"string"` + Value *string `min:"1" type:"string"` metadataDimensionFilter `json:"-" xml:"-"` } @@ -850,14 +850,14 @@ type GetMetricStatisticsInput struct { EndTime *time.Time `type:"timestamp" timestampFormat:"iso8601" required:"true"` // The name of the metric, with or without spaces. - MetricName *string `type:"string" required:"true"` + MetricName *string `min:"1" type:"string" required:"true"` // The namespace of the metric, with or without spaces. - Namespace *string `type:"string" required:"true"` + Namespace *string `min:"1" type:"string" required:"true"` // The granularity, in seconds, of the returned datapoints. Period must be at // least 60 seconds and must be a multiple of 60. The default value is 60. - Period *int64 `type:"integer" required:"true"` + Period *int64 `min:"60" type:"integer" required:"true"` // The time stamp to use for determining the first datapoint to return. The // value specified is inclusive; results include datapoints with the time stamp @@ -869,7 +869,7 @@ type GetMetricStatisticsInput struct { // in the Amazon CloudWatch Developer Guide. // // Valid Values: Average | Sum | SampleCount | Maximum | Minimum - Statistics []*string `type:"list" required:"true"` + Statistics []*string `min:"1" type:"list" required:"true"` // The unit for the metric. Unit *string `type:"string" enum:"StandardUnit"` @@ -921,10 +921,10 @@ type ListMetricsInput struct { Dimensions []*DimensionFilter `type:"list"` // The name of the metric to filter against. - MetricName *string `type:"string"` + MetricName *string `min:"1" type:"string"` // The namespace to filter against. - Namespace *string `type:"string"` + Namespace *string `min:"1" type:"string"` // The token returned by a previous call to indicate that there is more data // available. @@ -984,10 +984,10 @@ type Metric struct { Dimensions []*Dimension `type:"list"` // The name of the metric. - MetricName *string `type:"string"` + MetricName *string `min:"1" type:"string"` // The namespace of the metric. - Namespace *string `type:"string"` + Namespace *string `min:"1" type:"string"` metadataMetric `json:"-" xml:"-"` } @@ -1013,15 +1013,15 @@ type MetricAlarm struct { // state. ActionsEnabled *bool `type:"boolean"` - // The Amazon Resource Name (ARN) of the alarm. - AlarmARN *string `locationName:"AlarmArn" type:"string"` - // The list of actions to execute when this alarm transitions into an ALARM // state from any other state. Each action is specified as an Amazon Resource // Number (ARN). Currently the only actions supported are publishing to an Amazon // SNS topic and triggering an Auto Scaling policy. AlarmActions []*string `type:"list"` + // The Amazon Resource Name (ARN) of the alarm. + AlarmArn *string `min:"1" type:"string"` + // The time stamp of the last update to the alarm configuration. Amazon CloudWatch // uses Coordinated Universal Time (UTC) when returning time stamps, which do // not accommodate seasonal adjustments such as daylight savings time. For more @@ -1033,7 +1033,7 @@ type MetricAlarm struct { AlarmDescription *string `type:"string"` // The name of the alarm. - AlarmName *string `type:"string"` + AlarmName *string `min:"1" type:"string"` // The arithmetic operation to use when comparing the specified Statistic and // Threshold. The specified Statistic value is used as the first operand. @@ -1043,7 +1043,7 @@ type MetricAlarm struct { Dimensions []*Dimension `type:"list"` // The number of periods over which data is compared to the specified threshold. - EvaluationPeriods *int64 `type:"integer"` + EvaluationPeriods *int64 `min:"1" type:"integer"` // The list of actions to execute when this alarm transitions into an INSUFFICIENT_DATA // state from any other state. Each action is specified as an Amazon Resource @@ -1054,10 +1054,10 @@ type MetricAlarm struct { InsufficientDataActions []*string `type:"list"` // The name of the alarm's metric. - MetricName *string `type:"string"` + MetricName *string `min:"1" type:"string"` // The namespace of alarm's associated metric. - Namespace *string `type:"string"` + Namespace *string `min:"1" type:"string"` // The list of actions to execute when this alarm transitions into an OK state // from any other state. Each action is specified as an Amazon Resource Number @@ -1066,7 +1066,7 @@ type MetricAlarm struct { OKActions []*string `type:"list"` // The period in seconds over which the statistic is applied. - Period *int64 `type:"integer"` + Period *int64 `min:"60" type:"integer"` // A human-readable explanation for the alarm's state. StateReason *string `type:"string"` @@ -1119,7 +1119,7 @@ type MetricDatum struct { Dimensions []*Dimension `type:"list"` // The name of the metric. - MetricName *string `type:"string" required:"true"` + MetricName *string `min:"1" type:"string" required:"true"` // A set of statistical values describing the metric. StatisticValues *StatisticSet `type:"structure"` @@ -1176,7 +1176,7 @@ type PutMetricAlarmInput struct { // The descriptive name for the alarm. This name must be unique within the user's // AWS account - AlarmName *string `type:"string" required:"true"` + AlarmName *string `min:"1" type:"string" required:"true"` // The arithmetic operation to use when comparing the specified Statistic and // Threshold. The specified Statistic value is used as the first operand. @@ -1186,7 +1186,7 @@ type PutMetricAlarmInput struct { Dimensions []*Dimension `type:"list"` // The number of periods over which data is compared to the specified threshold. - EvaluationPeriods *int64 `type:"integer" required:"true"` + EvaluationPeriods *int64 `min:"1" type:"integer" required:"true"` // The list of actions to execute when this alarm transitions into an INSUFFICIENT_DATA // state from any other state. Each action is specified as an Amazon Resource @@ -1195,10 +1195,10 @@ type PutMetricAlarmInput struct { InsufficientDataActions []*string `type:"list"` // The name for the alarm's associated metric. - MetricName *string `type:"string" required:"true"` + MetricName *string `min:"1" type:"string" required:"true"` // The namespace for the alarm's associated metric. - Namespace *string `type:"string" required:"true"` + Namespace *string `min:"1" type:"string" required:"true"` // The list of actions to execute when this alarm transitions into an OK state // from any other state. Each action is specified as an Amazon Resource Number @@ -1207,7 +1207,7 @@ type PutMetricAlarmInput struct { OKActions []*string `type:"list"` // The period in seconds over which the specified statistic is applied. - Period *int64 `type:"integer" required:"true"` + Period *int64 `min:"60" type:"integer" required:"true"` // The statistic to apply to the alarm's associated metric. Statistic *string `type:"string" required:"true" enum:"Statistic"` @@ -1258,7 +1258,7 @@ type PutMetricDataInput struct { MetricData []*MetricDatum `type:"list" required:"true"` // The namespace for the metric data. - Namespace *string `type:"string" required:"true"` + Namespace *string `min:"1" type:"string" required:"true"` metadataPutMetricDataInput `json:"-" xml:"-"` } @@ -1298,7 +1298,7 @@ func (s PutMetricDataOutput) GoString() string { type SetAlarmStateInput struct { // The descriptive name for the alarm. This name must be unique within the user's // AWS account. The maximum length is 255 characters. - AlarmName *string `type:"string" required:"true"` + AlarmName *string `min:"1" type:"string" required:"true"` // The reason that this alarm is set to this specific state (in human-readable // text format) diff --git a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/service/cloudwatch/cloudwatchiface/interface.go b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/service/cloudwatch/cloudwatchiface/interface.go index 77947d73980..d73332aa0c0 100644 --- a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/service/cloudwatch/cloudwatchiface/interface.go +++ b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/service/cloudwatch/cloudwatchiface/interface.go @@ -4,59 +4,59 @@ package cloudwatchiface import ( - "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/aws/request" "github.com/aws/aws-sdk-go/service/cloudwatch" ) // CloudWatchAPI is the interface type for cloudwatch.CloudWatch. type CloudWatchAPI interface { - DeleteAlarmsRequest(*cloudwatch.DeleteAlarmsInput) (*aws.Request, *cloudwatch.DeleteAlarmsOutput) + DeleteAlarmsRequest(*cloudwatch.DeleteAlarmsInput) (*request.Request, *cloudwatch.DeleteAlarmsOutput) DeleteAlarms(*cloudwatch.DeleteAlarmsInput) (*cloudwatch.DeleteAlarmsOutput, error) - DescribeAlarmHistoryRequest(*cloudwatch.DescribeAlarmHistoryInput) (*aws.Request, *cloudwatch.DescribeAlarmHistoryOutput) + DescribeAlarmHistoryRequest(*cloudwatch.DescribeAlarmHistoryInput) (*request.Request, *cloudwatch.DescribeAlarmHistoryOutput) DescribeAlarmHistory(*cloudwatch.DescribeAlarmHistoryInput) (*cloudwatch.DescribeAlarmHistoryOutput, error) DescribeAlarmHistoryPages(*cloudwatch.DescribeAlarmHistoryInput, func(*cloudwatch.DescribeAlarmHistoryOutput, bool) bool) error - DescribeAlarmsRequest(*cloudwatch.DescribeAlarmsInput) (*aws.Request, *cloudwatch.DescribeAlarmsOutput) + DescribeAlarmsRequest(*cloudwatch.DescribeAlarmsInput) (*request.Request, *cloudwatch.DescribeAlarmsOutput) DescribeAlarms(*cloudwatch.DescribeAlarmsInput) (*cloudwatch.DescribeAlarmsOutput, error) DescribeAlarmsPages(*cloudwatch.DescribeAlarmsInput, func(*cloudwatch.DescribeAlarmsOutput, bool) bool) error - DescribeAlarmsForMetricRequest(*cloudwatch.DescribeAlarmsForMetricInput) (*aws.Request, *cloudwatch.DescribeAlarmsForMetricOutput) + DescribeAlarmsForMetricRequest(*cloudwatch.DescribeAlarmsForMetricInput) (*request.Request, *cloudwatch.DescribeAlarmsForMetricOutput) DescribeAlarmsForMetric(*cloudwatch.DescribeAlarmsForMetricInput) (*cloudwatch.DescribeAlarmsForMetricOutput, error) - DisableAlarmActionsRequest(*cloudwatch.DisableAlarmActionsInput) (*aws.Request, *cloudwatch.DisableAlarmActionsOutput) + DisableAlarmActionsRequest(*cloudwatch.DisableAlarmActionsInput) (*request.Request, *cloudwatch.DisableAlarmActionsOutput) DisableAlarmActions(*cloudwatch.DisableAlarmActionsInput) (*cloudwatch.DisableAlarmActionsOutput, error) - EnableAlarmActionsRequest(*cloudwatch.EnableAlarmActionsInput) (*aws.Request, *cloudwatch.EnableAlarmActionsOutput) + EnableAlarmActionsRequest(*cloudwatch.EnableAlarmActionsInput) (*request.Request, *cloudwatch.EnableAlarmActionsOutput) EnableAlarmActions(*cloudwatch.EnableAlarmActionsInput) (*cloudwatch.EnableAlarmActionsOutput, error) - GetMetricStatisticsRequest(*cloudwatch.GetMetricStatisticsInput) (*aws.Request, *cloudwatch.GetMetricStatisticsOutput) + GetMetricStatisticsRequest(*cloudwatch.GetMetricStatisticsInput) (*request.Request, *cloudwatch.GetMetricStatisticsOutput) GetMetricStatistics(*cloudwatch.GetMetricStatisticsInput) (*cloudwatch.GetMetricStatisticsOutput, error) - ListMetricsRequest(*cloudwatch.ListMetricsInput) (*aws.Request, *cloudwatch.ListMetricsOutput) + ListMetricsRequest(*cloudwatch.ListMetricsInput) (*request.Request, *cloudwatch.ListMetricsOutput) ListMetrics(*cloudwatch.ListMetricsInput) (*cloudwatch.ListMetricsOutput, error) ListMetricsPages(*cloudwatch.ListMetricsInput, func(*cloudwatch.ListMetricsOutput, bool) bool) error - PutMetricAlarmRequest(*cloudwatch.PutMetricAlarmInput) (*aws.Request, *cloudwatch.PutMetricAlarmOutput) + PutMetricAlarmRequest(*cloudwatch.PutMetricAlarmInput) (*request.Request, *cloudwatch.PutMetricAlarmOutput) PutMetricAlarm(*cloudwatch.PutMetricAlarmInput) (*cloudwatch.PutMetricAlarmOutput, error) - PutMetricDataRequest(*cloudwatch.PutMetricDataInput) (*aws.Request, *cloudwatch.PutMetricDataOutput) + PutMetricDataRequest(*cloudwatch.PutMetricDataInput) (*request.Request, *cloudwatch.PutMetricDataOutput) PutMetricData(*cloudwatch.PutMetricDataInput) (*cloudwatch.PutMetricDataOutput, error) - SetAlarmStateRequest(*cloudwatch.SetAlarmStateInput) (*aws.Request, *cloudwatch.SetAlarmStateOutput) + SetAlarmStateRequest(*cloudwatch.SetAlarmStateInput) (*request.Request, *cloudwatch.SetAlarmStateOutput) SetAlarmState(*cloudwatch.SetAlarmStateInput) (*cloudwatch.SetAlarmStateOutput, error) } diff --git a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/service/cloudwatch/examples_test.go b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/service/cloudwatch/examples_test.go index cd1eeb2350a..fbfc3f516df 100644 --- a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/service/cloudwatch/examples_test.go +++ b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/service/cloudwatch/examples_test.go @@ -8,8 +8,6 @@ import ( "time" "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/awserr" - "github.com/aws/aws-sdk-go/aws/awsutil" "github.com/aws/aws-sdk-go/service/cloudwatch" ) @@ -28,22 +26,14 @@ func ExampleCloudWatch_DeleteAlarms() { resp, err := svc.DeleteAlarms(params) if err != nil { - if awsErr, ok := err.(awserr.Error); ok { - // Generic AWS error with Code, Message, and original error (if any) - fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) - if reqErr, ok := err.(awserr.RequestFailure); ok { - // A service error occurred - fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) - } - } else { - // This case should never be hit, the SDK should always return an - // error which satisfies the awserr.Error interface. - fmt.Println(err.Error()) - } + // Print the error, cast err to awserr.Error to get the Code and + // Message from an error. + fmt.Println(err.Error()) + return } // Pretty-print the response data. - fmt.Println(awsutil.Prettify(resp)) + fmt.Println(resp) } func ExampleCloudWatch_DescribeAlarmHistory() { @@ -60,22 +50,14 @@ func ExampleCloudWatch_DescribeAlarmHistory() { resp, err := svc.DescribeAlarmHistory(params) if err != nil { - if awsErr, ok := err.(awserr.Error); ok { - // Generic AWS error with Code, Message, and original error (if any) - fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) - if reqErr, ok := err.(awserr.RequestFailure); ok { - // A service error occurred - fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) - } - } else { - // This case should never be hit, the SDK should always return an - // error which satisfies the awserr.Error interface. - fmt.Println(err.Error()) - } + // Print the error, cast err to awserr.Error to get the Code and + // Message from an error. + fmt.Println(err.Error()) + return } // Pretty-print the response data. - fmt.Println(awsutil.Prettify(resp)) + fmt.Println(resp) } func ExampleCloudWatch_DescribeAlarms() { @@ -95,22 +77,14 @@ func ExampleCloudWatch_DescribeAlarms() { resp, err := svc.DescribeAlarms(params) if err != nil { - if awsErr, ok := err.(awserr.Error); ok { - // Generic AWS error with Code, Message, and original error (if any) - fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) - if reqErr, ok := err.(awserr.RequestFailure); ok { - // A service error occurred - fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) - } - } else { - // This case should never be hit, the SDK should always return an - // error which satisfies the awserr.Error interface. - fmt.Println(err.Error()) - } + // Print the error, cast err to awserr.Error to get the Code and + // Message from an error. + fmt.Println(err.Error()) + return } // Pretty-print the response data. - fmt.Println(awsutil.Prettify(resp)) + fmt.Println(resp) } func ExampleCloudWatch_DescribeAlarmsForMetric() { @@ -133,22 +107,14 @@ func ExampleCloudWatch_DescribeAlarmsForMetric() { resp, err := svc.DescribeAlarmsForMetric(params) if err != nil { - if awsErr, ok := err.(awserr.Error); ok { - // Generic AWS error with Code, Message, and original error (if any) - fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) - if reqErr, ok := err.(awserr.RequestFailure); ok { - // A service error occurred - fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) - } - } else { - // This case should never be hit, the SDK should always return an - // error which satisfies the awserr.Error interface. - fmt.Println(err.Error()) - } + // Print the error, cast err to awserr.Error to get the Code and + // Message from an error. + fmt.Println(err.Error()) + return } // Pretty-print the response data. - fmt.Println(awsutil.Prettify(resp)) + fmt.Println(resp) } func ExampleCloudWatch_DisableAlarmActions() { @@ -163,22 +129,14 @@ func ExampleCloudWatch_DisableAlarmActions() { resp, err := svc.DisableAlarmActions(params) if err != nil { - if awsErr, ok := err.(awserr.Error); ok { - // Generic AWS error with Code, Message, and original error (if any) - fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) - if reqErr, ok := err.(awserr.RequestFailure); ok { - // A service error occurred - fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) - } - } else { - // This case should never be hit, the SDK should always return an - // error which satisfies the awserr.Error interface. - fmt.Println(err.Error()) - } + // Print the error, cast err to awserr.Error to get the Code and + // Message from an error. + fmt.Println(err.Error()) + return } // Pretty-print the response data. - fmt.Println(awsutil.Prettify(resp)) + fmt.Println(resp) } func ExampleCloudWatch_EnableAlarmActions() { @@ -193,22 +151,14 @@ func ExampleCloudWatch_EnableAlarmActions() { resp, err := svc.EnableAlarmActions(params) if err != nil { - if awsErr, ok := err.(awserr.Error); ok { - // Generic AWS error with Code, Message, and original error (if any) - fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) - if reqErr, ok := err.(awserr.RequestFailure); ok { - // A service error occurred - fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) - } - } else { - // This case should never be hit, the SDK should always return an - // error which satisfies the awserr.Error interface. - fmt.Println(err.Error()) - } + // Print the error, cast err to awserr.Error to get the Code and + // Message from an error. + fmt.Println(err.Error()) + return } // Pretty-print the response data. - fmt.Println(awsutil.Prettify(resp)) + fmt.Println(resp) } func ExampleCloudWatch_GetMetricStatistics() { @@ -236,22 +186,14 @@ func ExampleCloudWatch_GetMetricStatistics() { resp, err := svc.GetMetricStatistics(params) if err != nil { - if awsErr, ok := err.(awserr.Error); ok { - // Generic AWS error with Code, Message, and original error (if any) - fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) - if reqErr, ok := err.(awserr.RequestFailure); ok { - // A service error occurred - fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) - } - } else { - // This case should never be hit, the SDK should always return an - // error which satisfies the awserr.Error interface. - fmt.Println(err.Error()) - } + // Print the error, cast err to awserr.Error to get the Code and + // Message from an error. + fmt.Println(err.Error()) + return } // Pretty-print the response data. - fmt.Println(awsutil.Prettify(resp)) + fmt.Println(resp) } func ExampleCloudWatch_ListMetrics() { @@ -272,22 +214,14 @@ func ExampleCloudWatch_ListMetrics() { resp, err := svc.ListMetrics(params) if err != nil { - if awsErr, ok := err.(awserr.Error); ok { - // Generic AWS error with Code, Message, and original error (if any) - fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) - if reqErr, ok := err.(awserr.RequestFailure); ok { - // A service error occurred - fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) - } - } else { - // This case should never be hit, the SDK should always return an - // error which satisfies the awserr.Error interface. - fmt.Println(err.Error()) - } + // Print the error, cast err to awserr.Error to get the Code and + // Message from an error. + fmt.Println(err.Error()) + return } // Pretty-print the response data. - fmt.Println(awsutil.Prettify(resp)) + fmt.Println(resp) } func ExampleCloudWatch_PutMetricAlarm() { @@ -328,22 +262,14 @@ func ExampleCloudWatch_PutMetricAlarm() { resp, err := svc.PutMetricAlarm(params) if err != nil { - if awsErr, ok := err.(awserr.Error); ok { - // Generic AWS error with Code, Message, and original error (if any) - fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) - if reqErr, ok := err.(awserr.RequestFailure); ok { - // A service error occurred - fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) - } - } else { - // This case should never be hit, the SDK should always return an - // error which satisfies the awserr.Error interface. - fmt.Println(err.Error()) - } + // Print the error, cast err to awserr.Error to get the Code and + // Message from an error. + fmt.Println(err.Error()) + return } // Pretty-print the response data. - fmt.Println(awsutil.Prettify(resp)) + fmt.Println(resp) } func ExampleCloudWatch_PutMetricData() { @@ -377,22 +303,14 @@ func ExampleCloudWatch_PutMetricData() { resp, err := svc.PutMetricData(params) if err != nil { - if awsErr, ok := err.(awserr.Error); ok { - // Generic AWS error with Code, Message, and original error (if any) - fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) - if reqErr, ok := err.(awserr.RequestFailure); ok { - // A service error occurred - fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) - } - } else { - // This case should never be hit, the SDK should always return an - // error which satisfies the awserr.Error interface. - fmt.Println(err.Error()) - } + // Print the error, cast err to awserr.Error to get the Code and + // Message from an error. + fmt.Println(err.Error()) + return } // Pretty-print the response data. - fmt.Println(awsutil.Prettify(resp)) + fmt.Println(resp) } func ExampleCloudWatch_SetAlarmState() { @@ -407,20 +325,12 @@ func ExampleCloudWatch_SetAlarmState() { resp, err := svc.SetAlarmState(params) if err != nil { - if awsErr, ok := err.(awserr.Error); ok { - // Generic AWS error with Code, Message, and original error (if any) - fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) - if reqErr, ok := err.(awserr.RequestFailure); ok { - // A service error occurred - fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) - } - } else { - // This case should never be hit, the SDK should always return an - // error which satisfies the awserr.Error interface. - fmt.Println(err.Error()) - } + // Print the error, cast err to awserr.Error to get the Code and + // Message from an error. + fmt.Println(err.Error()) + return } // Pretty-print the response data. - fmt.Println(awsutil.Prettify(resp)) + fmt.Println(resp) } diff --git a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/service/cloudwatch/service.go b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/service/cloudwatch/service.go index eadc454e2a3..17a6f3f7524 100644 --- a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/service/cloudwatch/service.go +++ b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/service/cloudwatch/service.go @@ -4,8 +4,12 @@ package cloudwatch import ( "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/internal/protocol/query" - "github.com/aws/aws-sdk-go/internal/signer/v4" + "github.com/aws/aws-sdk-go/aws/defaults" + "github.com/aws/aws-sdk-go/aws/request" + "github.com/aws/aws-sdk-go/aws/service" + "github.com/aws/aws-sdk-go/aws/service/serviceinfo" + "github.com/aws/aws-sdk-go/private/protocol/query" + "github.com/aws/aws-sdk-go/private/signer/v4" ) // This is the Amazon CloudWatch API Reference. This guide provides detailed @@ -49,21 +53,23 @@ import ( // AWS Ruby Developer Center (http://aws.amazon.com/ruby/) AWS Windows and .NET // Developer Center (http://aws.amazon.com/net/) type CloudWatch struct { - *aws.Service + *service.Service } // Used for custom service initialization logic -var initService func(*aws.Service) +var initService func(*service.Service) // Used for custom request initialization logic -var initRequest func(*aws.Request) +var initRequest func(*request.Request) // New returns a new CloudWatch client. func New(config *aws.Config) *CloudWatch { - service := &aws.Service{ - Config: aws.DefaultConfig.Merge(config), - ServiceName: "monitoring", - APIVersion: "2010-08-01", + service := &service.Service{ + ServiceInfo: serviceinfo.ServiceInfo{ + Config: defaults.DefaultConfig.Merge(config), + ServiceName: "monitoring", + APIVersion: "2010-08-01", + }, } service.Initialize() @@ -84,8 +90,8 @@ func New(config *aws.Config) *CloudWatch { // newRequest creates a new request for a CloudWatch operation and runs any // custom request initialization. -func (c *CloudWatch) newRequest(op *aws.Operation, params, data interface{}) *aws.Request { - req := aws.NewRequest(c.Service, op, params, data) +func (c *CloudWatch) newRequest(op *request.Operation, params, data interface{}) *request.Request { + req := c.NewRequest(op, params, data) // Run custom request initialization if present if initRequest != nil { diff --git a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/service/ec2/api.go b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/service/ec2/api.go index b6e84b4b43d..b4c238a5fb0 100644 --- a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/service/ec2/api.go +++ b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/service/ec2/api.go @@ -6,26 +6,26 @@ package ec2 import ( "time" - "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/aws/awsutil" + "github.com/aws/aws-sdk-go/aws/request" ) -const opAcceptVPCPeeringConnection = "AcceptVpcPeeringConnection" +const opAcceptVpcPeeringConnection = "AcceptVpcPeeringConnection" -// AcceptVPCPeeringConnectionRequest generates a request for the AcceptVPCPeeringConnection operation. -func (c *EC2) AcceptVPCPeeringConnectionRequest(input *AcceptVPCPeeringConnectionInput) (req *aws.Request, output *AcceptVPCPeeringConnectionOutput) { - op := &aws.Operation{ - Name: opAcceptVPCPeeringConnection, +// AcceptVpcPeeringConnectionRequest generates a request for the AcceptVpcPeeringConnection operation. +func (c *EC2) AcceptVpcPeeringConnectionRequest(input *AcceptVpcPeeringConnectionInput) (req *request.Request, output *AcceptVpcPeeringConnectionOutput) { + op := &request.Operation{ + Name: opAcceptVpcPeeringConnection, HTTPMethod: "POST", HTTPPath: "/", } if input == nil { - input = &AcceptVPCPeeringConnectionInput{} + input = &AcceptVpcPeeringConnectionInput{} } req = c.newRequest(op, input, output) - output = &AcceptVPCPeeringConnectionOutput{} + output = &AcceptVpcPeeringConnectionOutput{} req.Data = output return } @@ -34,8 +34,8 @@ func (c *EC2) AcceptVPCPeeringConnectionRequest(input *AcceptVPCPeeringConnectio // connection must be in the pending-acceptance state, and you must be the owner // of the peer VPC. Use the DescribeVpcPeeringConnections request to view your // outstanding VPC peering connection requests. -func (c *EC2) AcceptVPCPeeringConnection(input *AcceptVPCPeeringConnectionInput) (*AcceptVPCPeeringConnectionOutput, error) { - req, out := c.AcceptVPCPeeringConnectionRequest(input) +func (c *EC2) AcceptVpcPeeringConnection(input *AcceptVpcPeeringConnectionInput) (*AcceptVpcPeeringConnectionOutput, error) { + req, out := c.AcceptVpcPeeringConnectionRequest(input) err := req.Send() return out, err } @@ -43,8 +43,8 @@ func (c *EC2) AcceptVPCPeeringConnection(input *AcceptVPCPeeringConnectionInput) const opAllocateAddress = "AllocateAddress" // AllocateAddressRequest generates a request for the AllocateAddress operation. -func (c *EC2) AllocateAddressRequest(input *AllocateAddressInput) (req *aws.Request, output *AllocateAddressOutput) { - op := &aws.Operation{ +func (c *EC2) AllocateAddressRequest(input *AllocateAddressInput) (req *request.Request, output *AllocateAddressOutput) { + op := &request.Operation{ Name: opAllocateAddress, HTTPMethod: "POST", HTTPPath: "/", @@ -71,22 +71,22 @@ func (c *EC2) AllocateAddress(input *AllocateAddressInput) (*AllocateAddressOutp return out, err } -const opAssignPrivateIPAddresses = "AssignPrivateIpAddresses" +const opAssignPrivateIpAddresses = "AssignPrivateIpAddresses" -// AssignPrivateIPAddressesRequest generates a request for the AssignPrivateIPAddresses operation. -func (c *EC2) AssignPrivateIPAddressesRequest(input *AssignPrivateIPAddressesInput) (req *aws.Request, output *AssignPrivateIPAddressesOutput) { - op := &aws.Operation{ - Name: opAssignPrivateIPAddresses, +// AssignPrivateIpAddressesRequest generates a request for the AssignPrivateIpAddresses operation. +func (c *EC2) AssignPrivateIpAddressesRequest(input *AssignPrivateIpAddressesInput) (req *request.Request, output *AssignPrivateIpAddressesOutput) { + op := &request.Operation{ + Name: opAssignPrivateIpAddresses, HTTPMethod: "POST", HTTPPath: "/", } if input == nil { - input = &AssignPrivateIPAddressesInput{} + input = &AssignPrivateIpAddressesInput{} } req = c.newRequest(op, input, output) - output = &AssignPrivateIPAddressesOutput{} + output = &AssignPrivateIpAddressesOutput{} req.Data = output return } @@ -102,8 +102,8 @@ func (c *EC2) AssignPrivateIPAddressesRequest(input *AssignPrivateIPAddressesInp // in the Amazon Elastic Compute Cloud User Guide. // // AssignPrivateIpAddresses is available only in EC2-VPC. -func (c *EC2) AssignPrivateIPAddresses(input *AssignPrivateIPAddressesInput) (*AssignPrivateIPAddressesOutput, error) { - req, out := c.AssignPrivateIPAddressesRequest(input) +func (c *EC2) AssignPrivateIpAddresses(input *AssignPrivateIpAddressesInput) (*AssignPrivateIpAddressesOutput, error) { + req, out := c.AssignPrivateIpAddressesRequest(input) err := req.Send() return out, err } @@ -111,8 +111,8 @@ func (c *EC2) AssignPrivateIPAddresses(input *AssignPrivateIPAddressesInput) (*A const opAssociateAddress = "AssociateAddress" // AssociateAddressRequest generates a request for the AssociateAddress operation. -func (c *EC2) AssociateAddressRequest(input *AssociateAddressInput) (req *aws.Request, output *AssociateAddressOutput) { - op := &aws.Operation{ +func (c *EC2) AssociateAddressRequest(input *AssociateAddressInput) (req *request.Request, output *AssociateAddressOutput) { + op := &request.Operation{ Name: opAssociateAddress, HTTPMethod: "POST", HTTPPath: "/", @@ -151,22 +151,22 @@ func (c *EC2) AssociateAddress(input *AssociateAddressInput) (*AssociateAddressO return out, err } -const opAssociateDHCPOptions = "AssociateDhcpOptions" +const opAssociateDhcpOptions = "AssociateDhcpOptions" -// AssociateDHCPOptionsRequest generates a request for the AssociateDHCPOptions operation. -func (c *EC2) AssociateDHCPOptionsRequest(input *AssociateDHCPOptionsInput) (req *aws.Request, output *AssociateDHCPOptionsOutput) { - op := &aws.Operation{ - Name: opAssociateDHCPOptions, +// AssociateDhcpOptionsRequest generates a request for the AssociateDhcpOptions operation. +func (c *EC2) AssociateDhcpOptionsRequest(input *AssociateDhcpOptionsInput) (req *request.Request, output *AssociateDhcpOptionsOutput) { + op := &request.Operation{ + Name: opAssociateDhcpOptions, HTTPMethod: "POST", HTTPPath: "/", } if input == nil { - input = &AssociateDHCPOptionsInput{} + input = &AssociateDhcpOptionsInput{} } req = c.newRequest(op, input, output) - output = &AssociateDHCPOptionsOutput{} + output = &AssociateDhcpOptionsOutput{} req.Data = output return } @@ -183,8 +183,8 @@ func (c *EC2) AssociateDHCPOptionsRequest(input *AssociateDHCPOptionsInput) (req // // For more information, see DHCP Options Sets (http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/VPC_DHCP_Options.html) // in the Amazon Virtual Private Cloud User Guide. -func (c *EC2) AssociateDHCPOptions(input *AssociateDHCPOptionsInput) (*AssociateDHCPOptionsOutput, error) { - req, out := c.AssociateDHCPOptionsRequest(input) +func (c *EC2) AssociateDhcpOptions(input *AssociateDhcpOptionsInput) (*AssociateDhcpOptionsOutput, error) { + req, out := c.AssociateDhcpOptionsRequest(input) err := req.Send() return out, err } @@ -192,8 +192,8 @@ func (c *EC2) AssociateDHCPOptions(input *AssociateDHCPOptionsInput) (*Associate const opAssociateRouteTable = "AssociateRouteTable" // AssociateRouteTableRequest generates a request for the AssociateRouteTable operation. -func (c *EC2) AssociateRouteTableRequest(input *AssociateRouteTableInput) (req *aws.Request, output *AssociateRouteTableOutput) { - op := &aws.Operation{ +func (c *EC2) AssociateRouteTableRequest(input *AssociateRouteTableInput) (req *request.Request, output *AssociateRouteTableOutput) { + op := &request.Operation{ Name: opAssociateRouteTable, HTTPMethod: "POST", HTTPPath: "/", @@ -223,22 +223,22 @@ func (c *EC2) AssociateRouteTable(input *AssociateRouteTableInput) (*AssociateRo return out, err } -const opAttachClassicLinkVPC = "AttachClassicLinkVpc" +const opAttachClassicLinkVpc = "AttachClassicLinkVpc" -// AttachClassicLinkVPCRequest generates a request for the AttachClassicLinkVPC operation. -func (c *EC2) AttachClassicLinkVPCRequest(input *AttachClassicLinkVPCInput) (req *aws.Request, output *AttachClassicLinkVPCOutput) { - op := &aws.Operation{ - Name: opAttachClassicLinkVPC, +// AttachClassicLinkVpcRequest generates a request for the AttachClassicLinkVpc operation. +func (c *EC2) AttachClassicLinkVpcRequest(input *AttachClassicLinkVpcInput) (req *request.Request, output *AttachClassicLinkVpcOutput) { + op := &request.Operation{ + Name: opAttachClassicLinkVpc, HTTPMethod: "POST", HTTPPath: "/", } if input == nil { - input = &AttachClassicLinkVPCInput{} + input = &AttachClassicLinkVpcInput{} } req = c.newRequest(op, input, output) - output = &AttachClassicLinkVPCOutput{} + output = &AttachClassicLinkVpcOutput{} req.Data = output return } @@ -255,8 +255,8 @@ func (c *EC2) AttachClassicLinkVPCRequest(input *AttachClassicLinkVPCInput) (req // // Linking your instance to a VPC is sometimes referred to as attaching your // instance. -func (c *EC2) AttachClassicLinkVPC(input *AttachClassicLinkVPCInput) (*AttachClassicLinkVPCOutput, error) { - req, out := c.AttachClassicLinkVPCRequest(input) +func (c *EC2) AttachClassicLinkVpc(input *AttachClassicLinkVpcInput) (*AttachClassicLinkVpcOutput, error) { + req, out := c.AttachClassicLinkVpcRequest(input) err := req.Send() return out, err } @@ -264,8 +264,8 @@ func (c *EC2) AttachClassicLinkVPC(input *AttachClassicLinkVPCInput) (*AttachCla const opAttachInternetGateway = "AttachInternetGateway" // AttachInternetGatewayRequest generates a request for the AttachInternetGateway operation. -func (c *EC2) AttachInternetGatewayRequest(input *AttachInternetGatewayInput) (req *aws.Request, output *AttachInternetGatewayOutput) { - op := &aws.Operation{ +func (c *EC2) AttachInternetGatewayRequest(input *AttachInternetGatewayInput) (req *request.Request, output *AttachInternetGatewayOutput) { + op := &request.Operation{ Name: opAttachInternetGateway, HTTPMethod: "POST", HTTPPath: "/", @@ -293,8 +293,8 @@ func (c *EC2) AttachInternetGateway(input *AttachInternetGatewayInput) (*AttachI const opAttachNetworkInterface = "AttachNetworkInterface" // AttachNetworkInterfaceRequest generates a request for the AttachNetworkInterface operation. -func (c *EC2) AttachNetworkInterfaceRequest(input *AttachNetworkInterfaceInput) (req *aws.Request, output *AttachNetworkInterfaceOutput) { - op := &aws.Operation{ +func (c *EC2) AttachNetworkInterfaceRequest(input *AttachNetworkInterfaceInput) (req *request.Request, output *AttachNetworkInterfaceOutput) { + op := &request.Operation{ Name: opAttachNetworkInterface, HTTPMethod: "POST", HTTPPath: "/", @@ -317,40 +317,11 @@ func (c *EC2) AttachNetworkInterface(input *AttachNetworkInterfaceInput) (*Attac return out, err } -const opAttachVPNGateway = "AttachVpnGateway" - -// AttachVPNGatewayRequest generates a request for the AttachVPNGateway operation. -func (c *EC2) AttachVPNGatewayRequest(input *AttachVPNGatewayInput) (req *aws.Request, output *AttachVPNGatewayOutput) { - op := &aws.Operation{ - Name: opAttachVPNGateway, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &AttachVPNGatewayInput{} - } - - req = c.newRequest(op, input, output) - output = &AttachVPNGatewayOutput{} - req.Data = output - return -} - -// Attaches a virtual private gateway to a VPC. For more information, see Adding -// a Hardware Virtual Private Gateway to Your VPC (http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/VPC_VPN.html) -// in the Amazon Virtual Private Cloud User Guide. -func (c *EC2) AttachVPNGateway(input *AttachVPNGatewayInput) (*AttachVPNGatewayOutput, error) { - req, out := c.AttachVPNGatewayRequest(input) - err := req.Send() - return out, err -} - const opAttachVolume = "AttachVolume" // AttachVolumeRequest generates a request for the AttachVolume operation. -func (c *EC2) AttachVolumeRequest(input *AttachVolumeInput) (req *aws.Request, output *VolumeAttachment) { - op := &aws.Operation{ +func (c *EC2) AttachVolumeRequest(input *AttachVolumeInput) (req *request.Request, output *VolumeAttachment) { + op := &request.Operation{ Name: opAttachVolume, HTTPMethod: "POST", HTTPPath: "/", @@ -397,11 +368,40 @@ func (c *EC2) AttachVolume(input *AttachVolumeInput) (*VolumeAttachment, error) return out, err } +const opAttachVpnGateway = "AttachVpnGateway" + +// AttachVpnGatewayRequest generates a request for the AttachVpnGateway operation. +func (c *EC2) AttachVpnGatewayRequest(input *AttachVpnGatewayInput) (req *request.Request, output *AttachVpnGatewayOutput) { + op := &request.Operation{ + Name: opAttachVpnGateway, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &AttachVpnGatewayInput{} + } + + req = c.newRequest(op, input, output) + output = &AttachVpnGatewayOutput{} + req.Data = output + return +} + +// Attaches a virtual private gateway to a VPC. For more information, see Adding +// a Hardware Virtual Private Gateway to Your VPC (http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/VPC_VPN.html) +// in the Amazon Virtual Private Cloud User Guide. +func (c *EC2) AttachVpnGateway(input *AttachVpnGatewayInput) (*AttachVpnGatewayOutput, error) { + req, out := c.AttachVpnGatewayRequest(input) + err := req.Send() + return out, err +} + const opAuthorizeSecurityGroupEgress = "AuthorizeSecurityGroupEgress" // AuthorizeSecurityGroupEgressRequest generates a request for the AuthorizeSecurityGroupEgress operation. -func (c *EC2) AuthorizeSecurityGroupEgressRequest(input *AuthorizeSecurityGroupEgressInput) (req *aws.Request, output *AuthorizeSecurityGroupEgressOutput) { - op := &aws.Operation{ +func (c *EC2) AuthorizeSecurityGroupEgressRequest(input *AuthorizeSecurityGroupEgressInput) (req *request.Request, output *AuthorizeSecurityGroupEgressOutput) { + op := &request.Operation{ Name: opAuthorizeSecurityGroupEgress, HTTPMethod: "POST", HTTPPath: "/", @@ -447,8 +447,8 @@ func (c *EC2) AuthorizeSecurityGroupEgress(input *AuthorizeSecurityGroupEgressIn const opAuthorizeSecurityGroupIngress = "AuthorizeSecurityGroupIngress" // AuthorizeSecurityGroupIngressRequest generates a request for the AuthorizeSecurityGroupIngress operation. -func (c *EC2) AuthorizeSecurityGroupIngressRequest(input *AuthorizeSecurityGroupIngressInput) (req *aws.Request, output *AuthorizeSecurityGroupIngressOutput) { - op := &aws.Operation{ +func (c *EC2) AuthorizeSecurityGroupIngressRequest(input *AuthorizeSecurityGroupIngressInput) (req *request.Request, output *AuthorizeSecurityGroupIngressOutput) { + op := &request.Operation{ Name: opAuthorizeSecurityGroupIngress, HTTPMethod: "POST", HTTPPath: "/", @@ -492,8 +492,8 @@ func (c *EC2) AuthorizeSecurityGroupIngress(input *AuthorizeSecurityGroupIngress const opBundleInstance = "BundleInstance" // BundleInstanceRequest generates a request for the BundleInstance operation. -func (c *EC2) BundleInstanceRequest(input *BundleInstanceInput) (req *aws.Request, output *BundleInstanceOutput) { - op := &aws.Operation{ +func (c *EC2) BundleInstanceRequest(input *BundleInstanceInput) (req *request.Request, output *BundleInstanceOutput) { + op := &request.Operation{ Name: opBundleInstance, HTTPMethod: "POST", HTTPPath: "/", @@ -528,8 +528,8 @@ func (c *EC2) BundleInstance(input *BundleInstanceInput) (*BundleInstanceOutput, const opCancelBundleTask = "CancelBundleTask" // CancelBundleTaskRequest generates a request for the CancelBundleTask operation. -func (c *EC2) CancelBundleTaskRequest(input *CancelBundleTaskInput) (req *aws.Request, output *CancelBundleTaskOutput) { - op := &aws.Operation{ +func (c *EC2) CancelBundleTaskRequest(input *CancelBundleTaskInput) (req *request.Request, output *CancelBundleTaskOutput) { + op := &request.Operation{ Name: opCancelBundleTask, HTTPMethod: "POST", HTTPPath: "/", @@ -555,8 +555,8 @@ func (c *EC2) CancelBundleTask(input *CancelBundleTaskInput) (*CancelBundleTaskO const opCancelConversionTask = "CancelConversionTask" // CancelConversionTaskRequest generates a request for the CancelConversionTask operation. -func (c *EC2) CancelConversionTaskRequest(input *CancelConversionTaskInput) (req *aws.Request, output *CancelConversionTaskOutput) { - op := &aws.Operation{ +func (c *EC2) CancelConversionTaskRequest(input *CancelConversionTaskInput) (req *request.Request, output *CancelConversionTaskOutput) { + op := &request.Operation{ Name: opCancelConversionTask, HTTPMethod: "POST", HTTPPath: "/", @@ -590,8 +590,8 @@ func (c *EC2) CancelConversionTask(input *CancelConversionTaskInput) (*CancelCon const opCancelExportTask = "CancelExportTask" // CancelExportTaskRequest generates a request for the CancelExportTask operation. -func (c *EC2) CancelExportTaskRequest(input *CancelExportTaskInput) (req *aws.Request, output *CancelExportTaskOutput) { - op := &aws.Operation{ +func (c *EC2) CancelExportTaskRequest(input *CancelExportTaskInput) (req *request.Request, output *CancelExportTaskOutput) { + op := &request.Operation{ Name: opCancelExportTask, HTTPMethod: "POST", HTTPPath: "/", @@ -620,8 +620,8 @@ func (c *EC2) CancelExportTask(input *CancelExportTaskInput) (*CancelExportTaskO const opCancelImportTask = "CancelImportTask" // CancelImportTaskRequest generates a request for the CancelImportTask operation. -func (c *EC2) CancelImportTaskRequest(input *CancelImportTaskInput) (req *aws.Request, output *CancelImportTaskOutput) { - op := &aws.Operation{ +func (c *EC2) CancelImportTaskRequest(input *CancelImportTaskInput) (req *request.Request, output *CancelImportTaskOutput) { + op := &request.Operation{ Name: opCancelImportTask, HTTPMethod: "POST", HTTPPath: "/", @@ -647,8 +647,8 @@ func (c *EC2) CancelImportTask(input *CancelImportTaskInput) (*CancelImportTaskO const opCancelReservedInstancesListing = "CancelReservedInstancesListing" // CancelReservedInstancesListingRequest generates a request for the CancelReservedInstancesListing operation. -func (c *EC2) CancelReservedInstancesListingRequest(input *CancelReservedInstancesListingInput) (req *aws.Request, output *CancelReservedInstancesListingOutput) { - op := &aws.Operation{ +func (c *EC2) CancelReservedInstancesListingRequest(input *CancelReservedInstancesListingInput) (req *request.Request, output *CancelReservedInstancesListingOutput) { + op := &request.Operation{ Name: opCancelReservedInstancesListing, HTTPMethod: "POST", HTTPPath: "/", @@ -678,8 +678,8 @@ func (c *EC2) CancelReservedInstancesListing(input *CancelReservedInstancesListi const opCancelSpotFleetRequests = "CancelSpotFleetRequests" // CancelSpotFleetRequestsRequest generates a request for the CancelSpotFleetRequests operation. -func (c *EC2) CancelSpotFleetRequestsRequest(input *CancelSpotFleetRequestsInput) (req *aws.Request, output *CancelSpotFleetRequestsOutput) { - op := &aws.Operation{ +func (c *EC2) CancelSpotFleetRequestsRequest(input *CancelSpotFleetRequestsInput) (req *request.Request, output *CancelSpotFleetRequestsOutput) { + op := &request.Operation{ Name: opCancelSpotFleetRequests, HTTPMethod: "POST", HTTPPath: "/", @@ -696,6 +696,13 @@ func (c *EC2) CancelSpotFleetRequestsRequest(input *CancelSpotFleetRequestsInput } // Cancels the specified Spot fleet requests. +// +// After you cancel a Spot fleet request, the Spot fleet launches no new Spot +// instances. You must specify whether the Spot fleet should also terminate +// its Spot instances. If you terminate the instances, the Spot fleet request +// enters the cancelled_terminating state. Otherwise, the Spot fleet request +// enters the cancelled_running state and the instances continue to run until +// they are interrupted or you terminate them manually. func (c *EC2) CancelSpotFleetRequests(input *CancelSpotFleetRequestsInput) (*CancelSpotFleetRequestsOutput, error) { req, out := c.CancelSpotFleetRequestsRequest(input) err := req.Send() @@ -705,8 +712,8 @@ func (c *EC2) CancelSpotFleetRequests(input *CancelSpotFleetRequestsInput) (*Can const opCancelSpotInstanceRequests = "CancelSpotInstanceRequests" // CancelSpotInstanceRequestsRequest generates a request for the CancelSpotInstanceRequests operation. -func (c *EC2) CancelSpotInstanceRequestsRequest(input *CancelSpotInstanceRequestsInput) (req *aws.Request, output *CancelSpotInstanceRequestsOutput) { - op := &aws.Operation{ +func (c *EC2) CancelSpotInstanceRequestsRequest(input *CancelSpotInstanceRequestsInput) (req *request.Request, output *CancelSpotInstanceRequestsOutput) { + op := &request.Operation{ Name: opCancelSpotInstanceRequests, HTTPMethod: "POST", HTTPPath: "/", @@ -722,14 +729,14 @@ func (c *EC2) CancelSpotInstanceRequestsRequest(input *CancelSpotInstanceRequest return } -// Cancels one or more Spot Instance requests. Spot Instances are instances +// Cancels one or more Spot instance requests. Spot instances are instances // that Amazon EC2 starts on your behalf when the bid price that you specify -// exceeds the current Spot Price. Amazon EC2 periodically sets the Spot Price -// based on available Spot Instance capacity and current Spot Instance requests. +// exceeds the current Spot price. Amazon EC2 periodically sets the Spot price +// based on available Spot instance capacity and current Spot instance requests. // For more information, see Spot Instance Requests (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/spot-requests.html) // in the Amazon Elastic Compute Cloud User Guide. // -// Canceling a Spot Instance request does not terminate running Spot Instances +// Canceling a Spot instance request does not terminate running Spot instances // associated with the request. func (c *EC2) CancelSpotInstanceRequests(input *CancelSpotInstanceRequestsInput) (*CancelSpotInstanceRequestsOutput, error) { req, out := c.CancelSpotInstanceRequestsRequest(input) @@ -740,8 +747,8 @@ func (c *EC2) CancelSpotInstanceRequests(input *CancelSpotInstanceRequestsInput) const opConfirmProductInstance = "ConfirmProductInstance" // ConfirmProductInstanceRequest generates a request for the ConfirmProductInstance operation. -func (c *EC2) ConfirmProductInstanceRequest(input *ConfirmProductInstanceInput) (req *aws.Request, output *ConfirmProductInstanceOutput) { - op := &aws.Operation{ +func (c *EC2) ConfirmProductInstanceRequest(input *ConfirmProductInstanceInput) (req *request.Request, output *ConfirmProductInstanceOutput) { + op := &request.Operation{ Name: opConfirmProductInstance, HTTPMethod: "POST", HTTPPath: "/", @@ -770,8 +777,8 @@ func (c *EC2) ConfirmProductInstance(input *ConfirmProductInstanceInput) (*Confi const opCopyImage = "CopyImage" // CopyImageRequest generates a request for the CopyImage operation. -func (c *EC2) CopyImageRequest(input *CopyImageInput) (req *aws.Request, output *CopyImageOutput) { - op := &aws.Operation{ +func (c *EC2) CopyImageRequest(input *CopyImageInput) (req *request.Request, output *CopyImageOutput) { + op := &request.Operation{ Name: opCopyImage, HTTPMethod: "POST", HTTPPath: "/", @@ -803,8 +810,8 @@ func (c *EC2) CopyImage(input *CopyImageInput) (*CopyImageOutput, error) { const opCopySnapshot = "CopySnapshot" // CopySnapshotRequest generates a request for the CopySnapshot operation. -func (c *EC2) CopySnapshotRequest(input *CopySnapshotInput) (req *aws.Request, output *CopySnapshotOutput) { - op := &aws.Operation{ +func (c *EC2) CopySnapshotRequest(input *CopySnapshotInput) (req *request.Request, output *CopySnapshotOutput) { + op := &request.Operation{ Name: opCopySnapshot, HTTPMethod: "POST", HTTPPath: "/", @@ -843,8 +850,8 @@ func (c *EC2) CopySnapshot(input *CopySnapshotInput) (*CopySnapshotOutput, error const opCreateCustomerGateway = "CreateCustomerGateway" // CreateCustomerGatewayRequest generates a request for the CreateCustomerGateway operation. -func (c *EC2) CreateCustomerGatewayRequest(input *CreateCustomerGatewayInput) (req *aws.Request, output *CreateCustomerGatewayOutput) { - op := &aws.Operation{ +func (c *EC2) CreateCustomerGatewayRequest(input *CreateCustomerGatewayInput) (req *request.Request, output *CreateCustomerGatewayOutput) { + op := &request.Operation{ Name: opCreateCustomerGateway, HTTPMethod: "POST", HTTPPath: "/", @@ -891,22 +898,22 @@ func (c *EC2) CreateCustomerGateway(input *CreateCustomerGatewayInput) (*CreateC return out, err } -const opCreateDHCPOptions = "CreateDhcpOptions" +const opCreateDhcpOptions = "CreateDhcpOptions" -// CreateDHCPOptionsRequest generates a request for the CreateDHCPOptions operation. -func (c *EC2) CreateDHCPOptionsRequest(input *CreateDHCPOptionsInput) (req *aws.Request, output *CreateDHCPOptionsOutput) { - op := &aws.Operation{ - Name: opCreateDHCPOptions, +// CreateDhcpOptionsRequest generates a request for the CreateDhcpOptions operation. +func (c *EC2) CreateDhcpOptionsRequest(input *CreateDhcpOptionsInput) (req *request.Request, output *CreateDhcpOptionsOutput) { + op := &request.Operation{ + Name: opCreateDhcpOptions, HTTPMethod: "POST", HTTPPath: "/", } if input == nil { - input = &CreateDHCPOptionsInput{} + input = &CreateDhcpOptionsInput{} } req = c.newRequest(op, input, output) - output = &CreateDHCPOptionsOutput{} + output = &CreateDhcpOptionsOutput{} req.Data = output return } @@ -940,8 +947,8 @@ func (c *EC2) CreateDHCPOptionsRequest(input *CreateDHCPOptionsInput) (req *aws. // either to AmazonProvidedDNS or to a domain name server of your choice. For // more information about DHCP options, see DHCP Options Sets (http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/VPC_DHCP_Options.html) // in the Amazon Virtual Private Cloud User Guide. -func (c *EC2) CreateDHCPOptions(input *CreateDHCPOptionsInput) (*CreateDHCPOptionsOutput, error) { - req, out := c.CreateDHCPOptionsRequest(input) +func (c *EC2) CreateDhcpOptions(input *CreateDhcpOptionsInput) (*CreateDhcpOptionsOutput, error) { + req, out := c.CreateDhcpOptionsRequest(input) err := req.Send() return out, err } @@ -949,8 +956,8 @@ func (c *EC2) CreateDHCPOptions(input *CreateDHCPOptionsInput) (*CreateDHCPOptio const opCreateFlowLogs = "CreateFlowLogs" // CreateFlowLogsRequest generates a request for the CreateFlowLogs operation. -func (c *EC2) CreateFlowLogsRequest(input *CreateFlowLogsInput) (req *aws.Request, output *CreateFlowLogsOutput) { - op := &aws.Operation{ +func (c *EC2) CreateFlowLogsRequest(input *CreateFlowLogsInput) (req *request.Request, output *CreateFlowLogsOutput) { + op := &request.Operation{ Name: opCreateFlowLogs, HTTPMethod: "POST", HTTPPath: "/", @@ -985,8 +992,8 @@ func (c *EC2) CreateFlowLogs(input *CreateFlowLogsInput) (*CreateFlowLogsOutput, const opCreateImage = "CreateImage" // CreateImageRequest generates a request for the CreateImage operation. -func (c *EC2) CreateImageRequest(input *CreateImageInput) (req *aws.Request, output *CreateImageOutput) { - op := &aws.Operation{ +func (c *EC2) CreateImageRequest(input *CreateImageInput) (req *request.Request, output *CreateImageOutput) { + op := &request.Operation{ Name: opCreateImage, HTTPMethod: "POST", HTTPPath: "/", @@ -1021,8 +1028,8 @@ func (c *EC2) CreateImage(input *CreateImageInput) (*CreateImageOutput, error) { const opCreateInstanceExportTask = "CreateInstanceExportTask" // CreateInstanceExportTaskRequest generates a request for the CreateInstanceExportTask operation. -func (c *EC2) CreateInstanceExportTaskRequest(input *CreateInstanceExportTaskInput) (req *aws.Request, output *CreateInstanceExportTaskOutput) { - op := &aws.Operation{ +func (c *EC2) CreateInstanceExportTaskRequest(input *CreateInstanceExportTaskInput) (req *request.Request, output *CreateInstanceExportTaskOutput) { + op := &request.Operation{ Name: opCreateInstanceExportTask, HTTPMethod: "POST", HTTPPath: "/", @@ -1053,8 +1060,8 @@ func (c *EC2) CreateInstanceExportTask(input *CreateInstanceExportTaskInput) (*C const opCreateInternetGateway = "CreateInternetGateway" // CreateInternetGatewayRequest generates a request for the CreateInternetGateway operation. -func (c *EC2) CreateInternetGatewayRequest(input *CreateInternetGatewayInput) (req *aws.Request, output *CreateInternetGatewayOutput) { - op := &aws.Operation{ +func (c *EC2) CreateInternetGatewayRequest(input *CreateInternetGatewayInput) (req *request.Request, output *CreateInternetGatewayOutput) { + op := &request.Operation{ Name: opCreateInternetGateway, HTTPMethod: "POST", HTTPPath: "/", @@ -1084,8 +1091,8 @@ func (c *EC2) CreateInternetGateway(input *CreateInternetGatewayInput) (*CreateI const opCreateKeyPair = "CreateKeyPair" // CreateKeyPairRequest generates a request for the CreateKeyPair operation. -func (c *EC2) CreateKeyPairRequest(input *CreateKeyPairInput) (req *aws.Request, output *CreateKeyPairOutput) { - op := &aws.Operation{ +func (c *EC2) CreateKeyPairRequest(input *CreateKeyPairInput) (req *request.Request, output *CreateKeyPairOutput) { + op := &request.Operation{ Name: opCreateKeyPair, HTTPMethod: "POST", HTTPPath: "/", @@ -1119,22 +1126,22 @@ func (c *EC2) CreateKeyPair(input *CreateKeyPairInput) (*CreateKeyPairOutput, er return out, err } -const opCreateNetworkACL = "CreateNetworkAcl" +const opCreateNetworkAcl = "CreateNetworkAcl" -// CreateNetworkACLRequest generates a request for the CreateNetworkACL operation. -func (c *EC2) CreateNetworkACLRequest(input *CreateNetworkACLInput) (req *aws.Request, output *CreateNetworkACLOutput) { - op := &aws.Operation{ - Name: opCreateNetworkACL, +// CreateNetworkAclRequest generates a request for the CreateNetworkAcl operation. +func (c *EC2) CreateNetworkAclRequest(input *CreateNetworkAclInput) (req *request.Request, output *CreateNetworkAclOutput) { + op := &request.Operation{ + Name: opCreateNetworkAcl, HTTPMethod: "POST", HTTPPath: "/", } if input == nil { - input = &CreateNetworkACLInput{} + input = &CreateNetworkAclInput{} } req = c.newRequest(op, input, output) - output = &CreateNetworkACLOutput{} + output = &CreateNetworkAclOutput{} req.Data = output return } @@ -1144,28 +1151,28 @@ func (c *EC2) CreateNetworkACLRequest(input *CreateNetworkACLInput) (req *aws.Re // // For more information about network ACLs, see Network ACLs (http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/VPC_ACLs.html) // in the Amazon Virtual Private Cloud User Guide. -func (c *EC2) CreateNetworkACL(input *CreateNetworkACLInput) (*CreateNetworkACLOutput, error) { - req, out := c.CreateNetworkACLRequest(input) +func (c *EC2) CreateNetworkAcl(input *CreateNetworkAclInput) (*CreateNetworkAclOutput, error) { + req, out := c.CreateNetworkAclRequest(input) err := req.Send() return out, err } -const opCreateNetworkACLEntry = "CreateNetworkAclEntry" +const opCreateNetworkAclEntry = "CreateNetworkAclEntry" -// CreateNetworkACLEntryRequest generates a request for the CreateNetworkACLEntry operation. -func (c *EC2) CreateNetworkACLEntryRequest(input *CreateNetworkACLEntryInput) (req *aws.Request, output *CreateNetworkACLEntryOutput) { - op := &aws.Operation{ - Name: opCreateNetworkACLEntry, +// CreateNetworkAclEntryRequest generates a request for the CreateNetworkAclEntry operation. +func (c *EC2) CreateNetworkAclEntryRequest(input *CreateNetworkAclEntryInput) (req *request.Request, output *CreateNetworkAclEntryOutput) { + op := &request.Operation{ + Name: opCreateNetworkAclEntry, HTTPMethod: "POST", HTTPPath: "/", } if input == nil { - input = &CreateNetworkACLEntryInput{} + input = &CreateNetworkAclEntryInput{} } req = c.newRequest(op, input, output) - output = &CreateNetworkACLEntryOutput{} + output = &CreateNetworkAclEntryOutput{} req.Data = output return } @@ -1187,8 +1194,8 @@ func (c *EC2) CreateNetworkACLEntryRequest(input *CreateNetworkACLEntryInput) (r // // For more information about network ACLs, see Network ACLs (http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/VPC_ACLs.html) // in the Amazon Virtual Private Cloud User Guide. -func (c *EC2) CreateNetworkACLEntry(input *CreateNetworkACLEntryInput) (*CreateNetworkACLEntryOutput, error) { - req, out := c.CreateNetworkACLEntryRequest(input) +func (c *EC2) CreateNetworkAclEntry(input *CreateNetworkAclEntryInput) (*CreateNetworkAclEntryOutput, error) { + req, out := c.CreateNetworkAclEntryRequest(input) err := req.Send() return out, err } @@ -1196,8 +1203,8 @@ func (c *EC2) CreateNetworkACLEntry(input *CreateNetworkACLEntryInput) (*CreateN const opCreateNetworkInterface = "CreateNetworkInterface" // CreateNetworkInterfaceRequest generates a request for the CreateNetworkInterface operation. -func (c *EC2) CreateNetworkInterfaceRequest(input *CreateNetworkInterfaceInput) (req *aws.Request, output *CreateNetworkInterfaceOutput) { - op := &aws.Operation{ +func (c *EC2) CreateNetworkInterfaceRequest(input *CreateNetworkInterfaceInput) (req *request.Request, output *CreateNetworkInterfaceOutput) { + op := &request.Operation{ Name: opCreateNetworkInterface, HTTPMethod: "POST", HTTPPath: "/", @@ -1227,8 +1234,8 @@ func (c *EC2) CreateNetworkInterface(input *CreateNetworkInterfaceInput) (*Creat const opCreatePlacementGroup = "CreatePlacementGroup" // CreatePlacementGroupRequest generates a request for the CreatePlacementGroup operation. -func (c *EC2) CreatePlacementGroupRequest(input *CreatePlacementGroupInput) (req *aws.Request, output *CreatePlacementGroupOutput) { - op := &aws.Operation{ +func (c *EC2) CreatePlacementGroupRequest(input *CreatePlacementGroupInput) (req *request.Request, output *CreatePlacementGroupOutput) { + op := &request.Operation{ Name: opCreatePlacementGroup, HTTPMethod: "POST", HTTPPath: "/", @@ -1259,8 +1266,8 @@ func (c *EC2) CreatePlacementGroup(input *CreatePlacementGroupInput) (*CreatePla const opCreateReservedInstancesListing = "CreateReservedInstancesListing" // CreateReservedInstancesListingRequest generates a request for the CreateReservedInstancesListing operation. -func (c *EC2) CreateReservedInstancesListingRequest(input *CreateReservedInstancesListingInput) (req *aws.Request, output *CreateReservedInstancesListingOutput) { - op := &aws.Operation{ +func (c *EC2) CreateReservedInstancesListingRequest(input *CreateReservedInstancesListingInput) (req *request.Request, output *CreateReservedInstancesListingOutput) { + op := &request.Operation{ Name: opCreateReservedInstancesListing, HTTPMethod: "POST", HTTPPath: "/", @@ -1305,8 +1312,8 @@ func (c *EC2) CreateReservedInstancesListing(input *CreateReservedInstancesListi const opCreateRoute = "CreateRoute" // CreateRouteRequest generates a request for the CreateRoute operation. -func (c *EC2) CreateRouteRequest(input *CreateRouteInput) (req *aws.Request, output *CreateRouteOutput) { - op := &aws.Operation{ +func (c *EC2) CreateRouteRequest(input *CreateRouteInput) (req *request.Request, output *CreateRouteOutput) { + op := &request.Operation{ Name: opCreateRoute, HTTPMethod: "POST", HTTPPath: "/", @@ -1350,8 +1357,8 @@ func (c *EC2) CreateRoute(input *CreateRouteInput) (*CreateRouteOutput, error) { const opCreateRouteTable = "CreateRouteTable" // CreateRouteTableRequest generates a request for the CreateRouteTable operation. -func (c *EC2) CreateRouteTableRequest(input *CreateRouteTableInput) (req *aws.Request, output *CreateRouteTableOutput) { - op := &aws.Operation{ +func (c *EC2) CreateRouteTableRequest(input *CreateRouteTableInput) (req *request.Request, output *CreateRouteTableOutput) { + op := &request.Operation{ Name: opCreateRouteTable, HTTPMethod: "POST", HTTPPath: "/", @@ -1381,8 +1388,8 @@ func (c *EC2) CreateRouteTable(input *CreateRouteTableInput) (*CreateRouteTableO const opCreateSecurityGroup = "CreateSecurityGroup" // CreateSecurityGroupRequest generates a request for the CreateSecurityGroup operation. -func (c *EC2) CreateSecurityGroupRequest(input *CreateSecurityGroupInput) (req *aws.Request, output *CreateSecurityGroupOutput) { - op := &aws.Operation{ +func (c *EC2) CreateSecurityGroupRequest(input *CreateSecurityGroupInput) (req *request.Request, output *CreateSecurityGroupOutput) { + op := &request.Operation{ Name: opCreateSecurityGroup, HTTPMethod: "POST", HTTPPath: "/", @@ -1434,8 +1441,8 @@ func (c *EC2) CreateSecurityGroup(input *CreateSecurityGroupInput) (*CreateSecur const opCreateSnapshot = "CreateSnapshot" // CreateSnapshotRequest generates a request for the CreateSnapshot operation. -func (c *EC2) CreateSnapshotRequest(input *CreateSnapshotInput) (req *aws.Request, output *Snapshot) { - op := &aws.Operation{ +func (c *EC2) CreateSnapshotRequest(input *CreateSnapshotInput) (req *request.Request, output *Snapshot) { + op := &request.Operation{ Name: opCreateSnapshot, HTTPMethod: "POST", HTTPPath: "/", @@ -1488,8 +1495,8 @@ func (c *EC2) CreateSnapshot(input *CreateSnapshotInput) (*Snapshot, error) { const opCreateSpotDatafeedSubscription = "CreateSpotDatafeedSubscription" // CreateSpotDatafeedSubscriptionRequest generates a request for the CreateSpotDatafeedSubscription operation. -func (c *EC2) CreateSpotDatafeedSubscriptionRequest(input *CreateSpotDatafeedSubscriptionInput) (req *aws.Request, output *CreateSpotDatafeedSubscriptionOutput) { - op := &aws.Operation{ +func (c *EC2) CreateSpotDatafeedSubscriptionRequest(input *CreateSpotDatafeedSubscriptionInput) (req *request.Request, output *CreateSpotDatafeedSubscriptionOutput) { + op := &request.Operation{ Name: opCreateSpotDatafeedSubscription, HTTPMethod: "POST", HTTPPath: "/", @@ -1505,7 +1512,7 @@ func (c *EC2) CreateSpotDatafeedSubscriptionRequest(input *CreateSpotDatafeedSub return } -// Creates a data feed for Spot Instances, enabling you to view Spot Instance +// Creates a data feed for Spot instances, enabling you to view Spot instance // usage logs. You can create one data feed per AWS account. For more information, // see Spot Instance Data Feed (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/spot-data-feeds.html) // in the Amazon Elastic Compute Cloud User Guide. @@ -1518,8 +1525,8 @@ func (c *EC2) CreateSpotDatafeedSubscription(input *CreateSpotDatafeedSubscripti const opCreateSubnet = "CreateSubnet" // CreateSubnetRequest generates a request for the CreateSubnet operation. -func (c *EC2) CreateSubnetRequest(input *CreateSubnetInput) (req *aws.Request, output *CreateSubnetOutput) { - op := &aws.Operation{ +func (c *EC2) CreateSubnetRequest(input *CreateSubnetInput) (req *request.Request, output *CreateSubnetOutput) { + op := &request.Operation{ Name: opCreateSubnet, HTTPMethod: "POST", HTTPPath: "/", @@ -1569,8 +1576,8 @@ func (c *EC2) CreateSubnet(input *CreateSubnetInput) (*CreateSubnetOutput, error const opCreateTags = "CreateTags" // CreateTagsRequest generates a request for the CreateTags operation. -func (c *EC2) CreateTagsRequest(input *CreateTagsInput) (req *aws.Request, output *CreateTagsOutput) { - op := &aws.Operation{ +func (c *EC2) CreateTagsRequest(input *CreateTagsInput) (req *request.Request, output *CreateTagsOutput) { + op := &request.Operation{ Name: opCreateTags, HTTPMethod: "POST", HTTPPath: "/", @@ -1598,228 +1605,11 @@ func (c *EC2) CreateTags(input *CreateTagsInput) (*CreateTagsOutput, error) { return out, err } -const opCreateVPC = "CreateVpc" - -// CreateVPCRequest generates a request for the CreateVPC operation. -func (c *EC2) CreateVPCRequest(input *CreateVPCInput) (req *aws.Request, output *CreateVPCOutput) { - op := &aws.Operation{ - Name: opCreateVPC, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &CreateVPCInput{} - } - - req = c.newRequest(op, input, output) - output = &CreateVPCOutput{} - req.Data = output - return -} - -// Creates a VPC with the specified CIDR block. -// -// The smallest VPC you can create uses a /28 netmask (16 IP addresses), and -// the largest uses a /16 netmask (65,536 IP addresses). To help you decide -// how big to make your VPC, see Your VPC and Subnets (http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/VPC_Subnets.html) -// in the Amazon Virtual Private Cloud User Guide. -// -// By default, each instance you launch in the VPC has the default DHCP options, -// which includes only a default DNS server that we provide (AmazonProvidedDNS). -// For more information about DHCP options, see DHCP Options Sets (http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/VPC_DHCP_Options.html) -// in the Amazon Virtual Private Cloud User Guide. -func (c *EC2) CreateVPC(input *CreateVPCInput) (*CreateVPCOutput, error) { - req, out := c.CreateVPCRequest(input) - err := req.Send() - return out, err -} - -const opCreateVPCEndpoint = "CreateVpcEndpoint" - -// CreateVPCEndpointRequest generates a request for the CreateVPCEndpoint operation. -func (c *EC2) CreateVPCEndpointRequest(input *CreateVPCEndpointInput) (req *aws.Request, output *CreateVPCEndpointOutput) { - op := &aws.Operation{ - Name: opCreateVPCEndpoint, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &CreateVPCEndpointInput{} - } - - req = c.newRequest(op, input, output) - output = &CreateVPCEndpointOutput{} - req.Data = output - return -} - -// Creates a VPC endpoint for a specified AWS service. An endpoint enables you -// to create a private connection between your VPC and another AWS service in -// your account. You can specify an endpoint policy to attach to the endpoint -// that will control access to the service from your VPC. You can also specify -// the VPC route tables that use the endpoint. -// -// Currently, only endpoints to Amazon S3 are supported. -func (c *EC2) CreateVPCEndpoint(input *CreateVPCEndpointInput) (*CreateVPCEndpointOutput, error) { - req, out := c.CreateVPCEndpointRequest(input) - err := req.Send() - return out, err -} - -const opCreateVPCPeeringConnection = "CreateVpcPeeringConnection" - -// CreateVPCPeeringConnectionRequest generates a request for the CreateVPCPeeringConnection operation. -func (c *EC2) CreateVPCPeeringConnectionRequest(input *CreateVPCPeeringConnectionInput) (req *aws.Request, output *CreateVPCPeeringConnectionOutput) { - op := &aws.Operation{ - Name: opCreateVPCPeeringConnection, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &CreateVPCPeeringConnectionInput{} - } - - req = c.newRequest(op, input, output) - output = &CreateVPCPeeringConnectionOutput{} - req.Data = output - return -} - -// Requests a VPC peering connection between two VPCs: a requester VPC that -// you own and a peer VPC with which to create the connection. The peer VPC -// can belong to another AWS account. The requester VPC and peer VPC cannot -// have overlapping CIDR blocks. -// -// The owner of the peer VPC must accept the peering request to activate the -// peering connection. The VPC peering connection request expires after 7 days, -// after which it cannot be accepted or rejected. -// -// A CreateVpcPeeringConnection request between VPCs with overlapping CIDR -// blocks results in the VPC peering connection having a status of failed. -func (c *EC2) CreateVPCPeeringConnection(input *CreateVPCPeeringConnectionInput) (*CreateVPCPeeringConnectionOutput, error) { - req, out := c.CreateVPCPeeringConnectionRequest(input) - err := req.Send() - return out, err -} - -const opCreateVPNConnection = "CreateVpnConnection" - -// CreateVPNConnectionRequest generates a request for the CreateVPNConnection operation. -func (c *EC2) CreateVPNConnectionRequest(input *CreateVPNConnectionInput) (req *aws.Request, output *CreateVPNConnectionOutput) { - op := &aws.Operation{ - Name: opCreateVPNConnection, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &CreateVPNConnectionInput{} - } - - req = c.newRequest(op, input, output) - output = &CreateVPNConnectionOutput{} - req.Data = output - return -} - -// Creates a VPN connection between an existing virtual private gateway and -// a VPN customer gateway. The only supported connection type is ipsec.1. -// -// The response includes information that you need to give to your network -// administrator to configure your customer gateway. -// -// We strongly recommend that you use HTTPS when calling this operation because -// the response contains sensitive cryptographic information for configuring -// your customer gateway. -// -// If you decide to shut down your VPN connection for any reason and later -// create a new VPN connection, you must reconfigure your customer gateway with -// the new information returned from this call. -// -// For more information about VPN connections, see Adding a Hardware Virtual -// Private Gateway to Your VPC (http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/VPC_VPN.html) -// in the Amazon Virtual Private Cloud User Guide. -func (c *EC2) CreateVPNConnection(input *CreateVPNConnectionInput) (*CreateVPNConnectionOutput, error) { - req, out := c.CreateVPNConnectionRequest(input) - err := req.Send() - return out, err -} - -const opCreateVPNConnectionRoute = "CreateVpnConnectionRoute" - -// CreateVPNConnectionRouteRequest generates a request for the CreateVPNConnectionRoute operation. -func (c *EC2) CreateVPNConnectionRouteRequest(input *CreateVPNConnectionRouteInput) (req *aws.Request, output *CreateVPNConnectionRouteOutput) { - op := &aws.Operation{ - Name: opCreateVPNConnectionRoute, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &CreateVPNConnectionRouteInput{} - } - - req = c.newRequest(op, input, output) - output = &CreateVPNConnectionRouteOutput{} - req.Data = output - return -} - -// Creates a static route associated with a VPN connection between an existing -// virtual private gateway and a VPN customer gateway. The static route allows -// traffic to be routed from the virtual private gateway to the VPN customer -// gateway. -// -// For more information about VPN connections, see Adding a Hardware Virtual -// Private Gateway to Your VPC (http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/VPC_VPN.html) -// in the Amazon Virtual Private Cloud User Guide. -func (c *EC2) CreateVPNConnectionRoute(input *CreateVPNConnectionRouteInput) (*CreateVPNConnectionRouteOutput, error) { - req, out := c.CreateVPNConnectionRouteRequest(input) - err := req.Send() - return out, err -} - -const opCreateVPNGateway = "CreateVpnGateway" - -// CreateVPNGatewayRequest generates a request for the CreateVPNGateway operation. -func (c *EC2) CreateVPNGatewayRequest(input *CreateVPNGatewayInput) (req *aws.Request, output *CreateVPNGatewayOutput) { - op := &aws.Operation{ - Name: opCreateVPNGateway, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &CreateVPNGatewayInput{} - } - - req = c.newRequest(op, input, output) - output = &CreateVPNGatewayOutput{} - req.Data = output - return -} - -// Creates a virtual private gateway. A virtual private gateway is the endpoint -// on the VPC side of your VPN connection. You can create a virtual private -// gateway before creating the VPC itself. -// -// For more information about virtual private gateways, see Adding a Hardware -// Virtual Private Gateway to Your VPC (http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/VPC_VPN.html) -// in the Amazon Virtual Private Cloud User Guide. -func (c *EC2) CreateVPNGateway(input *CreateVPNGatewayInput) (*CreateVPNGatewayOutput, error) { - req, out := c.CreateVPNGatewayRequest(input) - err := req.Send() - return out, err -} - const opCreateVolume = "CreateVolume" // CreateVolumeRequest generates a request for the CreateVolume operation. -func (c *EC2) CreateVolumeRequest(input *CreateVolumeInput) (req *aws.Request, output *Volume) { - op := &aws.Operation{ +func (c *EC2) CreateVolumeRequest(input *CreateVolumeInput) (req *request.Request, output *Volume) { + op := &request.Operation{ Name: opCreateVolume, HTTPMethod: "POST", HTTPPath: "/", @@ -1857,11 +1647,228 @@ func (c *EC2) CreateVolume(input *CreateVolumeInput) (*Volume, error) { return out, err } +const opCreateVpc = "CreateVpc" + +// CreateVpcRequest generates a request for the CreateVpc operation. +func (c *EC2) CreateVpcRequest(input *CreateVpcInput) (req *request.Request, output *CreateVpcOutput) { + op := &request.Operation{ + Name: opCreateVpc, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &CreateVpcInput{} + } + + req = c.newRequest(op, input, output) + output = &CreateVpcOutput{} + req.Data = output + return +} + +// Creates a VPC with the specified CIDR block. +// +// The smallest VPC you can create uses a /28 netmask (16 IP addresses), and +// the largest uses a /16 netmask (65,536 IP addresses). To help you decide +// how big to make your VPC, see Your VPC and Subnets (http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/VPC_Subnets.html) +// in the Amazon Virtual Private Cloud User Guide. +// +// By default, each instance you launch in the VPC has the default DHCP options, +// which includes only a default DNS server that we provide (AmazonProvidedDNS). +// For more information about DHCP options, see DHCP Options Sets (http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/VPC_DHCP_Options.html) +// in the Amazon Virtual Private Cloud User Guide. +func (c *EC2) CreateVpc(input *CreateVpcInput) (*CreateVpcOutput, error) { + req, out := c.CreateVpcRequest(input) + err := req.Send() + return out, err +} + +const opCreateVpcEndpoint = "CreateVpcEndpoint" + +// CreateVpcEndpointRequest generates a request for the CreateVpcEndpoint operation. +func (c *EC2) CreateVpcEndpointRequest(input *CreateVpcEndpointInput) (req *request.Request, output *CreateVpcEndpointOutput) { + op := &request.Operation{ + Name: opCreateVpcEndpoint, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &CreateVpcEndpointInput{} + } + + req = c.newRequest(op, input, output) + output = &CreateVpcEndpointOutput{} + req.Data = output + return +} + +// Creates a VPC endpoint for a specified AWS service. An endpoint enables you +// to create a private connection between your VPC and another AWS service in +// your account. You can specify an endpoint policy to attach to the endpoint +// that will control access to the service from your VPC. You can also specify +// the VPC route tables that use the endpoint. +// +// Currently, only endpoints to Amazon S3 are supported. +func (c *EC2) CreateVpcEndpoint(input *CreateVpcEndpointInput) (*CreateVpcEndpointOutput, error) { + req, out := c.CreateVpcEndpointRequest(input) + err := req.Send() + return out, err +} + +const opCreateVpcPeeringConnection = "CreateVpcPeeringConnection" + +// CreateVpcPeeringConnectionRequest generates a request for the CreateVpcPeeringConnection operation. +func (c *EC2) CreateVpcPeeringConnectionRequest(input *CreateVpcPeeringConnectionInput) (req *request.Request, output *CreateVpcPeeringConnectionOutput) { + op := &request.Operation{ + Name: opCreateVpcPeeringConnection, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &CreateVpcPeeringConnectionInput{} + } + + req = c.newRequest(op, input, output) + output = &CreateVpcPeeringConnectionOutput{} + req.Data = output + return +} + +// Requests a VPC peering connection between two VPCs: a requester VPC that +// you own and a peer VPC with which to create the connection. The peer VPC +// can belong to another AWS account. The requester VPC and peer VPC cannot +// have overlapping CIDR blocks. +// +// The owner of the peer VPC must accept the peering request to activate the +// peering connection. The VPC peering connection request expires after 7 days, +// after which it cannot be accepted or rejected. +// +// A CreateVpcPeeringConnection request between VPCs with overlapping CIDR +// blocks results in the VPC peering connection having a status of failed. +func (c *EC2) CreateVpcPeeringConnection(input *CreateVpcPeeringConnectionInput) (*CreateVpcPeeringConnectionOutput, error) { + req, out := c.CreateVpcPeeringConnectionRequest(input) + err := req.Send() + return out, err +} + +const opCreateVpnConnection = "CreateVpnConnection" + +// CreateVpnConnectionRequest generates a request for the CreateVpnConnection operation. +func (c *EC2) CreateVpnConnectionRequest(input *CreateVpnConnectionInput) (req *request.Request, output *CreateVpnConnectionOutput) { + op := &request.Operation{ + Name: opCreateVpnConnection, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &CreateVpnConnectionInput{} + } + + req = c.newRequest(op, input, output) + output = &CreateVpnConnectionOutput{} + req.Data = output + return +} + +// Creates a VPN connection between an existing virtual private gateway and +// a VPN customer gateway. The only supported connection type is ipsec.1. +// +// The response includes information that you need to give to your network +// administrator to configure your customer gateway. +// +// We strongly recommend that you use HTTPS when calling this operation because +// the response contains sensitive cryptographic information for configuring +// your customer gateway. +// +// If you decide to shut down your VPN connection for any reason and later +// create a new VPN connection, you must reconfigure your customer gateway with +// the new information returned from this call. +// +// For more information about VPN connections, see Adding a Hardware Virtual +// Private Gateway to Your VPC (http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/VPC_VPN.html) +// in the Amazon Virtual Private Cloud User Guide. +func (c *EC2) CreateVpnConnection(input *CreateVpnConnectionInput) (*CreateVpnConnectionOutput, error) { + req, out := c.CreateVpnConnectionRequest(input) + err := req.Send() + return out, err +} + +const opCreateVpnConnectionRoute = "CreateVpnConnectionRoute" + +// CreateVpnConnectionRouteRequest generates a request for the CreateVpnConnectionRoute operation. +func (c *EC2) CreateVpnConnectionRouteRequest(input *CreateVpnConnectionRouteInput) (req *request.Request, output *CreateVpnConnectionRouteOutput) { + op := &request.Operation{ + Name: opCreateVpnConnectionRoute, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &CreateVpnConnectionRouteInput{} + } + + req = c.newRequest(op, input, output) + output = &CreateVpnConnectionRouteOutput{} + req.Data = output + return +} + +// Creates a static route associated with a VPN connection between an existing +// virtual private gateway and a VPN customer gateway. The static route allows +// traffic to be routed from the virtual private gateway to the VPN customer +// gateway. +// +// For more information about VPN connections, see Adding a Hardware Virtual +// Private Gateway to Your VPC (http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/VPC_VPN.html) +// in the Amazon Virtual Private Cloud User Guide. +func (c *EC2) CreateVpnConnectionRoute(input *CreateVpnConnectionRouteInput) (*CreateVpnConnectionRouteOutput, error) { + req, out := c.CreateVpnConnectionRouteRequest(input) + err := req.Send() + return out, err +} + +const opCreateVpnGateway = "CreateVpnGateway" + +// CreateVpnGatewayRequest generates a request for the CreateVpnGateway operation. +func (c *EC2) CreateVpnGatewayRequest(input *CreateVpnGatewayInput) (req *request.Request, output *CreateVpnGatewayOutput) { + op := &request.Operation{ + Name: opCreateVpnGateway, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &CreateVpnGatewayInput{} + } + + req = c.newRequest(op, input, output) + output = &CreateVpnGatewayOutput{} + req.Data = output + return +} + +// Creates a virtual private gateway. A virtual private gateway is the endpoint +// on the VPC side of your VPN connection. You can create a virtual private +// gateway before creating the VPC itself. +// +// For more information about virtual private gateways, see Adding a Hardware +// Virtual Private Gateway to Your VPC (http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/VPC_VPN.html) +// in the Amazon Virtual Private Cloud User Guide. +func (c *EC2) CreateVpnGateway(input *CreateVpnGatewayInput) (*CreateVpnGatewayOutput, error) { + req, out := c.CreateVpnGatewayRequest(input) + err := req.Send() + return out, err +} + const opDeleteCustomerGateway = "DeleteCustomerGateway" // DeleteCustomerGatewayRequest generates a request for the DeleteCustomerGateway operation. -func (c *EC2) DeleteCustomerGatewayRequest(input *DeleteCustomerGatewayInput) (req *aws.Request, output *DeleteCustomerGatewayOutput) { - op := &aws.Operation{ +func (c *EC2) DeleteCustomerGatewayRequest(input *DeleteCustomerGatewayInput) (req *request.Request, output *DeleteCustomerGatewayOutput) { + op := &request.Operation{ Name: opDeleteCustomerGateway, HTTPMethod: "POST", HTTPPath: "/", @@ -1885,22 +1892,22 @@ func (c *EC2) DeleteCustomerGateway(input *DeleteCustomerGatewayInput) (*DeleteC return out, err } -const opDeleteDHCPOptions = "DeleteDhcpOptions" +const opDeleteDhcpOptions = "DeleteDhcpOptions" -// DeleteDHCPOptionsRequest generates a request for the DeleteDHCPOptions operation. -func (c *EC2) DeleteDHCPOptionsRequest(input *DeleteDHCPOptionsInput) (req *aws.Request, output *DeleteDHCPOptionsOutput) { - op := &aws.Operation{ - Name: opDeleteDHCPOptions, +// DeleteDhcpOptionsRequest generates a request for the DeleteDhcpOptions operation. +func (c *EC2) DeleteDhcpOptionsRequest(input *DeleteDhcpOptionsInput) (req *request.Request, output *DeleteDhcpOptionsOutput) { + op := &request.Operation{ + Name: opDeleteDhcpOptions, HTTPMethod: "POST", HTTPPath: "/", } if input == nil { - input = &DeleteDHCPOptionsInput{} + input = &DeleteDhcpOptionsInput{} } req = c.newRequest(op, input, output) - output = &DeleteDHCPOptionsOutput{} + output = &DeleteDhcpOptionsOutput{} req.Data = output return } @@ -1909,8 +1916,8 @@ func (c *EC2) DeleteDHCPOptionsRequest(input *DeleteDHCPOptionsInput) (req *aws. // of DHCP options before you can delete it. You can disassociate the set of // DHCP options by associating either a new set of options or the default set // of options with the VPC. -func (c *EC2) DeleteDHCPOptions(input *DeleteDHCPOptionsInput) (*DeleteDHCPOptionsOutput, error) { - req, out := c.DeleteDHCPOptionsRequest(input) +func (c *EC2) DeleteDhcpOptions(input *DeleteDhcpOptionsInput) (*DeleteDhcpOptionsOutput, error) { + req, out := c.DeleteDhcpOptionsRequest(input) err := req.Send() return out, err } @@ -1918,8 +1925,8 @@ func (c *EC2) DeleteDHCPOptions(input *DeleteDHCPOptionsInput) (*DeleteDHCPOptio const opDeleteFlowLogs = "DeleteFlowLogs" // DeleteFlowLogsRequest generates a request for the DeleteFlowLogs operation. -func (c *EC2) DeleteFlowLogsRequest(input *DeleteFlowLogsInput) (req *aws.Request, output *DeleteFlowLogsOutput) { - op := &aws.Operation{ +func (c *EC2) DeleteFlowLogsRequest(input *DeleteFlowLogsInput) (req *request.Request, output *DeleteFlowLogsOutput) { + op := &request.Operation{ Name: opDeleteFlowLogs, HTTPMethod: "POST", HTTPPath: "/", @@ -1945,8 +1952,8 @@ func (c *EC2) DeleteFlowLogs(input *DeleteFlowLogsInput) (*DeleteFlowLogsOutput, const opDeleteInternetGateway = "DeleteInternetGateway" // DeleteInternetGatewayRequest generates a request for the DeleteInternetGateway operation. -func (c *EC2) DeleteInternetGatewayRequest(input *DeleteInternetGatewayInput) (req *aws.Request, output *DeleteInternetGatewayOutput) { - op := &aws.Operation{ +func (c *EC2) DeleteInternetGatewayRequest(input *DeleteInternetGatewayInput) (req *request.Request, output *DeleteInternetGatewayOutput) { + op := &request.Operation{ Name: opDeleteInternetGateway, HTTPMethod: "POST", HTTPPath: "/", @@ -1973,8 +1980,8 @@ func (c *EC2) DeleteInternetGateway(input *DeleteInternetGatewayInput) (*DeleteI const opDeleteKeyPair = "DeleteKeyPair" // DeleteKeyPairRequest generates a request for the DeleteKeyPair operation. -func (c *EC2) DeleteKeyPairRequest(input *DeleteKeyPairInput) (req *aws.Request, output *DeleteKeyPairOutput) { - op := &aws.Operation{ +func (c *EC2) DeleteKeyPairRequest(input *DeleteKeyPairInput) (req *request.Request, output *DeleteKeyPairOutput) { + op := &request.Operation{ Name: opDeleteKeyPair, HTTPMethod: "POST", HTTPPath: "/", @@ -1997,58 +2004,58 @@ func (c *EC2) DeleteKeyPair(input *DeleteKeyPairInput) (*DeleteKeyPairOutput, er return out, err } -const opDeleteNetworkACL = "DeleteNetworkAcl" +const opDeleteNetworkAcl = "DeleteNetworkAcl" -// DeleteNetworkACLRequest generates a request for the DeleteNetworkACL operation. -func (c *EC2) DeleteNetworkACLRequest(input *DeleteNetworkACLInput) (req *aws.Request, output *DeleteNetworkACLOutput) { - op := &aws.Operation{ - Name: opDeleteNetworkACL, +// DeleteNetworkAclRequest generates a request for the DeleteNetworkAcl operation. +func (c *EC2) DeleteNetworkAclRequest(input *DeleteNetworkAclInput) (req *request.Request, output *DeleteNetworkAclOutput) { + op := &request.Operation{ + Name: opDeleteNetworkAcl, HTTPMethod: "POST", HTTPPath: "/", } if input == nil { - input = &DeleteNetworkACLInput{} + input = &DeleteNetworkAclInput{} } req = c.newRequest(op, input, output) - output = &DeleteNetworkACLOutput{} + output = &DeleteNetworkAclOutput{} req.Data = output return } // Deletes the specified network ACL. You can't delete the ACL if it's associated // with any subnets. You can't delete the default network ACL. -func (c *EC2) DeleteNetworkACL(input *DeleteNetworkACLInput) (*DeleteNetworkACLOutput, error) { - req, out := c.DeleteNetworkACLRequest(input) +func (c *EC2) DeleteNetworkAcl(input *DeleteNetworkAclInput) (*DeleteNetworkAclOutput, error) { + req, out := c.DeleteNetworkAclRequest(input) err := req.Send() return out, err } -const opDeleteNetworkACLEntry = "DeleteNetworkAclEntry" +const opDeleteNetworkAclEntry = "DeleteNetworkAclEntry" -// DeleteNetworkACLEntryRequest generates a request for the DeleteNetworkACLEntry operation. -func (c *EC2) DeleteNetworkACLEntryRequest(input *DeleteNetworkACLEntryInput) (req *aws.Request, output *DeleteNetworkACLEntryOutput) { - op := &aws.Operation{ - Name: opDeleteNetworkACLEntry, +// DeleteNetworkAclEntryRequest generates a request for the DeleteNetworkAclEntry operation. +func (c *EC2) DeleteNetworkAclEntryRequest(input *DeleteNetworkAclEntryInput) (req *request.Request, output *DeleteNetworkAclEntryOutput) { + op := &request.Operation{ + Name: opDeleteNetworkAclEntry, HTTPMethod: "POST", HTTPPath: "/", } if input == nil { - input = &DeleteNetworkACLEntryInput{} + input = &DeleteNetworkAclEntryInput{} } req = c.newRequest(op, input, output) - output = &DeleteNetworkACLEntryOutput{} + output = &DeleteNetworkAclEntryOutput{} req.Data = output return } // Deletes the specified ingress or egress entry (rule) from the specified network // ACL. -func (c *EC2) DeleteNetworkACLEntry(input *DeleteNetworkACLEntryInput) (*DeleteNetworkACLEntryOutput, error) { - req, out := c.DeleteNetworkACLEntryRequest(input) +func (c *EC2) DeleteNetworkAclEntry(input *DeleteNetworkAclEntryInput) (*DeleteNetworkAclEntryOutput, error) { + req, out := c.DeleteNetworkAclEntryRequest(input) err := req.Send() return out, err } @@ -2056,8 +2063,8 @@ func (c *EC2) DeleteNetworkACLEntry(input *DeleteNetworkACLEntryInput) (*DeleteN const opDeleteNetworkInterface = "DeleteNetworkInterface" // DeleteNetworkInterfaceRequest generates a request for the DeleteNetworkInterface operation. -func (c *EC2) DeleteNetworkInterfaceRequest(input *DeleteNetworkInterfaceInput) (req *aws.Request, output *DeleteNetworkInterfaceOutput) { - op := &aws.Operation{ +func (c *EC2) DeleteNetworkInterfaceRequest(input *DeleteNetworkInterfaceInput) (req *request.Request, output *DeleteNetworkInterfaceOutput) { + op := &request.Operation{ Name: opDeleteNetworkInterface, HTTPMethod: "POST", HTTPPath: "/", @@ -2084,8 +2091,8 @@ func (c *EC2) DeleteNetworkInterface(input *DeleteNetworkInterfaceInput) (*Delet const opDeletePlacementGroup = "DeletePlacementGroup" // DeletePlacementGroupRequest generates a request for the DeletePlacementGroup operation. -func (c *EC2) DeletePlacementGroupRequest(input *DeletePlacementGroupInput) (req *aws.Request, output *DeletePlacementGroupOutput) { - op := &aws.Operation{ +func (c *EC2) DeletePlacementGroupRequest(input *DeletePlacementGroupInput) (req *request.Request, output *DeletePlacementGroupOutput) { + op := &request.Operation{ Name: opDeletePlacementGroup, HTTPMethod: "POST", HTTPPath: "/", @@ -2114,8 +2121,8 @@ func (c *EC2) DeletePlacementGroup(input *DeletePlacementGroupInput) (*DeletePla const opDeleteRoute = "DeleteRoute" // DeleteRouteRequest generates a request for the DeleteRoute operation. -func (c *EC2) DeleteRouteRequest(input *DeleteRouteInput) (req *aws.Request, output *DeleteRouteOutput) { - op := &aws.Operation{ +func (c *EC2) DeleteRouteRequest(input *DeleteRouteInput) (req *request.Request, output *DeleteRouteOutput) { + op := &request.Operation{ Name: opDeleteRoute, HTTPMethod: "POST", HTTPPath: "/", @@ -2141,8 +2148,8 @@ func (c *EC2) DeleteRoute(input *DeleteRouteInput) (*DeleteRouteOutput, error) { const opDeleteRouteTable = "DeleteRouteTable" // DeleteRouteTableRequest generates a request for the DeleteRouteTable operation. -func (c *EC2) DeleteRouteTableRequest(input *DeleteRouteTableInput) (req *aws.Request, output *DeleteRouteTableOutput) { - op := &aws.Operation{ +func (c *EC2) DeleteRouteTableRequest(input *DeleteRouteTableInput) (req *request.Request, output *DeleteRouteTableOutput) { + op := &request.Operation{ Name: opDeleteRouteTable, HTTPMethod: "POST", HTTPPath: "/", @@ -2170,8 +2177,8 @@ func (c *EC2) DeleteRouteTable(input *DeleteRouteTableInput) (*DeleteRouteTableO const opDeleteSecurityGroup = "DeleteSecurityGroup" // DeleteSecurityGroupRequest generates a request for the DeleteSecurityGroup operation. -func (c *EC2) DeleteSecurityGroupRequest(input *DeleteSecurityGroupInput) (req *aws.Request, output *DeleteSecurityGroupOutput) { - op := &aws.Operation{ +func (c *EC2) DeleteSecurityGroupRequest(input *DeleteSecurityGroupInput) (req *request.Request, output *DeleteSecurityGroupOutput) { + op := &request.Operation{ Name: opDeleteSecurityGroup, HTTPMethod: "POST", HTTPPath: "/", @@ -2201,8 +2208,8 @@ func (c *EC2) DeleteSecurityGroup(input *DeleteSecurityGroupInput) (*DeleteSecur const opDeleteSnapshot = "DeleteSnapshot" // DeleteSnapshotRequest generates a request for the DeleteSnapshot operation. -func (c *EC2) DeleteSnapshotRequest(input *DeleteSnapshotInput) (req *aws.Request, output *DeleteSnapshotOutput) { - op := &aws.Operation{ +func (c *EC2) DeleteSnapshotRequest(input *DeleteSnapshotInput) (req *request.Request, output *DeleteSnapshotOutput) { + op := &request.Operation{ Name: opDeleteSnapshot, HTTPMethod: "POST", HTTPPath: "/", @@ -2242,8 +2249,8 @@ func (c *EC2) DeleteSnapshot(input *DeleteSnapshotInput) (*DeleteSnapshotOutput, const opDeleteSpotDatafeedSubscription = "DeleteSpotDatafeedSubscription" // DeleteSpotDatafeedSubscriptionRequest generates a request for the DeleteSpotDatafeedSubscription operation. -func (c *EC2) DeleteSpotDatafeedSubscriptionRequest(input *DeleteSpotDatafeedSubscriptionInput) (req *aws.Request, output *DeleteSpotDatafeedSubscriptionOutput) { - op := &aws.Operation{ +func (c *EC2) DeleteSpotDatafeedSubscriptionRequest(input *DeleteSpotDatafeedSubscriptionInput) (req *request.Request, output *DeleteSpotDatafeedSubscriptionOutput) { + op := &request.Operation{ Name: opDeleteSpotDatafeedSubscription, HTTPMethod: "POST", HTTPPath: "/", @@ -2259,9 +2266,7 @@ func (c *EC2) DeleteSpotDatafeedSubscriptionRequest(input *DeleteSpotDatafeedSub return } -// Deletes the data feed for Spot Instances. For more information, see Spot -// Instance Data Feed (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/spot-data-feeds.html) -// in the Amazon Elastic Compute Cloud User Guide. +// Deletes the data feed for Spot instances. func (c *EC2) DeleteSpotDatafeedSubscription(input *DeleteSpotDatafeedSubscriptionInput) (*DeleteSpotDatafeedSubscriptionOutput, error) { req, out := c.DeleteSpotDatafeedSubscriptionRequest(input) err := req.Send() @@ -2271,8 +2276,8 @@ func (c *EC2) DeleteSpotDatafeedSubscription(input *DeleteSpotDatafeedSubscripti const opDeleteSubnet = "DeleteSubnet" // DeleteSubnetRequest generates a request for the DeleteSubnet operation. -func (c *EC2) DeleteSubnetRequest(input *DeleteSubnetInput) (req *aws.Request, output *DeleteSubnetOutput) { - op := &aws.Operation{ +func (c *EC2) DeleteSubnetRequest(input *DeleteSubnetInput) (req *request.Request, output *DeleteSubnetOutput) { + op := &request.Operation{ Name: opDeleteSubnet, HTTPMethod: "POST", HTTPPath: "/", @@ -2299,8 +2304,8 @@ func (c *EC2) DeleteSubnet(input *DeleteSubnetInput) (*DeleteSubnetOutput, error const opDeleteTags = "DeleteTags" // DeleteTagsRequest generates a request for the DeleteTags operation. -func (c *EC2) DeleteTagsRequest(input *DeleteTagsInput) (req *aws.Request, output *DeleteTagsOutput) { - op := &aws.Operation{ +func (c *EC2) DeleteTagsRequest(input *DeleteTagsInput) (req *request.Request, output *DeleteTagsOutput) { + op := &request.Operation{ Name: opDeleteTags, HTTPMethod: "POST", HTTPPath: "/", @@ -2327,197 +2332,11 @@ func (c *EC2) DeleteTags(input *DeleteTagsInput) (*DeleteTagsOutput, error) { return out, err } -const opDeleteVPC = "DeleteVpc" - -// DeleteVPCRequest generates a request for the DeleteVPC operation. -func (c *EC2) DeleteVPCRequest(input *DeleteVPCInput) (req *aws.Request, output *DeleteVPCOutput) { - op := &aws.Operation{ - Name: opDeleteVPC, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &DeleteVPCInput{} - } - - req = c.newRequest(op, input, output) - output = &DeleteVPCOutput{} - req.Data = output - return -} - -// Deletes the specified VPC. You must detach or delete all gateways and resources -// that are associated with the VPC before you can delete it. For example, you -// must terminate all instances running in the VPC, delete all security groups -// associated with the VPC (except the default one), delete all route tables -// associated with the VPC (except the default one), and so on. -func (c *EC2) DeleteVPC(input *DeleteVPCInput) (*DeleteVPCOutput, error) { - req, out := c.DeleteVPCRequest(input) - err := req.Send() - return out, err -} - -const opDeleteVPCEndpoints = "DeleteVpcEndpoints" - -// DeleteVPCEndpointsRequest generates a request for the DeleteVPCEndpoints operation. -func (c *EC2) DeleteVPCEndpointsRequest(input *DeleteVPCEndpointsInput) (req *aws.Request, output *DeleteVPCEndpointsOutput) { - op := &aws.Operation{ - Name: opDeleteVPCEndpoints, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &DeleteVPCEndpointsInput{} - } - - req = c.newRequest(op, input, output) - output = &DeleteVPCEndpointsOutput{} - req.Data = output - return -} - -// Deletes one or more specified VPC endpoints. Deleting the endpoint also deletes -// the endpoint routes in the route tables that were associated with the endpoint. -func (c *EC2) DeleteVPCEndpoints(input *DeleteVPCEndpointsInput) (*DeleteVPCEndpointsOutput, error) { - req, out := c.DeleteVPCEndpointsRequest(input) - err := req.Send() - return out, err -} - -const opDeleteVPCPeeringConnection = "DeleteVpcPeeringConnection" - -// DeleteVPCPeeringConnectionRequest generates a request for the DeleteVPCPeeringConnection operation. -func (c *EC2) DeleteVPCPeeringConnectionRequest(input *DeleteVPCPeeringConnectionInput) (req *aws.Request, output *DeleteVPCPeeringConnectionOutput) { - op := &aws.Operation{ - Name: opDeleteVPCPeeringConnection, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &DeleteVPCPeeringConnectionInput{} - } - - req = c.newRequest(op, input, output) - output = &DeleteVPCPeeringConnectionOutput{} - req.Data = output - return -} - -// Deletes a VPC peering connection. Either the owner of the requester VPC or -// the owner of the peer VPC can delete the VPC peering connection if it's in -// the active state. The owner of the requester VPC can delete a VPC peering -// connection in the pending-acceptance state. -func (c *EC2) DeleteVPCPeeringConnection(input *DeleteVPCPeeringConnectionInput) (*DeleteVPCPeeringConnectionOutput, error) { - req, out := c.DeleteVPCPeeringConnectionRequest(input) - err := req.Send() - return out, err -} - -const opDeleteVPNConnection = "DeleteVpnConnection" - -// DeleteVPNConnectionRequest generates a request for the DeleteVPNConnection operation. -func (c *EC2) DeleteVPNConnectionRequest(input *DeleteVPNConnectionInput) (req *aws.Request, output *DeleteVPNConnectionOutput) { - op := &aws.Operation{ - Name: opDeleteVPNConnection, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &DeleteVPNConnectionInput{} - } - - req = c.newRequest(op, input, output) - output = &DeleteVPNConnectionOutput{} - req.Data = output - return -} - -// Deletes the specified VPN connection. -// -// If you're deleting the VPC and its associated components, we recommend that -// you detach the virtual private gateway from the VPC and delete the VPC before -// deleting the VPN connection. If you believe that the tunnel credentials for -// your VPN connection have been compromised, you can delete the VPN connection -// and create a new one that has new keys, without needing to delete the VPC -// or virtual private gateway. If you create a new VPN connection, you must -// reconfigure the customer gateway using the new configuration information -// returned with the new VPN connection ID. -func (c *EC2) DeleteVPNConnection(input *DeleteVPNConnectionInput) (*DeleteVPNConnectionOutput, error) { - req, out := c.DeleteVPNConnectionRequest(input) - err := req.Send() - return out, err -} - -const opDeleteVPNConnectionRoute = "DeleteVpnConnectionRoute" - -// DeleteVPNConnectionRouteRequest generates a request for the DeleteVPNConnectionRoute operation. -func (c *EC2) DeleteVPNConnectionRouteRequest(input *DeleteVPNConnectionRouteInput) (req *aws.Request, output *DeleteVPNConnectionRouteOutput) { - op := &aws.Operation{ - Name: opDeleteVPNConnectionRoute, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &DeleteVPNConnectionRouteInput{} - } - - req = c.newRequest(op, input, output) - output = &DeleteVPNConnectionRouteOutput{} - req.Data = output - return -} - -// Deletes the specified static route associated with a VPN connection between -// an existing virtual private gateway and a VPN customer gateway. The static -// route allows traffic to be routed from the virtual private gateway to the -// VPN customer gateway. -func (c *EC2) DeleteVPNConnectionRoute(input *DeleteVPNConnectionRouteInput) (*DeleteVPNConnectionRouteOutput, error) { - req, out := c.DeleteVPNConnectionRouteRequest(input) - err := req.Send() - return out, err -} - -const opDeleteVPNGateway = "DeleteVpnGateway" - -// DeleteVPNGatewayRequest generates a request for the DeleteVPNGateway operation. -func (c *EC2) DeleteVPNGatewayRequest(input *DeleteVPNGatewayInput) (req *aws.Request, output *DeleteVPNGatewayOutput) { - op := &aws.Operation{ - Name: opDeleteVPNGateway, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &DeleteVPNGatewayInput{} - } - - req = c.newRequest(op, input, output) - output = &DeleteVPNGatewayOutput{} - req.Data = output - return -} - -// Deletes the specified virtual private gateway. We recommend that before you -// delete a virtual private gateway, you detach it from the VPC and delete the -// VPN connection. Note that you don't need to delete the virtual private gateway -// if you plan to delete and recreate the VPN connection between your VPC and -// your network. -func (c *EC2) DeleteVPNGateway(input *DeleteVPNGatewayInput) (*DeleteVPNGatewayOutput, error) { - req, out := c.DeleteVPNGatewayRequest(input) - err := req.Send() - return out, err -} - const opDeleteVolume = "DeleteVolume" // DeleteVolumeRequest generates a request for the DeleteVolume operation. -func (c *EC2) DeleteVolumeRequest(input *DeleteVolumeInput) (req *aws.Request, output *DeleteVolumeOutput) { - op := &aws.Operation{ +func (c *EC2) DeleteVolumeRequest(input *DeleteVolumeInput) (req *request.Request, output *DeleteVolumeOutput) { + op := &request.Operation{ Name: opDeleteVolume, HTTPMethod: "POST", HTTPPath: "/", @@ -2546,11 +2365,197 @@ func (c *EC2) DeleteVolume(input *DeleteVolumeInput) (*DeleteVolumeOutput, error return out, err } +const opDeleteVpc = "DeleteVpc" + +// DeleteVpcRequest generates a request for the DeleteVpc operation. +func (c *EC2) DeleteVpcRequest(input *DeleteVpcInput) (req *request.Request, output *DeleteVpcOutput) { + op := &request.Operation{ + Name: opDeleteVpc, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &DeleteVpcInput{} + } + + req = c.newRequest(op, input, output) + output = &DeleteVpcOutput{} + req.Data = output + return +} + +// Deletes the specified VPC. You must detach or delete all gateways and resources +// that are associated with the VPC before you can delete it. For example, you +// must terminate all instances running in the VPC, delete all security groups +// associated with the VPC (except the default one), delete all route tables +// associated with the VPC (except the default one), and so on. +func (c *EC2) DeleteVpc(input *DeleteVpcInput) (*DeleteVpcOutput, error) { + req, out := c.DeleteVpcRequest(input) + err := req.Send() + return out, err +} + +const opDeleteVpcEndpoints = "DeleteVpcEndpoints" + +// DeleteVpcEndpointsRequest generates a request for the DeleteVpcEndpoints operation. +func (c *EC2) DeleteVpcEndpointsRequest(input *DeleteVpcEndpointsInput) (req *request.Request, output *DeleteVpcEndpointsOutput) { + op := &request.Operation{ + Name: opDeleteVpcEndpoints, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &DeleteVpcEndpointsInput{} + } + + req = c.newRequest(op, input, output) + output = &DeleteVpcEndpointsOutput{} + req.Data = output + return +} + +// Deletes one or more specified VPC endpoints. Deleting the endpoint also deletes +// the endpoint routes in the route tables that were associated with the endpoint. +func (c *EC2) DeleteVpcEndpoints(input *DeleteVpcEndpointsInput) (*DeleteVpcEndpointsOutput, error) { + req, out := c.DeleteVpcEndpointsRequest(input) + err := req.Send() + return out, err +} + +const opDeleteVpcPeeringConnection = "DeleteVpcPeeringConnection" + +// DeleteVpcPeeringConnectionRequest generates a request for the DeleteVpcPeeringConnection operation. +func (c *EC2) DeleteVpcPeeringConnectionRequest(input *DeleteVpcPeeringConnectionInput) (req *request.Request, output *DeleteVpcPeeringConnectionOutput) { + op := &request.Operation{ + Name: opDeleteVpcPeeringConnection, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &DeleteVpcPeeringConnectionInput{} + } + + req = c.newRequest(op, input, output) + output = &DeleteVpcPeeringConnectionOutput{} + req.Data = output + return +} + +// Deletes a VPC peering connection. Either the owner of the requester VPC or +// the owner of the peer VPC can delete the VPC peering connection if it's in +// the active state. The owner of the requester VPC can delete a VPC peering +// connection in the pending-acceptance state. +func (c *EC2) DeleteVpcPeeringConnection(input *DeleteVpcPeeringConnectionInput) (*DeleteVpcPeeringConnectionOutput, error) { + req, out := c.DeleteVpcPeeringConnectionRequest(input) + err := req.Send() + return out, err +} + +const opDeleteVpnConnection = "DeleteVpnConnection" + +// DeleteVpnConnectionRequest generates a request for the DeleteVpnConnection operation. +func (c *EC2) DeleteVpnConnectionRequest(input *DeleteVpnConnectionInput) (req *request.Request, output *DeleteVpnConnectionOutput) { + op := &request.Operation{ + Name: opDeleteVpnConnection, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &DeleteVpnConnectionInput{} + } + + req = c.newRequest(op, input, output) + output = &DeleteVpnConnectionOutput{} + req.Data = output + return +} + +// Deletes the specified VPN connection. +// +// If you're deleting the VPC and its associated components, we recommend that +// you detach the virtual private gateway from the VPC and delete the VPC before +// deleting the VPN connection. If you believe that the tunnel credentials for +// your VPN connection have been compromised, you can delete the VPN connection +// and create a new one that has new keys, without needing to delete the VPC +// or virtual private gateway. If you create a new VPN connection, you must +// reconfigure the customer gateway using the new configuration information +// returned with the new VPN connection ID. +func (c *EC2) DeleteVpnConnection(input *DeleteVpnConnectionInput) (*DeleteVpnConnectionOutput, error) { + req, out := c.DeleteVpnConnectionRequest(input) + err := req.Send() + return out, err +} + +const opDeleteVpnConnectionRoute = "DeleteVpnConnectionRoute" + +// DeleteVpnConnectionRouteRequest generates a request for the DeleteVpnConnectionRoute operation. +func (c *EC2) DeleteVpnConnectionRouteRequest(input *DeleteVpnConnectionRouteInput) (req *request.Request, output *DeleteVpnConnectionRouteOutput) { + op := &request.Operation{ + Name: opDeleteVpnConnectionRoute, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &DeleteVpnConnectionRouteInput{} + } + + req = c.newRequest(op, input, output) + output = &DeleteVpnConnectionRouteOutput{} + req.Data = output + return +} + +// Deletes the specified static route associated with a VPN connection between +// an existing virtual private gateway and a VPN customer gateway. The static +// route allows traffic to be routed from the virtual private gateway to the +// VPN customer gateway. +func (c *EC2) DeleteVpnConnectionRoute(input *DeleteVpnConnectionRouteInput) (*DeleteVpnConnectionRouteOutput, error) { + req, out := c.DeleteVpnConnectionRouteRequest(input) + err := req.Send() + return out, err +} + +const opDeleteVpnGateway = "DeleteVpnGateway" + +// DeleteVpnGatewayRequest generates a request for the DeleteVpnGateway operation. +func (c *EC2) DeleteVpnGatewayRequest(input *DeleteVpnGatewayInput) (req *request.Request, output *DeleteVpnGatewayOutput) { + op := &request.Operation{ + Name: opDeleteVpnGateway, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &DeleteVpnGatewayInput{} + } + + req = c.newRequest(op, input, output) + output = &DeleteVpnGatewayOutput{} + req.Data = output + return +} + +// Deletes the specified virtual private gateway. We recommend that before you +// delete a virtual private gateway, you detach it from the VPC and delete the +// VPN connection. Note that you don't need to delete the virtual private gateway +// if you plan to delete and recreate the VPN connection between your VPC and +// your network. +func (c *EC2) DeleteVpnGateway(input *DeleteVpnGatewayInput) (*DeleteVpnGatewayOutput, error) { + req, out := c.DeleteVpnGatewayRequest(input) + err := req.Send() + return out, err +} + const opDeregisterImage = "DeregisterImage" // DeregisterImageRequest generates a request for the DeregisterImage operation. -func (c *EC2) DeregisterImageRequest(input *DeregisterImageInput) (req *aws.Request, output *DeregisterImageOutput) { - op := &aws.Operation{ +func (c *EC2) DeregisterImageRequest(input *DeregisterImageInput) (req *request.Request, output *DeregisterImageOutput) { + op := &request.Operation{ Name: opDeregisterImage, HTTPMethod: "POST", HTTPPath: "/", @@ -2579,8 +2584,8 @@ func (c *EC2) DeregisterImage(input *DeregisterImageInput) (*DeregisterImageOutp const opDescribeAccountAttributes = "DescribeAccountAttributes" // DescribeAccountAttributesRequest generates a request for the DescribeAccountAttributes operation. -func (c *EC2) DescribeAccountAttributesRequest(input *DescribeAccountAttributesInput) (req *aws.Request, output *DescribeAccountAttributesOutput) { - op := &aws.Operation{ +func (c *EC2) DescribeAccountAttributesRequest(input *DescribeAccountAttributesInput) (req *request.Request, output *DescribeAccountAttributesOutput) { + op := &request.Operation{ Name: opDescribeAccountAttributes, HTTPMethod: "POST", HTTPPath: "/", @@ -2624,8 +2629,8 @@ func (c *EC2) DescribeAccountAttributes(input *DescribeAccountAttributesInput) ( const opDescribeAddresses = "DescribeAddresses" // DescribeAddressesRequest generates a request for the DescribeAddresses operation. -func (c *EC2) DescribeAddressesRequest(input *DescribeAddressesInput) (req *aws.Request, output *DescribeAddressesOutput) { - op := &aws.Operation{ +func (c *EC2) DescribeAddressesRequest(input *DescribeAddressesInput) (req *request.Request, output *DescribeAddressesOutput) { + op := &request.Operation{ Name: opDescribeAddresses, HTTPMethod: "POST", HTTPPath: "/", @@ -2655,8 +2660,8 @@ func (c *EC2) DescribeAddresses(input *DescribeAddressesInput) (*DescribeAddress const opDescribeAvailabilityZones = "DescribeAvailabilityZones" // DescribeAvailabilityZonesRequest generates a request for the DescribeAvailabilityZones operation. -func (c *EC2) DescribeAvailabilityZonesRequest(input *DescribeAvailabilityZonesInput) (req *aws.Request, output *DescribeAvailabilityZonesOutput) { - op := &aws.Operation{ +func (c *EC2) DescribeAvailabilityZonesRequest(input *DescribeAvailabilityZonesInput) (req *request.Request, output *DescribeAvailabilityZonesOutput) { + op := &request.Operation{ Name: opDescribeAvailabilityZones, HTTPMethod: "POST", HTTPPath: "/", @@ -2688,8 +2693,8 @@ func (c *EC2) DescribeAvailabilityZones(input *DescribeAvailabilityZonesInput) ( const opDescribeBundleTasks = "DescribeBundleTasks" // DescribeBundleTasksRequest generates a request for the DescribeBundleTasks operation. -func (c *EC2) DescribeBundleTasksRequest(input *DescribeBundleTasksInput) (req *aws.Request, output *DescribeBundleTasksOutput) { - op := &aws.Operation{ +func (c *EC2) DescribeBundleTasksRequest(input *DescribeBundleTasksInput) (req *request.Request, output *DescribeBundleTasksOutput) { + op := &request.Operation{ Name: opDescribeBundleTasks, HTTPMethod: "POST", HTTPPath: "/", @@ -2720,8 +2725,8 @@ func (c *EC2) DescribeBundleTasks(input *DescribeBundleTasksInput) (*DescribeBun const opDescribeClassicLinkInstances = "DescribeClassicLinkInstances" // DescribeClassicLinkInstancesRequest generates a request for the DescribeClassicLinkInstances operation. -func (c *EC2) DescribeClassicLinkInstancesRequest(input *DescribeClassicLinkInstancesInput) (req *aws.Request, output *DescribeClassicLinkInstancesOutput) { - op := &aws.Operation{ +func (c *EC2) DescribeClassicLinkInstancesRequest(input *DescribeClassicLinkInstancesInput) (req *request.Request, output *DescribeClassicLinkInstancesOutput) { + op := &request.Operation{ Name: opDescribeClassicLinkInstances, HTTPMethod: "POST", HTTPPath: "/", @@ -2750,8 +2755,8 @@ func (c *EC2) DescribeClassicLinkInstances(input *DescribeClassicLinkInstancesIn const opDescribeConversionTasks = "DescribeConversionTasks" // DescribeConversionTasksRequest generates a request for the DescribeConversionTasks operation. -func (c *EC2) DescribeConversionTasksRequest(input *DescribeConversionTasksInput) (req *aws.Request, output *DescribeConversionTasksOutput) { - op := &aws.Operation{ +func (c *EC2) DescribeConversionTasksRequest(input *DescribeConversionTasksInput) (req *request.Request, output *DescribeConversionTasksOutput) { + op := &request.Operation{ Name: opDescribeConversionTasks, HTTPMethod: "POST", HTTPPath: "/", @@ -2780,8 +2785,8 @@ func (c *EC2) DescribeConversionTasks(input *DescribeConversionTasksInput) (*Des const opDescribeCustomerGateways = "DescribeCustomerGateways" // DescribeCustomerGatewaysRequest generates a request for the DescribeCustomerGateways operation. -func (c *EC2) DescribeCustomerGatewaysRequest(input *DescribeCustomerGatewaysInput) (req *aws.Request, output *DescribeCustomerGatewaysOutput) { - op := &aws.Operation{ +func (c *EC2) DescribeCustomerGatewaysRequest(input *DescribeCustomerGatewaysInput) (req *request.Request, output *DescribeCustomerGatewaysOutput) { + op := &request.Operation{ Name: opDescribeCustomerGateways, HTTPMethod: "POST", HTTPPath: "/", @@ -2808,22 +2813,22 @@ func (c *EC2) DescribeCustomerGateways(input *DescribeCustomerGatewaysInput) (*D return out, err } -const opDescribeDHCPOptions = "DescribeDhcpOptions" +const opDescribeDhcpOptions = "DescribeDhcpOptions" -// DescribeDHCPOptionsRequest generates a request for the DescribeDHCPOptions operation. -func (c *EC2) DescribeDHCPOptionsRequest(input *DescribeDHCPOptionsInput) (req *aws.Request, output *DescribeDHCPOptionsOutput) { - op := &aws.Operation{ - Name: opDescribeDHCPOptions, +// DescribeDhcpOptionsRequest generates a request for the DescribeDhcpOptions operation. +func (c *EC2) DescribeDhcpOptionsRequest(input *DescribeDhcpOptionsInput) (req *request.Request, output *DescribeDhcpOptionsOutput) { + op := &request.Operation{ + Name: opDescribeDhcpOptions, HTTPMethod: "POST", HTTPPath: "/", } if input == nil { - input = &DescribeDHCPOptionsInput{} + input = &DescribeDhcpOptionsInput{} } req = c.newRequest(op, input, output) - output = &DescribeDHCPOptionsOutput{} + output = &DescribeDhcpOptionsOutput{} req.Data = output return } @@ -2832,8 +2837,8 @@ func (c *EC2) DescribeDHCPOptionsRequest(input *DescribeDHCPOptionsInput) (req * // // For more information about DHCP options sets, see DHCP Options Sets (http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/VPC_DHCP_Options.html) // in the Amazon Virtual Private Cloud User Guide. -func (c *EC2) DescribeDHCPOptions(input *DescribeDHCPOptionsInput) (*DescribeDHCPOptionsOutput, error) { - req, out := c.DescribeDHCPOptionsRequest(input) +func (c *EC2) DescribeDhcpOptions(input *DescribeDhcpOptionsInput) (*DescribeDhcpOptionsOutput, error) { + req, out := c.DescribeDhcpOptionsRequest(input) err := req.Send() return out, err } @@ -2841,8 +2846,8 @@ func (c *EC2) DescribeDHCPOptions(input *DescribeDHCPOptionsInput) (*DescribeDHC const opDescribeExportTasks = "DescribeExportTasks" // DescribeExportTasksRequest generates a request for the DescribeExportTasks operation. -func (c *EC2) DescribeExportTasksRequest(input *DescribeExportTasksInput) (req *aws.Request, output *DescribeExportTasksOutput) { - op := &aws.Operation{ +func (c *EC2) DescribeExportTasksRequest(input *DescribeExportTasksInput) (req *request.Request, output *DescribeExportTasksOutput) { + op := &request.Operation{ Name: opDescribeExportTasks, HTTPMethod: "POST", HTTPPath: "/", @@ -2868,8 +2873,8 @@ func (c *EC2) DescribeExportTasks(input *DescribeExportTasksInput) (*DescribeExp const opDescribeFlowLogs = "DescribeFlowLogs" // DescribeFlowLogsRequest generates a request for the DescribeFlowLogs operation. -func (c *EC2) DescribeFlowLogsRequest(input *DescribeFlowLogsInput) (req *aws.Request, output *DescribeFlowLogsOutput) { - op := &aws.Operation{ +func (c *EC2) DescribeFlowLogsRequest(input *DescribeFlowLogsInput) (req *request.Request, output *DescribeFlowLogsOutput) { + op := &request.Operation{ Name: opDescribeFlowLogs, HTTPMethod: "POST", HTTPPath: "/", @@ -2897,8 +2902,8 @@ func (c *EC2) DescribeFlowLogs(input *DescribeFlowLogsInput) (*DescribeFlowLogsO const opDescribeImageAttribute = "DescribeImageAttribute" // DescribeImageAttributeRequest generates a request for the DescribeImageAttribute operation. -func (c *EC2) DescribeImageAttributeRequest(input *DescribeImageAttributeInput) (req *aws.Request, output *DescribeImageAttributeOutput) { - op := &aws.Operation{ +func (c *EC2) DescribeImageAttributeRequest(input *DescribeImageAttributeInput) (req *request.Request, output *DescribeImageAttributeOutput) { + op := &request.Operation{ Name: opDescribeImageAttribute, HTTPMethod: "POST", HTTPPath: "/", @@ -2925,8 +2930,8 @@ func (c *EC2) DescribeImageAttribute(input *DescribeImageAttributeInput) (*Descr const opDescribeImages = "DescribeImages" // DescribeImagesRequest generates a request for the DescribeImages operation. -func (c *EC2) DescribeImagesRequest(input *DescribeImagesInput) (req *aws.Request, output *DescribeImagesOutput) { - op := &aws.Operation{ +func (c *EC2) DescribeImagesRequest(input *DescribeImagesInput) (req *request.Request, output *DescribeImagesOutput) { + op := &request.Operation{ Name: opDescribeImages, HTTPMethod: "POST", HTTPPath: "/", @@ -2958,8 +2963,8 @@ func (c *EC2) DescribeImages(input *DescribeImagesInput) (*DescribeImagesOutput, const opDescribeImportImageTasks = "DescribeImportImageTasks" // DescribeImportImageTasksRequest generates a request for the DescribeImportImageTasks operation. -func (c *EC2) DescribeImportImageTasksRequest(input *DescribeImportImageTasksInput) (req *aws.Request, output *DescribeImportImageTasksOutput) { - op := &aws.Operation{ +func (c *EC2) DescribeImportImageTasksRequest(input *DescribeImportImageTasksInput) (req *request.Request, output *DescribeImportImageTasksOutput) { + op := &request.Operation{ Name: opDescribeImportImageTasks, HTTPMethod: "POST", HTTPPath: "/", @@ -2986,8 +2991,8 @@ func (c *EC2) DescribeImportImageTasks(input *DescribeImportImageTasksInput) (*D const opDescribeImportSnapshotTasks = "DescribeImportSnapshotTasks" // DescribeImportSnapshotTasksRequest generates a request for the DescribeImportSnapshotTasks operation. -func (c *EC2) DescribeImportSnapshotTasksRequest(input *DescribeImportSnapshotTasksInput) (req *aws.Request, output *DescribeImportSnapshotTasksOutput) { - op := &aws.Operation{ +func (c *EC2) DescribeImportSnapshotTasksRequest(input *DescribeImportSnapshotTasksInput) (req *request.Request, output *DescribeImportSnapshotTasksOutput) { + op := &request.Operation{ Name: opDescribeImportSnapshotTasks, HTTPMethod: "POST", HTTPPath: "/", @@ -3013,8 +3018,8 @@ func (c *EC2) DescribeImportSnapshotTasks(input *DescribeImportSnapshotTasksInpu const opDescribeInstanceAttribute = "DescribeInstanceAttribute" // DescribeInstanceAttributeRequest generates a request for the DescribeInstanceAttribute operation. -func (c *EC2) DescribeInstanceAttributeRequest(input *DescribeInstanceAttributeInput) (req *aws.Request, output *DescribeInstanceAttributeOutput) { - op := &aws.Operation{ +func (c *EC2) DescribeInstanceAttributeRequest(input *DescribeInstanceAttributeInput) (req *request.Request, output *DescribeInstanceAttributeOutput) { + op := &request.Operation{ Name: opDescribeInstanceAttribute, HTTPMethod: "POST", HTTPPath: "/", @@ -3044,12 +3049,12 @@ func (c *EC2) DescribeInstanceAttribute(input *DescribeInstanceAttributeInput) ( const opDescribeInstanceStatus = "DescribeInstanceStatus" // DescribeInstanceStatusRequest generates a request for the DescribeInstanceStatus operation. -func (c *EC2) DescribeInstanceStatusRequest(input *DescribeInstanceStatusInput) (req *aws.Request, output *DescribeInstanceStatusOutput) { - op := &aws.Operation{ +func (c *EC2) DescribeInstanceStatusRequest(input *DescribeInstanceStatusInput) (req *request.Request, output *DescribeInstanceStatusOutput) { + op := &request.Operation{ Name: opDescribeInstanceStatus, HTTPMethod: "POST", HTTPPath: "/", - Paginator: &aws.Paginator{ + Paginator: &request.Paginator{ InputTokens: []string{"NextToken"}, OutputTokens: []string{"NextToken"}, LimitToken: "MaxResults", @@ -3103,12 +3108,12 @@ func (c *EC2) DescribeInstanceStatusPages(input *DescribeInstanceStatusInput, fn const opDescribeInstances = "DescribeInstances" // DescribeInstancesRequest generates a request for the DescribeInstances operation. -func (c *EC2) DescribeInstancesRequest(input *DescribeInstancesInput) (req *aws.Request, output *DescribeInstancesOutput) { - op := &aws.Operation{ +func (c *EC2) DescribeInstancesRequest(input *DescribeInstancesInput) (req *request.Request, output *DescribeInstancesOutput) { + op := &request.Operation{ Name: opDescribeInstances, HTTPMethod: "POST", HTTPPath: "/", - Paginator: &aws.Paginator{ + Paginator: &request.Paginator{ InputTokens: []string{"NextToken"}, OutputTokens: []string{"NextToken"}, LimitToken: "MaxResults", @@ -3152,8 +3157,8 @@ func (c *EC2) DescribeInstancesPages(input *DescribeInstancesInput, fn func(p *D const opDescribeInternetGateways = "DescribeInternetGateways" // DescribeInternetGatewaysRequest generates a request for the DescribeInternetGateways operation. -func (c *EC2) DescribeInternetGatewaysRequest(input *DescribeInternetGatewaysInput) (req *aws.Request, output *DescribeInternetGatewaysOutput) { - op := &aws.Operation{ +func (c *EC2) DescribeInternetGatewaysRequest(input *DescribeInternetGatewaysInput) (req *request.Request, output *DescribeInternetGatewaysOutput) { + op := &request.Operation{ Name: opDescribeInternetGateways, HTTPMethod: "POST", HTTPPath: "/", @@ -3179,8 +3184,8 @@ func (c *EC2) DescribeInternetGateways(input *DescribeInternetGatewaysInput) (*D const opDescribeKeyPairs = "DescribeKeyPairs" // DescribeKeyPairsRequest generates a request for the DescribeKeyPairs operation. -func (c *EC2) DescribeKeyPairsRequest(input *DescribeKeyPairsInput) (req *aws.Request, output *DescribeKeyPairsOutput) { - op := &aws.Operation{ +func (c *EC2) DescribeKeyPairsRequest(input *DescribeKeyPairsInput) (req *request.Request, output *DescribeKeyPairsOutput) { + op := &request.Operation{ Name: opDescribeKeyPairs, HTTPMethod: "POST", HTTPPath: "/", @@ -3209,8 +3214,8 @@ func (c *EC2) DescribeKeyPairs(input *DescribeKeyPairsInput) (*DescribeKeyPairsO const opDescribeMovingAddresses = "DescribeMovingAddresses" // DescribeMovingAddressesRequest generates a request for the DescribeMovingAddresses operation. -func (c *EC2) DescribeMovingAddressesRequest(input *DescribeMovingAddressesInput) (req *aws.Request, output *DescribeMovingAddressesOutput) { - op := &aws.Operation{ +func (c *EC2) DescribeMovingAddressesRequest(input *DescribeMovingAddressesInput) (req *request.Request, output *DescribeMovingAddressesOutput) { + op := &request.Operation{ Name: opDescribeMovingAddresses, HTTPMethod: "POST", HTTPPath: "/", @@ -3235,22 +3240,22 @@ func (c *EC2) DescribeMovingAddresses(input *DescribeMovingAddressesInput) (*Des return out, err } -const opDescribeNetworkACLs = "DescribeNetworkAcls" +const opDescribeNetworkAcls = "DescribeNetworkAcls" -// DescribeNetworkACLsRequest generates a request for the DescribeNetworkACLs operation. -func (c *EC2) DescribeNetworkACLsRequest(input *DescribeNetworkACLsInput) (req *aws.Request, output *DescribeNetworkACLsOutput) { - op := &aws.Operation{ - Name: opDescribeNetworkACLs, +// DescribeNetworkAclsRequest generates a request for the DescribeNetworkAcls operation. +func (c *EC2) DescribeNetworkAclsRequest(input *DescribeNetworkAclsInput) (req *request.Request, output *DescribeNetworkAclsOutput) { + op := &request.Operation{ + Name: opDescribeNetworkAcls, HTTPMethod: "POST", HTTPPath: "/", } if input == nil { - input = &DescribeNetworkACLsInput{} + input = &DescribeNetworkAclsInput{} } req = c.newRequest(op, input, output) - output = &DescribeNetworkACLsOutput{} + output = &DescribeNetworkAclsOutput{} req.Data = output return } @@ -3259,8 +3264,8 @@ func (c *EC2) DescribeNetworkACLsRequest(input *DescribeNetworkACLsInput) (req * // // For more information about network ACLs, see Network ACLs (http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/VPC_ACLs.html) // in the Amazon Virtual Private Cloud User Guide. -func (c *EC2) DescribeNetworkACLs(input *DescribeNetworkACLsInput) (*DescribeNetworkACLsOutput, error) { - req, out := c.DescribeNetworkACLsRequest(input) +func (c *EC2) DescribeNetworkAcls(input *DescribeNetworkAclsInput) (*DescribeNetworkAclsOutput, error) { + req, out := c.DescribeNetworkAclsRequest(input) err := req.Send() return out, err } @@ -3268,8 +3273,8 @@ func (c *EC2) DescribeNetworkACLs(input *DescribeNetworkACLsInput) (*DescribeNet const opDescribeNetworkInterfaceAttribute = "DescribeNetworkInterfaceAttribute" // DescribeNetworkInterfaceAttributeRequest generates a request for the DescribeNetworkInterfaceAttribute operation. -func (c *EC2) DescribeNetworkInterfaceAttributeRequest(input *DescribeNetworkInterfaceAttributeInput) (req *aws.Request, output *DescribeNetworkInterfaceAttributeOutput) { - op := &aws.Operation{ +func (c *EC2) DescribeNetworkInterfaceAttributeRequest(input *DescribeNetworkInterfaceAttributeInput) (req *request.Request, output *DescribeNetworkInterfaceAttributeOutput) { + op := &request.Operation{ Name: opDescribeNetworkInterfaceAttribute, HTTPMethod: "POST", HTTPPath: "/", @@ -3296,8 +3301,8 @@ func (c *EC2) DescribeNetworkInterfaceAttribute(input *DescribeNetworkInterfaceA const opDescribeNetworkInterfaces = "DescribeNetworkInterfaces" // DescribeNetworkInterfacesRequest generates a request for the DescribeNetworkInterfaces operation. -func (c *EC2) DescribeNetworkInterfacesRequest(input *DescribeNetworkInterfacesInput) (req *aws.Request, output *DescribeNetworkInterfacesOutput) { - op := &aws.Operation{ +func (c *EC2) DescribeNetworkInterfacesRequest(input *DescribeNetworkInterfacesInput) (req *request.Request, output *DescribeNetworkInterfacesOutput) { + op := &request.Operation{ Name: opDescribeNetworkInterfaces, HTTPMethod: "POST", HTTPPath: "/", @@ -3323,8 +3328,8 @@ func (c *EC2) DescribeNetworkInterfaces(input *DescribeNetworkInterfacesInput) ( const opDescribePlacementGroups = "DescribePlacementGroups" // DescribePlacementGroupsRequest generates a request for the DescribePlacementGroups operation. -func (c *EC2) DescribePlacementGroupsRequest(input *DescribePlacementGroupsInput) (req *aws.Request, output *DescribePlacementGroupsOutput) { - op := &aws.Operation{ +func (c *EC2) DescribePlacementGroupsRequest(input *DescribePlacementGroupsInput) (req *request.Request, output *DescribePlacementGroupsOutput) { + op := &request.Operation{ Name: opDescribePlacementGroups, HTTPMethod: "POST", HTTPPath: "/", @@ -3352,8 +3357,8 @@ func (c *EC2) DescribePlacementGroups(input *DescribePlacementGroupsInput) (*Des const opDescribePrefixLists = "DescribePrefixLists" // DescribePrefixListsRequest generates a request for the DescribePrefixLists operation. -func (c *EC2) DescribePrefixListsRequest(input *DescribePrefixListsInput) (req *aws.Request, output *DescribePrefixListsOutput) { - op := &aws.Operation{ +func (c *EC2) DescribePrefixListsRequest(input *DescribePrefixListsInput) (req *request.Request, output *DescribePrefixListsOutput) { + op := &request.Operation{ Name: opDescribePrefixLists, HTTPMethod: "POST", HTTPPath: "/", @@ -3383,8 +3388,8 @@ func (c *EC2) DescribePrefixLists(input *DescribePrefixListsInput) (*DescribePre const opDescribeRegions = "DescribeRegions" // DescribeRegionsRequest generates a request for the DescribeRegions operation. -func (c *EC2) DescribeRegionsRequest(input *DescribeRegionsInput) (req *aws.Request, output *DescribeRegionsOutput) { - op := &aws.Operation{ +func (c *EC2) DescribeRegionsRequest(input *DescribeRegionsInput) (req *request.Request, output *DescribeRegionsOutput) { + op := &request.Operation{ Name: opDescribeRegions, HTTPMethod: "POST", HTTPPath: "/", @@ -3413,8 +3418,8 @@ func (c *EC2) DescribeRegions(input *DescribeRegionsInput) (*DescribeRegionsOutp const opDescribeReservedInstances = "DescribeReservedInstances" // DescribeReservedInstancesRequest generates a request for the DescribeReservedInstances operation. -func (c *EC2) DescribeReservedInstancesRequest(input *DescribeReservedInstancesInput) (req *aws.Request, output *DescribeReservedInstancesOutput) { - op := &aws.Operation{ +func (c *EC2) DescribeReservedInstancesRequest(input *DescribeReservedInstancesInput) (req *request.Request, output *DescribeReservedInstancesOutput) { + op := &request.Operation{ Name: opDescribeReservedInstances, HTTPMethod: "POST", HTTPPath: "/", @@ -3443,8 +3448,8 @@ func (c *EC2) DescribeReservedInstances(input *DescribeReservedInstancesInput) ( const opDescribeReservedInstancesListings = "DescribeReservedInstancesListings" // DescribeReservedInstancesListingsRequest generates a request for the DescribeReservedInstancesListings operation. -func (c *EC2) DescribeReservedInstancesListingsRequest(input *DescribeReservedInstancesListingsInput) (req *aws.Request, output *DescribeReservedInstancesListingsOutput) { - op := &aws.Operation{ +func (c *EC2) DescribeReservedInstancesListingsRequest(input *DescribeReservedInstancesListingsInput) (req *request.Request, output *DescribeReservedInstancesListingsOutput) { + op := &request.Operation{ Name: opDescribeReservedInstancesListings, HTTPMethod: "POST", HTTPPath: "/", @@ -3491,12 +3496,12 @@ func (c *EC2) DescribeReservedInstancesListings(input *DescribeReservedInstances const opDescribeReservedInstancesModifications = "DescribeReservedInstancesModifications" // DescribeReservedInstancesModificationsRequest generates a request for the DescribeReservedInstancesModifications operation. -func (c *EC2) DescribeReservedInstancesModificationsRequest(input *DescribeReservedInstancesModificationsInput) (req *aws.Request, output *DescribeReservedInstancesModificationsOutput) { - op := &aws.Operation{ +func (c *EC2) DescribeReservedInstancesModificationsRequest(input *DescribeReservedInstancesModificationsInput) (req *request.Request, output *DescribeReservedInstancesModificationsOutput) { + op := &request.Operation{ Name: opDescribeReservedInstancesModifications, HTTPMethod: "POST", HTTPPath: "/", - Paginator: &aws.Paginator{ + Paginator: &request.Paginator{ InputTokens: []string{"NextToken"}, OutputTokens: []string{"NextToken"}, LimitToken: "", @@ -3537,12 +3542,12 @@ func (c *EC2) DescribeReservedInstancesModificationsPages(input *DescribeReserve const opDescribeReservedInstancesOfferings = "DescribeReservedInstancesOfferings" // DescribeReservedInstancesOfferingsRequest generates a request for the DescribeReservedInstancesOfferings operation. -func (c *EC2) DescribeReservedInstancesOfferingsRequest(input *DescribeReservedInstancesOfferingsInput) (req *aws.Request, output *DescribeReservedInstancesOfferingsOutput) { - op := &aws.Operation{ +func (c *EC2) DescribeReservedInstancesOfferingsRequest(input *DescribeReservedInstancesOfferingsInput) (req *request.Request, output *DescribeReservedInstancesOfferingsOutput) { + op := &request.Operation{ Name: opDescribeReservedInstancesOfferings, HTTPMethod: "POST", HTTPPath: "/", - Paginator: &aws.Paginator{ + Paginator: &request.Paginator{ InputTokens: []string{"NextToken"}, OutputTokens: []string{"NextToken"}, LimitToken: "MaxResults", @@ -3584,8 +3589,8 @@ func (c *EC2) DescribeReservedInstancesOfferingsPages(input *DescribeReservedIns const opDescribeRouteTables = "DescribeRouteTables" // DescribeRouteTablesRequest generates a request for the DescribeRouteTables operation. -func (c *EC2) DescribeRouteTablesRequest(input *DescribeRouteTablesInput) (req *aws.Request, output *DescribeRouteTablesOutput) { - op := &aws.Operation{ +func (c *EC2) DescribeRouteTablesRequest(input *DescribeRouteTablesInput) (req *request.Request, output *DescribeRouteTablesOutput) { + op := &request.Operation{ Name: opDescribeRouteTables, HTTPMethod: "POST", HTTPPath: "/", @@ -3619,8 +3624,8 @@ func (c *EC2) DescribeRouteTables(input *DescribeRouteTablesInput) (*DescribeRou const opDescribeSecurityGroups = "DescribeSecurityGroups" // DescribeSecurityGroupsRequest generates a request for the DescribeSecurityGroups operation. -func (c *EC2) DescribeSecurityGroupsRequest(input *DescribeSecurityGroupsInput) (req *aws.Request, output *DescribeSecurityGroupsOutput) { - op := &aws.Operation{ +func (c *EC2) DescribeSecurityGroupsRequest(input *DescribeSecurityGroupsInput) (req *request.Request, output *DescribeSecurityGroupsOutput) { + op := &request.Operation{ Name: opDescribeSecurityGroups, HTTPMethod: "POST", HTTPPath: "/", @@ -3653,8 +3658,8 @@ func (c *EC2) DescribeSecurityGroups(input *DescribeSecurityGroupsInput) (*Descr const opDescribeSnapshotAttribute = "DescribeSnapshotAttribute" // DescribeSnapshotAttributeRequest generates a request for the DescribeSnapshotAttribute operation. -func (c *EC2) DescribeSnapshotAttributeRequest(input *DescribeSnapshotAttributeInput) (req *aws.Request, output *DescribeSnapshotAttributeOutput) { - op := &aws.Operation{ +func (c *EC2) DescribeSnapshotAttributeRequest(input *DescribeSnapshotAttributeInput) (req *request.Request, output *DescribeSnapshotAttributeOutput) { + op := &request.Operation{ Name: opDescribeSnapshotAttribute, HTTPMethod: "POST", HTTPPath: "/", @@ -3684,12 +3689,12 @@ func (c *EC2) DescribeSnapshotAttribute(input *DescribeSnapshotAttributeInput) ( const opDescribeSnapshots = "DescribeSnapshots" // DescribeSnapshotsRequest generates a request for the DescribeSnapshots operation. -func (c *EC2) DescribeSnapshotsRequest(input *DescribeSnapshotsInput) (req *aws.Request, output *DescribeSnapshotsOutput) { - op := &aws.Operation{ +func (c *EC2) DescribeSnapshotsRequest(input *DescribeSnapshotsInput) (req *request.Request, output *DescribeSnapshotsOutput) { + op := &request.Operation{ Name: opDescribeSnapshots, HTTPMethod: "POST", HTTPPath: "/", - Paginator: &aws.Paginator{ + Paginator: &request.Paginator{ InputTokens: []string{"NextToken"}, OutputTokens: []string{"NextToken"}, LimitToken: "", @@ -3763,8 +3768,8 @@ func (c *EC2) DescribeSnapshotsPages(input *DescribeSnapshotsInput, fn func(p *D const opDescribeSpotDatafeedSubscription = "DescribeSpotDatafeedSubscription" // DescribeSpotDatafeedSubscriptionRequest generates a request for the DescribeSpotDatafeedSubscription operation. -func (c *EC2) DescribeSpotDatafeedSubscriptionRequest(input *DescribeSpotDatafeedSubscriptionInput) (req *aws.Request, output *DescribeSpotDatafeedSubscriptionOutput) { - op := &aws.Operation{ +func (c *EC2) DescribeSpotDatafeedSubscriptionRequest(input *DescribeSpotDatafeedSubscriptionInput) (req *request.Request, output *DescribeSpotDatafeedSubscriptionOutput) { + op := &request.Operation{ Name: opDescribeSpotDatafeedSubscription, HTTPMethod: "POST", HTTPPath: "/", @@ -3780,7 +3785,7 @@ func (c *EC2) DescribeSpotDatafeedSubscriptionRequest(input *DescribeSpotDatafee return } -// Describes the data feed for Spot Instances. For more information, see Spot +// Describes the data feed for Spot instances. For more information, see Spot // Instance Data Feed (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/spot-data-feeds.html) // in the Amazon Elastic Compute Cloud User Guide. func (c *EC2) DescribeSpotDatafeedSubscription(input *DescribeSpotDatafeedSubscriptionInput) (*DescribeSpotDatafeedSubscriptionOutput, error) { @@ -3792,8 +3797,8 @@ func (c *EC2) DescribeSpotDatafeedSubscription(input *DescribeSpotDatafeedSubscr const opDescribeSpotFleetInstances = "DescribeSpotFleetInstances" // DescribeSpotFleetInstancesRequest generates a request for the DescribeSpotFleetInstances operation. -func (c *EC2) DescribeSpotFleetInstancesRequest(input *DescribeSpotFleetInstancesInput) (req *aws.Request, output *DescribeSpotFleetInstancesOutput) { - op := &aws.Operation{ +func (c *EC2) DescribeSpotFleetInstancesRequest(input *DescribeSpotFleetInstancesInput) (req *request.Request, output *DescribeSpotFleetInstancesOutput) { + op := &request.Operation{ Name: opDescribeSpotFleetInstances, HTTPMethod: "POST", HTTPPath: "/", @@ -3819,8 +3824,8 @@ func (c *EC2) DescribeSpotFleetInstances(input *DescribeSpotFleetInstancesInput) const opDescribeSpotFleetRequestHistory = "DescribeSpotFleetRequestHistory" // DescribeSpotFleetRequestHistoryRequest generates a request for the DescribeSpotFleetRequestHistory operation. -func (c *EC2) DescribeSpotFleetRequestHistoryRequest(input *DescribeSpotFleetRequestHistoryInput) (req *aws.Request, output *DescribeSpotFleetRequestHistoryOutput) { - op := &aws.Operation{ +func (c *EC2) DescribeSpotFleetRequestHistoryRequest(input *DescribeSpotFleetRequestHistoryInput) (req *request.Request, output *DescribeSpotFleetRequestHistoryOutput) { + op := &request.Operation{ Name: opDescribeSpotFleetRequestHistory, HTTPMethod: "POST", HTTPPath: "/", @@ -3851,8 +3856,8 @@ func (c *EC2) DescribeSpotFleetRequestHistory(input *DescribeSpotFleetRequestHis const opDescribeSpotFleetRequests = "DescribeSpotFleetRequests" // DescribeSpotFleetRequestsRequest generates a request for the DescribeSpotFleetRequests operation. -func (c *EC2) DescribeSpotFleetRequestsRequest(input *DescribeSpotFleetRequestsInput) (req *aws.Request, output *DescribeSpotFleetRequestsOutput) { - op := &aws.Operation{ +func (c *EC2) DescribeSpotFleetRequestsRequest(input *DescribeSpotFleetRequestsInput) (req *request.Request, output *DescribeSpotFleetRequestsOutput) { + op := &request.Operation{ Name: opDescribeSpotFleetRequests, HTTPMethod: "POST", HTTPPath: "/", @@ -3878,8 +3883,8 @@ func (c *EC2) DescribeSpotFleetRequests(input *DescribeSpotFleetRequestsInput) ( const opDescribeSpotInstanceRequests = "DescribeSpotInstanceRequests" // DescribeSpotInstanceRequestsRequest generates a request for the DescribeSpotInstanceRequests operation. -func (c *EC2) DescribeSpotInstanceRequestsRequest(input *DescribeSpotInstanceRequestsInput) (req *aws.Request, output *DescribeSpotInstanceRequestsOutput) { - op := &aws.Operation{ +func (c *EC2) DescribeSpotInstanceRequestsRequest(input *DescribeSpotInstanceRequestsInput) (req *request.Request, output *DescribeSpotInstanceRequestsOutput) { + op := &request.Operation{ Name: opDescribeSpotInstanceRequests, HTTPMethod: "POST", HTTPPath: "/", @@ -3895,15 +3900,15 @@ func (c *EC2) DescribeSpotInstanceRequestsRequest(input *DescribeSpotInstanceReq return } -// Describes the Spot Instance requests that belong to your account. Spot Instances +// Describes the Spot instance requests that belong to your account. Spot instances // are instances that Amazon EC2 launches when the bid price that you specify -// exceeds the current Spot Price. Amazon EC2 periodically sets the Spot Price -// based on available Spot Instance capacity and current Spot Instance requests. +// exceeds the current Spot price. Amazon EC2 periodically sets the Spot price +// based on available Spot instance capacity and current Spot instance requests. // For more information, see Spot Instance Requests (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/spot-requests.html) // in the Amazon Elastic Compute Cloud User Guide. // -// You can use DescribeSpotInstanceRequests to find a running Spot Instance -// by examining the response. If the status of the Spot Instance is fulfilled, +// You can use DescribeSpotInstanceRequests to find a running Spot instance +// by examining the response. If the status of the Spot instance is fulfilled, // the instance ID appears in the response and contains the identifier of the // instance. Alternatively, you can use DescribeInstances with a filter to look // for instances where the instance lifecycle is spot. @@ -3916,12 +3921,12 @@ func (c *EC2) DescribeSpotInstanceRequests(input *DescribeSpotInstanceRequestsIn const opDescribeSpotPriceHistory = "DescribeSpotPriceHistory" // DescribeSpotPriceHistoryRequest generates a request for the DescribeSpotPriceHistory operation. -func (c *EC2) DescribeSpotPriceHistoryRequest(input *DescribeSpotPriceHistoryInput) (req *aws.Request, output *DescribeSpotPriceHistoryOutput) { - op := &aws.Operation{ +func (c *EC2) DescribeSpotPriceHistoryRequest(input *DescribeSpotPriceHistoryInput) (req *request.Request, output *DescribeSpotPriceHistoryOutput) { + op := &request.Operation{ Name: opDescribeSpotPriceHistory, HTTPMethod: "POST", HTTPPath: "/", - Paginator: &aws.Paginator{ + Paginator: &request.Paginator{ InputTokens: []string{"NextToken"}, OutputTokens: []string{"NextToken"}, LimitToken: "MaxResults", @@ -3939,7 +3944,7 @@ func (c *EC2) DescribeSpotPriceHistoryRequest(input *DescribeSpotPriceHistoryInp return } -// Describes the Spot Price history. The prices returned are listed in chronological +// Describes the Spot price history. The prices returned are listed in chronological // order, from the oldest to the most recent, for up to the past 90 days. For // more information, see Spot Instance Pricing History (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-spot-instances-history.html) // in the Amazon Elastic Compute Cloud User Guide. @@ -3964,8 +3969,8 @@ func (c *EC2) DescribeSpotPriceHistoryPages(input *DescribeSpotPriceHistoryInput const opDescribeSubnets = "DescribeSubnets" // DescribeSubnetsRequest generates a request for the DescribeSubnets operation. -func (c *EC2) DescribeSubnetsRequest(input *DescribeSubnetsInput) (req *aws.Request, output *DescribeSubnetsOutput) { - op := &aws.Operation{ +func (c *EC2) DescribeSubnetsRequest(input *DescribeSubnetsInput) (req *request.Request, output *DescribeSubnetsOutput) { + op := &request.Operation{ Name: opDescribeSubnets, HTTPMethod: "POST", HTTPPath: "/", @@ -3994,8 +3999,8 @@ func (c *EC2) DescribeSubnets(input *DescribeSubnetsInput) (*DescribeSubnetsOutp const opDescribeTags = "DescribeTags" // DescribeTagsRequest generates a request for the DescribeTags operation. -func (c *EC2) DescribeTagsRequest(input *DescribeTagsInput) (req *aws.Request, output *DescribeTagsOutput) { - op := &aws.Operation{ +func (c *EC2) DescribeTagsRequest(input *DescribeTagsInput) (req *request.Request, output *DescribeTagsOutput) { + op := &request.Operation{ Name: opDescribeTags, HTTPMethod: "POST", HTTPPath: "/", @@ -4021,237 +4026,11 @@ func (c *EC2) DescribeTags(input *DescribeTagsInput) (*DescribeTagsOutput, error return out, err } -const opDescribeVPCAttribute = "DescribeVpcAttribute" - -// DescribeVPCAttributeRequest generates a request for the DescribeVPCAttribute operation. -func (c *EC2) DescribeVPCAttributeRequest(input *DescribeVPCAttributeInput) (req *aws.Request, output *DescribeVPCAttributeOutput) { - op := &aws.Operation{ - Name: opDescribeVPCAttribute, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &DescribeVPCAttributeInput{} - } - - req = c.newRequest(op, input, output) - output = &DescribeVPCAttributeOutput{} - req.Data = output - return -} - -// Describes the specified attribute of the specified VPC. You can specify only -// one attribute at a time. -func (c *EC2) DescribeVPCAttribute(input *DescribeVPCAttributeInput) (*DescribeVPCAttributeOutput, error) { - req, out := c.DescribeVPCAttributeRequest(input) - err := req.Send() - return out, err -} - -const opDescribeVPCClassicLink = "DescribeVpcClassicLink" - -// DescribeVPCClassicLinkRequest generates a request for the DescribeVPCClassicLink operation. -func (c *EC2) DescribeVPCClassicLinkRequest(input *DescribeVPCClassicLinkInput) (req *aws.Request, output *DescribeVPCClassicLinkOutput) { - op := &aws.Operation{ - Name: opDescribeVPCClassicLink, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &DescribeVPCClassicLinkInput{} - } - - req = c.newRequest(op, input, output) - output = &DescribeVPCClassicLinkOutput{} - req.Data = output - return -} - -// Describes the ClassicLink status of one or more VPCs. -func (c *EC2) DescribeVPCClassicLink(input *DescribeVPCClassicLinkInput) (*DescribeVPCClassicLinkOutput, error) { - req, out := c.DescribeVPCClassicLinkRequest(input) - err := req.Send() - return out, err -} - -const opDescribeVPCEndpointServices = "DescribeVpcEndpointServices" - -// DescribeVPCEndpointServicesRequest generates a request for the DescribeVPCEndpointServices operation. -func (c *EC2) DescribeVPCEndpointServicesRequest(input *DescribeVPCEndpointServicesInput) (req *aws.Request, output *DescribeVPCEndpointServicesOutput) { - op := &aws.Operation{ - Name: opDescribeVPCEndpointServices, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &DescribeVPCEndpointServicesInput{} - } - - req = c.newRequest(op, input, output) - output = &DescribeVPCEndpointServicesOutput{} - req.Data = output - return -} - -// Describes all supported AWS services that can be specified when creating -// a VPC endpoint. -func (c *EC2) DescribeVPCEndpointServices(input *DescribeVPCEndpointServicesInput) (*DescribeVPCEndpointServicesOutput, error) { - req, out := c.DescribeVPCEndpointServicesRequest(input) - err := req.Send() - return out, err -} - -const opDescribeVPCEndpoints = "DescribeVpcEndpoints" - -// DescribeVPCEndpointsRequest generates a request for the DescribeVPCEndpoints operation. -func (c *EC2) DescribeVPCEndpointsRequest(input *DescribeVPCEndpointsInput) (req *aws.Request, output *DescribeVPCEndpointsOutput) { - op := &aws.Operation{ - Name: opDescribeVPCEndpoints, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &DescribeVPCEndpointsInput{} - } - - req = c.newRequest(op, input, output) - output = &DescribeVPCEndpointsOutput{} - req.Data = output - return -} - -// Describes one or more of your VPC endpoints. -func (c *EC2) DescribeVPCEndpoints(input *DescribeVPCEndpointsInput) (*DescribeVPCEndpointsOutput, error) { - req, out := c.DescribeVPCEndpointsRequest(input) - err := req.Send() - return out, err -} - -const opDescribeVPCPeeringConnections = "DescribeVpcPeeringConnections" - -// DescribeVPCPeeringConnectionsRequest generates a request for the DescribeVPCPeeringConnections operation. -func (c *EC2) DescribeVPCPeeringConnectionsRequest(input *DescribeVPCPeeringConnectionsInput) (req *aws.Request, output *DescribeVPCPeeringConnectionsOutput) { - op := &aws.Operation{ - Name: opDescribeVPCPeeringConnections, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &DescribeVPCPeeringConnectionsInput{} - } - - req = c.newRequest(op, input, output) - output = &DescribeVPCPeeringConnectionsOutput{} - req.Data = output - return -} - -// Describes one or more of your VPC peering connections. -func (c *EC2) DescribeVPCPeeringConnections(input *DescribeVPCPeeringConnectionsInput) (*DescribeVPCPeeringConnectionsOutput, error) { - req, out := c.DescribeVPCPeeringConnectionsRequest(input) - err := req.Send() - return out, err -} - -const opDescribeVPCs = "DescribeVpcs" - -// DescribeVPCsRequest generates a request for the DescribeVPCs operation. -func (c *EC2) DescribeVPCsRequest(input *DescribeVPCsInput) (req *aws.Request, output *DescribeVPCsOutput) { - op := &aws.Operation{ - Name: opDescribeVPCs, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &DescribeVPCsInput{} - } - - req = c.newRequest(op, input, output) - output = &DescribeVPCsOutput{} - req.Data = output - return -} - -// Describes one or more of your VPCs. -func (c *EC2) DescribeVPCs(input *DescribeVPCsInput) (*DescribeVPCsOutput, error) { - req, out := c.DescribeVPCsRequest(input) - err := req.Send() - return out, err -} - -const opDescribeVPNConnections = "DescribeVpnConnections" - -// DescribeVPNConnectionsRequest generates a request for the DescribeVPNConnections operation. -func (c *EC2) DescribeVPNConnectionsRequest(input *DescribeVPNConnectionsInput) (req *aws.Request, output *DescribeVPNConnectionsOutput) { - op := &aws.Operation{ - Name: opDescribeVPNConnections, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &DescribeVPNConnectionsInput{} - } - - req = c.newRequest(op, input, output) - output = &DescribeVPNConnectionsOutput{} - req.Data = output - return -} - -// Describes one or more of your VPN connections. -// -// For more information about VPN connections, see Adding a Hardware Virtual -// Private Gateway to Your VPC (http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/VPC_VPN.html) -// in the Amazon Virtual Private Cloud User Guide. -func (c *EC2) DescribeVPNConnections(input *DescribeVPNConnectionsInput) (*DescribeVPNConnectionsOutput, error) { - req, out := c.DescribeVPNConnectionsRequest(input) - err := req.Send() - return out, err -} - -const opDescribeVPNGateways = "DescribeVpnGateways" - -// DescribeVPNGatewaysRequest generates a request for the DescribeVPNGateways operation. -func (c *EC2) DescribeVPNGatewaysRequest(input *DescribeVPNGatewaysInput) (req *aws.Request, output *DescribeVPNGatewaysOutput) { - op := &aws.Operation{ - Name: opDescribeVPNGateways, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &DescribeVPNGatewaysInput{} - } - - req = c.newRequest(op, input, output) - output = &DescribeVPNGatewaysOutput{} - req.Data = output - return -} - -// Describes one or more of your virtual private gateways. -// -// For more information about virtual private gateways, see Adding an IPsec -// Hardware VPN to Your VPC (http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/VPC_VPN.html) -// in the Amazon Virtual Private Cloud User Guide. -func (c *EC2) DescribeVPNGateways(input *DescribeVPNGatewaysInput) (*DescribeVPNGatewaysOutput, error) { - req, out := c.DescribeVPNGatewaysRequest(input) - err := req.Send() - return out, err -} - const opDescribeVolumeAttribute = "DescribeVolumeAttribute" // DescribeVolumeAttributeRequest generates a request for the DescribeVolumeAttribute operation. -func (c *EC2) DescribeVolumeAttributeRequest(input *DescribeVolumeAttributeInput) (req *aws.Request, output *DescribeVolumeAttributeOutput) { - op := &aws.Operation{ +func (c *EC2) DescribeVolumeAttributeRequest(input *DescribeVolumeAttributeInput) (req *request.Request, output *DescribeVolumeAttributeOutput) { + op := &request.Operation{ Name: opDescribeVolumeAttribute, HTTPMethod: "POST", HTTPPath: "/", @@ -4281,12 +4060,12 @@ func (c *EC2) DescribeVolumeAttribute(input *DescribeVolumeAttributeInput) (*Des const opDescribeVolumeStatus = "DescribeVolumeStatus" // DescribeVolumeStatusRequest generates a request for the DescribeVolumeStatus operation. -func (c *EC2) DescribeVolumeStatusRequest(input *DescribeVolumeStatusInput) (req *aws.Request, output *DescribeVolumeStatusOutput) { - op := &aws.Operation{ +func (c *EC2) DescribeVolumeStatusRequest(input *DescribeVolumeStatusInput) (req *request.Request, output *DescribeVolumeStatusOutput) { + op := &request.Operation{ Name: opDescribeVolumeStatus, HTTPMethod: "POST", HTTPPath: "/", - Paginator: &aws.Paginator{ + Paginator: &request.Paginator{ InputTokens: []string{"NextToken"}, OutputTokens: []string{"NextToken"}, LimitToken: "MaxResults", @@ -4355,12 +4134,12 @@ func (c *EC2) DescribeVolumeStatusPages(input *DescribeVolumeStatusInput, fn fun const opDescribeVolumes = "DescribeVolumes" // DescribeVolumesRequest generates a request for the DescribeVolumes operation. -func (c *EC2) DescribeVolumesRequest(input *DescribeVolumesInput) (req *aws.Request, output *DescribeVolumesOutput) { - op := &aws.Operation{ +func (c *EC2) DescribeVolumesRequest(input *DescribeVolumesInput) (req *request.Request, output *DescribeVolumesOutput) { + op := &request.Operation{ Name: opDescribeVolumes, HTTPMethod: "POST", HTTPPath: "/", - Paginator: &aws.Paginator{ + Paginator: &request.Paginator{ InputTokens: []string{"NextToken"}, OutputTokens: []string{"NextToken"}, LimitToken: "MaxResults", @@ -4402,22 +4181,248 @@ func (c *EC2) DescribeVolumesPages(input *DescribeVolumesInput, fn func(p *Descr }) } -const opDetachClassicLinkVPC = "DetachClassicLinkVpc" +const opDescribeVpcAttribute = "DescribeVpcAttribute" -// DetachClassicLinkVPCRequest generates a request for the DetachClassicLinkVPC operation. -func (c *EC2) DetachClassicLinkVPCRequest(input *DetachClassicLinkVPCInput) (req *aws.Request, output *DetachClassicLinkVPCOutput) { - op := &aws.Operation{ - Name: opDetachClassicLinkVPC, +// DescribeVpcAttributeRequest generates a request for the DescribeVpcAttribute operation. +func (c *EC2) DescribeVpcAttributeRequest(input *DescribeVpcAttributeInput) (req *request.Request, output *DescribeVpcAttributeOutput) { + op := &request.Operation{ + Name: opDescribeVpcAttribute, HTTPMethod: "POST", HTTPPath: "/", } if input == nil { - input = &DetachClassicLinkVPCInput{} + input = &DescribeVpcAttributeInput{} } req = c.newRequest(op, input, output) - output = &DetachClassicLinkVPCOutput{} + output = &DescribeVpcAttributeOutput{} + req.Data = output + return +} + +// Describes the specified attribute of the specified VPC. You can specify only +// one attribute at a time. +func (c *EC2) DescribeVpcAttribute(input *DescribeVpcAttributeInput) (*DescribeVpcAttributeOutput, error) { + req, out := c.DescribeVpcAttributeRequest(input) + err := req.Send() + return out, err +} + +const opDescribeVpcClassicLink = "DescribeVpcClassicLink" + +// DescribeVpcClassicLinkRequest generates a request for the DescribeVpcClassicLink operation. +func (c *EC2) DescribeVpcClassicLinkRequest(input *DescribeVpcClassicLinkInput) (req *request.Request, output *DescribeVpcClassicLinkOutput) { + op := &request.Operation{ + Name: opDescribeVpcClassicLink, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &DescribeVpcClassicLinkInput{} + } + + req = c.newRequest(op, input, output) + output = &DescribeVpcClassicLinkOutput{} + req.Data = output + return +} + +// Describes the ClassicLink status of one or more VPCs. +func (c *EC2) DescribeVpcClassicLink(input *DescribeVpcClassicLinkInput) (*DescribeVpcClassicLinkOutput, error) { + req, out := c.DescribeVpcClassicLinkRequest(input) + err := req.Send() + return out, err +} + +const opDescribeVpcEndpointServices = "DescribeVpcEndpointServices" + +// DescribeVpcEndpointServicesRequest generates a request for the DescribeVpcEndpointServices operation. +func (c *EC2) DescribeVpcEndpointServicesRequest(input *DescribeVpcEndpointServicesInput) (req *request.Request, output *DescribeVpcEndpointServicesOutput) { + op := &request.Operation{ + Name: opDescribeVpcEndpointServices, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &DescribeVpcEndpointServicesInput{} + } + + req = c.newRequest(op, input, output) + output = &DescribeVpcEndpointServicesOutput{} + req.Data = output + return +} + +// Describes all supported AWS services that can be specified when creating +// a VPC endpoint. +func (c *EC2) DescribeVpcEndpointServices(input *DescribeVpcEndpointServicesInput) (*DescribeVpcEndpointServicesOutput, error) { + req, out := c.DescribeVpcEndpointServicesRequest(input) + err := req.Send() + return out, err +} + +const opDescribeVpcEndpoints = "DescribeVpcEndpoints" + +// DescribeVpcEndpointsRequest generates a request for the DescribeVpcEndpoints operation. +func (c *EC2) DescribeVpcEndpointsRequest(input *DescribeVpcEndpointsInput) (req *request.Request, output *DescribeVpcEndpointsOutput) { + op := &request.Operation{ + Name: opDescribeVpcEndpoints, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &DescribeVpcEndpointsInput{} + } + + req = c.newRequest(op, input, output) + output = &DescribeVpcEndpointsOutput{} + req.Data = output + return +} + +// Describes one or more of your VPC endpoints. +func (c *EC2) DescribeVpcEndpoints(input *DescribeVpcEndpointsInput) (*DescribeVpcEndpointsOutput, error) { + req, out := c.DescribeVpcEndpointsRequest(input) + err := req.Send() + return out, err +} + +const opDescribeVpcPeeringConnections = "DescribeVpcPeeringConnections" + +// DescribeVpcPeeringConnectionsRequest generates a request for the DescribeVpcPeeringConnections operation. +func (c *EC2) DescribeVpcPeeringConnectionsRequest(input *DescribeVpcPeeringConnectionsInput) (req *request.Request, output *DescribeVpcPeeringConnectionsOutput) { + op := &request.Operation{ + Name: opDescribeVpcPeeringConnections, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &DescribeVpcPeeringConnectionsInput{} + } + + req = c.newRequest(op, input, output) + output = &DescribeVpcPeeringConnectionsOutput{} + req.Data = output + return +} + +// Describes one or more of your VPC peering connections. +func (c *EC2) DescribeVpcPeeringConnections(input *DescribeVpcPeeringConnectionsInput) (*DescribeVpcPeeringConnectionsOutput, error) { + req, out := c.DescribeVpcPeeringConnectionsRequest(input) + err := req.Send() + return out, err +} + +const opDescribeVpcs = "DescribeVpcs" + +// DescribeVpcsRequest generates a request for the DescribeVpcs operation. +func (c *EC2) DescribeVpcsRequest(input *DescribeVpcsInput) (req *request.Request, output *DescribeVpcsOutput) { + op := &request.Operation{ + Name: opDescribeVpcs, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &DescribeVpcsInput{} + } + + req = c.newRequest(op, input, output) + output = &DescribeVpcsOutput{} + req.Data = output + return +} + +// Describes one or more of your VPCs. +func (c *EC2) DescribeVpcs(input *DescribeVpcsInput) (*DescribeVpcsOutput, error) { + req, out := c.DescribeVpcsRequest(input) + err := req.Send() + return out, err +} + +const opDescribeVpnConnections = "DescribeVpnConnections" + +// DescribeVpnConnectionsRequest generates a request for the DescribeVpnConnections operation. +func (c *EC2) DescribeVpnConnectionsRequest(input *DescribeVpnConnectionsInput) (req *request.Request, output *DescribeVpnConnectionsOutput) { + op := &request.Operation{ + Name: opDescribeVpnConnections, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &DescribeVpnConnectionsInput{} + } + + req = c.newRequest(op, input, output) + output = &DescribeVpnConnectionsOutput{} + req.Data = output + return +} + +// Describes one or more of your VPN connections. +// +// For more information about VPN connections, see Adding a Hardware Virtual +// Private Gateway to Your VPC (http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/VPC_VPN.html) +// in the Amazon Virtual Private Cloud User Guide. +func (c *EC2) DescribeVpnConnections(input *DescribeVpnConnectionsInput) (*DescribeVpnConnectionsOutput, error) { + req, out := c.DescribeVpnConnectionsRequest(input) + err := req.Send() + return out, err +} + +const opDescribeVpnGateways = "DescribeVpnGateways" + +// DescribeVpnGatewaysRequest generates a request for the DescribeVpnGateways operation. +func (c *EC2) DescribeVpnGatewaysRequest(input *DescribeVpnGatewaysInput) (req *request.Request, output *DescribeVpnGatewaysOutput) { + op := &request.Operation{ + Name: opDescribeVpnGateways, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &DescribeVpnGatewaysInput{} + } + + req = c.newRequest(op, input, output) + output = &DescribeVpnGatewaysOutput{} + req.Data = output + return +} + +// Describes one or more of your virtual private gateways. +// +// For more information about virtual private gateways, see Adding an IPsec +// Hardware VPN to Your VPC (http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/VPC_VPN.html) +// in the Amazon Virtual Private Cloud User Guide. +func (c *EC2) DescribeVpnGateways(input *DescribeVpnGatewaysInput) (*DescribeVpnGatewaysOutput, error) { + req, out := c.DescribeVpnGatewaysRequest(input) + err := req.Send() + return out, err +} + +const opDetachClassicLinkVpc = "DetachClassicLinkVpc" + +// DetachClassicLinkVpcRequest generates a request for the DetachClassicLinkVpc operation. +func (c *EC2) DetachClassicLinkVpcRequest(input *DetachClassicLinkVpcInput) (req *request.Request, output *DetachClassicLinkVpcOutput) { + op := &request.Operation{ + Name: opDetachClassicLinkVpc, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &DetachClassicLinkVpcInput{} + } + + req = c.newRequest(op, input, output) + output = &DetachClassicLinkVpcOutput{} req.Data = output return } @@ -4425,8 +4430,8 @@ func (c *EC2) DetachClassicLinkVPCRequest(input *DetachClassicLinkVPCInput) (req // Unlinks (detaches) a linked EC2-Classic instance from a VPC. After the instance // has been unlinked, the VPC security groups are no longer associated with // it. An instance is automatically unlinked from a VPC when it's stopped. -func (c *EC2) DetachClassicLinkVPC(input *DetachClassicLinkVPCInput) (*DetachClassicLinkVPCOutput, error) { - req, out := c.DetachClassicLinkVPCRequest(input) +func (c *EC2) DetachClassicLinkVpc(input *DetachClassicLinkVpcInput) (*DetachClassicLinkVpcOutput, error) { + req, out := c.DetachClassicLinkVpcRequest(input) err := req.Send() return out, err } @@ -4434,8 +4439,8 @@ func (c *EC2) DetachClassicLinkVPC(input *DetachClassicLinkVPCInput) (*DetachCla const opDetachInternetGateway = "DetachInternetGateway" // DetachInternetGatewayRequest generates a request for the DetachInternetGateway operation. -func (c *EC2) DetachInternetGatewayRequest(input *DetachInternetGatewayInput) (req *aws.Request, output *DetachInternetGatewayOutput) { - op := &aws.Operation{ +func (c *EC2) DetachInternetGatewayRequest(input *DetachInternetGatewayInput) (req *request.Request, output *DetachInternetGatewayOutput) { + op := &request.Operation{ Name: opDetachInternetGateway, HTTPMethod: "POST", HTTPPath: "/", @@ -4463,8 +4468,8 @@ func (c *EC2) DetachInternetGateway(input *DetachInternetGatewayInput) (*DetachI const opDetachNetworkInterface = "DetachNetworkInterface" // DetachNetworkInterfaceRequest generates a request for the DetachNetworkInterface operation. -func (c *EC2) DetachNetworkInterfaceRequest(input *DetachNetworkInterfaceInput) (req *aws.Request, output *DetachNetworkInterfaceOutput) { - op := &aws.Operation{ +func (c *EC2) DetachNetworkInterfaceRequest(input *DetachNetworkInterfaceInput) (req *request.Request, output *DetachNetworkInterfaceOutput) { + op := &request.Operation{ Name: opDetachNetworkInterface, HTTPMethod: "POST", HTTPPath: "/", @@ -4487,45 +4492,11 @@ func (c *EC2) DetachNetworkInterface(input *DetachNetworkInterfaceInput) (*Detac return out, err } -const opDetachVPNGateway = "DetachVpnGateway" - -// DetachVPNGatewayRequest generates a request for the DetachVPNGateway operation. -func (c *EC2) DetachVPNGatewayRequest(input *DetachVPNGatewayInput) (req *aws.Request, output *DetachVPNGatewayOutput) { - op := &aws.Operation{ - Name: opDetachVPNGateway, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &DetachVPNGatewayInput{} - } - - req = c.newRequest(op, input, output) - output = &DetachVPNGatewayOutput{} - req.Data = output - return -} - -// Detaches a virtual private gateway from a VPC. You do this if you're planning -// to turn off the VPC and not use it anymore. You can confirm a virtual private -// gateway has been completely detached from a VPC by describing the virtual -// private gateway (any attachments to the virtual private gateway are also -// described). -// -// You must wait for the attachment's state to switch to detached before you -// can delete the VPC or attach a different VPC to the virtual private gateway. -func (c *EC2) DetachVPNGateway(input *DetachVPNGatewayInput) (*DetachVPNGatewayOutput, error) { - req, out := c.DetachVPNGatewayRequest(input) - err := req.Send() - return out, err -} - const opDetachVolume = "DetachVolume" // DetachVolumeRequest generates a request for the DetachVolume operation. -func (c *EC2) DetachVolumeRequest(input *DetachVolumeInput) (req *aws.Request, output *VolumeAttachment) { - op := &aws.Operation{ +func (c *EC2) DetachVolumeRequest(input *DetachVolumeInput) (req *request.Request, output *VolumeAttachment) { + op := &request.Operation{ Name: opDetachVolume, HTTPMethod: "POST", HTTPPath: "/", @@ -4560,58 +4531,92 @@ func (c *EC2) DetachVolume(input *DetachVolumeInput) (*VolumeAttachment, error) return out, err } -const opDisableVGWRoutePropagation = "DisableVgwRoutePropagation" +const opDetachVpnGateway = "DetachVpnGateway" -// DisableVGWRoutePropagationRequest generates a request for the DisableVGWRoutePropagation operation. -func (c *EC2) DisableVGWRoutePropagationRequest(input *DisableVGWRoutePropagationInput) (req *aws.Request, output *DisableVGWRoutePropagationOutput) { - op := &aws.Operation{ - Name: opDisableVGWRoutePropagation, +// DetachVpnGatewayRequest generates a request for the DetachVpnGateway operation. +func (c *EC2) DetachVpnGatewayRequest(input *DetachVpnGatewayInput) (req *request.Request, output *DetachVpnGatewayOutput) { + op := &request.Operation{ + Name: opDetachVpnGateway, HTTPMethod: "POST", HTTPPath: "/", } if input == nil { - input = &DisableVGWRoutePropagationInput{} + input = &DetachVpnGatewayInput{} } req = c.newRequest(op, input, output) - output = &DisableVGWRoutePropagationOutput{} + output = &DetachVpnGatewayOutput{} + req.Data = output + return +} + +// Detaches a virtual private gateway from a VPC. You do this if you're planning +// to turn off the VPC and not use it anymore. You can confirm a virtual private +// gateway has been completely detached from a VPC by describing the virtual +// private gateway (any attachments to the virtual private gateway are also +// described). +// +// You must wait for the attachment's state to switch to detached before you +// can delete the VPC or attach a different VPC to the virtual private gateway. +func (c *EC2) DetachVpnGateway(input *DetachVpnGatewayInput) (*DetachVpnGatewayOutput, error) { + req, out := c.DetachVpnGatewayRequest(input) + err := req.Send() + return out, err +} + +const opDisableVgwRoutePropagation = "DisableVgwRoutePropagation" + +// DisableVgwRoutePropagationRequest generates a request for the DisableVgwRoutePropagation operation. +func (c *EC2) DisableVgwRoutePropagationRequest(input *DisableVgwRoutePropagationInput) (req *request.Request, output *DisableVgwRoutePropagationOutput) { + op := &request.Operation{ + Name: opDisableVgwRoutePropagation, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &DisableVgwRoutePropagationInput{} + } + + req = c.newRequest(op, input, output) + output = &DisableVgwRoutePropagationOutput{} req.Data = output return } // Disables a virtual private gateway (VGW) from propagating routes to a specified // route table of a VPC. -func (c *EC2) DisableVGWRoutePropagation(input *DisableVGWRoutePropagationInput) (*DisableVGWRoutePropagationOutput, error) { - req, out := c.DisableVGWRoutePropagationRequest(input) +func (c *EC2) DisableVgwRoutePropagation(input *DisableVgwRoutePropagationInput) (*DisableVgwRoutePropagationOutput, error) { + req, out := c.DisableVgwRoutePropagationRequest(input) err := req.Send() return out, err } -const opDisableVPCClassicLink = "DisableVpcClassicLink" +const opDisableVpcClassicLink = "DisableVpcClassicLink" -// DisableVPCClassicLinkRequest generates a request for the DisableVPCClassicLink operation. -func (c *EC2) DisableVPCClassicLinkRequest(input *DisableVPCClassicLinkInput) (req *aws.Request, output *DisableVPCClassicLinkOutput) { - op := &aws.Operation{ - Name: opDisableVPCClassicLink, +// DisableVpcClassicLinkRequest generates a request for the DisableVpcClassicLink operation. +func (c *EC2) DisableVpcClassicLinkRequest(input *DisableVpcClassicLinkInput) (req *request.Request, output *DisableVpcClassicLinkOutput) { + op := &request.Operation{ + Name: opDisableVpcClassicLink, HTTPMethod: "POST", HTTPPath: "/", } if input == nil { - input = &DisableVPCClassicLinkInput{} + input = &DisableVpcClassicLinkInput{} } req = c.newRequest(op, input, output) - output = &DisableVPCClassicLinkOutput{} + output = &DisableVpcClassicLinkOutput{} req.Data = output return } // Disables ClassicLink for a VPC. You cannot disable ClassicLink for a VPC // that has EC2-Classic instances linked to it. -func (c *EC2) DisableVPCClassicLink(input *DisableVPCClassicLinkInput) (*DisableVPCClassicLinkOutput, error) { - req, out := c.DisableVPCClassicLinkRequest(input) +func (c *EC2) DisableVpcClassicLink(input *DisableVpcClassicLinkInput) (*DisableVpcClassicLinkOutput, error) { + req, out := c.DisableVpcClassicLinkRequest(input) err := req.Send() return out, err } @@ -4619,8 +4624,8 @@ func (c *EC2) DisableVPCClassicLink(input *DisableVPCClassicLinkInput) (*Disable const opDisassociateAddress = "DisassociateAddress" // DisassociateAddressRequest generates a request for the DisassociateAddress operation. -func (c *EC2) DisassociateAddressRequest(input *DisassociateAddressInput) (req *aws.Request, output *DisassociateAddressOutput) { - op := &aws.Operation{ +func (c *EC2) DisassociateAddressRequest(input *DisassociateAddressInput) (req *request.Request, output *DisassociateAddressOutput) { + op := &request.Operation{ Name: opDisassociateAddress, HTTPMethod: "POST", HTTPPath: "/", @@ -4654,8 +4659,8 @@ func (c *EC2) DisassociateAddress(input *DisassociateAddressInput) (*Disassociat const opDisassociateRouteTable = "DisassociateRouteTable" // DisassociateRouteTableRequest generates a request for the DisassociateRouteTable operation. -func (c *EC2) DisassociateRouteTableRequest(input *DisassociateRouteTableInput) (req *aws.Request, output *DisassociateRouteTableOutput) { - op := &aws.Operation{ +func (c *EC2) DisassociateRouteTableRequest(input *DisassociateRouteTableInput) (req *request.Request, output *DisassociateRouteTableOutput) { + op := &request.Operation{ Name: opDisassociateRouteTable, HTTPMethod: "POST", HTTPPath: "/", @@ -4683,63 +4688,30 @@ func (c *EC2) DisassociateRouteTable(input *DisassociateRouteTableInput) (*Disas return out, err } -const opEnableVGWRoutePropagation = "EnableVgwRoutePropagation" +const opEnableVgwRoutePropagation = "EnableVgwRoutePropagation" -// EnableVGWRoutePropagationRequest generates a request for the EnableVGWRoutePropagation operation. -func (c *EC2) EnableVGWRoutePropagationRequest(input *EnableVGWRoutePropagationInput) (req *aws.Request, output *EnableVGWRoutePropagationOutput) { - op := &aws.Operation{ - Name: opEnableVGWRoutePropagation, +// EnableVgwRoutePropagationRequest generates a request for the EnableVgwRoutePropagation operation. +func (c *EC2) EnableVgwRoutePropagationRequest(input *EnableVgwRoutePropagationInput) (req *request.Request, output *EnableVgwRoutePropagationOutput) { + op := &request.Operation{ + Name: opEnableVgwRoutePropagation, HTTPMethod: "POST", HTTPPath: "/", } if input == nil { - input = &EnableVGWRoutePropagationInput{} + input = &EnableVgwRoutePropagationInput{} } req = c.newRequest(op, input, output) - output = &EnableVGWRoutePropagationOutput{} + output = &EnableVgwRoutePropagationOutput{} req.Data = output return } // Enables a virtual private gateway (VGW) to propagate routes to the specified // route table of a VPC. -func (c *EC2) EnableVGWRoutePropagation(input *EnableVGWRoutePropagationInput) (*EnableVGWRoutePropagationOutput, error) { - req, out := c.EnableVGWRoutePropagationRequest(input) - err := req.Send() - return out, err -} - -const opEnableVPCClassicLink = "EnableVpcClassicLink" - -// EnableVPCClassicLinkRequest generates a request for the EnableVPCClassicLink operation. -func (c *EC2) EnableVPCClassicLinkRequest(input *EnableVPCClassicLinkInput) (req *aws.Request, output *EnableVPCClassicLinkOutput) { - op := &aws.Operation{ - Name: opEnableVPCClassicLink, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &EnableVPCClassicLinkInput{} - } - - req = c.newRequest(op, input, output) - output = &EnableVPCClassicLinkOutput{} - req.Data = output - return -} - -// Enables a VPC for ClassicLink. You can then link EC2-Classic instances to -// your ClassicLink-enabled VPC to allow communication over private IP addresses. -// You cannot enable your VPC for ClassicLink if any of your VPC's route tables -// have existing routes for address ranges within the 10.0.0.0/8 IP address -// range, excluding local routes for VPCs in the 10.0.0.0/16 and 10.1.0.0/16 -// IP address ranges. For more information, see ClassicLink (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/vpc-classiclink.html) -// in the Amazon Elastic Compute Cloud User Guide. -func (c *EC2) EnableVPCClassicLink(input *EnableVPCClassicLinkInput) (*EnableVPCClassicLinkOutput, error) { - req, out := c.EnableVPCClassicLinkRequest(input) +func (c *EC2) EnableVgwRoutePropagation(input *EnableVgwRoutePropagationInput) (*EnableVgwRoutePropagationOutput, error) { + req, out := c.EnableVgwRoutePropagationRequest(input) err := req.Send() return out, err } @@ -4747,8 +4719,8 @@ func (c *EC2) EnableVPCClassicLink(input *EnableVPCClassicLinkInput) (*EnableVPC const opEnableVolumeIO = "EnableVolumeIO" // EnableVolumeIORequest generates a request for the EnableVolumeIO operation. -func (c *EC2) EnableVolumeIORequest(input *EnableVolumeIOInput) (req *aws.Request, output *EnableVolumeIOOutput) { - op := &aws.Operation{ +func (c *EC2) EnableVolumeIORequest(input *EnableVolumeIOInput) (req *request.Request, output *EnableVolumeIOOutput) { + op := &request.Operation{ Name: opEnableVolumeIO, HTTPMethod: "POST", HTTPPath: "/", @@ -4772,11 +4744,44 @@ func (c *EC2) EnableVolumeIO(input *EnableVolumeIOInput) (*EnableVolumeIOOutput, return out, err } +const opEnableVpcClassicLink = "EnableVpcClassicLink" + +// EnableVpcClassicLinkRequest generates a request for the EnableVpcClassicLink operation. +func (c *EC2) EnableVpcClassicLinkRequest(input *EnableVpcClassicLinkInput) (req *request.Request, output *EnableVpcClassicLinkOutput) { + op := &request.Operation{ + Name: opEnableVpcClassicLink, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &EnableVpcClassicLinkInput{} + } + + req = c.newRequest(op, input, output) + output = &EnableVpcClassicLinkOutput{} + req.Data = output + return +} + +// Enables a VPC for ClassicLink. You can then link EC2-Classic instances to +// your ClassicLink-enabled VPC to allow communication over private IP addresses. +// You cannot enable your VPC for ClassicLink if any of your VPC's route tables +// have existing routes for address ranges within the 10.0.0.0/8 IP address +// range, excluding local routes for VPCs in the 10.0.0.0/16 and 10.1.0.0/16 +// IP address ranges. For more information, see ClassicLink (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/vpc-classiclink.html) +// in the Amazon Elastic Compute Cloud User Guide. +func (c *EC2) EnableVpcClassicLink(input *EnableVpcClassicLinkInput) (*EnableVpcClassicLinkOutput, error) { + req, out := c.EnableVpcClassicLinkRequest(input) + err := req.Send() + return out, err +} + const opGetConsoleOutput = "GetConsoleOutput" // GetConsoleOutputRequest generates a request for the GetConsoleOutput operation. -func (c *EC2) GetConsoleOutputRequest(input *GetConsoleOutputInput) (req *aws.Request, output *GetConsoleOutputOutput) { - op := &aws.Operation{ +func (c *EC2) GetConsoleOutputRequest(input *GetConsoleOutputInput) (req *request.Request, output *GetConsoleOutputOutput) { + op := &request.Operation{ Name: opGetConsoleOutput, HTTPMethod: "POST", HTTPPath: "/", @@ -4819,8 +4824,8 @@ func (c *EC2) GetConsoleOutput(input *GetConsoleOutputInput) (*GetConsoleOutputO const opGetPasswordData = "GetPasswordData" // GetPasswordDataRequest generates a request for the GetPasswordData operation. -func (c *EC2) GetPasswordDataRequest(input *GetPasswordDataInput) (req *aws.Request, output *GetPasswordDataOutput) { - op := &aws.Operation{ +func (c *EC2) GetPasswordDataRequest(input *GetPasswordDataInput) (req *request.Request, output *GetPasswordDataOutput) { + op := &request.Operation{ Name: opGetPasswordData, HTTPMethod: "POST", HTTPPath: "/", @@ -4859,8 +4864,8 @@ func (c *EC2) GetPasswordData(input *GetPasswordDataInput) (*GetPasswordDataOutp const opImportImage = "ImportImage" // ImportImageRequest generates a request for the ImportImage operation. -func (c *EC2) ImportImageRequest(input *ImportImageInput) (req *aws.Request, output *ImportImageOutput) { - op := &aws.Operation{ +func (c *EC2) ImportImageRequest(input *ImportImageInput) (req *request.Request, output *ImportImageOutput) { + op := &request.Operation{ Name: opImportImage, HTTPMethod: "POST", HTTPPath: "/", @@ -4887,8 +4892,8 @@ func (c *EC2) ImportImage(input *ImportImageInput) (*ImportImageOutput, error) { const opImportInstance = "ImportInstance" // ImportInstanceRequest generates a request for the ImportInstance operation. -func (c *EC2) ImportInstanceRequest(input *ImportInstanceInput) (req *aws.Request, output *ImportInstanceOutput) { - op := &aws.Operation{ +func (c *EC2) ImportInstanceRequest(input *ImportInstanceInput) (req *request.Request, output *ImportInstanceOutput) { + op := &request.Operation{ Name: opImportInstance, HTTPMethod: "POST", HTTPPath: "/", @@ -4920,8 +4925,8 @@ func (c *EC2) ImportInstance(input *ImportInstanceInput) (*ImportInstanceOutput, const opImportKeyPair = "ImportKeyPair" // ImportKeyPairRequest generates a request for the ImportKeyPair operation. -func (c *EC2) ImportKeyPairRequest(input *ImportKeyPairInput) (req *aws.Request, output *ImportKeyPairOutput) { - op := &aws.Operation{ +func (c *EC2) ImportKeyPairRequest(input *ImportKeyPairInput) (req *request.Request, output *ImportKeyPairOutput) { + op := &request.Operation{ Name: opImportKeyPair, HTTPMethod: "POST", HTTPPath: "/", @@ -4954,8 +4959,8 @@ func (c *EC2) ImportKeyPair(input *ImportKeyPairInput) (*ImportKeyPairOutput, er const opImportSnapshot = "ImportSnapshot" // ImportSnapshotRequest generates a request for the ImportSnapshot operation. -func (c *EC2) ImportSnapshotRequest(input *ImportSnapshotInput) (req *aws.Request, output *ImportSnapshotOutput) { - op := &aws.Operation{ +func (c *EC2) ImportSnapshotRequest(input *ImportSnapshotInput) (req *request.Request, output *ImportSnapshotOutput) { + op := &request.Operation{ Name: opImportSnapshot, HTTPMethod: "POST", HTTPPath: "/", @@ -4981,8 +4986,8 @@ func (c *EC2) ImportSnapshot(input *ImportSnapshotInput) (*ImportSnapshotOutput, const opImportVolume = "ImportVolume" // ImportVolumeRequest generates a request for the ImportVolume operation. -func (c *EC2) ImportVolumeRequest(input *ImportVolumeInput) (req *aws.Request, output *ImportVolumeOutput) { - op := &aws.Operation{ +func (c *EC2) ImportVolumeRequest(input *ImportVolumeInput) (req *request.Request, output *ImportVolumeOutput) { + op := &request.Operation{ Name: opImportVolume, HTTPMethod: "POST", HTTPPath: "/", @@ -5013,8 +5018,8 @@ func (c *EC2) ImportVolume(input *ImportVolumeInput) (*ImportVolumeOutput, error const opModifyImageAttribute = "ModifyImageAttribute" // ModifyImageAttributeRequest generates a request for the ModifyImageAttribute operation. -func (c *EC2) ModifyImageAttributeRequest(input *ModifyImageAttributeInput) (req *aws.Request, output *ModifyImageAttributeOutput) { - op := &aws.Operation{ +func (c *EC2) ModifyImageAttributeRequest(input *ModifyImageAttributeInput) (req *request.Request, output *ModifyImageAttributeOutput) { + op := &request.Operation{ Name: opModifyImageAttribute, HTTPMethod: "POST", HTTPPath: "/", @@ -5044,8 +5049,8 @@ func (c *EC2) ModifyImageAttribute(input *ModifyImageAttributeInput) (*ModifyIma const opModifyInstanceAttribute = "ModifyInstanceAttribute" // ModifyInstanceAttributeRequest generates a request for the ModifyInstanceAttribute operation. -func (c *EC2) ModifyInstanceAttributeRequest(input *ModifyInstanceAttributeInput) (req *aws.Request, output *ModifyInstanceAttributeOutput) { - op := &aws.Operation{ +func (c *EC2) ModifyInstanceAttributeRequest(input *ModifyInstanceAttributeInput) (req *request.Request, output *ModifyInstanceAttributeOutput) { + op := &request.Operation{ Name: opModifyInstanceAttribute, HTTPMethod: "POST", HTTPPath: "/", @@ -5076,8 +5081,8 @@ func (c *EC2) ModifyInstanceAttribute(input *ModifyInstanceAttributeInput) (*Mod const opModifyNetworkInterfaceAttribute = "ModifyNetworkInterfaceAttribute" // ModifyNetworkInterfaceAttributeRequest generates a request for the ModifyNetworkInterfaceAttribute operation. -func (c *EC2) ModifyNetworkInterfaceAttributeRequest(input *ModifyNetworkInterfaceAttributeInput) (req *aws.Request, output *ModifyNetworkInterfaceAttributeOutput) { - op := &aws.Operation{ +func (c *EC2) ModifyNetworkInterfaceAttributeRequest(input *ModifyNetworkInterfaceAttributeInput) (req *request.Request, output *ModifyNetworkInterfaceAttributeOutput) { + op := &request.Operation{ Name: opModifyNetworkInterfaceAttribute, HTTPMethod: "POST", HTTPPath: "/", @@ -5104,8 +5109,8 @@ func (c *EC2) ModifyNetworkInterfaceAttribute(input *ModifyNetworkInterfaceAttri const opModifyReservedInstances = "ModifyReservedInstances" // ModifyReservedInstancesRequest generates a request for the ModifyReservedInstances operation. -func (c *EC2) ModifyReservedInstancesRequest(input *ModifyReservedInstancesInput) (req *aws.Request, output *ModifyReservedInstancesOutput) { - op := &aws.Operation{ +func (c *EC2) ModifyReservedInstancesRequest(input *ModifyReservedInstancesInput) (req *request.Request, output *ModifyReservedInstancesOutput) { + op := &request.Operation{ Name: opModifyReservedInstances, HTTPMethod: "POST", HTTPPath: "/", @@ -5137,8 +5142,8 @@ func (c *EC2) ModifyReservedInstances(input *ModifyReservedInstancesInput) (*Mod const opModifySnapshotAttribute = "ModifySnapshotAttribute" // ModifySnapshotAttributeRequest generates a request for the ModifySnapshotAttribute operation. -func (c *EC2) ModifySnapshotAttributeRequest(input *ModifySnapshotAttributeInput) (req *aws.Request, output *ModifySnapshotAttributeOutput) { - op := &aws.Operation{ +func (c *EC2) ModifySnapshotAttributeRequest(input *ModifySnapshotAttributeInput) (req *request.Request, output *ModifySnapshotAttributeOutput) { + op := &request.Operation{ Name: opModifySnapshotAttribute, HTTPMethod: "POST", HTTPPath: "/", @@ -5171,11 +5176,57 @@ func (c *EC2) ModifySnapshotAttribute(input *ModifySnapshotAttributeInput) (*Mod return out, err } +const opModifySpotFleetRequest = "ModifySpotFleetRequest" + +// ModifySpotFleetRequestRequest generates a request for the ModifySpotFleetRequest operation. +func (c *EC2) ModifySpotFleetRequestRequest(input *ModifySpotFleetRequestInput) (req *request.Request, output *ModifySpotFleetRequestOutput) { + op := &request.Operation{ + Name: opModifySpotFleetRequest, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &ModifySpotFleetRequestInput{} + } + + req = c.newRequest(op, input, output) + output = &ModifySpotFleetRequestOutput{} + req.Data = output + return +} + +// Modifies the specified Spot fleet request. +// +// While the Spot fleet request is being modified, it is in the modifying state. +// +// To scale up your Spot fleet, increase its target capacity. The Spot fleet +// launches the additional Spot instances according to the allocation strategy +// for the Spot fleet request. If the allocation strategy is lowestPrice, the +// Spot fleet launches instances using the Spot pool with the lowest price. +// If the allocation strategy is diversified, the Spot fleet distributes the +// instances across the Spot pools. +// +// To scale down your Spot fleet, decrease its target capacity. First, the +// Spot fleet cancels any open bids that exceed the new target capacity. You +// can request that the Spot fleet terminate Spot instances until the size of +// the fleet no longer exceeds the new target capacity. If the allocation strategy +// is lowestPrice, the Spot fleet terminates the instances with the highest +// price per unit. If the allocation strategy is diversified, the Spot fleet +// terminates instances across the Spot pools. Alternatively, you can request +// that the Spot fleet keep the fleet at its current size, but not replace any +// Spot instances that are interrupted or that you terminate manually. +func (c *EC2) ModifySpotFleetRequest(input *ModifySpotFleetRequestInput) (*ModifySpotFleetRequestOutput, error) { + req, out := c.ModifySpotFleetRequestRequest(input) + err := req.Send() + return out, err +} + const opModifySubnetAttribute = "ModifySubnetAttribute" // ModifySubnetAttributeRequest generates a request for the ModifySubnetAttribute operation. -func (c *EC2) ModifySubnetAttributeRequest(input *ModifySubnetAttributeInput) (req *aws.Request, output *ModifySubnetAttributeOutput) { - op := &aws.Operation{ +func (c *EC2) ModifySubnetAttributeRequest(input *ModifySubnetAttributeInput) (req *request.Request, output *ModifySubnetAttributeOutput) { + op := &request.Operation{ Name: opModifySubnetAttribute, HTTPMethod: "POST", HTTPPath: "/", @@ -5198,67 +5249,11 @@ func (c *EC2) ModifySubnetAttribute(input *ModifySubnetAttributeInput) (*ModifyS return out, err } -const opModifyVPCAttribute = "ModifyVpcAttribute" - -// ModifyVPCAttributeRequest generates a request for the ModifyVPCAttribute operation. -func (c *EC2) ModifyVPCAttributeRequest(input *ModifyVPCAttributeInput) (req *aws.Request, output *ModifyVPCAttributeOutput) { - op := &aws.Operation{ - Name: opModifyVPCAttribute, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &ModifyVPCAttributeInput{} - } - - req = c.newRequest(op, input, output) - output = &ModifyVPCAttributeOutput{} - req.Data = output - return -} - -// Modifies the specified attribute of the specified VPC. -func (c *EC2) ModifyVPCAttribute(input *ModifyVPCAttributeInput) (*ModifyVPCAttributeOutput, error) { - req, out := c.ModifyVPCAttributeRequest(input) - err := req.Send() - return out, err -} - -const opModifyVPCEndpoint = "ModifyVpcEndpoint" - -// ModifyVPCEndpointRequest generates a request for the ModifyVPCEndpoint operation. -func (c *EC2) ModifyVPCEndpointRequest(input *ModifyVPCEndpointInput) (req *aws.Request, output *ModifyVPCEndpointOutput) { - op := &aws.Operation{ - Name: opModifyVPCEndpoint, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &ModifyVPCEndpointInput{} - } - - req = c.newRequest(op, input, output) - output = &ModifyVPCEndpointOutput{} - req.Data = output - return -} - -// Modifies attributes of a specified VPC endpoint. You can modify the policy -// associated with the endpoint, and you can add and remove route tables associated -// with the endpoint. -func (c *EC2) ModifyVPCEndpoint(input *ModifyVPCEndpointInput) (*ModifyVPCEndpointOutput, error) { - req, out := c.ModifyVPCEndpointRequest(input) - err := req.Send() - return out, err -} - const opModifyVolumeAttribute = "ModifyVolumeAttribute" // ModifyVolumeAttributeRequest generates a request for the ModifyVolumeAttribute operation. -func (c *EC2) ModifyVolumeAttributeRequest(input *ModifyVolumeAttributeInput) (req *aws.Request, output *ModifyVolumeAttributeOutput) { - op := &aws.Operation{ +func (c *EC2) ModifyVolumeAttributeRequest(input *ModifyVolumeAttributeInput) (req *request.Request, output *ModifyVolumeAttributeOutput) { + op := &request.Operation{ Name: opModifyVolumeAttribute, HTTPMethod: "POST", HTTPPath: "/", @@ -5290,11 +5285,67 @@ func (c *EC2) ModifyVolumeAttribute(input *ModifyVolumeAttributeInput) (*ModifyV return out, err } +const opModifyVpcAttribute = "ModifyVpcAttribute" + +// ModifyVpcAttributeRequest generates a request for the ModifyVpcAttribute operation. +func (c *EC2) ModifyVpcAttributeRequest(input *ModifyVpcAttributeInput) (req *request.Request, output *ModifyVpcAttributeOutput) { + op := &request.Operation{ + Name: opModifyVpcAttribute, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &ModifyVpcAttributeInput{} + } + + req = c.newRequest(op, input, output) + output = &ModifyVpcAttributeOutput{} + req.Data = output + return +} + +// Modifies the specified attribute of the specified VPC. +func (c *EC2) ModifyVpcAttribute(input *ModifyVpcAttributeInput) (*ModifyVpcAttributeOutput, error) { + req, out := c.ModifyVpcAttributeRequest(input) + err := req.Send() + return out, err +} + +const opModifyVpcEndpoint = "ModifyVpcEndpoint" + +// ModifyVpcEndpointRequest generates a request for the ModifyVpcEndpoint operation. +func (c *EC2) ModifyVpcEndpointRequest(input *ModifyVpcEndpointInput) (req *request.Request, output *ModifyVpcEndpointOutput) { + op := &request.Operation{ + Name: opModifyVpcEndpoint, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &ModifyVpcEndpointInput{} + } + + req = c.newRequest(op, input, output) + output = &ModifyVpcEndpointOutput{} + req.Data = output + return +} + +// Modifies attributes of a specified VPC endpoint. You can modify the policy +// associated with the endpoint, and you can add and remove route tables associated +// with the endpoint. +func (c *EC2) ModifyVpcEndpoint(input *ModifyVpcEndpointInput) (*ModifyVpcEndpointOutput, error) { + req, out := c.ModifyVpcEndpointRequest(input) + err := req.Send() + return out, err +} + const opMonitorInstances = "MonitorInstances" // MonitorInstancesRequest generates a request for the MonitorInstances operation. -func (c *EC2) MonitorInstancesRequest(input *MonitorInstancesInput) (req *aws.Request, output *MonitorInstancesOutput) { - op := &aws.Operation{ +func (c *EC2) MonitorInstancesRequest(input *MonitorInstancesInput) (req *request.Request, output *MonitorInstancesOutput) { + op := &request.Operation{ Name: opMonitorInstances, HTTPMethod: "POST", HTTPPath: "/", @@ -5319,22 +5370,22 @@ func (c *EC2) MonitorInstances(input *MonitorInstancesInput) (*MonitorInstancesO return out, err } -const opMoveAddressToVPC = "MoveAddressToVpc" +const opMoveAddressToVpc = "MoveAddressToVpc" -// MoveAddressToVPCRequest generates a request for the MoveAddressToVPC operation. -func (c *EC2) MoveAddressToVPCRequest(input *MoveAddressToVPCInput) (req *aws.Request, output *MoveAddressToVPCOutput) { - op := &aws.Operation{ - Name: opMoveAddressToVPC, +// MoveAddressToVpcRequest generates a request for the MoveAddressToVpc operation. +func (c *EC2) MoveAddressToVpcRequest(input *MoveAddressToVpcInput) (req *request.Request, output *MoveAddressToVpcOutput) { + op := &request.Operation{ + Name: opMoveAddressToVpc, HTTPMethod: "POST", HTTPPath: "/", } if input == nil { - input = &MoveAddressToVPCInput{} + input = &MoveAddressToVpcInput{} } req = c.newRequest(op, input, output) - output = &MoveAddressToVPCOutput{} + output = &MoveAddressToVpcOutput{} req.Data = output return } @@ -5346,8 +5397,8 @@ func (c *EC2) MoveAddressToVPCRequest(input *MoveAddressToVPCInput) (req *aws.Re // you move it back using the RestoreAddressToClassic request. You cannot move // an Elastic IP address that's allocated for use in the EC2-VPC platform to // the EC2-Classic platform. -func (c *EC2) MoveAddressToVPC(input *MoveAddressToVPCInput) (*MoveAddressToVPCOutput, error) { - req, out := c.MoveAddressToVPCRequest(input) +func (c *EC2) MoveAddressToVpc(input *MoveAddressToVpcInput) (*MoveAddressToVpcOutput, error) { + req, out := c.MoveAddressToVpcRequest(input) err := req.Send() return out, err } @@ -5355,8 +5406,8 @@ func (c *EC2) MoveAddressToVPC(input *MoveAddressToVPCInput) (*MoveAddressToVPCO const opPurchaseReservedInstancesOffering = "PurchaseReservedInstancesOffering" // PurchaseReservedInstancesOfferingRequest generates a request for the PurchaseReservedInstancesOffering operation. -func (c *EC2) PurchaseReservedInstancesOfferingRequest(input *PurchaseReservedInstancesOfferingInput) (req *aws.Request, output *PurchaseReservedInstancesOfferingOutput) { - op := &aws.Operation{ +func (c *EC2) PurchaseReservedInstancesOfferingRequest(input *PurchaseReservedInstancesOfferingInput) (req *request.Request, output *PurchaseReservedInstancesOfferingOutput) { + op := &request.Operation{ Name: opPurchaseReservedInstancesOffering, HTTPMethod: "POST", HTTPPath: "/", @@ -5393,8 +5444,8 @@ func (c *EC2) PurchaseReservedInstancesOffering(input *PurchaseReservedInstances const opRebootInstances = "RebootInstances" // RebootInstancesRequest generates a request for the RebootInstances operation. -func (c *EC2) RebootInstancesRequest(input *RebootInstancesInput) (req *aws.Request, output *RebootInstancesOutput) { - op := &aws.Operation{ +func (c *EC2) RebootInstancesRequest(input *RebootInstancesInput) (req *request.Request, output *RebootInstancesOutput) { + op := &request.Operation{ Name: opRebootInstances, HTTPMethod: "POST", HTTPPath: "/", @@ -5430,8 +5481,8 @@ func (c *EC2) RebootInstances(input *RebootInstancesInput) (*RebootInstancesOutp const opRegisterImage = "RegisterImage" // RegisterImageRequest generates a request for the RegisterImage operation. -func (c *EC2) RegisterImageRequest(input *RegisterImageInput) (req *aws.Request, output *RegisterImageOutput) { - op := &aws.Operation{ +func (c *EC2) RegisterImageRequest(input *RegisterImageInput) (req *request.Request, output *RegisterImageOutput) { + op := &request.Operation{ Name: opRegisterImage, HTTPMethod: "POST", HTTPPath: "/", @@ -5448,23 +5499,32 @@ func (c *EC2) RegisterImageRequest(input *RegisterImageInput) (req *aws.Request, } // Registers an AMI. When you're creating an AMI, this is the final step you -// must complete before you can launch an instance from the AMI. This step is -// required if you're creating an instance store-backed Linux or Windows AMI. -// For more information, see Creating an Instance Store-Backed Linux AMI (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/creating-an-ami-instance-store.html) -// and Creating an Instance Store-Backed Windows AMI (http://docs.aws.amazon.com/AWSEC2/latest/WindowsGuide/Creating_InstanceStoreBacked_WinAMI.html) +// must complete before you can launch an instance from the AMI. For more information +// about creating AMIs, see Creating Your Own AMIs (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/creating-an-ami.html) // in the Amazon Elastic Compute Cloud User Guide. // // For Amazon EBS-backed instances, CreateImage creates and registers the AMI // in a single request, so you don't have to register the AMI yourself. // -// You can also use RegisterImage to create an Amazon EBS-backed AMI from a -// snapshot of a root device volume. For more information, see Launching an -// Instance from a Backup (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instance-launch-snapshot.html) -// in the Amazon Elastic Compute Cloud User Guide. Note that although you can -// create a Windows AMI from a snapshot, you can't launch an instance from the -// AMI - use the CreateImage command instead. +// You can also use RegisterImage to create an Amazon EBS-backed Linux AMI +// from a snapshot of a root device volume. For more information, see Launching +// an Instance from a Snapshot (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Using_LaunchingInstanceFromSnapshot.html) +// in the Amazon Elastic Compute Cloud User Guide. // -// If needed, you can deregister an AMI at any time. Any modifications you +// Some Linux distributions, such as Red Hat Enterprise Linux (RHEL) and SUSE +// Linux Enterprise Server (SLES), use the EC2 billingProduct code associated +// with an AMI to verify subscription status for package updates. Creating an +// AMI from an EBS snapshot does not maintain this billing code, and subsequent +// instances launched from such an AMI will not be able to connect to package +// update infrastructure. +// +// Similarly, although you can create a Windows AMI from a snapshot, you can't +// successfully launch an instance from the AMI. +// +// To create Windows AMIs or to create AMIs for Linux operating systems that +// must retain AMI billing codes to work properly, see CreateImage. +// +// If needed, you can deregister an AMI at any time. Any modifications you // make to an AMI backed by an instance store volume invalidates its registration. // If you make changes to an image, deregister the previous image and register // the new image. @@ -5477,22 +5537,22 @@ func (c *EC2) RegisterImage(input *RegisterImageInput) (*RegisterImageOutput, er return out, err } -const opRejectVPCPeeringConnection = "RejectVpcPeeringConnection" +const opRejectVpcPeeringConnection = "RejectVpcPeeringConnection" -// RejectVPCPeeringConnectionRequest generates a request for the RejectVPCPeeringConnection operation. -func (c *EC2) RejectVPCPeeringConnectionRequest(input *RejectVPCPeeringConnectionInput) (req *aws.Request, output *RejectVPCPeeringConnectionOutput) { - op := &aws.Operation{ - Name: opRejectVPCPeeringConnection, +// RejectVpcPeeringConnectionRequest generates a request for the RejectVpcPeeringConnection operation. +func (c *EC2) RejectVpcPeeringConnectionRequest(input *RejectVpcPeeringConnectionInput) (req *request.Request, output *RejectVpcPeeringConnectionOutput) { + op := &request.Operation{ + Name: opRejectVpcPeeringConnection, HTTPMethod: "POST", HTTPPath: "/", } if input == nil { - input = &RejectVPCPeeringConnectionInput{} + input = &RejectVpcPeeringConnectionInput{} } req = c.newRequest(op, input, output) - output = &RejectVPCPeeringConnectionOutput{} + output = &RejectVpcPeeringConnectionOutput{} req.Data = output return } @@ -5502,8 +5562,8 @@ func (c *EC2) RejectVPCPeeringConnectionRequest(input *RejectVPCPeeringConnectio // request to view your outstanding VPC peering connection requests. To delete // an active VPC peering connection, or to delete a VPC peering connection request // that you initiated, use DeleteVpcPeeringConnection. -func (c *EC2) RejectVPCPeeringConnection(input *RejectVPCPeeringConnectionInput) (*RejectVPCPeeringConnectionOutput, error) { - req, out := c.RejectVPCPeeringConnectionRequest(input) +func (c *EC2) RejectVpcPeeringConnection(input *RejectVpcPeeringConnectionInput) (*RejectVpcPeeringConnectionOutput, error) { + req, out := c.RejectVpcPeeringConnectionRequest(input) err := req.Send() return out, err } @@ -5511,8 +5571,8 @@ func (c *EC2) RejectVPCPeeringConnection(input *RejectVPCPeeringConnectionInput) const opReleaseAddress = "ReleaseAddress" // ReleaseAddressRequest generates a request for the ReleaseAddress operation. -func (c *EC2) ReleaseAddressRequest(input *ReleaseAddressInput) (req *aws.Request, output *ReleaseAddressOutput) { - op := &aws.Operation{ +func (c *EC2) ReleaseAddressRequest(input *ReleaseAddressInput) (req *request.Request, output *ReleaseAddressOutput) { + op := &request.Operation{ Name: opReleaseAddress, HTTPMethod: "POST", HTTPPath: "/", @@ -5549,22 +5609,22 @@ func (c *EC2) ReleaseAddress(input *ReleaseAddressInput) (*ReleaseAddressOutput, return out, err } -const opReplaceNetworkACLAssociation = "ReplaceNetworkAclAssociation" +const opReplaceNetworkAclAssociation = "ReplaceNetworkAclAssociation" -// ReplaceNetworkACLAssociationRequest generates a request for the ReplaceNetworkACLAssociation operation. -func (c *EC2) ReplaceNetworkACLAssociationRequest(input *ReplaceNetworkACLAssociationInput) (req *aws.Request, output *ReplaceNetworkACLAssociationOutput) { - op := &aws.Operation{ - Name: opReplaceNetworkACLAssociation, +// ReplaceNetworkAclAssociationRequest generates a request for the ReplaceNetworkAclAssociation operation. +func (c *EC2) ReplaceNetworkAclAssociationRequest(input *ReplaceNetworkAclAssociationInput) (req *request.Request, output *ReplaceNetworkAclAssociationOutput) { + op := &request.Operation{ + Name: opReplaceNetworkAclAssociation, HTTPMethod: "POST", HTTPPath: "/", } if input == nil { - input = &ReplaceNetworkACLAssociationInput{} + input = &ReplaceNetworkAclAssociationInput{} } req = c.newRequest(op, input, output) - output = &ReplaceNetworkACLAssociationOutput{} + output = &ReplaceNetworkAclAssociationOutput{} req.Data = output return } @@ -5573,28 +5633,28 @@ func (c *EC2) ReplaceNetworkACLAssociationRequest(input *ReplaceNetworkACLAssoci // create a subnet, it's automatically associated with the default network ACL. // For more information about network ACLs, see Network ACLs (http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/VPC_ACLs.html) // in the Amazon Virtual Private Cloud User Guide. -func (c *EC2) ReplaceNetworkACLAssociation(input *ReplaceNetworkACLAssociationInput) (*ReplaceNetworkACLAssociationOutput, error) { - req, out := c.ReplaceNetworkACLAssociationRequest(input) +func (c *EC2) ReplaceNetworkAclAssociation(input *ReplaceNetworkAclAssociationInput) (*ReplaceNetworkAclAssociationOutput, error) { + req, out := c.ReplaceNetworkAclAssociationRequest(input) err := req.Send() return out, err } -const opReplaceNetworkACLEntry = "ReplaceNetworkAclEntry" +const opReplaceNetworkAclEntry = "ReplaceNetworkAclEntry" -// ReplaceNetworkACLEntryRequest generates a request for the ReplaceNetworkACLEntry operation. -func (c *EC2) ReplaceNetworkACLEntryRequest(input *ReplaceNetworkACLEntryInput) (req *aws.Request, output *ReplaceNetworkACLEntryOutput) { - op := &aws.Operation{ - Name: opReplaceNetworkACLEntry, +// ReplaceNetworkAclEntryRequest generates a request for the ReplaceNetworkAclEntry operation. +func (c *EC2) ReplaceNetworkAclEntryRequest(input *ReplaceNetworkAclEntryInput) (req *request.Request, output *ReplaceNetworkAclEntryOutput) { + op := &request.Operation{ + Name: opReplaceNetworkAclEntry, HTTPMethod: "POST", HTTPPath: "/", } if input == nil { - input = &ReplaceNetworkACLEntryInput{} + input = &ReplaceNetworkAclEntryInput{} } req = c.newRequest(op, input, output) - output = &ReplaceNetworkACLEntryOutput{} + output = &ReplaceNetworkAclEntryOutput{} req.Data = output return } @@ -5602,8 +5662,8 @@ func (c *EC2) ReplaceNetworkACLEntryRequest(input *ReplaceNetworkACLEntryInput) // Replaces an entry (rule) in a network ACL. For more information about network // ACLs, see Network ACLs (http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/VPC_ACLs.html) // in the Amazon Virtual Private Cloud User Guide. -func (c *EC2) ReplaceNetworkACLEntry(input *ReplaceNetworkACLEntryInput) (*ReplaceNetworkACLEntryOutput, error) { - req, out := c.ReplaceNetworkACLEntryRequest(input) +func (c *EC2) ReplaceNetworkAclEntry(input *ReplaceNetworkAclEntryInput) (*ReplaceNetworkAclEntryOutput, error) { + req, out := c.ReplaceNetworkAclEntryRequest(input) err := req.Send() return out, err } @@ -5611,8 +5671,8 @@ func (c *EC2) ReplaceNetworkACLEntry(input *ReplaceNetworkACLEntryInput) (*Repla const opReplaceRoute = "ReplaceRoute" // ReplaceRouteRequest generates a request for the ReplaceRoute operation. -func (c *EC2) ReplaceRouteRequest(input *ReplaceRouteInput) (req *aws.Request, output *ReplaceRouteOutput) { - op := &aws.Operation{ +func (c *EC2) ReplaceRouteRequest(input *ReplaceRouteInput) (req *request.Request, output *ReplaceRouteOutput) { + op := &request.Operation{ Name: opReplaceRoute, HTTPMethod: "POST", HTTPPath: "/", @@ -5643,8 +5703,8 @@ func (c *EC2) ReplaceRoute(input *ReplaceRouteInput) (*ReplaceRouteOutput, error const opReplaceRouteTableAssociation = "ReplaceRouteTableAssociation" // ReplaceRouteTableAssociationRequest generates a request for the ReplaceRouteTableAssociation operation. -func (c *EC2) ReplaceRouteTableAssociationRequest(input *ReplaceRouteTableAssociationInput) (req *aws.Request, output *ReplaceRouteTableAssociationOutput) { - op := &aws.Operation{ +func (c *EC2) ReplaceRouteTableAssociationRequest(input *ReplaceRouteTableAssociationInput) (req *request.Request, output *ReplaceRouteTableAssociationOutput) { + op := &request.Operation{ Name: opReplaceRouteTableAssociation, HTTPMethod: "POST", HTTPPath: "/", @@ -5678,8 +5738,8 @@ func (c *EC2) ReplaceRouteTableAssociation(input *ReplaceRouteTableAssociationIn const opReportInstanceStatus = "ReportInstanceStatus" // ReportInstanceStatusRequest generates a request for the ReportInstanceStatus operation. -func (c *EC2) ReportInstanceStatusRequest(input *ReportInstanceStatusInput) (req *aws.Request, output *ReportInstanceStatusOutput) { - op := &aws.Operation{ +func (c *EC2) ReportInstanceStatusRequest(input *ReportInstanceStatusInput) (req *request.Request, output *ReportInstanceStatusOutput) { + op := &request.Operation{ Name: opReportInstanceStatus, HTTPMethod: "POST", HTTPPath: "/", @@ -5711,8 +5771,8 @@ func (c *EC2) ReportInstanceStatus(input *ReportInstanceStatusInput) (*ReportIns const opRequestSpotFleet = "RequestSpotFleet" // RequestSpotFleetRequest generates a request for the RequestSpotFleet operation. -func (c *EC2) RequestSpotFleetRequest(input *RequestSpotFleetInput) (req *aws.Request, output *RequestSpotFleetOutput) { - op := &aws.Operation{ +func (c *EC2) RequestSpotFleetRequest(input *RequestSpotFleetInput) (req *request.Request, output *RequestSpotFleetOutput) { + op := &request.Operation{ Name: opRequestSpotFleet, HTTPMethod: "POST", HTTPPath: "/", @@ -5730,7 +5790,20 @@ func (c *EC2) RequestSpotFleetRequest(input *RequestSpotFleetInput) (req *aws.Re // Creates a Spot fleet request. // -// For more information, see Spot Fleets (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/spot-fleet.html) +// You can submit a single request that includes multiple launch specifications +// that vary by instance type, AMI, Availability Zone, or subnet. +// +// By default, the Spot fleet requests Spot instances in the Spot pool where +// the price per unit is the lowest. Each launch specification can include its +// own instance weighting that reflects the value of the instance type to your +// application workload. +// +// Alternatively, you can specify that the Spot fleet distribute the target +// capacity across the Spot pools included in its launch specifications. By +// ensuring that the Spot instances in your Spot fleet are in different Spot +// pools, you can improve the availability of your fleet. +// +// For more information, see Spot Fleet Requests (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/spot-fleet-requests.html) // in the Amazon Elastic Compute Cloud User Guide. func (c *EC2) RequestSpotFleet(input *RequestSpotFleetInput) (*RequestSpotFleetOutput, error) { req, out := c.RequestSpotFleetRequest(input) @@ -5741,8 +5814,8 @@ func (c *EC2) RequestSpotFleet(input *RequestSpotFleetInput) (*RequestSpotFleetO const opRequestSpotInstances = "RequestSpotInstances" // RequestSpotInstancesRequest generates a request for the RequestSpotInstances operation. -func (c *EC2) RequestSpotInstancesRequest(input *RequestSpotInstancesInput) (req *aws.Request, output *RequestSpotInstancesOutput) { - op := &aws.Operation{ +func (c *EC2) RequestSpotInstancesRequest(input *RequestSpotInstancesInput) (req *request.Request, output *RequestSpotInstancesOutput) { + op := &request.Operation{ Name: opRequestSpotInstances, HTTPMethod: "POST", HTTPPath: "/", @@ -5758,10 +5831,10 @@ func (c *EC2) RequestSpotInstancesRequest(input *RequestSpotInstancesInput) (req return } -// Creates a Spot Instance request. Spot Instances are instances that Amazon +// Creates a Spot instance request. Spot instances are instances that Amazon // EC2 launches when the bid price that you specify exceeds the current Spot -// Price. Amazon EC2 periodically sets the Spot Price based on available Spot -// Instance capacity and current Spot Instance requests. For more information, +// price. Amazon EC2 periodically sets the Spot price based on available Spot +// Instance capacity and current Spot instance requests. For more information, // see Spot Instance Requests (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/spot-requests.html) // in the Amazon Elastic Compute Cloud User Guide. func (c *EC2) RequestSpotInstances(input *RequestSpotInstancesInput) (*RequestSpotInstancesOutput, error) { @@ -5773,8 +5846,8 @@ func (c *EC2) RequestSpotInstances(input *RequestSpotInstancesInput) (*RequestSp const opResetImageAttribute = "ResetImageAttribute" // ResetImageAttributeRequest generates a request for the ResetImageAttribute operation. -func (c *EC2) ResetImageAttributeRequest(input *ResetImageAttributeInput) (req *aws.Request, output *ResetImageAttributeOutput) { - op := &aws.Operation{ +func (c *EC2) ResetImageAttributeRequest(input *ResetImageAttributeInput) (req *request.Request, output *ResetImageAttributeOutput) { + op := &request.Operation{ Name: opResetImageAttribute, HTTPMethod: "POST", HTTPPath: "/", @@ -5802,8 +5875,8 @@ func (c *EC2) ResetImageAttribute(input *ResetImageAttributeInput) (*ResetImageA const opResetInstanceAttribute = "ResetInstanceAttribute" // ResetInstanceAttributeRequest generates a request for the ResetInstanceAttribute operation. -func (c *EC2) ResetInstanceAttributeRequest(input *ResetInstanceAttributeInput) (req *aws.Request, output *ResetInstanceAttributeOutput) { - op := &aws.Operation{ +func (c *EC2) ResetInstanceAttributeRequest(input *ResetInstanceAttributeInput) (req *request.Request, output *ResetInstanceAttributeOutput) { + op := &request.Operation{ Name: opResetInstanceAttribute, HTTPMethod: "POST", HTTPPath: "/", @@ -5837,8 +5910,8 @@ func (c *EC2) ResetInstanceAttribute(input *ResetInstanceAttributeInput) (*Reset const opResetNetworkInterfaceAttribute = "ResetNetworkInterfaceAttribute" // ResetNetworkInterfaceAttributeRequest generates a request for the ResetNetworkInterfaceAttribute operation. -func (c *EC2) ResetNetworkInterfaceAttributeRequest(input *ResetNetworkInterfaceAttributeInput) (req *aws.Request, output *ResetNetworkInterfaceAttributeOutput) { - op := &aws.Operation{ +func (c *EC2) ResetNetworkInterfaceAttributeRequest(input *ResetNetworkInterfaceAttributeInput) (req *request.Request, output *ResetNetworkInterfaceAttributeOutput) { + op := &request.Operation{ Name: opResetNetworkInterfaceAttribute, HTTPMethod: "POST", HTTPPath: "/", @@ -5865,8 +5938,8 @@ func (c *EC2) ResetNetworkInterfaceAttribute(input *ResetNetworkInterfaceAttribu const opResetSnapshotAttribute = "ResetSnapshotAttribute" // ResetSnapshotAttributeRequest generates a request for the ResetSnapshotAttribute operation. -func (c *EC2) ResetSnapshotAttributeRequest(input *ResetSnapshotAttributeInput) (req *aws.Request, output *ResetSnapshotAttributeOutput) { - op := &aws.Operation{ +func (c *EC2) ResetSnapshotAttributeRequest(input *ResetSnapshotAttributeInput) (req *request.Request, output *ResetSnapshotAttributeOutput) { + op := &request.Operation{ Name: opResetSnapshotAttribute, HTTPMethod: "POST", HTTPPath: "/", @@ -5896,8 +5969,8 @@ func (c *EC2) ResetSnapshotAttribute(input *ResetSnapshotAttributeInput) (*Reset const opRestoreAddressToClassic = "RestoreAddressToClassic" // RestoreAddressToClassicRequest generates a request for the RestoreAddressToClassic operation. -func (c *EC2) RestoreAddressToClassicRequest(input *RestoreAddressToClassicInput) (req *aws.Request, output *RestoreAddressToClassicOutput) { - op := &aws.Operation{ +func (c *EC2) RestoreAddressToClassicRequest(input *RestoreAddressToClassicInput) (req *request.Request, output *RestoreAddressToClassicOutput) { + op := &request.Operation{ Name: opRestoreAddressToClassic, HTTPMethod: "POST", HTTPPath: "/", @@ -5926,8 +5999,8 @@ func (c *EC2) RestoreAddressToClassic(input *RestoreAddressToClassicInput) (*Res const opRevokeSecurityGroupEgress = "RevokeSecurityGroupEgress" // RevokeSecurityGroupEgressRequest generates a request for the RevokeSecurityGroupEgress operation. -func (c *EC2) RevokeSecurityGroupEgressRequest(input *RevokeSecurityGroupEgressInput) (req *aws.Request, output *RevokeSecurityGroupEgressOutput) { - op := &aws.Operation{ +func (c *EC2) RevokeSecurityGroupEgressRequest(input *RevokeSecurityGroupEgressInput) (req *request.Request, output *RevokeSecurityGroupEgressOutput) { + op := &request.Operation{ Name: opRevokeSecurityGroupEgress, HTTPMethod: "POST", HTTPPath: "/", @@ -5963,8 +6036,8 @@ func (c *EC2) RevokeSecurityGroupEgress(input *RevokeSecurityGroupEgressInput) ( const opRevokeSecurityGroupIngress = "RevokeSecurityGroupIngress" // RevokeSecurityGroupIngressRequest generates a request for the RevokeSecurityGroupIngress operation. -func (c *EC2) RevokeSecurityGroupIngressRequest(input *RevokeSecurityGroupIngressInput) (req *aws.Request, output *RevokeSecurityGroupIngressOutput) { - op := &aws.Operation{ +func (c *EC2) RevokeSecurityGroupIngressRequest(input *RevokeSecurityGroupIngressInput) (req *request.Request, output *RevokeSecurityGroupIngressOutput) { + op := &request.Operation{ Name: opRevokeSecurityGroupIngress, HTTPMethod: "POST", HTTPPath: "/", @@ -6000,8 +6073,8 @@ func (c *EC2) RevokeSecurityGroupIngress(input *RevokeSecurityGroupIngressInput) const opRunInstances = "RunInstances" // RunInstancesRequest generates a request for the RunInstances operation. -func (c *EC2) RunInstancesRequest(input *RunInstancesInput) (req *aws.Request, output *Reservation) { - op := &aws.Operation{ +func (c *EC2) RunInstancesRequest(input *RunInstancesInput) (req *request.Request, output *Reservation) { + op := &request.Operation{ Name: opRunInstances, HTTPMethod: "POST", HTTPPath: "/", @@ -6029,6 +6102,12 @@ func (c *EC2) RunInstancesRequest(input *RunInstancesInput) (req *aws.Request, o // (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-network-security.html) // in the Amazon Elastic Compute Cloud User Guide. // +// [EC2-VPC only accounts] If you don't specify a subnet in the request, we +// choose a default subnet from your default VPC for you. +// +// [EC2-Classic accounts] If you're launching into EC2-Classic and you don't +// specify an Availability Zone, we choose one for you. +// // Linux instances have access to the public key of the key pair at boot. You // can use this key to provide secure access to the instance. Amazon EC2 public // images use this feature to provide secure access without passwords. For more @@ -6059,8 +6138,8 @@ func (c *EC2) RunInstances(input *RunInstancesInput) (*Reservation, error) { const opStartInstances = "StartInstances" // StartInstancesRequest generates a request for the StartInstances operation. -func (c *EC2) StartInstancesRequest(input *StartInstancesInput) (req *aws.Request, output *StartInstancesOutput) { - op := &aws.Operation{ +func (c *EC2) StartInstancesRequest(input *StartInstancesInput) (req *request.Request, output *StartInstancesOutput) { + op := &request.Operation{ Name: opStartInstances, HTTPMethod: "POST", HTTPPath: "/", @@ -6104,8 +6183,8 @@ func (c *EC2) StartInstances(input *StartInstancesInput) (*StartInstancesOutput, const opStopInstances = "StopInstances" // StopInstancesRequest generates a request for the StopInstances operation. -func (c *EC2) StopInstancesRequest(input *StopInstancesInput) (req *aws.Request, output *StopInstancesOutput) { - op := &aws.Operation{ +func (c *EC2) StopInstancesRequest(input *StopInstancesInput) (req *request.Request, output *StopInstancesOutput) { + op := &request.Operation{ Name: opStopInstances, HTTPMethod: "POST", HTTPPath: "/", @@ -6161,8 +6240,8 @@ func (c *EC2) StopInstances(input *StopInstancesInput) (*StopInstancesOutput, er const opTerminateInstances = "TerminateInstances" // TerminateInstancesRequest generates a request for the TerminateInstances operation. -func (c *EC2) TerminateInstancesRequest(input *TerminateInstancesInput) (req *aws.Request, output *TerminateInstancesOutput) { - op := &aws.Operation{ +func (c *EC2) TerminateInstancesRequest(input *TerminateInstancesInput) (req *request.Request, output *TerminateInstancesOutput) { + op := &request.Operation{ Name: opTerminateInstances, HTTPMethod: "POST", HTTPPath: "/", @@ -6191,9 +6270,10 @@ func (c *EC2) TerminateInstancesRequest(input *TerminateInstancesInput) (req *aw // instance store-backed instances. What happens to an instance differs if you // stop it or terminate it. For example, when you stop an instance, the root // device and any other devices attached to the instance persist. When you terminate -// an instance, the root device and any other devices attached during the instance -// launch are automatically deleted. For more information about the differences -// between stopping and terminating instances, see Instance Lifecycle (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-instance-lifecycle.html) +// an instance, any attached EBS volumes with the DeleteOnTermination block +// device mapping parameter set to true are automatically deleted. For more +// information about the differences between stopping and terminating instances, +// see Instance Lifecycle (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-instance-lifecycle.html) // in the Amazon Elastic Compute Cloud User Guide. // // For more information about troubleshooting, see Troubleshooting Terminating @@ -6205,29 +6285,29 @@ func (c *EC2) TerminateInstances(input *TerminateInstancesInput) (*TerminateInst return out, err } -const opUnassignPrivateIPAddresses = "UnassignPrivateIpAddresses" +const opUnassignPrivateIpAddresses = "UnassignPrivateIpAddresses" -// UnassignPrivateIPAddressesRequest generates a request for the UnassignPrivateIPAddresses operation. -func (c *EC2) UnassignPrivateIPAddressesRequest(input *UnassignPrivateIPAddressesInput) (req *aws.Request, output *UnassignPrivateIPAddressesOutput) { - op := &aws.Operation{ - Name: opUnassignPrivateIPAddresses, +// UnassignPrivateIpAddressesRequest generates a request for the UnassignPrivateIpAddresses operation. +func (c *EC2) UnassignPrivateIpAddressesRequest(input *UnassignPrivateIpAddressesInput) (req *request.Request, output *UnassignPrivateIpAddressesOutput) { + op := &request.Operation{ + Name: opUnassignPrivateIpAddresses, HTTPMethod: "POST", HTTPPath: "/", } if input == nil { - input = &UnassignPrivateIPAddressesInput{} + input = &UnassignPrivateIpAddressesInput{} } req = c.newRequest(op, input, output) - output = &UnassignPrivateIPAddressesOutput{} + output = &UnassignPrivateIpAddressesOutput{} req.Data = output return } // Unassigns one or more secondary private IP addresses from a network interface. -func (c *EC2) UnassignPrivateIPAddresses(input *UnassignPrivateIPAddressesInput) (*UnassignPrivateIPAddressesOutput, error) { - req, out := c.UnassignPrivateIPAddressesRequest(input) +func (c *EC2) UnassignPrivateIpAddresses(input *UnassignPrivateIpAddressesInput) (*UnassignPrivateIpAddressesOutput, error) { + req, out := c.UnassignPrivateIpAddressesRequest(input) err := req.Send() return out, err } @@ -6235,8 +6315,8 @@ func (c *EC2) UnassignPrivateIPAddresses(input *UnassignPrivateIPAddressesInput) const opUnmonitorInstances = "UnmonitorInstances" // UnmonitorInstancesRequest generates a request for the UnmonitorInstances operation. -func (c *EC2) UnmonitorInstancesRequest(input *UnmonitorInstancesInput) (req *aws.Request, output *UnmonitorInstancesOutput) { - op := &aws.Operation{ +func (c *EC2) UnmonitorInstancesRequest(input *UnmonitorInstancesInput) (req *request.Request, output *UnmonitorInstancesOutput) { + op := &request.Operation{ Name: opUnmonitorInstances, HTTPMethod: "POST", HTTPPath: "/", @@ -6261,7 +6341,7 @@ func (c *EC2) UnmonitorInstances(input *UnmonitorInstancesInput) (*UnmonitorInst return out, err } -type AcceptVPCPeeringConnectionInput struct { +type AcceptVpcPeeringConnectionInput struct { // Checks whether you have the required permissions for the action, without // actually making the request, and provides an error response. If you have // the required permissions, the error response is DryRunOperation. Otherwise, @@ -6269,43 +6349,43 @@ type AcceptVPCPeeringConnectionInput struct { DryRun *bool `locationName:"dryRun" type:"boolean"` // The ID of the VPC peering connection. - VPCPeeringConnectionID *string `locationName:"vpcPeeringConnectionId" type:"string"` + VpcPeeringConnectionId *string `locationName:"vpcPeeringConnectionId" type:"string"` - metadataAcceptVPCPeeringConnectionInput `json:"-" xml:"-"` + metadataAcceptVpcPeeringConnectionInput `json:"-" xml:"-"` } -type metadataAcceptVPCPeeringConnectionInput struct { +type metadataAcceptVpcPeeringConnectionInput struct { SDKShapeTraits bool `type:"structure"` } // String returns the string representation -func (s AcceptVPCPeeringConnectionInput) String() string { +func (s AcceptVpcPeeringConnectionInput) String() string { return awsutil.Prettify(s) } // GoString returns the string representation -func (s AcceptVPCPeeringConnectionInput) GoString() string { +func (s AcceptVpcPeeringConnectionInput) GoString() string { return s.String() } -type AcceptVPCPeeringConnectionOutput struct { +type AcceptVpcPeeringConnectionOutput struct { // Information about the VPC peering connection. - VPCPeeringConnection *VPCPeeringConnection `locationName:"vpcPeeringConnection" type:"structure"` + VpcPeeringConnection *VpcPeeringConnection `locationName:"vpcPeeringConnection" type:"structure"` - metadataAcceptVPCPeeringConnectionOutput `json:"-" xml:"-"` + metadataAcceptVpcPeeringConnectionOutput `json:"-" xml:"-"` } -type metadataAcceptVPCPeeringConnectionOutput struct { +type metadataAcceptVpcPeeringConnectionOutput struct { SDKShapeTraits bool `type:"structure"` } // String returns the string representation -func (s AcceptVPCPeeringConnectionOutput) String() string { +func (s AcceptVpcPeeringConnectionOutput) String() string { return awsutil.Prettify(s) } // GoString returns the string representation -func (s AcceptVPCPeeringConnectionOutput) GoString() string { +func (s AcceptVpcPeeringConnectionOutput) GoString() string { return s.String() } @@ -6359,13 +6439,13 @@ func (s AccountAttributeValue) GoString() string { // Describes a running instance in a Spot fleet. type ActiveInstance struct { // The ID of the instance. - InstanceID *string `locationName:"instanceId" type:"string"` + InstanceId *string `locationName:"instanceId" type:"string"` // The instance type. InstanceType *string `locationName:"instanceType" type:"string"` - // The ID of the Spot Instance request. - SpotInstanceRequestID *string `locationName:"spotInstanceRequestId" type:"string"` + // The ID of the Spot instance request. + SpotInstanceRequestId *string `locationName:"spotInstanceRequestId" type:"string"` metadataActiveInstance `json:"-" xml:"-"` } @@ -6387,30 +6467,30 @@ func (s ActiveInstance) GoString() string { // Describes an Elastic IP address. type Address struct { // The ID representing the allocation of the address for use with EC2-VPC. - AllocationID *string `locationName:"allocationId" type:"string"` + AllocationId *string `locationName:"allocationId" type:"string"` // The ID representing the association of the address with an instance in a // VPC. - AssociationID *string `locationName:"associationId" type:"string"` + AssociationId *string `locationName:"associationId" type:"string"` // Indicates whether this Elastic IP address is for use with instances in EC2-Classic // (standard) or instances in a VPC (vpc). Domain *string `locationName:"domain" type:"string" enum:"DomainType"` // The ID of the instance that the address is associated with (if any). - InstanceID *string `locationName:"instanceId" type:"string"` + InstanceId *string `locationName:"instanceId" type:"string"` // The ID of the network interface. - NetworkInterfaceID *string `locationName:"networkInterfaceId" type:"string"` + NetworkInterfaceId *string `locationName:"networkInterfaceId" type:"string"` // The ID of the AWS account that owns the network interface. - NetworkInterfaceOwnerID *string `locationName:"networkInterfaceOwnerId" type:"string"` + NetworkInterfaceOwnerId *string `locationName:"networkInterfaceOwnerId" type:"string"` // The private IP address associated with the Elastic IP address. - PrivateIPAddress *string `locationName:"privateIpAddress" type:"string"` + PrivateIpAddress *string `locationName:"privateIpAddress" type:"string"` // The Elastic IP address. - PublicIP *string `locationName:"publicIp" type:"string"` + PublicIp *string `locationName:"publicIp" type:"string"` metadataAddress `json:"-" xml:"-"` } @@ -6461,14 +6541,14 @@ func (s AllocateAddressInput) GoString() string { type AllocateAddressOutput struct { // [EC2-VPC] The ID that AWS assigns to represent the allocation of the Elastic // IP address for use with instances in a VPC. - AllocationID *string `locationName:"allocationId" type:"string"` + AllocationId *string `locationName:"allocationId" type:"string"` // Indicates whether this Elastic IP address is for use with instances in EC2-Classic // (standard) or instances in a VPC (vpc). Domain *string `locationName:"domain" type:"string" enum:"DomainType"` // The Elastic IP address. - PublicIP *string `locationName:"publicIp" type:"string"` + PublicIp *string `locationName:"publicIp" type:"string"` metadataAllocateAddressOutput `json:"-" xml:"-"` } @@ -6487,13 +6567,13 @@ func (s AllocateAddressOutput) GoString() string { return s.String() } -type AssignPrivateIPAddressesInput struct { +type AssignPrivateIpAddressesInput struct { // Indicates whether to allow an IP address that is already assigned to another // network interface or instance to be reassigned to the specified network interface. AllowReassignment *bool `locationName:"allowReassignment" type:"boolean"` // The ID of the network interface. - NetworkInterfaceID *string `locationName:"networkInterfaceId" type:"string" required:"true"` + NetworkInterfaceId *string `locationName:"networkInterfaceId" type:"string" required:"true"` // One or more IP addresses to be assigned as a secondary private IP address // to the network interface. You can't specify this parameter when also specifying @@ -6501,50 +6581,50 @@ type AssignPrivateIPAddressesInput struct { // // If you don't specify an IP address, Amazon EC2 automatically selects an // IP address within the subnet range. - PrivateIPAddresses []*string `locationName:"privateIpAddress" locationNameList:"PrivateIpAddress" type:"list"` + PrivateIpAddresses []*string `locationName:"privateIpAddress" locationNameList:"PrivateIpAddress" type:"list"` // The number of secondary IP addresses to assign to the network interface. // You can't specify this parameter when also specifying private IP addresses. - SecondaryPrivateIPAddressCount *int64 `locationName:"secondaryPrivateIpAddressCount" type:"integer"` + SecondaryPrivateIpAddressCount *int64 `locationName:"secondaryPrivateIpAddressCount" type:"integer"` - metadataAssignPrivateIPAddressesInput `json:"-" xml:"-"` + metadataAssignPrivateIpAddressesInput `json:"-" xml:"-"` } -type metadataAssignPrivateIPAddressesInput struct { +type metadataAssignPrivateIpAddressesInput struct { SDKShapeTraits bool `type:"structure"` } // String returns the string representation -func (s AssignPrivateIPAddressesInput) String() string { +func (s AssignPrivateIpAddressesInput) String() string { return awsutil.Prettify(s) } // GoString returns the string representation -func (s AssignPrivateIPAddressesInput) GoString() string { +func (s AssignPrivateIpAddressesInput) GoString() string { return s.String() } -type AssignPrivateIPAddressesOutput struct { - metadataAssignPrivateIPAddressesOutput `json:"-" xml:"-"` +type AssignPrivateIpAddressesOutput struct { + metadataAssignPrivateIpAddressesOutput `json:"-" xml:"-"` } -type metadataAssignPrivateIPAddressesOutput struct { +type metadataAssignPrivateIpAddressesOutput struct { SDKShapeTraits bool `type:"structure"` } // String returns the string representation -func (s AssignPrivateIPAddressesOutput) String() string { +func (s AssignPrivateIpAddressesOutput) String() string { return awsutil.Prettify(s) } // GoString returns the string representation -func (s AssignPrivateIPAddressesOutput) GoString() string { +func (s AssignPrivateIpAddressesOutput) GoString() string { return s.String() } type AssociateAddressInput struct { // [EC2-VPC] The allocation ID. This is required for EC2-VPC. - AllocationID *string `locationName:"AllocationId" type:"string"` + AllocationId *string `type:"string"` // [EC2-VPC] Allows an Elastic IP address that is already associated with an // instance or network interface to be re-associated with the specified instance @@ -6563,19 +6643,19 @@ type AssociateAddressInput struct { // can specify either the instance ID or the network interface ID, but not both. // The operation fails if you specify an instance ID unless exactly one network // interface is attached. - InstanceID *string `locationName:"InstanceId" type:"string"` + InstanceId *string `type:"string"` // [EC2-VPC] The ID of the network interface. If the instance has more than // one network interface, you must specify a network interface ID. - NetworkInterfaceID *string `locationName:"networkInterfaceId" type:"string"` + NetworkInterfaceId *string `locationName:"networkInterfaceId" type:"string"` // [EC2-VPC] The primary or secondary private IP address to associate with the // Elastic IP address. If no private IP address is specified, the Elastic IP // address is associated with the primary private IP address. - PrivateIPAddress *string `locationName:"privateIpAddress" type:"string"` + PrivateIpAddress *string `locationName:"privateIpAddress" type:"string"` // The Elastic IP address. This is required for EC2-Classic. - PublicIP *string `locationName:"PublicIp" type:"string"` + PublicIp *string `type:"string"` metadataAssociateAddressInput `json:"-" xml:"-"` } @@ -6597,7 +6677,7 @@ func (s AssociateAddressInput) GoString() string { type AssociateAddressOutput struct { // [EC2-VPC] The ID that represents the association of the Elastic IP address // with an instance. - AssociationID *string `locationName:"associationId" type:"string"` + AssociationId *string `locationName:"associationId" type:"string"` metadataAssociateAddressOutput `json:"-" xml:"-"` } @@ -6616,10 +6696,10 @@ func (s AssociateAddressOutput) GoString() string { return s.String() } -type AssociateDHCPOptionsInput struct { +type AssociateDhcpOptionsInput struct { // The ID of the DHCP options set, or default to associate no DHCP options with // the VPC. - DHCPOptionsID *string `locationName:"DhcpOptionsId" type:"string" required:"true"` + DhcpOptionsId *string `type:"string" required:"true"` // Checks whether you have the required permissions for the action, without // actually making the request, and provides an error response. If you have @@ -6628,40 +6708,40 @@ type AssociateDHCPOptionsInput struct { DryRun *bool `locationName:"dryRun" type:"boolean"` // The ID of the VPC. - VPCID *string `locationName:"VpcId" type:"string" required:"true"` + VpcId *string `type:"string" required:"true"` - metadataAssociateDHCPOptionsInput `json:"-" xml:"-"` + metadataAssociateDhcpOptionsInput `json:"-" xml:"-"` } -type metadataAssociateDHCPOptionsInput struct { +type metadataAssociateDhcpOptionsInput struct { SDKShapeTraits bool `type:"structure"` } // String returns the string representation -func (s AssociateDHCPOptionsInput) String() string { +func (s AssociateDhcpOptionsInput) String() string { return awsutil.Prettify(s) } // GoString returns the string representation -func (s AssociateDHCPOptionsInput) GoString() string { +func (s AssociateDhcpOptionsInput) GoString() string { return s.String() } -type AssociateDHCPOptionsOutput struct { - metadataAssociateDHCPOptionsOutput `json:"-" xml:"-"` +type AssociateDhcpOptionsOutput struct { + metadataAssociateDhcpOptionsOutput `json:"-" xml:"-"` } -type metadataAssociateDHCPOptionsOutput struct { +type metadataAssociateDhcpOptionsOutput struct { SDKShapeTraits bool `type:"structure"` } // String returns the string representation -func (s AssociateDHCPOptionsOutput) String() string { +func (s AssociateDhcpOptionsOutput) String() string { return awsutil.Prettify(s) } // GoString returns the string representation -func (s AssociateDHCPOptionsOutput) GoString() string { +func (s AssociateDhcpOptionsOutput) GoString() string { return s.String() } @@ -6673,10 +6753,10 @@ type AssociateRouteTableInput struct { DryRun *bool `locationName:"dryRun" type:"boolean"` // The ID of the route table. - RouteTableID *string `locationName:"routeTableId" type:"string" required:"true"` + RouteTableId *string `locationName:"routeTableId" type:"string" required:"true"` // The ID of the subnet. - SubnetID *string `locationName:"subnetId" type:"string" required:"true"` + SubnetId *string `locationName:"subnetId" type:"string" required:"true"` metadataAssociateRouteTableInput `json:"-" xml:"-"` } @@ -6697,7 +6777,7 @@ func (s AssociateRouteTableInput) GoString() string { type AssociateRouteTableOutput struct { // The route table association ID (needed to disassociate the route table). - AssociationID *string `locationName:"associationId" type:"string"` + AssociationId *string `locationName:"associationId" type:"string"` metadataAssociateRouteTableOutput `json:"-" xml:"-"` } @@ -6716,7 +6796,7 @@ func (s AssociateRouteTableOutput) GoString() string { return s.String() } -type AttachClassicLinkVPCInput struct { +type AttachClassicLinkVpcInput struct { // Checks whether you have the required permissions for the action, without // actually making the request, and provides an error response. If you have // the required permissions, the error response is DryRunOperation. Otherwise, @@ -6728,46 +6808,46 @@ type AttachClassicLinkVPCInput struct { Groups []*string `locationName:"SecurityGroupId" locationNameList:"groupId" type:"list" required:"true"` // The ID of an EC2-Classic instance to link to the ClassicLink-enabled VPC. - InstanceID *string `locationName:"instanceId" type:"string" required:"true"` + InstanceId *string `locationName:"instanceId" type:"string" required:"true"` // The ID of a ClassicLink-enabled VPC. - VPCID *string `locationName:"vpcId" type:"string" required:"true"` + VpcId *string `locationName:"vpcId" type:"string" required:"true"` - metadataAttachClassicLinkVPCInput `json:"-" xml:"-"` + metadataAttachClassicLinkVpcInput `json:"-" xml:"-"` } -type metadataAttachClassicLinkVPCInput struct { +type metadataAttachClassicLinkVpcInput struct { SDKShapeTraits bool `type:"structure"` } // String returns the string representation -func (s AttachClassicLinkVPCInput) String() string { +func (s AttachClassicLinkVpcInput) String() string { return awsutil.Prettify(s) } // GoString returns the string representation -func (s AttachClassicLinkVPCInput) GoString() string { +func (s AttachClassicLinkVpcInput) GoString() string { return s.String() } -type AttachClassicLinkVPCOutput struct { +type AttachClassicLinkVpcOutput struct { // Returns true if the request succeeds; otherwise, it returns an error. Return *bool `locationName:"return" type:"boolean"` - metadataAttachClassicLinkVPCOutput `json:"-" xml:"-"` + metadataAttachClassicLinkVpcOutput `json:"-" xml:"-"` } -type metadataAttachClassicLinkVPCOutput struct { +type metadataAttachClassicLinkVpcOutput struct { SDKShapeTraits bool `type:"structure"` } // String returns the string representation -func (s AttachClassicLinkVPCOutput) String() string { +func (s AttachClassicLinkVpcOutput) String() string { return awsutil.Prettify(s) } // GoString returns the string representation -func (s AttachClassicLinkVPCOutput) GoString() string { +func (s AttachClassicLinkVpcOutput) GoString() string { return s.String() } @@ -6779,10 +6859,10 @@ type AttachInternetGatewayInput struct { DryRun *bool `locationName:"dryRun" type:"boolean"` // The ID of the Internet gateway. - InternetGatewayID *string `locationName:"internetGatewayId" type:"string" required:"true"` + InternetGatewayId *string `locationName:"internetGatewayId" type:"string" required:"true"` // The ID of the VPC. - VPCID *string `locationName:"vpcId" type:"string" required:"true"` + VpcId *string `locationName:"vpcId" type:"string" required:"true"` metadataAttachInternetGatewayInput `json:"-" xml:"-"` } @@ -6830,10 +6910,10 @@ type AttachNetworkInterfaceInput struct { DryRun *bool `locationName:"dryRun" type:"boolean"` // The ID of the instance. - InstanceID *string `locationName:"instanceId" type:"string" required:"true"` + InstanceId *string `locationName:"instanceId" type:"string" required:"true"` // The ID of the network interface. - NetworkInterfaceID *string `locationName:"networkInterfaceId" type:"string" required:"true"` + NetworkInterfaceId *string `locationName:"networkInterfaceId" type:"string" required:"true"` metadataAttachNetworkInterfaceInput `json:"-" xml:"-"` } @@ -6854,7 +6934,7 @@ func (s AttachNetworkInterfaceInput) GoString() string { type AttachNetworkInterfaceOutput struct { // The ID of the network interface attachment. - AttachmentID *string `locationName:"attachmentId" type:"string"` + AttachmentId *string `locationName:"attachmentId" type:"string"` metadataAttachNetworkInterfaceOutput `json:"-" xml:"-"` } @@ -6873,57 +6953,6 @@ func (s AttachNetworkInterfaceOutput) GoString() string { return s.String() } -type AttachVPNGatewayInput struct { - // Checks whether you have the required permissions for the action, without - // actually making the request, and provides an error response. If you have - // the required permissions, the error response is DryRunOperation. Otherwise, - // it is UnauthorizedOperation. - DryRun *bool `locationName:"dryRun" type:"boolean"` - - // The ID of the VPC. - VPCID *string `locationName:"VpcId" type:"string" required:"true"` - - // The ID of the virtual private gateway. - VPNGatewayID *string `locationName:"VpnGatewayId" type:"string" required:"true"` - - metadataAttachVPNGatewayInput `json:"-" xml:"-"` -} - -type metadataAttachVPNGatewayInput struct { - SDKShapeTraits bool `type:"structure"` -} - -// String returns the string representation -func (s AttachVPNGatewayInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s AttachVPNGatewayInput) GoString() string { - return s.String() -} - -type AttachVPNGatewayOutput struct { - // Information about the attachment. - VPCAttachment *VPCAttachment `locationName:"attachment" type:"structure"` - - metadataAttachVPNGatewayOutput `json:"-" xml:"-"` -} - -type metadataAttachVPNGatewayOutput struct { - SDKShapeTraits bool `type:"structure"` -} - -// String returns the string representation -func (s AttachVPNGatewayOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s AttachVPNGatewayOutput) GoString() string { - return s.String() -} - type AttachVolumeInput struct { // The device name to expose to the instance (for example, /dev/sdh or xvdh). Device *string `type:"string" required:"true"` @@ -6935,11 +6964,11 @@ type AttachVolumeInput struct { DryRun *bool `locationName:"dryRun" type:"boolean"` // The ID of the instance. - InstanceID *string `locationName:"InstanceId" type:"string" required:"true"` + InstanceId *string `type:"string" required:"true"` // The ID of the EBS volume. The volume and instance must be within the same // Availability Zone. - VolumeID *string `locationName:"VolumeId" type:"string" required:"true"` + VolumeId *string `type:"string" required:"true"` metadataAttachVolumeInput `json:"-" xml:"-"` } @@ -6958,6 +6987,57 @@ func (s AttachVolumeInput) GoString() string { return s.String() } +type AttachVpnGatewayInput struct { + // Checks whether you have the required permissions for the action, without + // actually making the request, and provides an error response. If you have + // the required permissions, the error response is DryRunOperation. Otherwise, + // it is UnauthorizedOperation. + DryRun *bool `locationName:"dryRun" type:"boolean"` + + // The ID of the VPC. + VpcId *string `type:"string" required:"true"` + + // The ID of the virtual private gateway. + VpnGatewayId *string `type:"string" required:"true"` + + metadataAttachVpnGatewayInput `json:"-" xml:"-"` +} + +type metadataAttachVpnGatewayInput struct { + SDKShapeTraits bool `type:"structure"` +} + +// String returns the string representation +func (s AttachVpnGatewayInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s AttachVpnGatewayInput) GoString() string { + return s.String() +} + +type AttachVpnGatewayOutput struct { + // Information about the attachment. + VpcAttachment *VpcAttachment `locationName:"attachment" type:"structure"` + + metadataAttachVpnGatewayOutput `json:"-" xml:"-"` +} + +type metadataAttachVpnGatewayOutput struct { + SDKShapeTraits bool `type:"structure"` +} + +// String returns the string representation +func (s AttachVpnGatewayOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s AttachVpnGatewayOutput) GoString() string { + return s.String() +} + // The value to use when a resource attribute accepts a Boolean value. type AttributeBooleanValue struct { // Valid values are true or false. @@ -7005,7 +7085,7 @@ func (s AttributeValue) GoString() string { type AuthorizeSecurityGroupEgressInput struct { // The CIDR IP address range. You can't specify this parameter when specifying // a source security group. - CIDRIP *string `locationName:"cidrIp" type:"string"` + CidrIp *string `locationName:"cidrIp" type:"string"` // Checks whether you have the required permissions for the action, without // actually making the request, and provides an error response. If you have @@ -7018,15 +7098,15 @@ type AuthorizeSecurityGroupEgressInput struct { FromPort *int64 `locationName:"fromPort" type:"integer"` // The ID of the security group. - GroupID *string `locationName:"groupId" type:"string" required:"true"` + GroupId *string `locationName:"groupId" type:"string" required:"true"` // A set of IP permissions. You can't specify a destination security group and // a CIDR IP address range. - IPPermissions []*IPPermission `locationName:"ipPermissions" locationNameList:"item" type:"list"` + IpPermissions []*IpPermission `locationName:"ipPermissions" locationNameList:"item" type:"list"` // The IP protocol name (tcp, udp, icmp) or number (see Protocol Numbers (http://www.iana.org/assignments/protocol-numbers/protocol-numbers.xhtml)). // Use -1 to specify all. - IPProtocol *string `locationName:"ipProtocol" type:"string"` + IpProtocol *string `locationName:"ipProtocol" type:"string"` // The name of a destination security group. To authorize outbound access to // a destination security group, we recommend that you use a set of IP permissions @@ -7036,7 +7116,7 @@ type AuthorizeSecurityGroupEgressInput struct { // The AWS account number for a destination security group. To authorize outbound // access to a destination security group, we recommend that you use a set of // IP permissions instead. - SourceSecurityGroupOwnerID *string `locationName:"sourceSecurityGroupOwnerId" type:"string"` + SourceSecurityGroupOwnerId *string `locationName:"sourceSecurityGroupOwnerId" type:"string"` // The end of port range for the TCP and UDP protocols, or an ICMP code number. // For the ICMP code number, use -1 to specify all ICMP codes for the ICMP type. @@ -7080,7 +7160,7 @@ func (s AuthorizeSecurityGroupEgressOutput) GoString() string { type AuthorizeSecurityGroupIngressInput struct { // The CIDR IP address range. You can't specify this parameter when specifying // a source security group. - CIDRIP *string `locationName:"CidrIp" type:"string"` + CidrIp *string `type:"string"` // Checks whether you have the required permissions for the action, without // actually making the request, and provides an error response. If you have @@ -7093,18 +7173,18 @@ type AuthorizeSecurityGroupIngressInput struct { FromPort *int64 `type:"integer"` // The ID of the security group. Required for a nondefault VPC. - GroupID *string `locationName:"GroupId" type:"string"` + GroupId *string `type:"string"` // [EC2-Classic, default VPC] The name of the security group. GroupName *string `type:"string"` // A set of IP permissions. Can be used to specify multiple rules in a single // command. - IPPermissions []*IPPermission `locationName:"IpPermissions" locationNameList:"item" type:"list"` + IpPermissions []*IpPermission `locationNameList:"item" type:"list"` // The IP protocol name (tcp, udp, icmp) or number (see Protocol Numbers (http://www.iana.org/assignments/protocol-numbers/protocol-numbers.xhtml)). // (VPC only) Use -1 to specify all. - IPProtocol *string `locationName:"IpProtocol" type:"string"` + IpProtocol *string `type:"string"` // [EC2-Classic, default VPC] The name of the source security group. You can't // specify this parameter in combination with the following parameters: the @@ -7120,7 +7200,7 @@ type AuthorizeSecurityGroupIngressInput struct { // and the end of the port range. Creates rules that grant full ICMP, UDP, and // TCP access. To create a rule with a specific IP protocol and port range, // use a set of IP permissions instead. - SourceSecurityGroupOwnerID *string `locationName:"SourceSecurityGroupOwnerId" type:"string"` + SourceSecurityGroupOwnerId *string `type:"string"` // The end of port range for the TCP and UDP protocols, or an ICMP code number. // For the ICMP code number, use -1 to specify all ICMP codes for the ICMP type. @@ -7169,7 +7249,7 @@ type AvailabilityZone struct { // The name of the region. RegionName *string `locationName:"regionName" type:"string"` - // The state of the Availability Zone (available | impaired | unavailable). + // The state of the Availability Zone. State *string `locationName:"zoneState" type:"string" enum:"AvailabilityZoneState"` // The name of the Availability Zone. @@ -7241,7 +7321,7 @@ type BlockDeviceMapping struct { // Parameters used to automatically set up EBS volumes when the instance is // launched. - EBS *EBSBlockDevice `locationName:"ebs" type:"structure"` + Ebs *EbsBlockDevice `locationName:"ebs" type:"structure"` // Suppresses the specified device included in the block device mapping of the // AMI. @@ -7290,7 +7370,7 @@ type BundleInstanceInput struct { // Default: None // // Required: Yes - InstanceID *string `locationName:"InstanceId" type:"string" required:"true"` + InstanceId *string `type:"string" required:"true"` // The bucket in which to store the AMI. You can specify a bucket that you already // own or a new bucket that Amazon EC2 creates on your behalf. If you specify @@ -7338,13 +7418,13 @@ func (s BundleInstanceOutput) GoString() string { // Describes a bundle task. type BundleTask struct { // The ID of the bundle task. - BundleID *string `locationName:"bundleId" type:"string"` + BundleId *string `locationName:"bundleId" type:"string"` // If the task fails, a description of the error. BundleTaskError *BundleTaskError `locationName:"error" type:"structure"` // The ID of the instance associated with this bundle task. - InstanceID *string `locationName:"instanceId" type:"string"` + InstanceId *string `locationName:"instanceId" type:"string"` // The level of task completion, as a percent (for example, 20%). Progress *string `locationName:"progress" type:"string"` @@ -7405,7 +7485,7 @@ func (s BundleTaskError) GoString() string { type CancelBundleTaskInput struct { // The ID of the bundle task. - BundleID *string `locationName:"BundleId" type:"string" required:"true"` + BundleId *string `type:"string" required:"true"` // Checks whether you have the required permissions for the action, without // actually making the request, and provides an error response. If you have @@ -7453,7 +7533,7 @@ func (s CancelBundleTaskOutput) GoString() string { type CancelConversionTaskInput struct { // The ID of the conversion task. - ConversionTaskID *string `locationName:"conversionTaskId" type:"string" required:"true"` + ConversionTaskId *string `locationName:"conversionTaskId" type:"string" required:"true"` // Checks whether you have the required permissions for the action, without // actually making the request, and provides an error response. If you have @@ -7501,7 +7581,7 @@ func (s CancelConversionTaskOutput) GoString() string { type CancelExportTaskInput struct { // The ID of the export task. This is the ID returned by CreateInstanceExportTask. - ExportTaskID *string `locationName:"exportTaskId" type:"string" required:"true"` + ExportTaskId *string `locationName:"exportTaskId" type:"string" required:"true"` metadataCancelExportTaskInput `json:"-" xml:"-"` } @@ -7549,7 +7629,7 @@ type CancelImportTaskInput struct { DryRun *bool `type:"boolean"` // The ID of the import image or import snapshot task to be canceled. - ImportTaskID *string `locationName:"ImportTaskId" type:"string"` + ImportTaskId *string `type:"string"` metadataCancelImportTaskInput `json:"-" xml:"-"` } @@ -7570,7 +7650,7 @@ func (s CancelImportTaskInput) GoString() string { type CancelImportTaskOutput struct { // The ID of the task being canceled. - ImportTaskID *string `locationName:"importTaskId" type:"string"` + ImportTaskId *string `locationName:"importTaskId" type:"string"` // The current state of the task being canceled. PreviousState *string `locationName:"previousState" type:"string"` @@ -7597,7 +7677,7 @@ func (s CancelImportTaskOutput) GoString() string { type CancelReservedInstancesListingInput struct { // The ID of the Reserved Instance listing. - ReservedInstancesListingID *string `locationName:"reservedInstancesListingId" type:"string" required:"true"` + ReservedInstancesListingId *string `locationName:"reservedInstancesListingId" type:"string" required:"true"` metadataCancelReservedInstancesListingInput `json:"-" xml:"-"` } @@ -7668,7 +7748,7 @@ type CancelSpotFleetRequestsErrorItem struct { Error *CancelSpotFleetRequestsError `locationName:"error" type:"structure" required:"true"` // The ID of the Spot fleet request. - SpotFleetRequestID *string `locationName:"spotFleetRequestId" type:"string" required:"true"` + SpotFleetRequestId *string `locationName:"spotFleetRequestId" type:"string" required:"true"` metadataCancelSpotFleetRequestsErrorItem `json:"-" xml:"-"` } @@ -7696,7 +7776,7 @@ type CancelSpotFleetRequestsInput struct { DryRun *bool `locationName:"dryRun" type:"boolean"` // The IDs of the Spot fleet requests. - SpotFleetRequestIDs []*string `locationName:"spotFleetRequestId" locationNameList:"item" type:"list" required:"true"` + SpotFleetRequestIds []*string `locationName:"spotFleetRequestId" locationNameList:"item" type:"list" required:"true"` // Indicates whether to terminate instances for a Spot fleet request if it is // canceled successfully. @@ -7753,7 +7833,7 @@ type CancelSpotFleetRequestsSuccessItem struct { PreviousSpotFleetRequestState *string `locationName:"previousSpotFleetRequestState" type:"string" required:"true" enum:"BatchState"` // The ID of the Spot fleet request. - SpotFleetRequestID *string `locationName:"spotFleetRequestId" type:"string" required:"true"` + SpotFleetRequestId *string `locationName:"spotFleetRequestId" type:"string" required:"true"` metadataCancelSpotFleetRequestsSuccessItem `json:"-" xml:"-"` } @@ -7780,8 +7860,8 @@ type CancelSpotInstanceRequestsInput struct { // it is UnauthorizedOperation. DryRun *bool `locationName:"dryRun" type:"boolean"` - // One or more Spot Instance request IDs. - SpotInstanceRequestIDs []*string `locationName:"SpotInstanceRequestId" locationNameList:"SpotInstanceRequestId" type:"list" required:"true"` + // One or more Spot instance request IDs. + SpotInstanceRequestIds []*string `locationName:"SpotInstanceRequestId" locationNameList:"SpotInstanceRequestId" type:"list" required:"true"` metadataCancelSpotInstanceRequestsInput `json:"-" xml:"-"` } @@ -7802,7 +7882,7 @@ func (s CancelSpotInstanceRequestsInput) GoString() string { // Contains the output of CancelSpotInstanceRequests. type CancelSpotInstanceRequestsOutput struct { - // One or more Spot Instance requests. + // One or more Spot instance requests. CancelledSpotInstanceRequests []*CancelledSpotInstanceRequest `locationName:"spotInstanceRequestSet" locationNameList:"item" type:"list"` metadataCancelSpotInstanceRequestsOutput `json:"-" xml:"-"` @@ -7822,12 +7902,12 @@ func (s CancelSpotInstanceRequestsOutput) GoString() string { return s.String() } -// Describes a request to cancel a Spot Instance. +// Describes a request to cancel a Spot instance. type CancelledSpotInstanceRequest struct { - // The ID of the Spot Instance request. - SpotInstanceRequestID *string `locationName:"spotInstanceRequestId" type:"string"` + // The ID of the Spot instance request. + SpotInstanceRequestId *string `locationName:"spotInstanceRequestId" type:"string"` - // The state of the Spot Instance request. + // The state of the Spot instance request. State *string `locationName:"state" type:"string" enum:"CancelSpotInstanceRequestState"` metadataCancelledSpotInstanceRequest `json:"-" xml:"-"` @@ -7853,13 +7933,13 @@ type ClassicLinkInstance struct { Groups []*GroupIdentifier `locationName:"groupSet" locationNameList:"item" type:"list"` // The ID of the instance. - InstanceID *string `locationName:"instanceId" type:"string"` + InstanceId *string `locationName:"instanceId" type:"string"` // Any tags assigned to the instance. Tags []*Tag `locationName:"tagSet" locationNameList:"item" type:"list"` // The ID of the VPC. - VPCID *string `locationName:"vpcId" type:"string"` + VpcId *string `locationName:"vpcId" type:"string"` metadataClassicLinkInstance `json:"-" xml:"-"` } @@ -7917,7 +7997,7 @@ type ConfirmProductInstanceInput struct { DryRun *bool `locationName:"dryRun" type:"boolean"` // The ID of the instance. - InstanceID *string `locationName:"InstanceId" type:"string" required:"true"` + InstanceId *string `type:"string" required:"true"` // The product code. This must be a product code that you own. ProductCode *string `type:"string" required:"true"` @@ -7942,7 +8022,7 @@ func (s ConfirmProductInstanceInput) GoString() string { type ConfirmProductInstanceOutput struct { // The AWS account ID of the instance owner. This is only present if the product // code is attached to the instance. - OwnerID *string `locationName:"ownerId" type:"string"` + OwnerId *string `locationName:"ownerId" type:"string"` // The return value of the request. Returns true if the specified product code // is owned by the requester and associated with the specified instance. @@ -7968,7 +8048,7 @@ func (s ConfirmProductInstanceOutput) GoString() string { // Describes a conversion task. type ConversionTask struct { // The ID of the conversion task. - ConversionTaskID *string `locationName:"conversionTaskId" type:"string" required:"true"` + ConversionTaskId *string `locationName:"conversionTaskId" type:"string" required:"true"` // The time when the task expires. If the upload isn't complete before the expiration // time, we automatically cancel the task. @@ -8027,7 +8107,7 @@ type CopyImageInput struct { Name *string `type:"string" required:"true"` // The ID of the AMI to copy. - SourceImageID *string `locationName:"SourceImageId" type:"string" required:"true"` + SourceImageId *string `type:"string" required:"true"` // The name of the region that contains the AMI to copy. SourceRegion *string `type:"string" required:"true"` @@ -8051,7 +8131,7 @@ func (s CopyImageInput) GoString() string { type CopyImageOutput struct { // The ID of the new AMI. - ImageID *string `locationName:"imageId" type:"string"` + ImageId *string `locationName:"imageId" type:"string"` metadataCopyImageOutput `json:"-" xml:"-"` } @@ -8107,7 +8187,7 @@ type CopySnapshotInput struct { // and then the CMK ID. For example, arn:aws:kms:us-east-1:012345678910:key/abcd1234-a123-456a-a12b-a123b4cd56ef. // The specified CMK must exist in the region that the snapshot is being copied // to. If a KmsKeyId is specified, the Encrypted flag must also be set. - KMSKeyID *string `locationName:"kmsKeyId" type:"string"` + KmsKeyId *string `locationName:"kmsKeyId" type:"string"` // The pre-signed URL that facilitates copying an encrypted snapshot. This parameter // is only required when copying an encrypted snapshot with the Amazon EC2 Query @@ -8121,13 +8201,13 @@ type CopySnapshotInput struct { // in the Amazon Simple Storage Service API Reference. An invalid or improperly // signed PresignedUrl will cause the copy operation to fail asynchronously, // and the snapshot will move to an error state. - PresignedURL *string `locationName:"presignedUrl" type:"string"` + PresignedUrl *string `locationName:"presignedUrl" type:"string"` // The ID of the region that contains the snapshot to be copied. SourceRegion *string `type:"string" required:"true"` // The ID of the EBS snapshot to copy. - SourceSnapshotID *string `locationName:"SourceSnapshotId" type:"string" required:"true"` + SourceSnapshotId *string `type:"string" required:"true"` metadataCopySnapshotInput `json:"-" xml:"-"` } @@ -8148,7 +8228,7 @@ func (s CopySnapshotInput) GoString() string { type CopySnapshotOutput struct { // The ID of the new snapshot. - SnapshotID *string `locationName:"snapshotId" type:"string"` + SnapshotId *string `locationName:"snapshotId" type:"string"` metadataCopySnapshotOutput `json:"-" xml:"-"` } @@ -8171,7 +8251,7 @@ type CreateCustomerGatewayInput struct { // For devices that support BGP, the customer gateway's BGP ASN. // // Default: 65000 - BGPASN *int64 `locationName:"BgpAsn" type:"integer" required:"true"` + BgpAsn *int64 `type:"integer" required:"true"` // Checks whether you have the required permissions for the action, without // actually making the request, and provides an error response. If you have @@ -8181,7 +8261,7 @@ type CreateCustomerGatewayInput struct { // The Internet-routable IP address for the customer gateway's outside interface. // The address must be static. - PublicIP *string `locationName:"IpAddress" type:"string" required:"true"` + PublicIp *string `locationName:"IpAddress" type:"string" required:"true"` // The type of VPN connection that this customer gateway supports (ipsec.1). Type *string `type:"string" required:"true" enum:"GatewayType"` @@ -8224,9 +8304,9 @@ func (s CreateCustomerGatewayOutput) GoString() string { return s.String() } -type CreateDHCPOptionsInput struct { +type CreateDhcpOptionsInput struct { // A DHCP configuration option. - DHCPConfigurations []*NewDHCPConfiguration `locationName:"dhcpConfiguration" locationNameList:"item" type:"list" required:"true"` + DhcpConfigurations []*NewDhcpConfiguration `locationName:"dhcpConfiguration" locationNameList:"item" type:"list" required:"true"` // Checks whether you have the required permissions for the action, without // actually making the request, and provides an error response. If you have @@ -8234,41 +8314,41 @@ type CreateDHCPOptionsInput struct { // it is UnauthorizedOperation. DryRun *bool `locationName:"dryRun" type:"boolean"` - metadataCreateDHCPOptionsInput `json:"-" xml:"-"` + metadataCreateDhcpOptionsInput `json:"-" xml:"-"` } -type metadataCreateDHCPOptionsInput struct { +type metadataCreateDhcpOptionsInput struct { SDKShapeTraits bool `type:"structure"` } // String returns the string representation -func (s CreateDHCPOptionsInput) String() string { +func (s CreateDhcpOptionsInput) String() string { return awsutil.Prettify(s) } // GoString returns the string representation -func (s CreateDHCPOptionsInput) GoString() string { +func (s CreateDhcpOptionsInput) GoString() string { return s.String() } -type CreateDHCPOptionsOutput struct { +type CreateDhcpOptionsOutput struct { // A set of DHCP options. - DHCPOptions *DHCPOptions `locationName:"dhcpOptions" type:"structure"` + DhcpOptions *DhcpOptions `locationName:"dhcpOptions" type:"structure"` - metadataCreateDHCPOptionsOutput `json:"-" xml:"-"` + metadataCreateDhcpOptionsOutput `json:"-" xml:"-"` } -type metadataCreateDHCPOptionsOutput struct { +type metadataCreateDhcpOptionsOutput struct { SDKShapeTraits bool `type:"structure"` } // String returns the string representation -func (s CreateDHCPOptionsOutput) String() string { +func (s CreateDhcpOptionsOutput) String() string { return awsutil.Prettify(s) } // GoString returns the string representation -func (s CreateDHCPOptionsOutput) GoString() string { +func (s CreateDhcpOptionsOutput) GoString() string { return s.String() } @@ -8279,13 +8359,13 @@ type CreateFlowLogsInput struct { // The ARN for the IAM role that's used to post flow logs to a CloudWatch Logs // log group. - DeliverLogsPermissionARN *string `locationName:"DeliverLogsPermissionArn" type:"string" required:"true"` + DeliverLogsPermissionArn *string `type:"string" required:"true"` // The name of the CloudWatch log group. LogGroupName *string `type:"string" required:"true"` // One or more subnet, network interface, or VPC IDs. - ResourceIDs []*string `locationName:"ResourceId" locationNameList:"item" type:"list" required:"true"` + ResourceIds []*string `locationName:"ResourceId" locationNameList:"item" type:"list" required:"true"` // The type of resource on which to create the flow log. ResourceType *string `type:"string" required:"true" enum:"FlowLogsResourceType"` @@ -8316,7 +8396,7 @@ type CreateFlowLogsOutput struct { ClientToken *string `locationName:"clientToken" type:"string"` // The IDs of the flow logs. - FlowLogIDs []*string `locationName:"flowLogIdSet" locationNameList:"item" type:"list"` + FlowLogIds []*string `locationName:"flowLogIdSet" locationNameList:"item" type:"list"` // Information about the flow logs that could not be created successfully. Unsuccessful []*UnsuccessfulItem `locationName:"unsuccessful" locationNameList:"item" type:"list"` @@ -8352,7 +8432,7 @@ type CreateImageInput struct { DryRun *bool `locationName:"dryRun" type:"boolean"` // The ID of the instance. - InstanceID *string `locationName:"instanceId" type:"string" required:"true"` + InstanceId *string `locationName:"instanceId" type:"string" required:"true"` // A name for the new image. // @@ -8387,7 +8467,7 @@ func (s CreateImageInput) GoString() string { type CreateImageOutput struct { // The ID of the new AMI. - ImageID *string `locationName:"imageId" type:"string"` + ImageId *string `locationName:"imageId" type:"string"` metadataCreateImageOutput `json:"-" xml:"-"` } @@ -8415,7 +8495,7 @@ type CreateInstanceExportTaskInput struct { ExportToS3Task *ExportToS3TaskSpecification `locationName:"exportToS3" type:"structure"` // The ID of the instance. - InstanceID *string `locationName:"instanceId" type:"string" required:"true"` + InstanceId *string `locationName:"instanceId" type:"string" required:"true"` // The target virtualization environment. TargetEnvironment *string `locationName:"targetEnvironment" type:"string" enum:"ExportEnvironment"` @@ -8560,9 +8640,9 @@ func (s CreateKeyPairOutput) GoString() string { return s.String() } -type CreateNetworkACLEntryInput struct { +type CreateNetworkAclEntryInput struct { // The network range to allow or deny, in CIDR notation (for example 172.16.0.0/24). - CIDRBlock *string `locationName:"cidrBlock" type:"string" required:"true"` + CidrBlock *string `locationName:"cidrBlock" type:"string" required:"true"` // Checks whether you have the required permissions for the action, without // actually making the request, and provides an error response. If you have @@ -8576,10 +8656,10 @@ type CreateNetworkACLEntryInput struct { // ICMP protocol: The ICMP type and code. Required if specifying ICMP for the // protocol. - ICMPTypeCode *ICMPTypeCode `locationName:"Icmp" type:"structure"` + IcmpTypeCode *IcmpTypeCode `locationName:"Icmp" type:"structure"` // The ID of the network ACL. - NetworkACLID *string `locationName:"networkAclId" type:"string" required:"true"` + NetworkAclId *string `locationName:"networkAclId" type:"string" required:"true"` // TCP or UDP protocols: The range of ports the rule applies to. PortRange *PortRange `locationName:"portRange" type:"structure"` @@ -8596,42 +8676,42 @@ type CreateNetworkACLEntryInput struct { // Constraints: Positive integer from 1 to 32766 RuleNumber *int64 `locationName:"ruleNumber" type:"integer" required:"true"` - metadataCreateNetworkACLEntryInput `json:"-" xml:"-"` + metadataCreateNetworkAclEntryInput `json:"-" xml:"-"` } -type metadataCreateNetworkACLEntryInput struct { +type metadataCreateNetworkAclEntryInput struct { SDKShapeTraits bool `type:"structure"` } // String returns the string representation -func (s CreateNetworkACLEntryInput) String() string { +func (s CreateNetworkAclEntryInput) String() string { return awsutil.Prettify(s) } // GoString returns the string representation -func (s CreateNetworkACLEntryInput) GoString() string { +func (s CreateNetworkAclEntryInput) GoString() string { return s.String() } -type CreateNetworkACLEntryOutput struct { - metadataCreateNetworkACLEntryOutput `json:"-" xml:"-"` +type CreateNetworkAclEntryOutput struct { + metadataCreateNetworkAclEntryOutput `json:"-" xml:"-"` } -type metadataCreateNetworkACLEntryOutput struct { +type metadataCreateNetworkAclEntryOutput struct { SDKShapeTraits bool `type:"structure"` } // String returns the string representation -func (s CreateNetworkACLEntryOutput) String() string { +func (s CreateNetworkAclEntryOutput) String() string { return awsutil.Prettify(s) } // GoString returns the string representation -func (s CreateNetworkACLEntryOutput) GoString() string { +func (s CreateNetworkAclEntryOutput) GoString() string { return s.String() } -type CreateNetworkACLInput struct { +type CreateNetworkAclInput struct { // Checks whether you have the required permissions for the action, without // actually making the request, and provides an error response. If you have // the required permissions, the error response is DryRunOperation. Otherwise, @@ -8639,43 +8719,43 @@ type CreateNetworkACLInput struct { DryRun *bool `locationName:"dryRun" type:"boolean"` // The ID of the VPC. - VPCID *string `locationName:"vpcId" type:"string" required:"true"` + VpcId *string `locationName:"vpcId" type:"string" required:"true"` - metadataCreateNetworkACLInput `json:"-" xml:"-"` + metadataCreateNetworkAclInput `json:"-" xml:"-"` } -type metadataCreateNetworkACLInput struct { +type metadataCreateNetworkAclInput struct { SDKShapeTraits bool `type:"structure"` } // String returns the string representation -func (s CreateNetworkACLInput) String() string { +func (s CreateNetworkAclInput) String() string { return awsutil.Prettify(s) } // GoString returns the string representation -func (s CreateNetworkACLInput) GoString() string { +func (s CreateNetworkAclInput) GoString() string { return s.String() } -type CreateNetworkACLOutput struct { +type CreateNetworkAclOutput struct { // Information about the network ACL. - NetworkACL *NetworkACL `locationName:"networkAcl" type:"structure"` + NetworkAcl *NetworkAcl `locationName:"networkAcl" type:"structure"` - metadataCreateNetworkACLOutput `json:"-" xml:"-"` + metadataCreateNetworkAclOutput `json:"-" xml:"-"` } -type metadataCreateNetworkACLOutput struct { +type metadataCreateNetworkAclOutput struct { SDKShapeTraits bool `type:"structure"` } // String returns the string representation -func (s CreateNetworkACLOutput) String() string { +func (s CreateNetworkAclOutput) String() string { return awsutil.Prettify(s) } // GoString returns the string representation -func (s CreateNetworkACLOutput) GoString() string { +func (s CreateNetworkAclOutput) GoString() string { return s.String() } @@ -8696,10 +8776,10 @@ type CreateNetworkInterfaceInput struct { // an IP address, Amazon EC2 selects one for you from the subnet range. If you // specify an IP address, you cannot indicate any IP addresses specified in // privateIpAddresses as primary (only one IP address can be designated as primary). - PrivateIPAddress *string `locationName:"privateIpAddress" type:"string"` + PrivateIpAddress *string `locationName:"privateIpAddress" type:"string"` // One or more private IP addresses. - PrivateIPAddresses []*PrivateIPAddressSpecification `locationName:"privateIpAddresses" locationNameList:"item" type:"list"` + PrivateIpAddresses []*PrivateIpAddressSpecification `locationName:"privateIpAddresses" locationNameList:"item" type:"list"` // The number of secondary private IP addresses to assign to a network interface. // When you specify a number of secondary IP addresses, Amazon EC2 selects these @@ -8710,10 +8790,10 @@ type CreateNetworkInterfaceInput struct { // by instance type. For more information, see Private IP Addresses Per ENI // Per Instance Type (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-eni.html#AvailableIpPerENI) // in the Amazon Elastic Compute Cloud User Guide. - SecondaryPrivateIPAddressCount *int64 `locationName:"secondaryPrivateIpAddressCount" type:"integer"` + SecondaryPrivateIpAddressCount *int64 `locationName:"secondaryPrivateIpAddressCount" type:"integer"` // The ID of the subnet to associate with the network interface. - SubnetID *string `locationName:"subnetId" type:"string" required:"true"` + SubnetId *string `locationName:"subnetId" type:"string" required:"true"` metadataCreateNetworkInterfaceInput `json:"-" xml:"-"` } @@ -8820,7 +8900,7 @@ type CreateReservedInstancesListingInput struct { PriceSchedules []*PriceScheduleSpecification `locationName:"priceSchedules" locationNameList:"item" type:"list" required:"true"` // The ID of the active Reserved Instance. - ReservedInstancesID *string `locationName:"reservedInstancesId" type:"string" required:"true"` + ReservedInstancesId *string `locationName:"reservedInstancesId" type:"string" required:"true"` metadataCreateReservedInstancesListingInput `json:"-" xml:"-"` } @@ -8863,7 +8943,7 @@ func (s CreateReservedInstancesListingOutput) GoString() string { type CreateRouteInput struct { // The CIDR address block used for the destination match. Routing decisions // are based on the most specific match. - DestinationCIDRBlock *string `locationName:"destinationCidrBlock" type:"string" required:"true"` + DestinationCidrBlock *string `locationName:"destinationCidrBlock" type:"string" required:"true"` // Checks whether you have the required permissions for the action, without // actually making the request, and provides an error response. If you have @@ -8873,20 +8953,20 @@ type CreateRouteInput struct { // The ID of an Internet gateway or virtual private gateway attached to your // VPC. - GatewayID *string `locationName:"gatewayId" type:"string"` + GatewayId *string `locationName:"gatewayId" type:"string"` // The ID of a NAT instance in your VPC. The operation fails if you specify // an instance ID unless exactly one network interface is attached. - InstanceID *string `locationName:"instanceId" type:"string"` + InstanceId *string `locationName:"instanceId" type:"string"` // The ID of a network interface. - NetworkInterfaceID *string `locationName:"networkInterfaceId" type:"string"` + NetworkInterfaceId *string `locationName:"networkInterfaceId" type:"string"` // The ID of the route table for the route. - RouteTableID *string `locationName:"routeTableId" type:"string" required:"true"` + RouteTableId *string `locationName:"routeTableId" type:"string" required:"true"` // The ID of a VPC peering connection. - VPCPeeringConnectionID *string `locationName:"vpcPeeringConnectionId" type:"string"` + VpcPeeringConnectionId *string `locationName:"vpcPeeringConnectionId" type:"string"` metadataCreateRouteInput `json:"-" xml:"-"` } @@ -8934,7 +9014,7 @@ type CreateRouteTableInput struct { DryRun *bool `locationName:"dryRun" type:"boolean"` // The ID of the VPC. - VPCID *string `locationName:"vpcId" type:"string" required:"true"` + VpcId *string `locationName:"vpcId" type:"string" required:"true"` metadataCreateRouteTableInput `json:"-" xml:"-"` } @@ -9000,7 +9080,7 @@ type CreateSecurityGroupInput struct { GroupName *string `type:"string" required:"true"` // [EC2-VPC] The ID of the VPC. Required for EC2-VPC. - VPCID *string `locationName:"VpcId" type:"string"` + VpcId *string `type:"string"` metadataCreateSecurityGroupInput `json:"-" xml:"-"` } @@ -9021,7 +9101,7 @@ func (s CreateSecurityGroupInput) GoString() string { type CreateSecurityGroupOutput struct { // The ID of the security group. - GroupID *string `locationName:"groupId" type:"string"` + GroupId *string `locationName:"groupId" type:"string"` metadataCreateSecurityGroupOutput `json:"-" xml:"-"` } @@ -9051,7 +9131,7 @@ type CreateSnapshotInput struct { DryRun *bool `locationName:"dryRun" type:"boolean"` // The ID of the EBS volume. - VolumeID *string `locationName:"VolumeId" type:"string" required:"true"` + VolumeId *string `type:"string" required:"true"` metadataCreateSnapshotInput `json:"-" xml:"-"` } @@ -9072,7 +9152,7 @@ func (s CreateSnapshotInput) GoString() string { // Contains the parameters for CreateSpotDatafeedSubscription. type CreateSpotDatafeedSubscriptionInput struct { - // The Amazon S3 bucket in which to store the Spot Instance data feed. + // The Amazon S3 bucket in which to store the Spot instance data feed. Bucket *string `locationName:"bucket" type:"string" required:"true"` // Checks whether you have the required permissions for the action, without @@ -9103,7 +9183,7 @@ func (s CreateSpotDatafeedSubscriptionInput) GoString() string { // Contains the output of CreateSpotDatafeedSubscription. type CreateSpotDatafeedSubscriptionOutput struct { - // The Spot Instance data feed subscription. + // The Spot instance data feed subscription. SpotDatafeedSubscription *SpotDatafeedSubscription `locationName:"spotDatafeedSubscription" type:"structure"` metadataCreateSpotDatafeedSubscriptionOutput `json:"-" xml:"-"` @@ -9130,7 +9210,7 @@ type CreateSubnetInput struct { AvailabilityZone *string `type:"string"` // The network range for the subnet, in CIDR notation. For example, 10.0.0.0/24. - CIDRBlock *string `locationName:"CidrBlock" type:"string" required:"true"` + CidrBlock *string `type:"string" required:"true"` // Checks whether you have the required permissions for the action, without // actually making the request, and provides an error response. If you have @@ -9139,7 +9219,7 @@ type CreateSubnetInput struct { DryRun *bool `locationName:"dryRun" type:"boolean"` // The ID of the VPC. - VPCID *string `locationName:"VpcId" type:"string" required:"true"` + VpcId *string `type:"string" required:"true"` metadataCreateSubnetInput `json:"-" xml:"-"` } @@ -9229,341 +9309,6 @@ func (s CreateTagsOutput) GoString() string { return s.String() } -type CreateVPCEndpointInput struct { - // Unique, case-sensitive identifier you provide to ensure the idempotency of - // the request. For more information, see How to Ensure Idempotency (http://docs.aws.amazon.com/AWSEC2/latest/APIReference/Run_Instance_Idempotency.html). - ClientToken *string `type:"string"` - - // Checks whether you have the required permissions for the action, without - // actually making the request, and provides an error response. If you have - // the required permissions, the error response is DryRunOperation. Otherwise, - // it is UnauthorizedOperation. - DryRun *bool `type:"boolean"` - - // A policy to attach to the endpoint that controls access to the service. The - // policy must be in valid JSON format. If this parameter is not specified, - // we attach a default policy that allows full access to the service. - PolicyDocument *string `type:"string"` - - // One or more route table IDs. - RouteTableIDs []*string `locationName:"RouteTableId" locationNameList:"item" type:"list"` - - // The AWS service name, in the form com.amazonaws.region.service. To get a - // list of available services, use the DescribeVpcEndpointServices request. - ServiceName *string `type:"string" required:"true"` - - // The ID of the VPC in which the endpoint will be used. - VPCID *string `locationName:"VpcId" type:"string" required:"true"` - - metadataCreateVPCEndpointInput `json:"-" xml:"-"` -} - -type metadataCreateVPCEndpointInput struct { - SDKShapeTraits bool `type:"structure"` -} - -// String returns the string representation -func (s CreateVPCEndpointInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s CreateVPCEndpointInput) GoString() string { - return s.String() -} - -type CreateVPCEndpointOutput struct { - // Unique, case-sensitive identifier you provide to ensure the idempotency of - // the request. - ClientToken *string `locationName:"clientToken" type:"string"` - - // Information about the endpoint. - VPCEndpoint *VPCEndpoint `locationName:"vpcEndpoint" type:"structure"` - - metadataCreateVPCEndpointOutput `json:"-" xml:"-"` -} - -type metadataCreateVPCEndpointOutput struct { - SDKShapeTraits bool `type:"structure"` -} - -// String returns the string representation -func (s CreateVPCEndpointOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s CreateVPCEndpointOutput) GoString() string { - return s.String() -} - -type CreateVPCInput struct { - // The network range for the VPC, in CIDR notation. For example, 10.0.0.0/16. - CIDRBlock *string `locationName:"CidrBlock" type:"string" required:"true"` - - // Checks whether you have the required permissions for the action, without - // actually making the request, and provides an error response. If you have - // the required permissions, the error response is DryRunOperation. Otherwise, - // it is UnauthorizedOperation. - DryRun *bool `locationName:"dryRun" type:"boolean"` - - // The supported tenancy options for instances launched into the VPC. A value - // of default means that instances can be launched with any tenancy; a value - // of dedicated means all instances launched into the VPC are launched as dedicated - // tenancy instances regardless of the tenancy assigned to the instance at launch. - // Dedicated tenancy instances run on single-tenant hardware. - // - // Default: default - InstanceTenancy *string `locationName:"instanceTenancy" type:"string" enum:"Tenancy"` - - metadataCreateVPCInput `json:"-" xml:"-"` -} - -type metadataCreateVPCInput struct { - SDKShapeTraits bool `type:"structure"` -} - -// String returns the string representation -func (s CreateVPCInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s CreateVPCInput) GoString() string { - return s.String() -} - -type CreateVPCOutput struct { - // Information about the VPC. - VPC *VPC `locationName:"vpc" type:"structure"` - - metadataCreateVPCOutput `json:"-" xml:"-"` -} - -type metadataCreateVPCOutput struct { - SDKShapeTraits bool `type:"structure"` -} - -// String returns the string representation -func (s CreateVPCOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s CreateVPCOutput) GoString() string { - return s.String() -} - -type CreateVPCPeeringConnectionInput struct { - // Checks whether you have the required permissions for the action, without - // actually making the request, and provides an error response. If you have - // the required permissions, the error response is DryRunOperation. Otherwise, - // it is UnauthorizedOperation. - DryRun *bool `locationName:"dryRun" type:"boolean"` - - // The AWS account ID of the owner of the peer VPC. - // - // Default: Your AWS account ID - PeerOwnerID *string `locationName:"peerOwnerId" type:"string"` - - // The ID of the VPC with which you are creating the VPC peering connection. - PeerVPCID *string `locationName:"peerVpcId" type:"string"` - - // The ID of the requester VPC. - VPCID *string `locationName:"vpcId" type:"string"` - - metadataCreateVPCPeeringConnectionInput `json:"-" xml:"-"` -} - -type metadataCreateVPCPeeringConnectionInput struct { - SDKShapeTraits bool `type:"structure"` -} - -// String returns the string representation -func (s CreateVPCPeeringConnectionInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s CreateVPCPeeringConnectionInput) GoString() string { - return s.String() -} - -type CreateVPCPeeringConnectionOutput struct { - // Information about the VPC peering connection. - VPCPeeringConnection *VPCPeeringConnection `locationName:"vpcPeeringConnection" type:"structure"` - - metadataCreateVPCPeeringConnectionOutput `json:"-" xml:"-"` -} - -type metadataCreateVPCPeeringConnectionOutput struct { - SDKShapeTraits bool `type:"structure"` -} - -// String returns the string representation -func (s CreateVPCPeeringConnectionOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s CreateVPCPeeringConnectionOutput) GoString() string { - return s.String() -} - -type CreateVPNConnectionInput struct { - // The ID of the customer gateway. - CustomerGatewayID *string `locationName:"CustomerGatewayId" type:"string" required:"true"` - - // Checks whether you have the required permissions for the action, without - // actually making the request, and provides an error response. If you have - // the required permissions, the error response is DryRunOperation. Otherwise, - // it is UnauthorizedOperation. - DryRun *bool `locationName:"dryRun" type:"boolean"` - - // Indicates whether the VPN connection requires static routes. If you are creating - // a VPN connection for a device that does not support BGP, you must specify - // true. - // - // Default: false - Options *VPNConnectionOptionsSpecification `locationName:"options" type:"structure"` - - // The type of VPN connection (ipsec.1). - Type *string `type:"string" required:"true"` - - // The ID of the virtual private gateway. - VPNGatewayID *string `locationName:"VpnGatewayId" type:"string" required:"true"` - - metadataCreateVPNConnectionInput `json:"-" xml:"-"` -} - -type metadataCreateVPNConnectionInput struct { - SDKShapeTraits bool `type:"structure"` -} - -// String returns the string representation -func (s CreateVPNConnectionInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s CreateVPNConnectionInput) GoString() string { - return s.String() -} - -type CreateVPNConnectionOutput struct { - // Information about the VPN connection. - VPNConnection *VPNConnection `locationName:"vpnConnection" type:"structure"` - - metadataCreateVPNConnectionOutput `json:"-" xml:"-"` -} - -type metadataCreateVPNConnectionOutput struct { - SDKShapeTraits bool `type:"structure"` -} - -// String returns the string representation -func (s CreateVPNConnectionOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s CreateVPNConnectionOutput) GoString() string { - return s.String() -} - -type CreateVPNConnectionRouteInput struct { - // The CIDR block associated with the local subnet of the customer network. - DestinationCIDRBlock *string `locationName:"DestinationCidrBlock" type:"string" required:"true"` - - // The ID of the VPN connection. - VPNConnectionID *string `locationName:"VpnConnectionId" type:"string" required:"true"` - - metadataCreateVPNConnectionRouteInput `json:"-" xml:"-"` -} - -type metadataCreateVPNConnectionRouteInput struct { - SDKShapeTraits bool `type:"structure"` -} - -// String returns the string representation -func (s CreateVPNConnectionRouteInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s CreateVPNConnectionRouteInput) GoString() string { - return s.String() -} - -type CreateVPNConnectionRouteOutput struct { - metadataCreateVPNConnectionRouteOutput `json:"-" xml:"-"` -} - -type metadataCreateVPNConnectionRouteOutput struct { - SDKShapeTraits bool `type:"structure"` -} - -// String returns the string representation -func (s CreateVPNConnectionRouteOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s CreateVPNConnectionRouteOutput) GoString() string { - return s.String() -} - -type CreateVPNGatewayInput struct { - // The Availability Zone for the virtual private gateway. - AvailabilityZone *string `type:"string"` - - // Checks whether you have the required permissions for the action, without - // actually making the request, and provides an error response. If you have - // the required permissions, the error response is DryRunOperation. Otherwise, - // it is UnauthorizedOperation. - DryRun *bool `locationName:"dryRun" type:"boolean"` - - // The type of VPN connection this virtual private gateway supports. - Type *string `type:"string" required:"true" enum:"GatewayType"` - - metadataCreateVPNGatewayInput `json:"-" xml:"-"` -} - -type metadataCreateVPNGatewayInput struct { - SDKShapeTraits bool `type:"structure"` -} - -// String returns the string representation -func (s CreateVPNGatewayInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s CreateVPNGatewayInput) GoString() string { - return s.String() -} - -type CreateVPNGatewayOutput struct { - // Information about the virtual private gateway. - VPNGateway *VPNGateway `locationName:"vpnGateway" type:"structure"` - - metadataCreateVPNGatewayOutput `json:"-" xml:"-"` -} - -type metadataCreateVPNGatewayOutput struct { - SDKShapeTraits bool `type:"structure"` -} - -// String returns the string representation -func (s CreateVPNGatewayOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s CreateVPNGatewayOutput) GoString() string { - return s.String() -} - type CreateVolumeInput struct { // The Availability Zone in which to create the volume. Use DescribeAvailabilityZones // to list the Availability Zones that are currently available to you. @@ -9589,7 +9334,7 @@ type CreateVolumeInput struct { // IOPS/GiB. // // Constraint: Range is 100 to 20000 for Provisioned IOPS (SSD) volumes - IOPS *int64 `locationName:"Iops" type:"integer"` + Iops *int64 `type:"integer"` // The full ARN of the AWS Key Management Service (AWS KMS) customer master // key (CMK) to use when creating the encrypted volume. This parameter is only @@ -9598,7 +9343,7 @@ type CreateVolumeInput struct { // followed by the region of the CMK, the AWS account ID of the CMK owner, the // key namespace, and then the CMK ID. For example, arn:aws:kms:us-east-1:012345678910:key/abcd1234-a123-456a-a12b-a123b4cd56ef. // If a KmsKeyId is specified, the Encrypted flag must also be set. - KMSKeyID *string `locationName:"KmsKeyId" type:"string"` + KmsKeyId *string `type:"string"` // The size of the volume, in GiBs. // @@ -9611,7 +9356,7 @@ type CreateVolumeInput struct { Size *int64 `type:"integer"` // The snapshot from which to create the volume. - SnapshotID *string `locationName:"SnapshotId" type:"string"` + SnapshotId *string `type:"string"` // The volume type. This can be gp2 for General Purpose (SSD) volumes, io1 for // Provisioned IOPS (SSD) volumes, or standard for Magnetic volumes. @@ -9645,7 +9390,7 @@ type CreateVolumePermission struct { // The specific AWS account ID that is to be added or removed from a volume's // list of create volume permissions. - UserID *string `locationName:"userId" type:"string"` + UserId *string `locationName:"userId" type:"string"` metadataCreateVolumePermission `json:"-" xml:"-"` } @@ -9691,17 +9436,352 @@ func (s CreateVolumePermissionModifications) GoString() string { return s.String() } +type CreateVpcEndpointInput struct { + // Unique, case-sensitive identifier you provide to ensure the idempotency of + // the request. For more information, see How to Ensure Idempotency (http://docs.aws.amazon.com/AWSEC2/latest/APIReference/Run_Instance_Idempotency.html). + ClientToken *string `type:"string"` + + // Checks whether you have the required permissions for the action, without + // actually making the request, and provides an error response. If you have + // the required permissions, the error response is DryRunOperation. Otherwise, + // it is UnauthorizedOperation. + DryRun *bool `type:"boolean"` + + // A policy to attach to the endpoint that controls access to the service. The + // policy must be in valid JSON format. If this parameter is not specified, + // we attach a default policy that allows full access to the service. + PolicyDocument *string `type:"string"` + + // One or more route table IDs. + RouteTableIds []*string `locationName:"RouteTableId" locationNameList:"item" type:"list"` + + // The AWS service name, in the form com.amazonaws.region.service. To get a + // list of available services, use the DescribeVpcEndpointServices request. + ServiceName *string `type:"string" required:"true"` + + // The ID of the VPC in which the endpoint will be used. + VpcId *string `type:"string" required:"true"` + + metadataCreateVpcEndpointInput `json:"-" xml:"-"` +} + +type metadataCreateVpcEndpointInput struct { + SDKShapeTraits bool `type:"structure"` +} + +// String returns the string representation +func (s CreateVpcEndpointInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s CreateVpcEndpointInput) GoString() string { + return s.String() +} + +type CreateVpcEndpointOutput struct { + // Unique, case-sensitive identifier you provide to ensure the idempotency of + // the request. + ClientToken *string `locationName:"clientToken" type:"string"` + + // Information about the endpoint. + VpcEndpoint *VpcEndpoint `locationName:"vpcEndpoint" type:"structure"` + + metadataCreateVpcEndpointOutput `json:"-" xml:"-"` +} + +type metadataCreateVpcEndpointOutput struct { + SDKShapeTraits bool `type:"structure"` +} + +// String returns the string representation +func (s CreateVpcEndpointOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s CreateVpcEndpointOutput) GoString() string { + return s.String() +} + +type CreateVpcInput struct { + // The network range for the VPC, in CIDR notation. For example, 10.0.0.0/16. + CidrBlock *string `type:"string" required:"true"` + + // Checks whether you have the required permissions for the action, without + // actually making the request, and provides an error response. If you have + // the required permissions, the error response is DryRunOperation. Otherwise, + // it is UnauthorizedOperation. + DryRun *bool `locationName:"dryRun" type:"boolean"` + + // The supported tenancy options for instances launched into the VPC. A value + // of default means that instances can be launched with any tenancy; a value + // of dedicated means all instances launched into the VPC are launched as dedicated + // tenancy instances regardless of the tenancy assigned to the instance at launch. + // Dedicated tenancy instances run on single-tenant hardware. + // + // Default: default + InstanceTenancy *string `locationName:"instanceTenancy" type:"string" enum:"Tenancy"` + + metadataCreateVpcInput `json:"-" xml:"-"` +} + +type metadataCreateVpcInput struct { + SDKShapeTraits bool `type:"structure"` +} + +// String returns the string representation +func (s CreateVpcInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s CreateVpcInput) GoString() string { + return s.String() +} + +type CreateVpcOutput struct { + // Information about the VPC. + Vpc *Vpc `locationName:"vpc" type:"structure"` + + metadataCreateVpcOutput `json:"-" xml:"-"` +} + +type metadataCreateVpcOutput struct { + SDKShapeTraits bool `type:"structure"` +} + +// String returns the string representation +func (s CreateVpcOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s CreateVpcOutput) GoString() string { + return s.String() +} + +type CreateVpcPeeringConnectionInput struct { + // Checks whether you have the required permissions for the action, without + // actually making the request, and provides an error response. If you have + // the required permissions, the error response is DryRunOperation. Otherwise, + // it is UnauthorizedOperation. + DryRun *bool `locationName:"dryRun" type:"boolean"` + + // The AWS account ID of the owner of the peer VPC. + // + // Default: Your AWS account ID + PeerOwnerId *string `locationName:"peerOwnerId" type:"string"` + + // The ID of the VPC with which you are creating the VPC peering connection. + PeerVpcId *string `locationName:"peerVpcId" type:"string"` + + // The ID of the requester VPC. + VpcId *string `locationName:"vpcId" type:"string"` + + metadataCreateVpcPeeringConnectionInput `json:"-" xml:"-"` +} + +type metadataCreateVpcPeeringConnectionInput struct { + SDKShapeTraits bool `type:"structure"` +} + +// String returns the string representation +func (s CreateVpcPeeringConnectionInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s CreateVpcPeeringConnectionInput) GoString() string { + return s.String() +} + +type CreateVpcPeeringConnectionOutput struct { + // Information about the VPC peering connection. + VpcPeeringConnection *VpcPeeringConnection `locationName:"vpcPeeringConnection" type:"structure"` + + metadataCreateVpcPeeringConnectionOutput `json:"-" xml:"-"` +} + +type metadataCreateVpcPeeringConnectionOutput struct { + SDKShapeTraits bool `type:"structure"` +} + +// String returns the string representation +func (s CreateVpcPeeringConnectionOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s CreateVpcPeeringConnectionOutput) GoString() string { + return s.String() +} + +type CreateVpnConnectionInput struct { + // The ID of the customer gateway. + CustomerGatewayId *string `type:"string" required:"true"` + + // Checks whether you have the required permissions for the action, without + // actually making the request, and provides an error response. If you have + // the required permissions, the error response is DryRunOperation. Otherwise, + // it is UnauthorizedOperation. + DryRun *bool `locationName:"dryRun" type:"boolean"` + + // Indicates whether the VPN connection requires static routes. If you are creating + // a VPN connection for a device that does not support BGP, you must specify + // true. + // + // Default: false + Options *VpnConnectionOptionsSpecification `locationName:"options" type:"structure"` + + // The type of VPN connection (ipsec.1). + Type *string `type:"string" required:"true"` + + // The ID of the virtual private gateway. + VpnGatewayId *string `type:"string" required:"true"` + + metadataCreateVpnConnectionInput `json:"-" xml:"-"` +} + +type metadataCreateVpnConnectionInput struct { + SDKShapeTraits bool `type:"structure"` +} + +// String returns the string representation +func (s CreateVpnConnectionInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s CreateVpnConnectionInput) GoString() string { + return s.String() +} + +type CreateVpnConnectionOutput struct { + // Information about the VPN connection. + VpnConnection *VpnConnection `locationName:"vpnConnection" type:"structure"` + + metadataCreateVpnConnectionOutput `json:"-" xml:"-"` +} + +type metadataCreateVpnConnectionOutput struct { + SDKShapeTraits bool `type:"structure"` +} + +// String returns the string representation +func (s CreateVpnConnectionOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s CreateVpnConnectionOutput) GoString() string { + return s.String() +} + +type CreateVpnConnectionRouteInput struct { + // The CIDR block associated with the local subnet of the customer network. + DestinationCidrBlock *string `type:"string" required:"true"` + + // The ID of the VPN connection. + VpnConnectionId *string `type:"string" required:"true"` + + metadataCreateVpnConnectionRouteInput `json:"-" xml:"-"` +} + +type metadataCreateVpnConnectionRouteInput struct { + SDKShapeTraits bool `type:"structure"` +} + +// String returns the string representation +func (s CreateVpnConnectionRouteInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s CreateVpnConnectionRouteInput) GoString() string { + return s.String() +} + +type CreateVpnConnectionRouteOutput struct { + metadataCreateVpnConnectionRouteOutput `json:"-" xml:"-"` +} + +type metadataCreateVpnConnectionRouteOutput struct { + SDKShapeTraits bool `type:"structure"` +} + +// String returns the string representation +func (s CreateVpnConnectionRouteOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s CreateVpnConnectionRouteOutput) GoString() string { + return s.String() +} + +type CreateVpnGatewayInput struct { + // The Availability Zone for the virtual private gateway. + AvailabilityZone *string `type:"string"` + + // Checks whether you have the required permissions for the action, without + // actually making the request, and provides an error response. If you have + // the required permissions, the error response is DryRunOperation. Otherwise, + // it is UnauthorizedOperation. + DryRun *bool `locationName:"dryRun" type:"boolean"` + + // The type of VPN connection this virtual private gateway supports. + Type *string `type:"string" required:"true" enum:"GatewayType"` + + metadataCreateVpnGatewayInput `json:"-" xml:"-"` +} + +type metadataCreateVpnGatewayInput struct { + SDKShapeTraits bool `type:"structure"` +} + +// String returns the string representation +func (s CreateVpnGatewayInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s CreateVpnGatewayInput) GoString() string { + return s.String() +} + +type CreateVpnGatewayOutput struct { + // Information about the virtual private gateway. + VpnGateway *VpnGateway `locationName:"vpnGateway" type:"structure"` + + metadataCreateVpnGatewayOutput `json:"-" xml:"-"` +} + +type metadataCreateVpnGatewayOutput struct { + SDKShapeTraits bool `type:"structure"` +} + +// String returns the string representation +func (s CreateVpnGatewayOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s CreateVpnGatewayOutput) GoString() string { + return s.String() +} + // Describes a customer gateway. type CustomerGateway struct { // The customer gateway's Border Gateway Protocol (BGP) Autonomous System Number // (ASN). - BGPASN *string `locationName:"bgpAsn" type:"string"` + BgpAsn *string `locationName:"bgpAsn" type:"string"` // The ID of the customer gateway. - CustomerGatewayID *string `locationName:"customerGatewayId" type:"string"` + CustomerGatewayId *string `locationName:"customerGatewayId" type:"string"` // The Internet-routable IP address of the customer gateway's outside interface. - IPAddress *string `locationName:"ipAddress" type:"string"` + IpAddress *string `locationName:"ipAddress" type:"string"` // The current state of the customer gateway (pending | available | deleting // | deleted). @@ -9730,62 +9810,9 @@ func (s CustomerGateway) GoString() string { return s.String() } -// Describes a DHCP configuration option. -type DHCPConfiguration struct { - // The name of a DHCP option. - Key *string `locationName:"key" type:"string"` - - // One or more values for the DHCP option. - Values []*AttributeValue `locationName:"valueSet" locationNameList:"item" type:"list"` - - metadataDHCPConfiguration `json:"-" xml:"-"` -} - -type metadataDHCPConfiguration struct { - SDKShapeTraits bool `type:"structure"` -} - -// String returns the string representation -func (s DHCPConfiguration) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s DHCPConfiguration) GoString() string { - return s.String() -} - -// Describes a set of DHCP options. -type DHCPOptions struct { - // One or more DHCP options in the set. - DHCPConfigurations []*DHCPConfiguration `locationName:"dhcpConfigurationSet" locationNameList:"item" type:"list"` - - // The ID of the set of DHCP options. - DHCPOptionsID *string `locationName:"dhcpOptionsId" type:"string"` - - // Any tags assigned to the DHCP options set. - Tags []*Tag `locationName:"tagSet" locationNameList:"item" type:"list"` - - metadataDHCPOptions `json:"-" xml:"-"` -} - -type metadataDHCPOptions struct { - SDKShapeTraits bool `type:"structure"` -} - -// String returns the string representation -func (s DHCPOptions) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s DHCPOptions) GoString() string { - return s.String() -} - type DeleteCustomerGatewayInput struct { // The ID of the customer gateway. - CustomerGatewayID *string `locationName:"CustomerGatewayId" type:"string" required:"true"` + CustomerGatewayId *string `type:"string" required:"true"` // Checks whether you have the required permissions for the action, without // actually making the request, and provides an error response. If you have @@ -9828,9 +9855,9 @@ func (s DeleteCustomerGatewayOutput) GoString() string { return s.String() } -type DeleteDHCPOptionsInput struct { +type DeleteDhcpOptionsInput struct { // The ID of the DHCP options set. - DHCPOptionsID *string `locationName:"DhcpOptionsId" type:"string" required:"true"` + DhcpOptionsId *string `type:"string" required:"true"` // Checks whether you have the required permissions for the action, without // actually making the request, and provides an error response. If you have @@ -9838,44 +9865,44 @@ type DeleteDHCPOptionsInput struct { // it is UnauthorizedOperation. DryRun *bool `locationName:"dryRun" type:"boolean"` - metadataDeleteDHCPOptionsInput `json:"-" xml:"-"` + metadataDeleteDhcpOptionsInput `json:"-" xml:"-"` } -type metadataDeleteDHCPOptionsInput struct { +type metadataDeleteDhcpOptionsInput struct { SDKShapeTraits bool `type:"structure"` } // String returns the string representation -func (s DeleteDHCPOptionsInput) String() string { +func (s DeleteDhcpOptionsInput) String() string { return awsutil.Prettify(s) } // GoString returns the string representation -func (s DeleteDHCPOptionsInput) GoString() string { +func (s DeleteDhcpOptionsInput) GoString() string { return s.String() } -type DeleteDHCPOptionsOutput struct { - metadataDeleteDHCPOptionsOutput `json:"-" xml:"-"` +type DeleteDhcpOptionsOutput struct { + metadataDeleteDhcpOptionsOutput `json:"-" xml:"-"` } -type metadataDeleteDHCPOptionsOutput struct { +type metadataDeleteDhcpOptionsOutput struct { SDKShapeTraits bool `type:"structure"` } // String returns the string representation -func (s DeleteDHCPOptionsOutput) String() string { +func (s DeleteDhcpOptionsOutput) String() string { return awsutil.Prettify(s) } // GoString returns the string representation -func (s DeleteDHCPOptionsOutput) GoString() string { +func (s DeleteDhcpOptionsOutput) GoString() string { return s.String() } type DeleteFlowLogsInput struct { // One or more flow log IDs. - FlowLogIDs []*string `locationName:"FlowLogId" locationNameList:"item" type:"list" required:"true"` + FlowLogIds []*string `locationName:"FlowLogId" locationNameList:"item" type:"list" required:"true"` metadataDeleteFlowLogsInput `json:"-" xml:"-"` } @@ -9923,7 +9950,7 @@ type DeleteInternetGatewayInput struct { DryRun *bool `locationName:"dryRun" type:"boolean"` // The ID of the Internet gateway. - InternetGatewayID *string `locationName:"internetGatewayId" type:"string" required:"true"` + InternetGatewayId *string `locationName:"internetGatewayId" type:"string" required:"true"` metadataDeleteInternetGatewayInput `json:"-" xml:"-"` } @@ -10005,7 +10032,7 @@ func (s DeleteKeyPairOutput) GoString() string { return s.String() } -type DeleteNetworkACLEntryInput struct { +type DeleteNetworkAclEntryInput struct { // Checks whether you have the required permissions for the action, without // actually making the request, and provides an error response. If you have // the required permissions, the error response is DryRunOperation. Otherwise, @@ -10016,47 +10043,47 @@ type DeleteNetworkACLEntryInput struct { Egress *bool `locationName:"egress" type:"boolean" required:"true"` // The ID of the network ACL. - NetworkACLID *string `locationName:"networkAclId" type:"string" required:"true"` + NetworkAclId *string `locationName:"networkAclId" type:"string" required:"true"` // The rule number of the entry to delete. RuleNumber *int64 `locationName:"ruleNumber" type:"integer" required:"true"` - metadataDeleteNetworkACLEntryInput `json:"-" xml:"-"` + metadataDeleteNetworkAclEntryInput `json:"-" xml:"-"` } -type metadataDeleteNetworkACLEntryInput struct { +type metadataDeleteNetworkAclEntryInput struct { SDKShapeTraits bool `type:"structure"` } // String returns the string representation -func (s DeleteNetworkACLEntryInput) String() string { +func (s DeleteNetworkAclEntryInput) String() string { return awsutil.Prettify(s) } // GoString returns the string representation -func (s DeleteNetworkACLEntryInput) GoString() string { +func (s DeleteNetworkAclEntryInput) GoString() string { return s.String() } -type DeleteNetworkACLEntryOutput struct { - metadataDeleteNetworkACLEntryOutput `json:"-" xml:"-"` +type DeleteNetworkAclEntryOutput struct { + metadataDeleteNetworkAclEntryOutput `json:"-" xml:"-"` } -type metadataDeleteNetworkACLEntryOutput struct { +type metadataDeleteNetworkAclEntryOutput struct { SDKShapeTraits bool `type:"structure"` } // String returns the string representation -func (s DeleteNetworkACLEntryOutput) String() string { +func (s DeleteNetworkAclEntryOutput) String() string { return awsutil.Prettify(s) } // GoString returns the string representation -func (s DeleteNetworkACLEntryOutput) GoString() string { +func (s DeleteNetworkAclEntryOutput) GoString() string { return s.String() } -type DeleteNetworkACLInput struct { +type DeleteNetworkAclInput struct { // Checks whether you have the required permissions for the action, without // actually making the request, and provides an error response. If you have // the required permissions, the error response is DryRunOperation. Otherwise, @@ -10064,40 +10091,40 @@ type DeleteNetworkACLInput struct { DryRun *bool `locationName:"dryRun" type:"boolean"` // The ID of the network ACL. - NetworkACLID *string `locationName:"networkAclId" type:"string" required:"true"` + NetworkAclId *string `locationName:"networkAclId" type:"string" required:"true"` - metadataDeleteNetworkACLInput `json:"-" xml:"-"` + metadataDeleteNetworkAclInput `json:"-" xml:"-"` } -type metadataDeleteNetworkACLInput struct { +type metadataDeleteNetworkAclInput struct { SDKShapeTraits bool `type:"structure"` } // String returns the string representation -func (s DeleteNetworkACLInput) String() string { +func (s DeleteNetworkAclInput) String() string { return awsutil.Prettify(s) } // GoString returns the string representation -func (s DeleteNetworkACLInput) GoString() string { +func (s DeleteNetworkAclInput) GoString() string { return s.String() } -type DeleteNetworkACLOutput struct { - metadataDeleteNetworkACLOutput `json:"-" xml:"-"` +type DeleteNetworkAclOutput struct { + metadataDeleteNetworkAclOutput `json:"-" xml:"-"` } -type metadataDeleteNetworkACLOutput struct { +type metadataDeleteNetworkAclOutput struct { SDKShapeTraits bool `type:"structure"` } // String returns the string representation -func (s DeleteNetworkACLOutput) String() string { +func (s DeleteNetworkAclOutput) String() string { return awsutil.Prettify(s) } // GoString returns the string representation -func (s DeleteNetworkACLOutput) GoString() string { +func (s DeleteNetworkAclOutput) GoString() string { return s.String() } @@ -10109,7 +10136,7 @@ type DeleteNetworkInterfaceInput struct { DryRun *bool `locationName:"dryRun" type:"boolean"` // The ID of the network interface. - NetworkInterfaceID *string `locationName:"networkInterfaceId" type:"string" required:"true"` + NetworkInterfaceId *string `locationName:"networkInterfaceId" type:"string" required:"true"` metadataDeleteNetworkInterfaceInput `json:"-" xml:"-"` } @@ -10194,7 +10221,7 @@ func (s DeletePlacementGroupOutput) GoString() string { type DeleteRouteInput struct { // The CIDR range for the route. The value you specify must match the CIDR for // the route exactly. - DestinationCIDRBlock *string `locationName:"destinationCidrBlock" type:"string" required:"true"` + DestinationCidrBlock *string `locationName:"destinationCidrBlock" type:"string" required:"true"` // Checks whether you have the required permissions for the action, without // actually making the request, and provides an error response. If you have @@ -10203,7 +10230,7 @@ type DeleteRouteInput struct { DryRun *bool `locationName:"dryRun" type:"boolean"` // The ID of the route table. - RouteTableID *string `locationName:"routeTableId" type:"string" required:"true"` + RouteTableId *string `locationName:"routeTableId" type:"string" required:"true"` metadataDeleteRouteInput `json:"-" xml:"-"` } @@ -10248,7 +10275,7 @@ type DeleteRouteTableInput struct { DryRun *bool `locationName:"dryRun" type:"boolean"` // The ID of the route table. - RouteTableID *string `locationName:"routeTableId" type:"string" required:"true"` + RouteTableId *string `locationName:"routeTableId" type:"string" required:"true"` metadataDeleteRouteTableInput `json:"-" xml:"-"` } @@ -10293,7 +10320,7 @@ type DeleteSecurityGroupInput struct { DryRun *bool `locationName:"dryRun" type:"boolean"` // The ID of the security group. Required for a nondefault VPC. - GroupID *string `locationName:"GroupId" type:"string"` + GroupId *string `type:"string"` // [EC2-Classic, default VPC] The name of the security group. You can specify // either the security group name or the security group ID. @@ -10342,7 +10369,7 @@ type DeleteSnapshotInput struct { DryRun *bool `locationName:"dryRun" type:"boolean"` // The ID of the EBS snapshot. - SnapshotID *string `locationName:"SnapshotId" type:"string" required:"true"` + SnapshotId *string `type:"string" required:"true"` metadataDeleteSnapshotInput `json:"-" xml:"-"` } @@ -10430,7 +10457,7 @@ type DeleteSubnetInput struct { DryRun *bool `locationName:"dryRun" type:"boolean"` // The ID of the subnet. - SubnetID *string `locationName:"SubnetId" type:"string" required:"true"` + SubnetId *string `type:"string" required:"true"` metadataDeleteSubnetInput `json:"-" xml:"-"` } @@ -10518,279 +10545,6 @@ func (s DeleteTagsOutput) GoString() string { return s.String() } -type DeleteVPCEndpointsInput struct { - // Checks whether you have the required permissions for the action, without - // actually making the request, and provides an error response. If you have - // the required permissions, the error response is DryRunOperation. Otherwise, - // it is UnauthorizedOperation. - DryRun *bool `type:"boolean"` - - // One or more endpoint IDs. - VPCEndpointIDs []*string `locationName:"VpcEndpointId" locationNameList:"item" type:"list" required:"true"` - - metadataDeleteVPCEndpointsInput `json:"-" xml:"-"` -} - -type metadataDeleteVPCEndpointsInput struct { - SDKShapeTraits bool `type:"structure"` -} - -// String returns the string representation -func (s DeleteVPCEndpointsInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s DeleteVPCEndpointsInput) GoString() string { - return s.String() -} - -type DeleteVPCEndpointsOutput struct { - // Information about the endpoints that were not successfully deleted. - Unsuccessful []*UnsuccessfulItem `locationName:"unsuccessful" locationNameList:"item" type:"list"` - - metadataDeleteVPCEndpointsOutput `json:"-" xml:"-"` -} - -type metadataDeleteVPCEndpointsOutput struct { - SDKShapeTraits bool `type:"structure"` -} - -// String returns the string representation -func (s DeleteVPCEndpointsOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s DeleteVPCEndpointsOutput) GoString() string { - return s.String() -} - -type DeleteVPCInput struct { - // Checks whether you have the required permissions for the action, without - // actually making the request, and provides an error response. If you have - // the required permissions, the error response is DryRunOperation. Otherwise, - // it is UnauthorizedOperation. - DryRun *bool `locationName:"dryRun" type:"boolean"` - - // The ID of the VPC. - VPCID *string `locationName:"VpcId" type:"string" required:"true"` - - metadataDeleteVPCInput `json:"-" xml:"-"` -} - -type metadataDeleteVPCInput struct { - SDKShapeTraits bool `type:"structure"` -} - -// String returns the string representation -func (s DeleteVPCInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s DeleteVPCInput) GoString() string { - return s.String() -} - -type DeleteVPCOutput struct { - metadataDeleteVPCOutput `json:"-" xml:"-"` -} - -type metadataDeleteVPCOutput struct { - SDKShapeTraits bool `type:"structure"` -} - -// String returns the string representation -func (s DeleteVPCOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s DeleteVPCOutput) GoString() string { - return s.String() -} - -type DeleteVPCPeeringConnectionInput struct { - // Checks whether you have the required permissions for the action, without - // actually making the request, and provides an error response. If you have - // the required permissions, the error response is DryRunOperation. Otherwise, - // it is UnauthorizedOperation. - DryRun *bool `locationName:"dryRun" type:"boolean"` - - // The ID of the VPC peering connection. - VPCPeeringConnectionID *string `locationName:"vpcPeeringConnectionId" type:"string" required:"true"` - - metadataDeleteVPCPeeringConnectionInput `json:"-" xml:"-"` -} - -type metadataDeleteVPCPeeringConnectionInput struct { - SDKShapeTraits bool `type:"structure"` -} - -// String returns the string representation -func (s DeleteVPCPeeringConnectionInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s DeleteVPCPeeringConnectionInput) GoString() string { - return s.String() -} - -type DeleteVPCPeeringConnectionOutput struct { - // Returns true if the request succeeds; otherwise, it returns an error. - Return *bool `locationName:"return" type:"boolean"` - - metadataDeleteVPCPeeringConnectionOutput `json:"-" xml:"-"` -} - -type metadataDeleteVPCPeeringConnectionOutput struct { - SDKShapeTraits bool `type:"structure"` -} - -// String returns the string representation -func (s DeleteVPCPeeringConnectionOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s DeleteVPCPeeringConnectionOutput) GoString() string { - return s.String() -} - -type DeleteVPNConnectionInput struct { - // Checks whether you have the required permissions for the action, without - // actually making the request, and provides an error response. If you have - // the required permissions, the error response is DryRunOperation. Otherwise, - // it is UnauthorizedOperation. - DryRun *bool `locationName:"dryRun" type:"boolean"` - - // The ID of the VPN connection. - VPNConnectionID *string `locationName:"VpnConnectionId" type:"string" required:"true"` - - metadataDeleteVPNConnectionInput `json:"-" xml:"-"` -} - -type metadataDeleteVPNConnectionInput struct { - SDKShapeTraits bool `type:"structure"` -} - -// String returns the string representation -func (s DeleteVPNConnectionInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s DeleteVPNConnectionInput) GoString() string { - return s.String() -} - -type DeleteVPNConnectionOutput struct { - metadataDeleteVPNConnectionOutput `json:"-" xml:"-"` -} - -type metadataDeleteVPNConnectionOutput struct { - SDKShapeTraits bool `type:"structure"` -} - -// String returns the string representation -func (s DeleteVPNConnectionOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s DeleteVPNConnectionOutput) GoString() string { - return s.String() -} - -type DeleteVPNConnectionRouteInput struct { - // The CIDR block associated with the local subnet of the customer network. - DestinationCIDRBlock *string `locationName:"DestinationCidrBlock" type:"string" required:"true"` - - // The ID of the VPN connection. - VPNConnectionID *string `locationName:"VpnConnectionId" type:"string" required:"true"` - - metadataDeleteVPNConnectionRouteInput `json:"-" xml:"-"` -} - -type metadataDeleteVPNConnectionRouteInput struct { - SDKShapeTraits bool `type:"structure"` -} - -// String returns the string representation -func (s DeleteVPNConnectionRouteInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s DeleteVPNConnectionRouteInput) GoString() string { - return s.String() -} - -type DeleteVPNConnectionRouteOutput struct { - metadataDeleteVPNConnectionRouteOutput `json:"-" xml:"-"` -} - -type metadataDeleteVPNConnectionRouteOutput struct { - SDKShapeTraits bool `type:"structure"` -} - -// String returns the string representation -func (s DeleteVPNConnectionRouteOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s DeleteVPNConnectionRouteOutput) GoString() string { - return s.String() -} - -type DeleteVPNGatewayInput struct { - // Checks whether you have the required permissions for the action, without - // actually making the request, and provides an error response. If you have - // the required permissions, the error response is DryRunOperation. Otherwise, - // it is UnauthorizedOperation. - DryRun *bool `locationName:"dryRun" type:"boolean"` - - // The ID of the virtual private gateway. - VPNGatewayID *string `locationName:"VpnGatewayId" type:"string" required:"true"` - - metadataDeleteVPNGatewayInput `json:"-" xml:"-"` -} - -type metadataDeleteVPNGatewayInput struct { - SDKShapeTraits bool `type:"structure"` -} - -// String returns the string representation -func (s DeleteVPNGatewayInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s DeleteVPNGatewayInput) GoString() string { - return s.String() -} - -type DeleteVPNGatewayOutput struct { - metadataDeleteVPNGatewayOutput `json:"-" xml:"-"` -} - -type metadataDeleteVPNGatewayOutput struct { - SDKShapeTraits bool `type:"structure"` -} - -// String returns the string representation -func (s DeleteVPNGatewayOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s DeleteVPNGatewayOutput) GoString() string { - return s.String() -} - type DeleteVolumeInput struct { // Checks whether you have the required permissions for the action, without // actually making the request, and provides an error response. If you have @@ -10799,7 +10553,7 @@ type DeleteVolumeInput struct { DryRun *bool `locationName:"dryRun" type:"boolean"` // The ID of the volume. - VolumeID *string `locationName:"VolumeId" type:"string" required:"true"` + VolumeId *string `type:"string" required:"true"` metadataDeleteVolumeInput `json:"-" xml:"-"` } @@ -10836,6 +10590,279 @@ func (s DeleteVolumeOutput) GoString() string { return s.String() } +type DeleteVpcEndpointsInput struct { + // Checks whether you have the required permissions for the action, without + // actually making the request, and provides an error response. If you have + // the required permissions, the error response is DryRunOperation. Otherwise, + // it is UnauthorizedOperation. + DryRun *bool `type:"boolean"` + + // One or more endpoint IDs. + VpcEndpointIds []*string `locationName:"VpcEndpointId" locationNameList:"item" type:"list" required:"true"` + + metadataDeleteVpcEndpointsInput `json:"-" xml:"-"` +} + +type metadataDeleteVpcEndpointsInput struct { + SDKShapeTraits bool `type:"structure"` +} + +// String returns the string representation +func (s DeleteVpcEndpointsInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DeleteVpcEndpointsInput) GoString() string { + return s.String() +} + +type DeleteVpcEndpointsOutput struct { + // Information about the endpoints that were not successfully deleted. + Unsuccessful []*UnsuccessfulItem `locationName:"unsuccessful" locationNameList:"item" type:"list"` + + metadataDeleteVpcEndpointsOutput `json:"-" xml:"-"` +} + +type metadataDeleteVpcEndpointsOutput struct { + SDKShapeTraits bool `type:"structure"` +} + +// String returns the string representation +func (s DeleteVpcEndpointsOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DeleteVpcEndpointsOutput) GoString() string { + return s.String() +} + +type DeleteVpcInput struct { + // Checks whether you have the required permissions for the action, without + // actually making the request, and provides an error response. If you have + // the required permissions, the error response is DryRunOperation. Otherwise, + // it is UnauthorizedOperation. + DryRun *bool `locationName:"dryRun" type:"boolean"` + + // The ID of the VPC. + VpcId *string `type:"string" required:"true"` + + metadataDeleteVpcInput `json:"-" xml:"-"` +} + +type metadataDeleteVpcInput struct { + SDKShapeTraits bool `type:"structure"` +} + +// String returns the string representation +func (s DeleteVpcInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DeleteVpcInput) GoString() string { + return s.String() +} + +type DeleteVpcOutput struct { + metadataDeleteVpcOutput `json:"-" xml:"-"` +} + +type metadataDeleteVpcOutput struct { + SDKShapeTraits bool `type:"structure"` +} + +// String returns the string representation +func (s DeleteVpcOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DeleteVpcOutput) GoString() string { + return s.String() +} + +type DeleteVpcPeeringConnectionInput struct { + // Checks whether you have the required permissions for the action, without + // actually making the request, and provides an error response. If you have + // the required permissions, the error response is DryRunOperation. Otherwise, + // it is UnauthorizedOperation. + DryRun *bool `locationName:"dryRun" type:"boolean"` + + // The ID of the VPC peering connection. + VpcPeeringConnectionId *string `locationName:"vpcPeeringConnectionId" type:"string" required:"true"` + + metadataDeleteVpcPeeringConnectionInput `json:"-" xml:"-"` +} + +type metadataDeleteVpcPeeringConnectionInput struct { + SDKShapeTraits bool `type:"structure"` +} + +// String returns the string representation +func (s DeleteVpcPeeringConnectionInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DeleteVpcPeeringConnectionInput) GoString() string { + return s.String() +} + +type DeleteVpcPeeringConnectionOutput struct { + // Returns true if the request succeeds; otherwise, it returns an error. + Return *bool `locationName:"return" type:"boolean"` + + metadataDeleteVpcPeeringConnectionOutput `json:"-" xml:"-"` +} + +type metadataDeleteVpcPeeringConnectionOutput struct { + SDKShapeTraits bool `type:"structure"` +} + +// String returns the string representation +func (s DeleteVpcPeeringConnectionOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DeleteVpcPeeringConnectionOutput) GoString() string { + return s.String() +} + +type DeleteVpnConnectionInput struct { + // Checks whether you have the required permissions for the action, without + // actually making the request, and provides an error response. If you have + // the required permissions, the error response is DryRunOperation. Otherwise, + // it is UnauthorizedOperation. + DryRun *bool `locationName:"dryRun" type:"boolean"` + + // The ID of the VPN connection. + VpnConnectionId *string `type:"string" required:"true"` + + metadataDeleteVpnConnectionInput `json:"-" xml:"-"` +} + +type metadataDeleteVpnConnectionInput struct { + SDKShapeTraits bool `type:"structure"` +} + +// String returns the string representation +func (s DeleteVpnConnectionInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DeleteVpnConnectionInput) GoString() string { + return s.String() +} + +type DeleteVpnConnectionOutput struct { + metadataDeleteVpnConnectionOutput `json:"-" xml:"-"` +} + +type metadataDeleteVpnConnectionOutput struct { + SDKShapeTraits bool `type:"structure"` +} + +// String returns the string representation +func (s DeleteVpnConnectionOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DeleteVpnConnectionOutput) GoString() string { + return s.String() +} + +type DeleteVpnConnectionRouteInput struct { + // The CIDR block associated with the local subnet of the customer network. + DestinationCidrBlock *string `type:"string" required:"true"` + + // The ID of the VPN connection. + VpnConnectionId *string `type:"string" required:"true"` + + metadataDeleteVpnConnectionRouteInput `json:"-" xml:"-"` +} + +type metadataDeleteVpnConnectionRouteInput struct { + SDKShapeTraits bool `type:"structure"` +} + +// String returns the string representation +func (s DeleteVpnConnectionRouteInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DeleteVpnConnectionRouteInput) GoString() string { + return s.String() +} + +type DeleteVpnConnectionRouteOutput struct { + metadataDeleteVpnConnectionRouteOutput `json:"-" xml:"-"` +} + +type metadataDeleteVpnConnectionRouteOutput struct { + SDKShapeTraits bool `type:"structure"` +} + +// String returns the string representation +func (s DeleteVpnConnectionRouteOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DeleteVpnConnectionRouteOutput) GoString() string { + return s.String() +} + +type DeleteVpnGatewayInput struct { + // Checks whether you have the required permissions for the action, without + // actually making the request, and provides an error response. If you have + // the required permissions, the error response is DryRunOperation. Otherwise, + // it is UnauthorizedOperation. + DryRun *bool `locationName:"dryRun" type:"boolean"` + + // The ID of the virtual private gateway. + VpnGatewayId *string `type:"string" required:"true"` + + metadataDeleteVpnGatewayInput `json:"-" xml:"-"` +} + +type metadataDeleteVpnGatewayInput struct { + SDKShapeTraits bool `type:"structure"` +} + +// String returns the string representation +func (s DeleteVpnGatewayInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DeleteVpnGatewayInput) GoString() string { + return s.String() +} + +type DeleteVpnGatewayOutput struct { + metadataDeleteVpnGatewayOutput `json:"-" xml:"-"` +} + +type metadataDeleteVpnGatewayOutput struct { + SDKShapeTraits bool `type:"structure"` +} + +// String returns the string representation +func (s DeleteVpnGatewayOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DeleteVpnGatewayOutput) GoString() string { + return s.String() +} + type DeregisterImageInput struct { // Checks whether you have the required permissions for the action, without // actually making the request, and provides an error response. If you have @@ -10844,7 +10871,7 @@ type DeregisterImageInput struct { DryRun *bool `locationName:"dryRun" type:"boolean"` // The ID of the AMI. - ImageID *string `locationName:"ImageId" type:"string" required:"true"` + ImageId *string `type:"string" required:"true"` metadataDeregisterImageInput `json:"-" xml:"-"` } @@ -10933,7 +10960,7 @@ type DescribeAddressesInput struct { // [EC2-VPC] One or more allocation IDs. // // Default: Describes all your Elastic IP addresses. - AllocationIDs []*string `locationName:"AllocationId" locationNameList:"AllocationId" type:"list"` + AllocationIds []*string `locationName:"AllocationId" locationNameList:"AllocationId" type:"list"` // Checks whether you have the required permissions for the action, without // actually making the request, and provides an error response. If you have @@ -10967,7 +10994,7 @@ type DescribeAddressesInput struct { // [EC2-Classic] One or more Elastic IP addresses. // // Default: Describes all your Elastic IP addresses. - PublicIPs []*string `locationName:"PublicIp" locationNameList:"PublicIp" type:"list"` + PublicIps []*string `locationName:"PublicIp" locationNameList:"PublicIp" type:"list"` metadataDescribeAddressesInput `json:"-" xml:"-"` } @@ -11021,7 +11048,8 @@ type DescribeAvailabilityZonesInput struct { // region-name - The name of the region for the Availability Zone (for example, // us-east-1). // - // state - The state of the Availability Zone (available | impaired | unavailable). + // state - The state of the Availability Zone (available | information | + // impaired | unavailable). // // zone-name - The name of the Availability Zone (for example, us-east-1a). Filters []*Filter `locationName:"Filter" locationNameList:"Filter" type:"list"` @@ -11071,7 +11099,7 @@ type DescribeBundleTasksInput struct { // One or more bundle task IDs. // // Default: Describes all your bundle tasks. - BundleIDs []*string `locationName:"BundleId" locationNameList:"BundleId" type:"list"` + BundleIds []*string `locationName:"BundleId" locationNameList:"BundleId" type:"list"` // Checks whether you have the required permissions for the action, without // actually making the request, and provides an error response. If you have @@ -11171,7 +11199,7 @@ type DescribeClassicLinkInstancesInput struct { Filters []*Filter `locationName:"Filter" locationNameList:"Filter" type:"list"` // One or more instance IDs. Must be instances linked to a VPC through ClassicLink. - InstanceIDs []*string `locationName:"InstanceId" locationNameList:"InstanceId" type:"list"` + InstanceIds []*string `locationName:"InstanceId" locationNameList:"InstanceId" type:"list"` // The maximum number of results to return for the request in a single page. // The remaining results of the initial request can be seen by sending another @@ -11230,7 +11258,7 @@ func (s DescribeClassicLinkInstancesOutput) GoString() string { type DescribeConversionTasksInput struct { // One or more conversion task IDs. - ConversionTaskIDs []*string `locationName:"conversionTaskId" locationNameList:"item" type:"list"` + ConversionTaskIds []*string `locationName:"conversionTaskId" locationNameList:"item" type:"list"` // Checks whether you have the required permissions for the action, without // actually making the request, and provides an error response. If you have @@ -11283,7 +11311,7 @@ type DescribeCustomerGatewaysInput struct { // One or more customer gateway IDs. // // Default: Describes all your customer gateways. - CustomerGatewayIDs []*string `locationName:"CustomerGatewayId" locationNameList:"CustomerGatewayId" type:"list"` + CustomerGatewayIds []*string `locationName:"CustomerGatewayId" locationNameList:"CustomerGatewayId" type:"list"` // Checks whether you have the required permissions for the action, without // actually making the request, and provides an error response. If you have @@ -11358,11 +11386,11 @@ func (s DescribeCustomerGatewaysOutput) GoString() string { return s.String() } -type DescribeDHCPOptionsInput struct { +type DescribeDhcpOptionsInput struct { // The IDs of one or more DHCP options sets. // // Default: Describes all your DHCP options sets. - DHCPOptionsIDs []*string `locationName:"DhcpOptionsId" locationNameList:"DhcpOptionsId" type:"list"` + DhcpOptionsIds []*string `locationName:"DhcpOptionsId" locationNameList:"DhcpOptionsId" type:"list"` // Checks whether you have the required permissions for the action, without // actually making the request, and provides an error response. If you have @@ -11391,47 +11419,47 @@ type DescribeDHCPOptionsInput struct { // independent of the tag-key filter. Filters []*Filter `locationName:"Filter" locationNameList:"Filter" type:"list"` - metadataDescribeDHCPOptionsInput `json:"-" xml:"-"` + metadataDescribeDhcpOptionsInput `json:"-" xml:"-"` } -type metadataDescribeDHCPOptionsInput struct { +type metadataDescribeDhcpOptionsInput struct { SDKShapeTraits bool `type:"structure"` } // String returns the string representation -func (s DescribeDHCPOptionsInput) String() string { +func (s DescribeDhcpOptionsInput) String() string { return awsutil.Prettify(s) } // GoString returns the string representation -func (s DescribeDHCPOptionsInput) GoString() string { +func (s DescribeDhcpOptionsInput) GoString() string { return s.String() } -type DescribeDHCPOptionsOutput struct { +type DescribeDhcpOptionsOutput struct { // Information about one or more DHCP options sets. - DHCPOptions []*DHCPOptions `locationName:"dhcpOptionsSet" locationNameList:"item" type:"list"` + DhcpOptions []*DhcpOptions `locationName:"dhcpOptionsSet" locationNameList:"item" type:"list"` - metadataDescribeDHCPOptionsOutput `json:"-" xml:"-"` + metadataDescribeDhcpOptionsOutput `json:"-" xml:"-"` } -type metadataDescribeDHCPOptionsOutput struct { +type metadataDescribeDhcpOptionsOutput struct { SDKShapeTraits bool `type:"structure"` } // String returns the string representation -func (s DescribeDHCPOptionsOutput) String() string { +func (s DescribeDhcpOptionsOutput) String() string { return awsutil.Prettify(s) } // GoString returns the string representation -func (s DescribeDHCPOptionsOutput) GoString() string { +func (s DescribeDhcpOptionsOutput) GoString() string { return s.String() } type DescribeExportTasksInput struct { // One or more export task IDs. - ExportTaskIDs []*string `locationName:"exportTaskId" locationNameList:"ExportTaskId" type:"list"` + ExportTaskIds []*string `locationName:"exportTaskId" locationNameList:"ExportTaskId" type:"list"` metadataDescribeExportTasksInput `json:"-" xml:"-"` } @@ -11486,7 +11514,7 @@ type DescribeFlowLogsInput struct { Filter []*Filter `locationNameList:"Filter" type:"list"` // One or more flow log IDs. - FlowLogIDs []*string `locationName:"FlowLogId" locationNameList:"item" type:"list"` + FlowLogIds []*string `locationName:"FlowLogId" locationNameList:"item" type:"list"` // The maximum number of results to return for the request in a single page. // The remaining results can be seen by sending another request with the returned @@ -11555,7 +11583,7 @@ type DescribeImageAttributeInput struct { DryRun *bool `locationName:"dryRun" type:"boolean"` // The ID of the AMI. - ImageID *string `locationName:"ImageId" type:"string" required:"true"` + ImageId *string `type:"string" required:"true"` metadataDescribeImageAttributeInput `json:"-" xml:"-"` } @@ -11583,10 +11611,10 @@ type DescribeImageAttributeOutput struct { Description *AttributeValue `locationName:"description" type:"structure"` // The ID of the AMI. - ImageID *string `locationName:"imageId" type:"string"` + ImageId *string `locationName:"imageId" type:"string"` // The kernel ID. - KernelID *AttributeValue `locationName:"kernel" type:"structure"` + KernelId *AttributeValue `locationName:"kernel" type:"structure"` // One or more launch permissions. LaunchPermissions []*LaunchPermission `locationName:"launchPermission" locationNameList:"item" type:"list"` @@ -11595,10 +11623,10 @@ type DescribeImageAttributeOutput struct { ProductCodes []*ProductCode `locationName:"productCodes" locationNameList:"item" type:"list"` // The RAM disk ID. - RAMDiskID *AttributeValue `locationName:"ramdisk" type:"structure"` + RamdiskId *AttributeValue `locationName:"ramdisk" type:"structure"` // The value to use for a resource attribute. - SRIOVNetSupport *AttributeValue `locationName:"sriovNetSupport" type:"structure"` + SriovNetSupport *AttributeValue `locationName:"sriovNetSupport" type:"structure"` metadataDescribeImageAttributeOutput `json:"-" xml:"-"` } @@ -11703,7 +11731,7 @@ type DescribeImagesInput struct { // One or more image IDs. // // Default: Describes all images available to you. - ImageIDs []*string `locationName:"ImageId" locationNameList:"ImageId" type:"list"` + ImageIds []*string `locationName:"ImageId" locationNameList:"ImageId" type:"list"` // Filters the images by the owner. Specify an AWS account ID, amazon (owner // is Amazon), aws-marketplace (owner is AWS Marketplace), self (owner is the @@ -11760,7 +11788,7 @@ type DescribeImportImageTasksInput struct { Filters []*Filter `locationNameList:"Filter" type:"list"` // A list of import image task IDs. - ImportTaskIDs []*string `locationName:"ImportTaskId" locationNameList:"ImportTaskId" type:"list"` + ImportTaskIds []*string `locationName:"ImportTaskId" locationNameList:"ImportTaskId" type:"list"` // The maximum number of results to return in a single request. MaxResults *int64 `type:"integer"` @@ -11822,7 +11850,7 @@ type DescribeImportSnapshotTasksInput struct { Filters []*Filter `locationNameList:"Filter" type:"list"` // A list of import snapshot task IDs. - ImportTaskIDs []*string `locationName:"ImportTaskId" locationNameList:"ImportTaskId" type:"list"` + ImportTaskIds []*string `locationName:"ImportTaskId" locationNameList:"ImportTaskId" type:"list"` // The maximum number of results to return in a single request. MaxResults *int64 `type:"integer"` @@ -11884,7 +11912,7 @@ type DescribeInstanceAttributeInput struct { DryRun *bool `locationName:"dryRun" type:"boolean"` // The ID of the instance. - InstanceID *string `locationName:"instanceId" type:"string" required:"true"` + InstanceId *string `locationName:"instanceId" type:"string" required:"true"` metadataDescribeInstanceAttributeInput `json:"-" xml:"-"` } @@ -11910,16 +11938,16 @@ type DescribeInstanceAttributeOutput struct { // If the value is true, you can't terminate the instance through the Amazon // EC2 console, CLI, or API; otherwise, you can. - DisableAPITermination *AttributeBooleanValue `locationName:"disableApiTermination" type:"structure"` + DisableApiTermination *AttributeBooleanValue `locationName:"disableApiTermination" type:"structure"` // Indicates whether the instance is optimized for EBS I/O. - EBSOptimized *AttributeBooleanValue `locationName:"ebsOptimized" type:"structure"` + EbsOptimized *AttributeBooleanValue `locationName:"ebsOptimized" type:"structure"` // The security groups associated with the instance. Groups []*GroupIdentifier `locationName:"groupSet" locationNameList:"item" type:"list"` // The ID of the instance. - InstanceID *string `locationName:"instanceId" type:"string"` + InstanceId *string `locationName:"instanceId" type:"string"` // Indicates whether an instance stops or terminates when you initiate shutdown // from the instance (using the operating system command for system shutdown). @@ -11929,25 +11957,25 @@ type DescribeInstanceAttributeOutput struct { InstanceType *AttributeValue `locationName:"instanceType" type:"structure"` // The kernel ID. - KernelID *AttributeValue `locationName:"kernel" type:"structure"` + KernelId *AttributeValue `locationName:"kernel" type:"structure"` // A list of product codes. ProductCodes []*ProductCode `locationName:"productCodes" locationNameList:"item" type:"list"` // The RAM disk ID. - RAMDiskID *AttributeValue `locationName:"ramdisk" type:"structure"` + RamdiskId *AttributeValue `locationName:"ramdisk" type:"structure"` // The name of the root device (for example, /dev/sda1 or /dev/xvda). RootDeviceName *AttributeValue `locationName:"rootDeviceName" type:"structure"` - // The value to use for a resource attribute. - SRIOVNetSupport *AttributeValue `locationName:"sriovNetSupport" type:"structure"` - // Indicates whether source/destination checking is enabled. A value of true // means checking is enabled, and false means checking is disabled. This value // must be false for a NAT instance to perform NAT. SourceDestCheck *AttributeBooleanValue `locationName:"sourceDestCheck" type:"structure"` + // The value to use for a resource attribute. + SriovNetSupport *AttributeValue `locationName:"sriovNetSupport" type:"structure"` + // The Base64-encoded MIME user data. UserData *AttributeValue `locationName:"userData" type:"structure"` @@ -12023,7 +12051,7 @@ type DescribeInstanceStatusInput struct { // Default: Describes all your instances. // // Constraints: Maximum 100 explicitly specified instance IDs. - InstanceIDs []*string `locationName:"InstanceId" locationNameList:"InstanceId" type:"list"` + InstanceIds []*string `locationName:"InstanceId" locationNameList:"InstanceId" type:"list"` // The maximum number of results to return for the request in a single page. // The remaining results of the initial request can be seen by sending another @@ -12313,7 +12341,7 @@ type DescribeInstancesInput struct { // One or more instance IDs. // // Default: Describes all your instances. - InstanceIDs []*string `locationName:"InstanceId" locationNameList:"InstanceId" type:"list"` + InstanceIds []*string `locationName:"InstanceId" locationNameList:"InstanceId" type:"list"` // The maximum number of results to return for the request in a single page. // The remaining results of the initial request can be seen by sending another @@ -12400,7 +12428,7 @@ type DescribeInternetGatewaysInput struct { // One or more Internet gateway IDs. // // Default: Describes all your Internet gateways. - InternetGatewayIDs []*string `locationName:"internetGatewayId" locationNameList:"item" type:"list"` + InternetGatewayIds []*string `locationName:"internetGatewayId" locationNameList:"item" type:"list"` metadataDescribeInternetGatewaysInput `json:"-" xml:"-"` } @@ -12521,7 +12549,7 @@ type DescribeMovingAddressesInput struct { NextToken *string `locationName:"nextToken" type:"string"` // One or more Elastic IP addresses. - PublicIPs []*string `locationName:"publicIp" locationNameList:"item" type:"list"` + PublicIps []*string `locationName:"publicIp" locationNameList:"item" type:"list"` metadataDescribeMovingAddressesInput `json:"-" xml:"-"` } @@ -12565,7 +12593,7 @@ func (s DescribeMovingAddressesOutput) GoString() string { return s.String() } -type DescribeNetworkACLsInput struct { +type DescribeNetworkAclsInput struct { // Checks whether you have the required permissions for the action, without // actually making the request, and provides an error response. If you have // the required permissions, the error response is DryRunOperation. Otherwise, @@ -12624,43 +12652,43 @@ type DescribeNetworkACLsInput struct { // One or more network ACL IDs. // // Default: Describes all your network ACLs. - NetworkACLIDs []*string `locationName:"NetworkAclId" locationNameList:"item" type:"list"` + NetworkAclIds []*string `locationName:"NetworkAclId" locationNameList:"item" type:"list"` - metadataDescribeNetworkACLsInput `json:"-" xml:"-"` + metadataDescribeNetworkAclsInput `json:"-" xml:"-"` } -type metadataDescribeNetworkACLsInput struct { +type metadataDescribeNetworkAclsInput struct { SDKShapeTraits bool `type:"structure"` } // String returns the string representation -func (s DescribeNetworkACLsInput) String() string { +func (s DescribeNetworkAclsInput) String() string { return awsutil.Prettify(s) } // GoString returns the string representation -func (s DescribeNetworkACLsInput) GoString() string { +func (s DescribeNetworkAclsInput) GoString() string { return s.String() } -type DescribeNetworkACLsOutput struct { +type DescribeNetworkAclsOutput struct { // Information about one or more network ACLs. - NetworkACLs []*NetworkACL `locationName:"networkAclSet" locationNameList:"item" type:"list"` + NetworkAcls []*NetworkAcl `locationName:"networkAclSet" locationNameList:"item" type:"list"` - metadataDescribeNetworkACLsOutput `json:"-" xml:"-"` + metadataDescribeNetworkAclsOutput `json:"-" xml:"-"` } -type metadataDescribeNetworkACLsOutput struct { +type metadataDescribeNetworkAclsOutput struct { SDKShapeTraits bool `type:"structure"` } // String returns the string representation -func (s DescribeNetworkACLsOutput) String() string { +func (s DescribeNetworkAclsOutput) String() string { return awsutil.Prettify(s) } // GoString returns the string representation -func (s DescribeNetworkACLsOutput) GoString() string { +func (s DescribeNetworkAclsOutput) GoString() string { return s.String() } @@ -12675,7 +12703,7 @@ type DescribeNetworkInterfaceAttributeInput struct { DryRun *bool `locationName:"dryRun" type:"boolean"` // The ID of the network interface. - NetworkInterfaceID *string `locationName:"networkInterfaceId" type:"string" required:"true"` + NetworkInterfaceId *string `locationName:"networkInterfaceId" type:"string" required:"true"` metadataDescribeNetworkInterfaceAttributeInput `json:"-" xml:"-"` } @@ -12705,7 +12733,7 @@ type DescribeNetworkInterfaceAttributeOutput struct { Groups []*GroupIdentifier `locationName:"groupSet" locationNameList:"item" type:"list"` // The ID of the network interface. - NetworkInterfaceID *string `locationName:"networkInterfaceId" type:"string"` + NetworkInterfaceId *string `locationName:"networkInterfaceId" type:"string"` // Indicates whether source/destination checking is enabled. SourceDestCheck *AttributeBooleanValue `locationName:"sourceDestCheck" type:"structure"` @@ -12838,7 +12866,7 @@ type DescribeNetworkInterfacesInput struct { // One or more network interface IDs. // // Default: Describes all your network interfaces. - NetworkInterfaceIDs []*string `locationName:"NetworkInterfaceId" locationNameList:"item" type:"list"` + NetworkInterfaceIds []*string `locationName:"NetworkInterfaceId" locationNameList:"item" type:"list"` metadataDescribeNetworkInterfacesInput `json:"-" xml:"-"` } @@ -12965,7 +12993,7 @@ type DescribePrefixListsInput struct { NextToken *string `type:"string"` // One or more prefix list IDs. - PrefixListIDs []*string `locationName:"PrefixListId" locationNameList:"item" type:"list"` + PrefixListIds []*string `locationName:"PrefixListId" locationNameList:"item" type:"list"` metadataDescribePrefixListsInput `json:"-" xml:"-"` } @@ -13130,7 +13158,7 @@ type DescribeReservedInstancesInput struct { // // Default: Describes all your Reserved Instances, or only those otherwise // specified. - ReservedInstancesIDs []*string `locationName:"ReservedInstancesId" locationNameList:"ReservedInstancesId" type:"list"` + ReservedInstancesIds []*string `locationName:"ReservedInstancesId" locationNameList:"ReservedInstancesId" type:"list"` metadataDescribeReservedInstancesInput `json:"-" xml:"-"` } @@ -13163,10 +13191,10 @@ type DescribeReservedInstancesListingsInput struct { Filters []*Filter `locationName:"filters" locationNameList:"Filter" type:"list"` // One or more Reserved Instance IDs. - ReservedInstancesID *string `locationName:"reservedInstancesId" type:"string"` + ReservedInstancesId *string `locationName:"reservedInstancesId" type:"string"` // One or more Reserved Instance Listing IDs. - ReservedInstancesListingID *string `locationName:"reservedInstancesListingId" type:"string"` + ReservedInstancesListingId *string `locationName:"reservedInstancesListingId" type:"string"` metadataDescribeReservedInstancesListingsInput `json:"-" xml:"-"` } @@ -13247,7 +13275,7 @@ type DescribeReservedInstancesModificationsInput struct { NextToken *string `locationName:"nextToken" type:"string"` // IDs for the submitted modification request. - ReservedInstancesModificationIDs []*string `locationName:"ReservedInstancesModificationId" locationNameList:"ReservedInstancesModificationId" type:"list"` + ReservedInstancesModificationIds []*string `locationName:"ReservedInstancesModificationId" locationNameList:"ReservedInstancesModificationId" type:"list"` metadataDescribeReservedInstancesModificationsInput `json:"-" xml:"-"` } @@ -13385,7 +13413,7 @@ type DescribeReservedInstancesOfferingsInput struct { ProductDescription *string `type:"string" enum:"RIProductDescription"` // One or more Reserved Instances offering IDs. - ReservedInstancesOfferingIDs []*string `locationName:"ReservedInstancesOfferingId" type:"list"` + ReservedInstancesOfferingIds []*string `locationName:"ReservedInstancesOfferingId" type:"list"` metadataDescribeReservedInstancesOfferingsInput `json:"-" xml:"-"` } @@ -13515,7 +13543,7 @@ type DescribeRouteTablesInput struct { // One or more route table IDs. // // Default: Describes all your route tables. - RouteTableIDs []*string `locationName:"RouteTableId" locationNameList:"item" type:"list"` + RouteTableIds []*string `locationName:"RouteTableId" locationNameList:"item" type:"list"` metadataDescribeRouteTablesInput `json:"-" xml:"-"` } @@ -13562,7 +13590,9 @@ type DescribeSecurityGroupsInput struct { // it is UnauthorizedOperation. DryRun *bool `locationName:"dryRun" type:"boolean"` - // One or more filters. + // One or more filters. If using multiple filters for rules, the results include + // security groups for which any combination of rules - not necessarily a single + // rule - match all filters. // // description - The description of the security group. // @@ -13606,7 +13636,7 @@ type DescribeSecurityGroupsInput struct { // VPC. // // Default: Describes all your security groups. - GroupIDs []*string `locationName:"GroupId" locationNameList:"groupId" type:"list"` + GroupIds []*string `locationName:"GroupId" locationNameList:"groupId" type:"list"` // [EC2-Classic and default VPC only] One or more security group names. You // can specify either the security group name or the security group ID. For @@ -13665,7 +13695,7 @@ type DescribeSnapshotAttributeInput struct { DryRun *bool `locationName:"dryRun" type:"boolean"` // The ID of the EBS snapshot. - SnapshotID *string `locationName:"SnapshotId" type:"string" required:"true"` + SnapshotId *string `type:"string" required:"true"` metadataDescribeSnapshotAttributeInput `json:"-" xml:"-"` } @@ -13692,7 +13722,7 @@ type DescribeSnapshotAttributeOutput struct { ProductCodes []*ProductCode `locationName:"productCodes" locationNameList:"item" type:"list"` // The ID of the EBS snapshot. - SnapshotID *string `locationName:"snapshotId" type:"string"` + SnapshotId *string `locationName:"snapshotId" type:"string"` metadataDescribeSnapshotAttributeOutput `json:"-" xml:"-"` } @@ -13773,15 +13803,15 @@ type DescribeSnapshotsInput struct { // Returns the snapshots owned by the specified owner. Multiple owners can be // specified. - OwnerIDs []*string `locationName:"Owner" locationNameList:"Owner" type:"list"` + OwnerIds []*string `locationName:"Owner" locationNameList:"Owner" type:"list"` // One or more AWS accounts IDs that can create volumes from the snapshot. - RestorableByUserIDs []*string `locationName:"RestorableBy" type:"list"` + RestorableByUserIds []*string `locationName:"RestorableBy" type:"list"` // One or more snapshot IDs. // // Default: Describes snapshots for which you have launch permissions. - SnapshotIDs []*string `locationName:"SnapshotId" locationNameList:"SnapshotId" type:"list"` + SnapshotIds []*string `locationName:"SnapshotId" locationNameList:"SnapshotId" type:"list"` metadataDescribeSnapshotsInput `json:"-" xml:"-"` } @@ -13854,7 +13884,7 @@ func (s DescribeSpotDatafeedSubscriptionInput) GoString() string { // Contains the output of DescribeSpotDatafeedSubscription. type DescribeSpotDatafeedSubscriptionOutput struct { - // The Spot Instance data feed subscription. + // The Spot instance data feed subscription. SpotDatafeedSubscription *SpotDatafeedSubscription `locationName:"spotDatafeedSubscription" type:"structure"` metadataDescribeSpotDatafeedSubscriptionOutput `json:"-" xml:"-"` @@ -13891,7 +13921,7 @@ type DescribeSpotFleetInstancesInput struct { NextToken *string `locationName:"nextToken" type:"string"` // The ID of the Spot fleet request. - SpotFleetRequestID *string `locationName:"spotFleetRequestId" type:"string" required:"true"` + SpotFleetRequestId *string `locationName:"spotFleetRequestId" type:"string" required:"true"` metadataDescribeSpotFleetInstancesInput `json:"-" xml:"-"` } @@ -13921,7 +13951,7 @@ type DescribeSpotFleetInstancesOutput struct { NextToken *string `locationName:"nextToken" type:"string"` // The ID of the Spot fleet request. - SpotFleetRequestID *string `locationName:"spotFleetRequestId" type:"string" required:"true"` + SpotFleetRequestId *string `locationName:"spotFleetRequestId" type:"string" required:"true"` metadataDescribeSpotFleetInstancesOutput `json:"-" xml:"-"` } @@ -13960,7 +13990,7 @@ type DescribeSpotFleetRequestHistoryInput struct { NextToken *string `locationName:"nextToken" type:"string"` // The ID of the Spot fleet request. - SpotFleetRequestID *string `locationName:"spotFleetRequestId" type:"string" required:"true"` + SpotFleetRequestId *string `locationName:"spotFleetRequestId" type:"string" required:"true"` // The starting date and time for the events, in UTC format (for example, YYYY-MM-DDTHH:MM:SSZ). StartTime *time.Time `locationName:"startTime" type:"timestamp" timestampFormat:"iso8601" required:"true"` @@ -13998,7 +14028,7 @@ type DescribeSpotFleetRequestHistoryOutput struct { NextToken *string `locationName:"nextToken" type:"string"` // The ID of the Spot fleet request. - SpotFleetRequestID *string `locationName:"spotFleetRequestId" type:"string" required:"true"` + SpotFleetRequestId *string `locationName:"spotFleetRequestId" type:"string" required:"true"` // The starting date and time for the events, in UTC format (for example, YYYY-MM-DDTHH:MM:SSZ). StartTime *time.Time `locationName:"startTime" type:"timestamp" timestampFormat:"iso8601" required:"true"` @@ -14037,7 +14067,7 @@ type DescribeSpotFleetRequestsInput struct { NextToken *string `locationName:"nextToken" type:"string"` // The IDs of the Spot fleet requests. - SpotFleetRequestIDs []*string `locationName:"spotFleetRequestId" locationNameList:"item" type:"list"` + SpotFleetRequestIds []*string `locationName:"spotFleetRequestId" locationNameList:"item" type:"list"` metadataDescribeSpotFleetRequestsInput `json:"-" xml:"-"` } @@ -14094,7 +14124,7 @@ type DescribeSpotInstanceRequestsInput struct { // // availability-zone-group - The Availability Zone group. // - // create-time - The time stamp when the Spot Instance request was created. + // create-time - The time stamp when the Spot instance request was created. // // fault-code - The fault code related to the request. // @@ -14102,7 +14132,7 @@ type DescribeSpotInstanceRequestsInput struct { // // instance-id - The ID of the instance that fulfilled the request. // - // launch-group - The Spot Instance launch group. + // launch-group - The Spot instance launch group. // // launch.block-device-mapping.delete-on-termination - Indicates whether // the Amazon EBS volume is deleted on instance termination. @@ -14130,7 +14160,7 @@ type DescribeSpotInstanceRequestsInput struct { // launch.key-name - The name of the key pair the instance launched with. // // launch.monitoring-enabled - Whether monitoring is enabled for the Spot - // Instance. + // instance. // // launch.ramdisk-id - The RAM disk ID. // @@ -14161,21 +14191,21 @@ type DescribeSpotInstanceRequestsInput struct { // product-description - The product description associated with the instance // (Linux/UNIX | Windows). // - // spot-instance-request-id - The Spot Instance request ID. + // spot-instance-request-id - The Spot instance request ID. // - // spot-price - The maximum hourly price for any Spot Instance launched to + // spot-price - The maximum hourly price for any Spot instance launched to // fulfill the request. // - // state - The state of the Spot Instance request (open | active | closed + // state - The state of the Spot instance request (open | active | closed // | cancelled | failed). Spot bid status information can help you track your - // Amazon EC2 Spot Instance requests. For more information, see Spot Bid Status + // Amazon EC2 Spot instance requests. For more information, see Spot Bid Status // (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/spot-bid-status.html) // in the Amazon Elastic Compute Cloud User Guide. // // status-code - The short code describing the most recent evaluation of - // your Spot Instance request. + // your Spot instance request. // - // status-message - The message explaining the status of the Spot Instance + // status-message - The message explaining the status of the Spot instance // request. // // tag:key=value - The key/value combination of a tag assigned to the resource. @@ -14190,7 +14220,7 @@ type DescribeSpotInstanceRequestsInput struct { // tag-value - The value of a tag assigned to the resource. This filter is // independent of the tag-key filter. // - // type - The type of Spot Instance request (one-time | persistent). + // type - The type of Spot instance request (one-time | persistent). // // launched-availability-zone - The Availability Zone in which the bid is // launched. @@ -14200,8 +14230,8 @@ type DescribeSpotInstanceRequestsInput struct { // valid-until - The end date of the request. Filters []*Filter `locationName:"Filter" locationNameList:"Filter" type:"list"` - // One or more Spot Instance request IDs. - SpotInstanceRequestIDs []*string `locationName:"SpotInstanceRequestId" locationNameList:"SpotInstanceRequestId" type:"list"` + // One or more Spot instance request IDs. + SpotInstanceRequestIds []*string `locationName:"SpotInstanceRequestId" locationNameList:"SpotInstanceRequestId" type:"list"` metadataDescribeSpotInstanceRequestsInput `json:"-" xml:"-"` } @@ -14222,7 +14252,7 @@ func (s DescribeSpotInstanceRequestsInput) GoString() string { // Contains the output of DescribeSpotInstanceRequests. type DescribeSpotInstanceRequestsOutput struct { - // One or more Spot Instance requests. + // One or more Spot instance requests. SpotInstanceRequests []*SpotInstanceRequest `locationName:"spotInstanceRequestSet" locationNameList:"item" type:"list"` metadataDescribeSpotInstanceRequestsOutput `json:"-" xml:"-"` @@ -14263,14 +14293,14 @@ type DescribeSpotPriceHistoryInput struct { // // instance-type - The type of instance (for example, m1.small). // - // product-description - The product description for the Spot Price (Linux/UNIX + // product-description - The product description for the Spot price (Linux/UNIX // | SUSE Linux | Windows | Linux/UNIX (Amazon VPC) | SUSE Linux (Amazon VPC) // | Windows (Amazon VPC)). // - // spot-price - The Spot Price. The value must match exactly (or use wildcards; + // spot-price - The Spot price. The value must match exactly (or use wildcards; // greater than or less than comparison is not supported). // - // timestamp - The timestamp of the Spot Price history, in UTC format (for + // timestamp - The timestamp of the Spot price history, in UTC format (for // example, YYYY-MM-DDTHH:MM:SSZ). You can use wildcards (* and ?). Greater // than or less than comparison is not supported. Filters []*Filter `locationName:"Filter" locationNameList:"Filter" type:"list"` @@ -14316,7 +14346,7 @@ type DescribeSpotPriceHistoryOutput struct { // when there are no more results to return. NextToken *string `locationName:"nextToken" type:"string"` - // The historical Spot Prices. + // The historical Spot prices. SpotPriceHistory []*SpotPrice `locationName:"spotPriceHistorySet" locationNameList:"item" type:"list"` metadataDescribeSpotPriceHistoryOutput `json:"-" xml:"-"` @@ -14380,7 +14410,7 @@ type DescribeSubnetsInput struct { // One or more subnet IDs. // // Default: Describes all your subnets. - SubnetIDs []*string `locationName:"SubnetId" locationNameList:"SubnetId" type:"list"` + SubnetIds []*string `locationName:"SubnetId" locationNameList:"SubnetId" type:"list"` metadataDescribeSubnetsInput `json:"-" xml:"-"` } @@ -14493,606 +14523,6 @@ func (s DescribeTagsOutput) GoString() string { return s.String() } -type DescribeVPCAttributeInput struct { - // The VPC attribute. - Attribute *string `type:"string" enum:"VpcAttributeName"` - - // Checks whether you have the required permissions for the action, without - // actually making the request, and provides an error response. If you have - // the required permissions, the error response is DryRunOperation. Otherwise, - // it is UnauthorizedOperation. - DryRun *bool `locationName:"dryRun" type:"boolean"` - - // The ID of the VPC. - VPCID *string `locationName:"VpcId" type:"string" required:"true"` - - metadataDescribeVPCAttributeInput `json:"-" xml:"-"` -} - -type metadataDescribeVPCAttributeInput struct { - SDKShapeTraits bool `type:"structure"` -} - -// String returns the string representation -func (s DescribeVPCAttributeInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s DescribeVPCAttributeInput) GoString() string { - return s.String() -} - -type DescribeVPCAttributeOutput struct { - // Indicates whether the instances launched in the VPC get DNS hostnames. If - // this attribute is true, instances in the VPC get DNS hostnames; otherwise, - // they do not. - EnableDNSHostnames *AttributeBooleanValue `locationName:"enableDnsHostnames" type:"structure"` - - // Indicates whether DNS resolution is enabled for the VPC. If this attribute - // is true, the Amazon DNS server resolves DNS hostnames for your instances - // to their corresponding IP addresses; otherwise, it does not. - EnableDNSSupport *AttributeBooleanValue `locationName:"enableDnsSupport" type:"structure"` - - // The ID of the VPC. - VPCID *string `locationName:"vpcId" type:"string"` - - metadataDescribeVPCAttributeOutput `json:"-" xml:"-"` -} - -type metadataDescribeVPCAttributeOutput struct { - SDKShapeTraits bool `type:"structure"` -} - -// String returns the string representation -func (s DescribeVPCAttributeOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s DescribeVPCAttributeOutput) GoString() string { - return s.String() -} - -type DescribeVPCClassicLinkInput struct { - // Checks whether you have the required permissions for the action, without - // actually making the request, and provides an error response. If you have - // the required permissions, the error response is DryRunOperation. Otherwise, - // it is UnauthorizedOperation. - DryRun *bool `locationName:"dryRun" type:"boolean"` - - // One or more filters. - // - // is-classic-link-enabled - Whether the VPC is enabled for ClassicLink (true - // | false). - // - // tag:key=value - The key/value combination of a tag assigned to the resource. - // - // tag-key - The key of a tag assigned to the resource. This filter is independent - // of the tag-value filter. For example, if you use both the filter "tag-key=Purpose" - // and the filter "tag-value=X", you get any resources assigned both the tag - // key Purpose (regardless of what the tag's value is), and the tag value X - // (regardless of what the tag's key is). If you want to list only resources - // where Purpose is X, see the tag:key=value filter. - // - // tag-value - The value of a tag assigned to the resource. This filter is - // independent of the tag-key filter. - Filters []*Filter `locationName:"Filter" locationNameList:"Filter" type:"list"` - - // One or more VPCs for which you want to describe the ClassicLink status. - VPCIDs []*string `locationName:"VpcId" locationNameList:"VpcId" type:"list"` - - metadataDescribeVPCClassicLinkInput `json:"-" xml:"-"` -} - -type metadataDescribeVPCClassicLinkInput struct { - SDKShapeTraits bool `type:"structure"` -} - -// String returns the string representation -func (s DescribeVPCClassicLinkInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s DescribeVPCClassicLinkInput) GoString() string { - return s.String() -} - -type DescribeVPCClassicLinkOutput struct { - // The ClassicLink status of one or more VPCs. - VPCs []*VPCClassicLink `locationName:"vpcSet" locationNameList:"item" type:"list"` - - metadataDescribeVPCClassicLinkOutput `json:"-" xml:"-"` -} - -type metadataDescribeVPCClassicLinkOutput struct { - SDKShapeTraits bool `type:"structure"` -} - -// String returns the string representation -func (s DescribeVPCClassicLinkOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s DescribeVPCClassicLinkOutput) GoString() string { - return s.String() -} - -type DescribeVPCEndpointServicesInput struct { - // Checks whether you have the required permissions for the action, without - // actually making the request, and provides an error response. If you have - // the required permissions, the error response is DryRunOperation. Otherwise, - // it is UnauthorizedOperation. - DryRun *bool `type:"boolean"` - - // The maximum number of items to return for this request. The request returns - // a token that you can specify in a subsequent call to get the next set of - // results. - // - // Constraint: If the value is greater than 1000, we return only 1000 items. - MaxResults *int64 `type:"integer"` - - // The token for the next set of items to return. (You received this token from - // a prior call.) - NextToken *string `type:"string"` - - metadataDescribeVPCEndpointServicesInput `json:"-" xml:"-"` -} - -type metadataDescribeVPCEndpointServicesInput struct { - SDKShapeTraits bool `type:"structure"` -} - -// String returns the string representation -func (s DescribeVPCEndpointServicesInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s DescribeVPCEndpointServicesInput) GoString() string { - return s.String() -} - -type DescribeVPCEndpointServicesOutput struct { - // The token to use when requesting the next set of items. If there are no additional - // items to return, the string is empty. - NextToken *string `locationName:"nextToken" type:"string"` - - // A list of supported AWS services. - ServiceNames []*string `locationName:"serviceNameSet" locationNameList:"item" type:"list"` - - metadataDescribeVPCEndpointServicesOutput `json:"-" xml:"-"` -} - -type metadataDescribeVPCEndpointServicesOutput struct { - SDKShapeTraits bool `type:"structure"` -} - -// String returns the string representation -func (s DescribeVPCEndpointServicesOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s DescribeVPCEndpointServicesOutput) GoString() string { - return s.String() -} - -type DescribeVPCEndpointsInput struct { - // Checks whether you have the required permissions for the action, without - // actually making the request, and provides an error response. If you have - // the required permissions, the error response is DryRunOperation. Otherwise, - // it is UnauthorizedOperation. - DryRun *bool `type:"boolean"` - - // One or more filters. - // - // service-name: The name of the AWS service. - // - // vpc-id: The ID of the VPC in which the endpoint resides. - // - // vpc-endpoint-id: The ID of the endpoint. - // - // vpc-endpoint-state: The state of the endpoint. (pending | available | - // deleting | deleted) - Filters []*Filter `locationName:"Filter" locationNameList:"Filter" type:"list"` - - // The maximum number of items to return for this request. The request returns - // a token that you can specify in a subsequent call to get the next set of - // results. - // - // Constraint: If the value is greater than 1000, we return only 1000 items. - MaxResults *int64 `type:"integer"` - - // The token for the next set of items to return. (You received this token from - // a prior call.) - NextToken *string `type:"string"` - - // One or more endpoint IDs. - VPCEndpointIDs []*string `locationName:"VpcEndpointId" locationNameList:"item" type:"list"` - - metadataDescribeVPCEndpointsInput `json:"-" xml:"-"` -} - -type metadataDescribeVPCEndpointsInput struct { - SDKShapeTraits bool `type:"structure"` -} - -// String returns the string representation -func (s DescribeVPCEndpointsInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s DescribeVPCEndpointsInput) GoString() string { - return s.String() -} - -type DescribeVPCEndpointsOutput struct { - // The token to use when requesting the next set of items. If there are no additional - // items to return, the string is empty. - NextToken *string `locationName:"nextToken" type:"string"` - - // Information about the endpoints. - VPCEndpoints []*VPCEndpoint `locationName:"vpcEndpointSet" locationNameList:"item" type:"list"` - - metadataDescribeVPCEndpointsOutput `json:"-" xml:"-"` -} - -type metadataDescribeVPCEndpointsOutput struct { - SDKShapeTraits bool `type:"structure"` -} - -// String returns the string representation -func (s DescribeVPCEndpointsOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s DescribeVPCEndpointsOutput) GoString() string { - return s.String() -} - -type DescribeVPCPeeringConnectionsInput struct { - // Checks whether you have the required permissions for the action, without - // actually making the request, and provides an error response. If you have - // the required permissions, the error response is DryRunOperation. Otherwise, - // it is UnauthorizedOperation. - DryRun *bool `locationName:"dryRun" type:"boolean"` - - // One or more filters. - // - // accepter-vpc-info.cidr-block - The CIDR block of the peer VPC. - // - // accepter-vpc-info.owner-id - The AWS account ID of the owner of the peer - // VPC. - // - // accepter-vpc-info.vpc-id - The ID of the peer VPC. - // - // expiration-time - The expiration date and time for the VPC peering connection. - // - // requester-vpc-info.cidr-block - The CIDR block of the requester's VPC. - // - // requester-vpc-info.owner-id - The AWS account ID of the owner of the requester - // VPC. - // - // requester-vpc-info.vpc-id - The ID of the requester VPC. - // - // status-code - The status of the VPC peering connection (pending-acceptance - // | failed | expired | provisioning | active | deleted | rejected). - // - // status-message - A message that provides more information about the status - // of the VPC peering connection, if applicable. - // - // tag:key=value - The key/value combination of a tag assigned to the resource. - // - // tag-key - The key of a tag assigned to the resource. This filter is independent - // of the tag-value filter. For example, if you use both the filter "tag-key=Purpose" - // and the filter "tag-value=X", you get any resources assigned both the tag - // key Purpose (regardless of what the tag's value is), and the tag value X - // (regardless of what the tag's key is). If you want to list only resources - // where Purpose is X, see the tag:key=value filter. - // - // tag-value - The value of a tag assigned to the resource. This filter is - // independent of the tag-key filter. - // - // vpc-peering-connection-id - The ID of the VPC peering connection. - Filters []*Filter `locationName:"Filter" locationNameList:"Filter" type:"list"` - - // One or more VPC peering connection IDs. - // - // Default: Describes all your VPC peering connections. - VPCPeeringConnectionIDs []*string `locationName:"VpcPeeringConnectionId" locationNameList:"item" type:"list"` - - metadataDescribeVPCPeeringConnectionsInput `json:"-" xml:"-"` -} - -type metadataDescribeVPCPeeringConnectionsInput struct { - SDKShapeTraits bool `type:"structure"` -} - -// String returns the string representation -func (s DescribeVPCPeeringConnectionsInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s DescribeVPCPeeringConnectionsInput) GoString() string { - return s.String() -} - -type DescribeVPCPeeringConnectionsOutput struct { - // Information about the VPC peering connections. - VPCPeeringConnections []*VPCPeeringConnection `locationName:"vpcPeeringConnectionSet" locationNameList:"item" type:"list"` - - metadataDescribeVPCPeeringConnectionsOutput `json:"-" xml:"-"` -} - -type metadataDescribeVPCPeeringConnectionsOutput struct { - SDKShapeTraits bool `type:"structure"` -} - -// String returns the string representation -func (s DescribeVPCPeeringConnectionsOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s DescribeVPCPeeringConnectionsOutput) GoString() string { - return s.String() -} - -type DescribeVPCsInput struct { - // Checks whether you have the required permissions for the action, without - // actually making the request, and provides an error response. If you have - // the required permissions, the error response is DryRunOperation. Otherwise, - // it is UnauthorizedOperation. - DryRun *bool `locationName:"dryRun" type:"boolean"` - - // One or more filters. - // - // cidr - The CIDR block of the VPC. The CIDR block you specify must exactly - // match the VPC's CIDR block for information to be returned for the VPC. Must - // contain the slash followed by one or two digits (for example, /28). - // - // dhcp-options-id - The ID of a set of DHCP options. - // - // isDefault - Indicates whether the VPC is the default VPC. - // - // state - The state of the VPC (pending | available). - // - // tag:key=value - The key/value combination of a tag assigned to the resource. - // - // tag-key - The key of a tag assigned to the resource. This filter is independent - // of the tag-value filter. For example, if you use both the filter "tag-key=Purpose" - // and the filter "tag-value=X", you get any resources assigned both the tag - // key Purpose (regardless of what the tag's value is), and the tag value X - // (regardless of what the tag's key is). If you want to list only resources - // where Purpose is X, see the tag:key=value filter. - // - // tag-value - The value of a tag assigned to the resource. This filter is - // independent of the tag-key filter. - // - // vpc-id - The ID of the VPC. - Filters []*Filter `locationName:"Filter" locationNameList:"Filter" type:"list"` - - // One or more VPC IDs. - // - // Default: Describes all your VPCs. - VPCIDs []*string `locationName:"VpcId" locationNameList:"VpcId" type:"list"` - - metadataDescribeVPCsInput `json:"-" xml:"-"` -} - -type metadataDescribeVPCsInput struct { - SDKShapeTraits bool `type:"structure"` -} - -// String returns the string representation -func (s DescribeVPCsInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s DescribeVPCsInput) GoString() string { - return s.String() -} - -type DescribeVPCsOutput struct { - // Information about one or more VPCs. - VPCs []*VPC `locationName:"vpcSet" locationNameList:"item" type:"list"` - - metadataDescribeVPCsOutput `json:"-" xml:"-"` -} - -type metadataDescribeVPCsOutput struct { - SDKShapeTraits bool `type:"structure"` -} - -// String returns the string representation -func (s DescribeVPCsOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s DescribeVPCsOutput) GoString() string { - return s.String() -} - -type DescribeVPNConnectionsInput struct { - // Checks whether you have the required permissions for the action, without - // actually making the request, and provides an error response. If you have - // the required permissions, the error response is DryRunOperation. Otherwise, - // it is UnauthorizedOperation. - DryRun *bool `locationName:"dryRun" type:"boolean"` - - // One or more filters. - // - // customer-gateway-configuration - The configuration information for the - // customer gateway. - // - // customer-gateway-id - The ID of a customer gateway associated with the - // VPN connection. - // - // state - The state of the VPN connection (pending | available | deleting - // | deleted). - // - // option.static-routes-only - Indicates whether the connection has static - // routes only. Used for devices that do not support Border Gateway Protocol - // (BGP). - // - // route.destination-cidr-block - The destination CIDR block. This corresponds - // to the subnet used in a customer data center. - // - // bgp-asn - The BGP Autonomous System Number (ASN) associated with a BGP - // device. - // - // tag:key=value - The key/value combination of a tag assigned to the resource. - // - // tag-key - The key of a tag assigned to the resource. This filter is independent - // of the tag-value filter. For example, if you use both the filter "tag-key=Purpose" - // and the filter "tag-value=X", you get any resources assigned both the tag - // key Purpose (regardless of what the tag's value is), and the tag value X - // (regardless of what the tag's key is). If you want to list only resources - // where Purpose is X, see the tag:key=value filter. - // - // tag-value - The value of a tag assigned to the resource. This filter is - // independent of the tag-key filter. - // - // type - The type of VPN connection. Currently the only supported type is - // ipsec.1. - // - // vpn-connection-id - The ID of the VPN connection. - // - // vpn-gateway-id - The ID of a virtual private gateway associated with the - // VPN connection. - Filters []*Filter `locationName:"Filter" locationNameList:"Filter" type:"list"` - - // One or more VPN connection IDs. - // - // Default: Describes your VPN connections. - VPNConnectionIDs []*string `locationName:"VpnConnectionId" locationNameList:"VpnConnectionId" type:"list"` - - metadataDescribeVPNConnectionsInput `json:"-" xml:"-"` -} - -type metadataDescribeVPNConnectionsInput struct { - SDKShapeTraits bool `type:"structure"` -} - -// String returns the string representation -func (s DescribeVPNConnectionsInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s DescribeVPNConnectionsInput) GoString() string { - return s.String() -} - -type DescribeVPNConnectionsOutput struct { - // Information about one or more VPN connections. - VPNConnections []*VPNConnection `locationName:"vpnConnectionSet" locationNameList:"item" type:"list"` - - metadataDescribeVPNConnectionsOutput `json:"-" xml:"-"` -} - -type metadataDescribeVPNConnectionsOutput struct { - SDKShapeTraits bool `type:"structure"` -} - -// String returns the string representation -func (s DescribeVPNConnectionsOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s DescribeVPNConnectionsOutput) GoString() string { - return s.String() -} - -type DescribeVPNGatewaysInput struct { - // Checks whether you have the required permissions for the action, without - // actually making the request, and provides an error response. If you have - // the required permissions, the error response is DryRunOperation. Otherwise, - // it is UnauthorizedOperation. - DryRun *bool `locationName:"dryRun" type:"boolean"` - - // One or more filters. - // - // attachment.state - The current state of the attachment between the gateway - // and the VPC (attaching | attached | detaching | detached). - // - // attachment.vpc-id - The ID of an attached VPC. - // - // availability-zone - The Availability Zone for the virtual private gateway. - // - // state - The state of the virtual private gateway (pending | available - // | deleting | deleted). - // - // tag:key=value - The key/value combination of a tag assigned to the resource. - // - // tag-key - The key of a tag assigned to the resource. This filter is independent - // of the tag-value filter. For example, if you use both the filter "tag-key=Purpose" - // and the filter "tag-value=X", you get any resources assigned both the tag - // key Purpose (regardless of what the tag's value is), and the tag value X - // (regardless of what the tag's key is). If you want to list only resources - // where Purpose is X, see the tag:key=value filter. - // - // tag-value - The value of a tag assigned to the resource. This filter is - // independent of the tag-key filter. - // - // type - The type of virtual private gateway. Currently the only supported - // type is ipsec.1. - // - // vpn-gateway-id - The ID of the virtual private gateway. - Filters []*Filter `locationName:"Filter" locationNameList:"Filter" type:"list"` - - // One or more virtual private gateway IDs. - // - // Default: Describes all your virtual private gateways. - VPNGatewayIDs []*string `locationName:"VpnGatewayId" locationNameList:"VpnGatewayId" type:"list"` - - metadataDescribeVPNGatewaysInput `json:"-" xml:"-"` -} - -type metadataDescribeVPNGatewaysInput struct { - SDKShapeTraits bool `type:"structure"` -} - -// String returns the string representation -func (s DescribeVPNGatewaysInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s DescribeVPNGatewaysInput) GoString() string { - return s.String() -} - -type DescribeVPNGatewaysOutput struct { - // Information about one or more virtual private gateways. - VPNGateways []*VPNGateway `locationName:"vpnGatewaySet" locationNameList:"item" type:"list"` - - metadataDescribeVPNGatewaysOutput `json:"-" xml:"-"` -} - -type metadataDescribeVPNGatewaysOutput struct { - SDKShapeTraits bool `type:"structure"` -} - -// String returns the string representation -func (s DescribeVPNGatewaysOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s DescribeVPNGatewaysOutput) GoString() string { - return s.String() -} - type DescribeVolumeAttributeInput struct { // The instance attribute. Attribute *string `type:"string" enum:"VolumeAttributeName"` @@ -15104,7 +14534,7 @@ type DescribeVolumeAttributeInput struct { DryRun *bool `locationName:"dryRun" type:"boolean"` // The ID of the volume. - VolumeID *string `locationName:"VolumeId" type:"string" required:"true"` + VolumeId *string `type:"string" required:"true"` metadataDescribeVolumeAttributeInput `json:"-" xml:"-"` } @@ -15131,7 +14561,7 @@ type DescribeVolumeAttributeOutput struct { ProductCodes []*ProductCode `locationName:"productCodes" locationNameList:"item" type:"list"` // The ID of the volume. - VolumeID *string `locationName:"volumeId" type:"string"` + VolumeId *string `locationName:"volumeId" type:"string"` metadataDescribeVolumeAttributeOutput `json:"-" xml:"-"` } @@ -15209,7 +14639,7 @@ type DescribeVolumeStatusInput struct { // One or more volume IDs. // // Default: Describes all your volumes. - VolumeIDs []*string `locationName:"VolumeId" locationNameList:"VolumeId" type:"list"` + VolumeIds []*string `locationName:"VolumeId" locationNameList:"VolumeId" type:"list"` metadataDescribeVolumeStatusInput `json:"-" xml:"-"` } @@ -15326,7 +14756,7 @@ type DescribeVolumesInput struct { NextToken *string `locationName:"nextToken" type:"string"` // One or more volume IDs. - VolumeIDs []*string `locationName:"VolumeId" locationNameList:"VolumeId" type:"list"` + VolumeIds []*string `locationName:"VolumeId" locationNameList:"VolumeId" type:"list"` metadataDescribeVolumesInput `json:"-" xml:"-"` } @@ -15372,7 +14802,607 @@ func (s DescribeVolumesOutput) GoString() string { return s.String() } -type DetachClassicLinkVPCInput struct { +type DescribeVpcAttributeInput struct { + // The VPC attribute. + Attribute *string `type:"string" enum:"VpcAttributeName"` + + // Checks whether you have the required permissions for the action, without + // actually making the request, and provides an error response. If you have + // the required permissions, the error response is DryRunOperation. Otherwise, + // it is UnauthorizedOperation. + DryRun *bool `locationName:"dryRun" type:"boolean"` + + // The ID of the VPC. + VpcId *string `type:"string" required:"true"` + + metadataDescribeVpcAttributeInput `json:"-" xml:"-"` +} + +type metadataDescribeVpcAttributeInput struct { + SDKShapeTraits bool `type:"structure"` +} + +// String returns the string representation +func (s DescribeVpcAttributeInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DescribeVpcAttributeInput) GoString() string { + return s.String() +} + +type DescribeVpcAttributeOutput struct { + // Indicates whether the instances launched in the VPC get DNS hostnames. If + // this attribute is true, instances in the VPC get DNS hostnames; otherwise, + // they do not. + EnableDnsHostnames *AttributeBooleanValue `locationName:"enableDnsHostnames" type:"structure"` + + // Indicates whether DNS resolution is enabled for the VPC. If this attribute + // is true, the Amazon DNS server resolves DNS hostnames for your instances + // to their corresponding IP addresses; otherwise, it does not. + EnableDnsSupport *AttributeBooleanValue `locationName:"enableDnsSupport" type:"structure"` + + // The ID of the VPC. + VpcId *string `locationName:"vpcId" type:"string"` + + metadataDescribeVpcAttributeOutput `json:"-" xml:"-"` +} + +type metadataDescribeVpcAttributeOutput struct { + SDKShapeTraits bool `type:"structure"` +} + +// String returns the string representation +func (s DescribeVpcAttributeOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DescribeVpcAttributeOutput) GoString() string { + return s.String() +} + +type DescribeVpcClassicLinkInput struct { + // Checks whether you have the required permissions for the action, without + // actually making the request, and provides an error response. If you have + // the required permissions, the error response is DryRunOperation. Otherwise, + // it is UnauthorizedOperation. + DryRun *bool `locationName:"dryRun" type:"boolean"` + + // One or more filters. + // + // is-classic-link-enabled - Whether the VPC is enabled for ClassicLink (true + // | false). + // + // tag:key=value - The key/value combination of a tag assigned to the resource. + // + // tag-key - The key of a tag assigned to the resource. This filter is independent + // of the tag-value filter. For example, if you use both the filter "tag-key=Purpose" + // and the filter "tag-value=X", you get any resources assigned both the tag + // key Purpose (regardless of what the tag's value is), and the tag value X + // (regardless of what the tag's key is). If you want to list only resources + // where Purpose is X, see the tag:key=value filter. + // + // tag-value - The value of a tag assigned to the resource. This filter is + // independent of the tag-key filter. + Filters []*Filter `locationName:"Filter" locationNameList:"Filter" type:"list"` + + // One or more VPCs for which you want to describe the ClassicLink status. + VpcIds []*string `locationName:"VpcId" locationNameList:"VpcId" type:"list"` + + metadataDescribeVpcClassicLinkInput `json:"-" xml:"-"` +} + +type metadataDescribeVpcClassicLinkInput struct { + SDKShapeTraits bool `type:"structure"` +} + +// String returns the string representation +func (s DescribeVpcClassicLinkInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DescribeVpcClassicLinkInput) GoString() string { + return s.String() +} + +type DescribeVpcClassicLinkOutput struct { + // The ClassicLink status of one or more VPCs. + Vpcs []*VpcClassicLink `locationName:"vpcSet" locationNameList:"item" type:"list"` + + metadataDescribeVpcClassicLinkOutput `json:"-" xml:"-"` +} + +type metadataDescribeVpcClassicLinkOutput struct { + SDKShapeTraits bool `type:"structure"` +} + +// String returns the string representation +func (s DescribeVpcClassicLinkOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DescribeVpcClassicLinkOutput) GoString() string { + return s.String() +} + +type DescribeVpcEndpointServicesInput struct { + // Checks whether you have the required permissions for the action, without + // actually making the request, and provides an error response. If you have + // the required permissions, the error response is DryRunOperation. Otherwise, + // it is UnauthorizedOperation. + DryRun *bool `type:"boolean"` + + // The maximum number of items to return for this request. The request returns + // a token that you can specify in a subsequent call to get the next set of + // results. + // + // Constraint: If the value is greater than 1000, we return only 1000 items. + MaxResults *int64 `type:"integer"` + + // The token for the next set of items to return. (You received this token from + // a prior call.) + NextToken *string `type:"string"` + + metadataDescribeVpcEndpointServicesInput `json:"-" xml:"-"` +} + +type metadataDescribeVpcEndpointServicesInput struct { + SDKShapeTraits bool `type:"structure"` +} + +// String returns the string representation +func (s DescribeVpcEndpointServicesInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DescribeVpcEndpointServicesInput) GoString() string { + return s.String() +} + +type DescribeVpcEndpointServicesOutput struct { + // The token to use when requesting the next set of items. If there are no additional + // items to return, the string is empty. + NextToken *string `locationName:"nextToken" type:"string"` + + // A list of supported AWS services. + ServiceNames []*string `locationName:"serviceNameSet" locationNameList:"item" type:"list"` + + metadataDescribeVpcEndpointServicesOutput `json:"-" xml:"-"` +} + +type metadataDescribeVpcEndpointServicesOutput struct { + SDKShapeTraits bool `type:"structure"` +} + +// String returns the string representation +func (s DescribeVpcEndpointServicesOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DescribeVpcEndpointServicesOutput) GoString() string { + return s.String() +} + +type DescribeVpcEndpointsInput struct { + // Checks whether you have the required permissions for the action, without + // actually making the request, and provides an error response. If you have + // the required permissions, the error response is DryRunOperation. Otherwise, + // it is UnauthorizedOperation. + DryRun *bool `type:"boolean"` + + // One or more filters. + // + // service-name: The name of the AWS service. + // + // vpc-id: The ID of the VPC in which the endpoint resides. + // + // vpc-endpoint-id: The ID of the endpoint. + // + // vpc-endpoint-state: The state of the endpoint. (pending | available | + // deleting | deleted) + Filters []*Filter `locationName:"Filter" locationNameList:"Filter" type:"list"` + + // The maximum number of items to return for this request. The request returns + // a token that you can specify in a subsequent call to get the next set of + // results. + // + // Constraint: If the value is greater than 1000, we return only 1000 items. + MaxResults *int64 `type:"integer"` + + // The token for the next set of items to return. (You received this token from + // a prior call.) + NextToken *string `type:"string"` + + // One or more endpoint IDs. + VpcEndpointIds []*string `locationName:"VpcEndpointId" locationNameList:"item" type:"list"` + + metadataDescribeVpcEndpointsInput `json:"-" xml:"-"` +} + +type metadataDescribeVpcEndpointsInput struct { + SDKShapeTraits bool `type:"structure"` +} + +// String returns the string representation +func (s DescribeVpcEndpointsInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DescribeVpcEndpointsInput) GoString() string { + return s.String() +} + +type DescribeVpcEndpointsOutput struct { + // The token to use when requesting the next set of items. If there are no additional + // items to return, the string is empty. + NextToken *string `locationName:"nextToken" type:"string"` + + // Information about the endpoints. + VpcEndpoints []*VpcEndpoint `locationName:"vpcEndpointSet" locationNameList:"item" type:"list"` + + metadataDescribeVpcEndpointsOutput `json:"-" xml:"-"` +} + +type metadataDescribeVpcEndpointsOutput struct { + SDKShapeTraits bool `type:"structure"` +} + +// String returns the string representation +func (s DescribeVpcEndpointsOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DescribeVpcEndpointsOutput) GoString() string { + return s.String() +} + +type DescribeVpcPeeringConnectionsInput struct { + // Checks whether you have the required permissions for the action, without + // actually making the request, and provides an error response. If you have + // the required permissions, the error response is DryRunOperation. Otherwise, + // it is UnauthorizedOperation. + DryRun *bool `locationName:"dryRun" type:"boolean"` + + // One or more filters. + // + // accepter-vpc-info.cidr-block - The CIDR block of the peer VPC. + // + // accepter-vpc-info.owner-id - The AWS account ID of the owner of the peer + // VPC. + // + // accepter-vpc-info.vpc-id - The ID of the peer VPC. + // + // expiration-time - The expiration date and time for the VPC peering connection. + // + // requester-vpc-info.cidr-block - The CIDR block of the requester's VPC. + // + // requester-vpc-info.owner-id - The AWS account ID of the owner of the requester + // VPC. + // + // requester-vpc-info.vpc-id - The ID of the requester VPC. + // + // status-code - The status of the VPC peering connection (pending-acceptance + // | failed | expired | provisioning | active | deleted | rejected). + // + // status-message - A message that provides more information about the status + // of the VPC peering connection, if applicable. + // + // tag:key=value - The key/value combination of a tag assigned to the resource. + // + // tag-key - The key of a tag assigned to the resource. This filter is independent + // of the tag-value filter. For example, if you use both the filter "tag-key=Purpose" + // and the filter "tag-value=X", you get any resources assigned both the tag + // key Purpose (regardless of what the tag's value is), and the tag value X + // (regardless of what the tag's key is). If you want to list only resources + // where Purpose is X, see the tag:key=value filter. + // + // tag-value - The value of a tag assigned to the resource. This filter is + // independent of the tag-key filter. + // + // vpc-peering-connection-id - The ID of the VPC peering connection. + Filters []*Filter `locationName:"Filter" locationNameList:"Filter" type:"list"` + + // One or more VPC peering connection IDs. + // + // Default: Describes all your VPC peering connections. + VpcPeeringConnectionIds []*string `locationName:"VpcPeeringConnectionId" locationNameList:"item" type:"list"` + + metadataDescribeVpcPeeringConnectionsInput `json:"-" xml:"-"` +} + +type metadataDescribeVpcPeeringConnectionsInput struct { + SDKShapeTraits bool `type:"structure"` +} + +// String returns the string representation +func (s DescribeVpcPeeringConnectionsInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DescribeVpcPeeringConnectionsInput) GoString() string { + return s.String() +} + +type DescribeVpcPeeringConnectionsOutput struct { + // Information about the VPC peering connections. + VpcPeeringConnections []*VpcPeeringConnection `locationName:"vpcPeeringConnectionSet" locationNameList:"item" type:"list"` + + metadataDescribeVpcPeeringConnectionsOutput `json:"-" xml:"-"` +} + +type metadataDescribeVpcPeeringConnectionsOutput struct { + SDKShapeTraits bool `type:"structure"` +} + +// String returns the string representation +func (s DescribeVpcPeeringConnectionsOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DescribeVpcPeeringConnectionsOutput) GoString() string { + return s.String() +} + +type DescribeVpcsInput struct { + // Checks whether you have the required permissions for the action, without + // actually making the request, and provides an error response. If you have + // the required permissions, the error response is DryRunOperation. Otherwise, + // it is UnauthorizedOperation. + DryRun *bool `locationName:"dryRun" type:"boolean"` + + // One or more filters. + // + // cidr - The CIDR block of the VPC. The CIDR block you specify must exactly + // match the VPC's CIDR block for information to be returned for the VPC. Must + // contain the slash followed by one or two digits (for example, /28). + // + // dhcp-options-id - The ID of a set of DHCP options. + // + // isDefault - Indicates whether the VPC is the default VPC. + // + // state - The state of the VPC (pending | available). + // + // tag:key=value - The key/value combination of a tag assigned to the resource. + // + // tag-key - The key of a tag assigned to the resource. This filter is independent + // of the tag-value filter. For example, if you use both the filter "tag-key=Purpose" + // and the filter "tag-value=X", you get any resources assigned both the tag + // key Purpose (regardless of what the tag's value is), and the tag value X + // (regardless of what the tag's key is). If you want to list only resources + // where Purpose is X, see the tag:key=value filter. + // + // tag-value - The value of a tag assigned to the resource. This filter is + // independent of the tag-key filter. + // + // vpc-id - The ID of the VPC. + Filters []*Filter `locationName:"Filter" locationNameList:"Filter" type:"list"` + + // One or more VPC IDs. + // + // Default: Describes all your VPCs. + VpcIds []*string `locationName:"VpcId" locationNameList:"VpcId" type:"list"` + + metadataDescribeVpcsInput `json:"-" xml:"-"` +} + +type metadataDescribeVpcsInput struct { + SDKShapeTraits bool `type:"structure"` +} + +// String returns the string representation +func (s DescribeVpcsInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DescribeVpcsInput) GoString() string { + return s.String() +} + +type DescribeVpcsOutput struct { + // Information about one or more VPCs. + Vpcs []*Vpc `locationName:"vpcSet" locationNameList:"item" type:"list"` + + metadataDescribeVpcsOutput `json:"-" xml:"-"` +} + +type metadataDescribeVpcsOutput struct { + SDKShapeTraits bool `type:"structure"` +} + +// String returns the string representation +func (s DescribeVpcsOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DescribeVpcsOutput) GoString() string { + return s.String() +} + +type DescribeVpnConnectionsInput struct { + // Checks whether you have the required permissions for the action, without + // actually making the request, and provides an error response. If you have + // the required permissions, the error response is DryRunOperation. Otherwise, + // it is UnauthorizedOperation. + DryRun *bool `locationName:"dryRun" type:"boolean"` + + // One or more filters. + // + // customer-gateway-configuration - The configuration information for the + // customer gateway. + // + // customer-gateway-id - The ID of a customer gateway associated with the + // VPN connection. + // + // state - The state of the VPN connection (pending | available | deleting + // | deleted). + // + // option.static-routes-only - Indicates whether the connection has static + // routes only. Used for devices that do not support Border Gateway Protocol + // (BGP). + // + // route.destination-cidr-block - The destination CIDR block. This corresponds + // to the subnet used in a customer data center. + // + // bgp-asn - The BGP Autonomous System Number (ASN) associated with a BGP + // device. + // + // tag:key=value - The key/value combination of a tag assigned to the resource. + // + // tag-key - The key of a tag assigned to the resource. This filter is independent + // of the tag-value filter. For example, if you use both the filter "tag-key=Purpose" + // and the filter "tag-value=X", you get any resources assigned both the tag + // key Purpose (regardless of what the tag's value is), and the tag value X + // (regardless of what the tag's key is). If you want to list only resources + // where Purpose is X, see the tag:key=value filter. + // + // tag-value - The value of a tag assigned to the resource. This filter is + // independent of the tag-key filter. + // + // type - The type of VPN connection. Currently the only supported type is + // ipsec.1. + // + // vpn-connection-id - The ID of the VPN connection. + // + // vpn-gateway-id - The ID of a virtual private gateway associated with the + // VPN connection. + Filters []*Filter `locationName:"Filter" locationNameList:"Filter" type:"list"` + + // One or more VPN connection IDs. + // + // Default: Describes your VPN connections. + VpnConnectionIds []*string `locationName:"VpnConnectionId" locationNameList:"VpnConnectionId" type:"list"` + + metadataDescribeVpnConnectionsInput `json:"-" xml:"-"` +} + +type metadataDescribeVpnConnectionsInput struct { + SDKShapeTraits bool `type:"structure"` +} + +// String returns the string representation +func (s DescribeVpnConnectionsInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DescribeVpnConnectionsInput) GoString() string { + return s.String() +} + +type DescribeVpnConnectionsOutput struct { + // Information about one or more VPN connections. + VpnConnections []*VpnConnection `locationName:"vpnConnectionSet" locationNameList:"item" type:"list"` + + metadataDescribeVpnConnectionsOutput `json:"-" xml:"-"` +} + +type metadataDescribeVpnConnectionsOutput struct { + SDKShapeTraits bool `type:"structure"` +} + +// String returns the string representation +func (s DescribeVpnConnectionsOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DescribeVpnConnectionsOutput) GoString() string { + return s.String() +} + +type DescribeVpnGatewaysInput struct { + // Checks whether you have the required permissions for the action, without + // actually making the request, and provides an error response. If you have + // the required permissions, the error response is DryRunOperation. Otherwise, + // it is UnauthorizedOperation. + DryRun *bool `locationName:"dryRun" type:"boolean"` + + // One or more filters. + // + // attachment.state - The current state of the attachment between the gateway + // and the VPC (attaching | attached | detaching | detached). + // + // attachment.vpc-id - The ID of an attached VPC. + // + // availability-zone - The Availability Zone for the virtual private gateway. + // + // state - The state of the virtual private gateway (pending | available + // | deleting | deleted). + // + // tag:key=value - The key/value combination of a tag assigned to the resource. + // + // tag-key - The key of a tag assigned to the resource. This filter is independent + // of the tag-value filter. For example, if you use both the filter "tag-key=Purpose" + // and the filter "tag-value=X", you get any resources assigned both the tag + // key Purpose (regardless of what the tag's value is), and the tag value X + // (regardless of what the tag's key is). If you want to list only resources + // where Purpose is X, see the tag:key=value filter. + // + // tag-value - The value of a tag assigned to the resource. This filter is + // independent of the tag-key filter. + // + // type - The type of virtual private gateway. Currently the only supported + // type is ipsec.1. + // + // vpn-gateway-id - The ID of the virtual private gateway. + Filters []*Filter `locationName:"Filter" locationNameList:"Filter" type:"list"` + + // One or more virtual private gateway IDs. + // + // Default: Describes all your virtual private gateways. + VpnGatewayIds []*string `locationName:"VpnGatewayId" locationNameList:"VpnGatewayId" type:"list"` + + metadataDescribeVpnGatewaysInput `json:"-" xml:"-"` +} + +type metadataDescribeVpnGatewaysInput struct { + SDKShapeTraits bool `type:"structure"` +} + +// String returns the string representation +func (s DescribeVpnGatewaysInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DescribeVpnGatewaysInput) GoString() string { + return s.String() +} + +type DescribeVpnGatewaysOutput struct { + // Information about one or more virtual private gateways. + VpnGateways []*VpnGateway `locationName:"vpnGatewaySet" locationNameList:"item" type:"list"` + + metadataDescribeVpnGatewaysOutput `json:"-" xml:"-"` +} + +type metadataDescribeVpnGatewaysOutput struct { + SDKShapeTraits bool `type:"structure"` +} + +// String returns the string representation +func (s DescribeVpnGatewaysOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DescribeVpnGatewaysOutput) GoString() string { + return s.String() +} + +type DetachClassicLinkVpcInput struct { // Checks whether you have the required permissions for the action, without // actually making the request, and provides an error response. If you have // the required permissions, the error response is DryRunOperation. Otherwise, @@ -15380,46 +15410,46 @@ type DetachClassicLinkVPCInput struct { DryRun *bool `locationName:"dryRun" type:"boolean"` // The ID of the instance to unlink from the VPC. - InstanceID *string `locationName:"instanceId" type:"string" required:"true"` + InstanceId *string `locationName:"instanceId" type:"string" required:"true"` // The ID of the VPC to which the instance is linked. - VPCID *string `locationName:"vpcId" type:"string" required:"true"` + VpcId *string `locationName:"vpcId" type:"string" required:"true"` - metadataDetachClassicLinkVPCInput `json:"-" xml:"-"` + metadataDetachClassicLinkVpcInput `json:"-" xml:"-"` } -type metadataDetachClassicLinkVPCInput struct { +type metadataDetachClassicLinkVpcInput struct { SDKShapeTraits bool `type:"structure"` } // String returns the string representation -func (s DetachClassicLinkVPCInput) String() string { +func (s DetachClassicLinkVpcInput) String() string { return awsutil.Prettify(s) } // GoString returns the string representation -func (s DetachClassicLinkVPCInput) GoString() string { +func (s DetachClassicLinkVpcInput) GoString() string { return s.String() } -type DetachClassicLinkVPCOutput struct { +type DetachClassicLinkVpcOutput struct { // Returns true if the request succeeds; otherwise, it returns an error. Return *bool `locationName:"return" type:"boolean"` - metadataDetachClassicLinkVPCOutput `json:"-" xml:"-"` + metadataDetachClassicLinkVpcOutput `json:"-" xml:"-"` } -type metadataDetachClassicLinkVPCOutput struct { +type metadataDetachClassicLinkVpcOutput struct { SDKShapeTraits bool `type:"structure"` } // String returns the string representation -func (s DetachClassicLinkVPCOutput) String() string { +func (s DetachClassicLinkVpcOutput) String() string { return awsutil.Prettify(s) } // GoString returns the string representation -func (s DetachClassicLinkVPCOutput) GoString() string { +func (s DetachClassicLinkVpcOutput) GoString() string { return s.String() } @@ -15431,10 +15461,10 @@ type DetachInternetGatewayInput struct { DryRun *bool `locationName:"dryRun" type:"boolean"` // The ID of the Internet gateway. - InternetGatewayID *string `locationName:"internetGatewayId" type:"string" required:"true"` + InternetGatewayId *string `locationName:"internetGatewayId" type:"string" required:"true"` // The ID of the VPC. - VPCID *string `locationName:"vpcId" type:"string" required:"true"` + VpcId *string `locationName:"vpcId" type:"string" required:"true"` metadataDetachInternetGatewayInput `json:"-" xml:"-"` } @@ -15473,7 +15503,7 @@ func (s DetachInternetGatewayOutput) GoString() string { type DetachNetworkInterfaceInput struct { // The ID of the attachment. - AttachmentID *string `locationName:"attachmentId" type:"string" required:"true"` + AttachmentId *string `locationName:"attachmentId" type:"string" required:"true"` // Checks whether you have the required permissions for the action, without // actually making the request, and provides an error response. If you have @@ -15519,54 +15549,6 @@ func (s DetachNetworkInterfaceOutput) GoString() string { return s.String() } -type DetachVPNGatewayInput struct { - // Checks whether you have the required permissions for the action, without - // actually making the request, and provides an error response. If you have - // the required permissions, the error response is DryRunOperation. Otherwise, - // it is UnauthorizedOperation. - DryRun *bool `locationName:"dryRun" type:"boolean"` - - // The ID of the VPC. - VPCID *string `locationName:"VpcId" type:"string" required:"true"` - - // The ID of the virtual private gateway. - VPNGatewayID *string `locationName:"VpnGatewayId" type:"string" required:"true"` - - metadataDetachVPNGatewayInput `json:"-" xml:"-"` -} - -type metadataDetachVPNGatewayInput struct { - SDKShapeTraits bool `type:"structure"` -} - -// String returns the string representation -func (s DetachVPNGatewayInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s DetachVPNGatewayInput) GoString() string { - return s.String() -} - -type DetachVPNGatewayOutput struct { - metadataDetachVPNGatewayOutput `json:"-" xml:"-"` -} - -type metadataDetachVPNGatewayOutput struct { - SDKShapeTraits bool `type:"structure"` -} - -// String returns the string representation -func (s DetachVPNGatewayOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s DetachVPNGatewayOutput) GoString() string { - return s.String() -} - type DetachVolumeInput struct { // The device name. Device *string `type:"string"` @@ -15587,10 +15569,10 @@ type DetachVolumeInput struct { Force *bool `type:"boolean"` // The ID of the instance. - InstanceID *string `locationName:"InstanceId" type:"string"` + InstanceId *string `type:"string"` // The ID of the volume. - VolumeID *string `locationName:"VolumeId" type:"string" required:"true"` + VolumeId *string `type:"string" required:"true"` metadataDetachVolumeInput `json:"-" xml:"-"` } @@ -15609,49 +15591,7 @@ func (s DetachVolumeInput) GoString() string { return s.String() } -type DisableVGWRoutePropagationInput struct { - // The ID of the virtual private gateway. - GatewayID *string `locationName:"GatewayId" type:"string" required:"true"` - - // The ID of the route table. - RouteTableID *string `locationName:"RouteTableId" type:"string" required:"true"` - - metadataDisableVGWRoutePropagationInput `json:"-" xml:"-"` -} - -type metadataDisableVGWRoutePropagationInput struct { - SDKShapeTraits bool `type:"structure"` -} - -// String returns the string representation -func (s DisableVGWRoutePropagationInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s DisableVGWRoutePropagationInput) GoString() string { - return s.String() -} - -type DisableVGWRoutePropagationOutput struct { - metadataDisableVGWRoutePropagationOutput `json:"-" xml:"-"` -} - -type metadataDisableVGWRoutePropagationOutput struct { - SDKShapeTraits bool `type:"structure"` -} - -// String returns the string representation -func (s DisableVGWRoutePropagationOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s DisableVGWRoutePropagationOutput) GoString() string { - return s.String() -} - -type DisableVPCClassicLinkInput struct { +type DetachVpnGatewayInput struct { // Checks whether you have the required permissions for the action, without // actually making the request, and provides an error response. If you have // the required permissions, the error response is DryRunOperation. Otherwise, @@ -15659,49 +15599,192 @@ type DisableVPCClassicLinkInput struct { DryRun *bool `locationName:"dryRun" type:"boolean"` // The ID of the VPC. - VPCID *string `locationName:"vpcId" type:"string" required:"true"` + VpcId *string `type:"string" required:"true"` - metadataDisableVPCClassicLinkInput `json:"-" xml:"-"` + // The ID of the virtual private gateway. + VpnGatewayId *string `type:"string" required:"true"` + + metadataDetachVpnGatewayInput `json:"-" xml:"-"` } -type metadataDisableVPCClassicLinkInput struct { +type metadataDetachVpnGatewayInput struct { SDKShapeTraits bool `type:"structure"` } // String returns the string representation -func (s DisableVPCClassicLinkInput) String() string { +func (s DetachVpnGatewayInput) String() string { return awsutil.Prettify(s) } // GoString returns the string representation -func (s DisableVPCClassicLinkInput) GoString() string { +func (s DetachVpnGatewayInput) GoString() string { return s.String() } -type DisableVPCClassicLinkOutput struct { - // Returns true if the request succeeds; otherwise, it returns an error. - Return *bool `locationName:"return" type:"boolean"` - - metadataDisableVPCClassicLinkOutput `json:"-" xml:"-"` +type DetachVpnGatewayOutput struct { + metadataDetachVpnGatewayOutput `json:"-" xml:"-"` } -type metadataDisableVPCClassicLinkOutput struct { +type metadataDetachVpnGatewayOutput struct { SDKShapeTraits bool `type:"structure"` } // String returns the string representation -func (s DisableVPCClassicLinkOutput) String() string { +func (s DetachVpnGatewayOutput) String() string { return awsutil.Prettify(s) } // GoString returns the string representation -func (s DisableVPCClassicLinkOutput) GoString() string { +func (s DetachVpnGatewayOutput) GoString() string { + return s.String() +} + +// Describes a DHCP configuration option. +type DhcpConfiguration struct { + // The name of a DHCP option. + Key *string `locationName:"key" type:"string"` + + // One or more values for the DHCP option. + Values []*AttributeValue `locationName:"valueSet" locationNameList:"item" type:"list"` + + metadataDhcpConfiguration `json:"-" xml:"-"` +} + +type metadataDhcpConfiguration struct { + SDKShapeTraits bool `type:"structure"` +} + +// String returns the string representation +func (s DhcpConfiguration) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DhcpConfiguration) GoString() string { + return s.String() +} + +// Describes a set of DHCP options. +type DhcpOptions struct { + // One or more DHCP options in the set. + DhcpConfigurations []*DhcpConfiguration `locationName:"dhcpConfigurationSet" locationNameList:"item" type:"list"` + + // The ID of the set of DHCP options. + DhcpOptionsId *string `locationName:"dhcpOptionsId" type:"string"` + + // Any tags assigned to the DHCP options set. + Tags []*Tag `locationName:"tagSet" locationNameList:"item" type:"list"` + + metadataDhcpOptions `json:"-" xml:"-"` +} + +type metadataDhcpOptions struct { + SDKShapeTraits bool `type:"structure"` +} + +// String returns the string representation +func (s DhcpOptions) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DhcpOptions) GoString() string { + return s.String() +} + +type DisableVgwRoutePropagationInput struct { + // The ID of the virtual private gateway. + GatewayId *string `type:"string" required:"true"` + + // The ID of the route table. + RouteTableId *string `type:"string" required:"true"` + + metadataDisableVgwRoutePropagationInput `json:"-" xml:"-"` +} + +type metadataDisableVgwRoutePropagationInput struct { + SDKShapeTraits bool `type:"structure"` +} + +// String returns the string representation +func (s DisableVgwRoutePropagationInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DisableVgwRoutePropagationInput) GoString() string { + return s.String() +} + +type DisableVgwRoutePropagationOutput struct { + metadataDisableVgwRoutePropagationOutput `json:"-" xml:"-"` +} + +type metadataDisableVgwRoutePropagationOutput struct { + SDKShapeTraits bool `type:"structure"` +} + +// String returns the string representation +func (s DisableVgwRoutePropagationOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DisableVgwRoutePropagationOutput) GoString() string { + return s.String() +} + +type DisableVpcClassicLinkInput struct { + // Checks whether you have the required permissions for the action, without + // actually making the request, and provides an error response. If you have + // the required permissions, the error response is DryRunOperation. Otherwise, + // it is UnauthorizedOperation. + DryRun *bool `locationName:"dryRun" type:"boolean"` + + // The ID of the VPC. + VpcId *string `locationName:"vpcId" type:"string" required:"true"` + + metadataDisableVpcClassicLinkInput `json:"-" xml:"-"` +} + +type metadataDisableVpcClassicLinkInput struct { + SDKShapeTraits bool `type:"structure"` +} + +// String returns the string representation +func (s DisableVpcClassicLinkInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DisableVpcClassicLinkInput) GoString() string { + return s.String() +} + +type DisableVpcClassicLinkOutput struct { + // Returns true if the request succeeds; otherwise, it returns an error. + Return *bool `locationName:"return" type:"boolean"` + + metadataDisableVpcClassicLinkOutput `json:"-" xml:"-"` +} + +type metadataDisableVpcClassicLinkOutput struct { + SDKShapeTraits bool `type:"structure"` +} + +// String returns the string representation +func (s DisableVpcClassicLinkOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DisableVpcClassicLinkOutput) GoString() string { return s.String() } type DisassociateAddressInput struct { // [EC2-VPC] The association ID. Required for EC2-VPC. - AssociationID *string `locationName:"AssociationId" type:"string"` + AssociationId *string `type:"string"` // Checks whether you have the required permissions for the action, without // actually making the request, and provides an error response. If you have @@ -15710,7 +15793,7 @@ type DisassociateAddressInput struct { DryRun *bool `locationName:"dryRun" type:"boolean"` // [EC2-Classic] The Elastic IP address. Required for EC2-Classic. - PublicIP *string `locationName:"PublicIp" type:"string"` + PublicIp *string `type:"string"` metadataDisassociateAddressInput `json:"-" xml:"-"` } @@ -15750,7 +15833,7 @@ func (s DisassociateAddressOutput) GoString() string { type DisassociateRouteTableInput struct { // The association ID representing the current association between the route // table and subnet. - AssociationID *string `locationName:"associationId" type:"string" required:"true"` + AssociationId *string `locationName:"associationId" type:"string" required:"true"` // Checks whether you have the required permissions for the action, without // actually making the request, and provides an error response. If you have @@ -15834,7 +15917,7 @@ type DiskImageDescription struct { // Request Authentication Alternative" section of the Authenticating REST Requests // (http://docs.aws.amazon.com/AmazonS3/latest/dev/RESTAuthentication.html) // topic in the Amazon Simple Storage Service Developer Guide. - ImportManifestURL *string `locationName:"importManifestUrl" type:"string" required:"true"` + ImportManifestUrl *string `locationName:"importManifestUrl" type:"string" required:"true"` // The size of the disk image, in GiB. Size *int64 `locationName:"size" type:"long" required:"true"` @@ -15869,7 +15952,7 @@ type DiskImageDetail struct { // URL for an Amazon S3 object, read the "Query String Request Authentication // Alternative" section of the Authenticating REST Requests (http://docs.aws.amazon.com/AmazonS3/latest/dev/RESTAuthentication.html) // topic in the Amazon Simple Storage Service Developer Guide. - ImportManifestURL *string `locationName:"importManifestUrl" type:"string" required:"true"` + ImportManifestUrl *string `locationName:"importManifestUrl" type:"string" required:"true"` metadataDiskImageDetail `json:"-" xml:"-"` } @@ -15891,7 +15974,7 @@ func (s DiskImageDetail) GoString() string { // Describes a disk image volume. type DiskImageVolumeDescription struct { // The volume identifier. - ID *string `locationName:"id" type:"string" required:"true"` + Id *string `locationName:"id" type:"string" required:"true"` // The size of the volume, in GiB. Size *int64 `locationName:"size" type:"long"` @@ -15914,7 +15997,7 @@ func (s DiskImageVolumeDescription) GoString() string { } // Describes a block device for an EBS volume. -type EBSBlockDevice struct { +type EbsBlockDevice struct { // Indicates whether the EBS volume is deleted on instance termination. DeleteOnTermination *bool `locationName:"deleteOnTermination" type:"boolean"` @@ -15935,10 +16018,10 @@ type EBSBlockDevice struct { // // Condition: This parameter is required for requests to create io1 volumes; // it is not used in requests to create standard or gp2 volumes. - IOPS *int64 `locationName:"iops" type:"integer"` + Iops *int64 `locationName:"iops" type:"integer"` // The ID of the snapshot. - SnapshotID *string `locationName:"snapshotId" type:"string"` + SnapshotId *string `locationName:"snapshotId" type:"string"` // The size of the volume, in GiB. // @@ -15956,25 +16039,25 @@ type EBSBlockDevice struct { // Default: standard VolumeType *string `locationName:"volumeType" type:"string" enum:"VolumeType"` - metadataEBSBlockDevice `json:"-" xml:"-"` + metadataEbsBlockDevice `json:"-" xml:"-"` } -type metadataEBSBlockDevice struct { +type metadataEbsBlockDevice struct { SDKShapeTraits bool `type:"structure"` } // String returns the string representation -func (s EBSBlockDevice) String() string { +func (s EbsBlockDevice) String() string { return awsutil.Prettify(s) } // GoString returns the string representation -func (s EBSBlockDevice) GoString() string { +func (s EbsBlockDevice) GoString() string { return s.String() } // Describes a parameter used to set up an EBS volume in a block device mapping. -type EBSInstanceBlockDevice struct { +type EbsInstanceBlockDevice struct { // The time stamp when the attachment initiated. AttachTime *time.Time `locationName:"attachTime" type:"timestamp" timestampFormat:"iso8601"` @@ -15985,136 +16068,88 @@ type EBSInstanceBlockDevice struct { Status *string `locationName:"status" type:"string" enum:"AttachmentStatus"` // The ID of the EBS volume. - VolumeID *string `locationName:"volumeId" type:"string"` + VolumeId *string `locationName:"volumeId" type:"string"` - metadataEBSInstanceBlockDevice `json:"-" xml:"-"` + metadataEbsInstanceBlockDevice `json:"-" xml:"-"` } -type metadataEBSInstanceBlockDevice struct { +type metadataEbsInstanceBlockDevice struct { SDKShapeTraits bool `type:"structure"` } // String returns the string representation -func (s EBSInstanceBlockDevice) String() string { +func (s EbsInstanceBlockDevice) String() string { return awsutil.Prettify(s) } // GoString returns the string representation -func (s EBSInstanceBlockDevice) GoString() string { +func (s EbsInstanceBlockDevice) GoString() string { return s.String() } -type EBSInstanceBlockDeviceSpecification struct { +type EbsInstanceBlockDeviceSpecification struct { // Indicates whether the volume is deleted on instance termination. DeleteOnTermination *bool `locationName:"deleteOnTermination" type:"boolean"` // The ID of the EBS volume. - VolumeID *string `locationName:"volumeId" type:"string"` + VolumeId *string `locationName:"volumeId" type:"string"` - metadataEBSInstanceBlockDeviceSpecification `json:"-" xml:"-"` + metadataEbsInstanceBlockDeviceSpecification `json:"-" xml:"-"` } -type metadataEBSInstanceBlockDeviceSpecification struct { +type metadataEbsInstanceBlockDeviceSpecification struct { SDKShapeTraits bool `type:"structure"` } // String returns the string representation -func (s EBSInstanceBlockDeviceSpecification) String() string { +func (s EbsInstanceBlockDeviceSpecification) String() string { return awsutil.Prettify(s) } // GoString returns the string representation -func (s EBSInstanceBlockDeviceSpecification) GoString() string { +func (s EbsInstanceBlockDeviceSpecification) GoString() string { return s.String() } -type EnableVGWRoutePropagationInput struct { +type EnableVgwRoutePropagationInput struct { // The ID of the virtual private gateway. - GatewayID *string `locationName:"GatewayId" type:"string" required:"true"` + GatewayId *string `type:"string" required:"true"` // The ID of the route table. - RouteTableID *string `locationName:"RouteTableId" type:"string" required:"true"` + RouteTableId *string `type:"string" required:"true"` - metadataEnableVGWRoutePropagationInput `json:"-" xml:"-"` + metadataEnableVgwRoutePropagationInput `json:"-" xml:"-"` } -type metadataEnableVGWRoutePropagationInput struct { +type metadataEnableVgwRoutePropagationInput struct { SDKShapeTraits bool `type:"structure"` } // String returns the string representation -func (s EnableVGWRoutePropagationInput) String() string { +func (s EnableVgwRoutePropagationInput) String() string { return awsutil.Prettify(s) } // GoString returns the string representation -func (s EnableVGWRoutePropagationInput) GoString() string { +func (s EnableVgwRoutePropagationInput) GoString() string { return s.String() } -type EnableVGWRoutePropagationOutput struct { - metadataEnableVGWRoutePropagationOutput `json:"-" xml:"-"` +type EnableVgwRoutePropagationOutput struct { + metadataEnableVgwRoutePropagationOutput `json:"-" xml:"-"` } -type metadataEnableVGWRoutePropagationOutput struct { +type metadataEnableVgwRoutePropagationOutput struct { SDKShapeTraits bool `type:"structure"` } // String returns the string representation -func (s EnableVGWRoutePropagationOutput) String() string { +func (s EnableVgwRoutePropagationOutput) String() string { return awsutil.Prettify(s) } // GoString returns the string representation -func (s EnableVGWRoutePropagationOutput) GoString() string { - return s.String() -} - -type EnableVPCClassicLinkInput struct { - // Checks whether you have the required permissions for the action, without - // actually making the request, and provides an error response. If you have - // the required permissions, the error response is DryRunOperation. Otherwise, - // it is UnauthorizedOperation. - DryRun *bool `locationName:"dryRun" type:"boolean"` - - // The ID of the VPC. - VPCID *string `locationName:"vpcId" type:"string" required:"true"` - - metadataEnableVPCClassicLinkInput `json:"-" xml:"-"` -} - -type metadataEnableVPCClassicLinkInput struct { - SDKShapeTraits bool `type:"structure"` -} - -// String returns the string representation -func (s EnableVPCClassicLinkInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s EnableVPCClassicLinkInput) GoString() string { - return s.String() -} - -type EnableVPCClassicLinkOutput struct { - // Returns true if the request succeeds; otherwise, it returns an error. - Return *bool `locationName:"return" type:"boolean"` - - metadataEnableVPCClassicLinkOutput `json:"-" xml:"-"` -} - -type metadataEnableVPCClassicLinkOutput struct { - SDKShapeTraits bool `type:"structure"` -} - -// String returns the string representation -func (s EnableVPCClassicLinkOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s EnableVPCClassicLinkOutput) GoString() string { +func (s EnableVgwRoutePropagationOutput) GoString() string { return s.String() } @@ -16126,7 +16161,7 @@ type EnableVolumeIOInput struct { DryRun *bool `locationName:"dryRun" type:"boolean"` // The ID of the volume. - VolumeID *string `locationName:"volumeId" type:"string" required:"true"` + VolumeId *string `locationName:"volumeId" type:"string" required:"true"` metadataEnableVolumeIOInput `json:"-" xml:"-"` } @@ -16163,6 +16198,54 @@ func (s EnableVolumeIOOutput) GoString() string { return s.String() } +type EnableVpcClassicLinkInput struct { + // Checks whether you have the required permissions for the action, without + // actually making the request, and provides an error response. If you have + // the required permissions, the error response is DryRunOperation. Otherwise, + // it is UnauthorizedOperation. + DryRun *bool `locationName:"dryRun" type:"boolean"` + + // The ID of the VPC. + VpcId *string `locationName:"vpcId" type:"string" required:"true"` + + metadataEnableVpcClassicLinkInput `json:"-" xml:"-"` +} + +type metadataEnableVpcClassicLinkInput struct { + SDKShapeTraits bool `type:"structure"` +} + +// String returns the string representation +func (s EnableVpcClassicLinkInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s EnableVpcClassicLinkInput) GoString() string { + return s.String() +} + +type EnableVpcClassicLinkOutput struct { + // Returns true if the request succeeds; otherwise, it returns an error. + Return *bool `locationName:"return" type:"boolean"` + + metadataEnableVpcClassicLinkOutput `json:"-" xml:"-"` +} + +type metadataEnableVpcClassicLinkOutput struct { + SDKShapeTraits bool `type:"structure"` +} + +// String returns the string representation +func (s EnableVpcClassicLinkOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s EnableVpcClassicLinkOutput) GoString() string { + return s.String() +} + // Describes a Spot fleet event. type EventInformation struct { // The description of the event. @@ -16172,39 +16255,48 @@ type EventInformation struct { // // The following are the error events. // - // iamFleetRoleInvalid - Spot fleet did not have the required permissions + // iamFleetRoleInvalid - The Spot fleet did not have the required permissions // either to launch or terminate an instance. // + // launchSpecTemporarilyBlacklisted - The configuration is not valid and + // several attempts to launch instances have failed. For more information, see + // the description of the event. + // // spotFleetRequestConfigurationInvalid - The configuration is not valid. - // For more information, see the description. + // For more information, see the description of the event. // // spotInstanceCountLimitExceeded - You've reached the limit on the number - // of Spot Instances that you can launch. + // of Spot instances that you can launch. // // The following are the fleetRequestChange events. // // active - The Spot fleet has been validated and Amazon EC2 is attempting - // to maintain the target number of running Spot Instances. + // to maintain the target number of running Spot instances. // - // cancelled - The Spot fleet is canceled and has no running Spot Instances. + // cancelled - The Spot fleet is canceled and has no running Spot instances. // The Spot fleet will be deleted two days after its instances were terminated. // // cancelled_running - The Spot fleet is canceled and will not launch additional - // Spot Instances, but its existing Spot Instances will continue to run until - // they are interrupted or terminated. + // Spot instances, but its existing Spot instances continue to run until they + // are interrupted or terminated. // - // cancelled_terminating - The Spot fleet is canceled and its Spot Instances + // cancelled_terminating - The Spot fleet is canceled and its Spot instances // are terminating. // // expired - The Spot fleet request has expired. A subsequent event indicates - // that the instances were terminated, if the request was created with terminateInstancesWithExpiration + // that the instances were terminated, if the request was created with TerminateInstancesWithExpiration // set. // + // modify_in_progress - A request to modify the Spot fleet request was accepted + // and is in progress. + // + // modify_successful - The Spot fleet request was modified. + // // price_update - The bid price for a launch configuration was adjusted because // it was too high. This change is permanent. // // submitted - The Spot fleet request is being evaluated and Amazon EC2 is - // preparing to launch the target number of Spot Instances. + // preparing to launch the target number of Spot instances. // // The following are the instanceChange events. // @@ -16215,7 +16307,7 @@ type EventInformation struct { // The ID of the instance. This information is available only for instanceChange // events. - InstanceID *string `locationName:"instanceId" type:"string"` + InstanceId *string `locationName:"instanceId" type:"string"` metadataEventInformation `json:"-" xml:"-"` } @@ -16240,7 +16332,7 @@ type ExportTask struct { Description *string `locationName:"description" type:"string"` // The ID of the export task. - ExportTaskID *string `locationName:"exportTaskId" type:"string"` + ExportTaskId *string `locationName:"exportTaskId" type:"string"` // Information about the export task. ExportToS3Task *ExportToS3Task `locationName:"exportToS3" type:"structure"` @@ -16378,13 +16470,13 @@ type FlowLog struct { DeliverLogsErrorMessage *string `locationName:"deliverLogsErrorMessage" type:"string"` // The ARN of the IAM role that posts logs to CloudWatch Logs. - DeliverLogsPermissionARN *string `locationName:"deliverLogsPermissionArn" type:"string"` + DeliverLogsPermissionArn *string `locationName:"deliverLogsPermissionArn" type:"string"` // The status of the logs delivery (SUCCESS | FAILED). DeliverLogsStatus *string `locationName:"deliverLogsStatus" type:"string"` // The flow log ID. - FlowLogID *string `locationName:"flowLogId" type:"string"` + FlowLogId *string `locationName:"flowLogId" type:"string"` // The status of the flow log (ACTIVE). FlowLogStatus *string `locationName:"flowLogStatus" type:"string"` @@ -16393,7 +16485,7 @@ type FlowLog struct { LogGroupName *string `locationName:"logGroupName" type:"string"` // The ID of the resource on which the flow log was created. - ResourceID *string `locationName:"resourceId" type:"string"` + ResourceId *string `locationName:"resourceId" type:"string"` // The type of traffic captured for the flow log. TrafficType *string `locationName:"trafficType" type:"string" enum:"TrafficType"` @@ -16423,7 +16515,7 @@ type GetConsoleOutputInput struct { DryRun *bool `locationName:"dryRun" type:"boolean"` // The ID of the instance. - InstanceID *string `locationName:"InstanceId" type:"string" required:"true"` + InstanceId *string `type:"string" required:"true"` metadataGetConsoleOutputInput `json:"-" xml:"-"` } @@ -16444,7 +16536,7 @@ func (s GetConsoleOutputInput) GoString() string { type GetConsoleOutputOutput struct { // The ID of the instance. - InstanceID *string `locationName:"instanceId" type:"string"` + InstanceId *string `locationName:"instanceId" type:"string"` // The console output, Base64 encoded. Output *string `locationName:"output" type:"string"` @@ -16477,7 +16569,7 @@ type GetPasswordDataInput struct { DryRun *bool `locationName:"dryRun" type:"boolean"` // The ID of the Windows instance. - InstanceID *string `locationName:"InstanceId" type:"string" required:"true"` + InstanceId *string `type:"string" required:"true"` metadataGetPasswordDataInput `json:"-" xml:"-"` } @@ -16498,7 +16590,7 @@ func (s GetPasswordDataInput) GoString() string { type GetPasswordDataOutput struct { // The ID of the Windows instance. - InstanceID *string `locationName:"instanceId" type:"string"` + InstanceId *string `locationName:"instanceId" type:"string"` // The password of the instance. PasswordData *string `locationName:"passwordData" type:"string"` @@ -16526,7 +16618,7 @@ func (s GetPasswordDataOutput) GoString() string { // Describes a security group. type GroupIdentifier struct { // The ID of the security group. - GroupID *string `locationName:"groupId" type:"string"` + GroupId *string `locationName:"groupId" type:"string"` // The name of the security group. GroupName *string `locationName:"groupName" type:"string"` @@ -16584,149 +16676,77 @@ func (s HistoryRecord) GoString() string { } // Describes an IAM instance profile. -type IAMInstanceProfile struct { +type IamInstanceProfile struct { // The Amazon Resource Name (ARN) of the instance profile. - ARN *string `locationName:"arn" type:"string"` + Arn *string `locationName:"arn" type:"string"` // The ID of the instance profile. - ID *string `locationName:"id" type:"string"` + Id *string `locationName:"id" type:"string"` - metadataIAMInstanceProfile `json:"-" xml:"-"` + metadataIamInstanceProfile `json:"-" xml:"-"` } -type metadataIAMInstanceProfile struct { +type metadataIamInstanceProfile struct { SDKShapeTraits bool `type:"structure"` } // String returns the string representation -func (s IAMInstanceProfile) String() string { +func (s IamInstanceProfile) String() string { return awsutil.Prettify(s) } // GoString returns the string representation -func (s IAMInstanceProfile) GoString() string { +func (s IamInstanceProfile) GoString() string { return s.String() } // Describes an IAM instance profile. -type IAMInstanceProfileSpecification struct { +type IamInstanceProfileSpecification struct { // The Amazon Resource Name (ARN) of the instance profile. - ARN *string `locationName:"arn" type:"string"` + Arn *string `locationName:"arn" type:"string"` // The name of the instance profile. Name *string `locationName:"name" type:"string"` - metadataIAMInstanceProfileSpecification `json:"-" xml:"-"` + metadataIamInstanceProfileSpecification `json:"-" xml:"-"` } -type metadataIAMInstanceProfileSpecification struct { +type metadataIamInstanceProfileSpecification struct { SDKShapeTraits bool `type:"structure"` } // String returns the string representation -func (s IAMInstanceProfileSpecification) String() string { +func (s IamInstanceProfileSpecification) String() string { return awsutil.Prettify(s) } // GoString returns the string representation -func (s IAMInstanceProfileSpecification) GoString() string { +func (s IamInstanceProfileSpecification) GoString() string { return s.String() } // Describes the ICMP type and code. -type ICMPTypeCode struct { +type IcmpTypeCode struct { // The ICMP type. A value of -1 means all types. Code *int64 `locationName:"code" type:"integer"` // The ICMP code. A value of -1 means all codes for the specified ICMP type. Type *int64 `locationName:"type" type:"integer"` - metadataICMPTypeCode `json:"-" xml:"-"` + metadataIcmpTypeCode `json:"-" xml:"-"` } -type metadataICMPTypeCode struct { +type metadataIcmpTypeCode struct { SDKShapeTraits bool `type:"structure"` } // String returns the string representation -func (s ICMPTypeCode) String() string { +func (s IcmpTypeCode) String() string { return awsutil.Prettify(s) } // GoString returns the string representation -func (s ICMPTypeCode) GoString() string { - return s.String() -} - -// Describes a security group rule. -type IPPermission struct { - // The start of port range for the TCP and UDP protocols, or an ICMP type number. - // A value of -1 indicates all ICMP types. - FromPort *int64 `locationName:"fromPort" type:"integer"` - - // The protocol. - // - // When you call DescribeSecurityGroups, the protocol value returned is the - // number. Exception: For TCP, UDP, and ICMP, the value returned is the name - // (for example, tcp, udp, or icmp). For a list of protocol numbers, see Protocol - // Numbers (http://www.iana.org/assignments/protocol-numbers/protocol-numbers.xhtml). - // (VPC only) When you call AuthorizeSecurityGroupIngress, you can use -1 to - // specify all. - IPProtocol *string `locationName:"ipProtocol" type:"string"` - - // One or more IP ranges. - IPRanges []*IPRange `locationName:"ipRanges" locationNameList:"item" type:"list"` - - // (Valid for AuthorizeSecurityGroupEgress, RevokeSecurityGroupEgress and DescribeSecurityGroups - // only) One or more prefix list IDs for an AWS service. In an AuthorizeSecurityGroupEgress - // request, this is the AWS service that you want to access through a VPC endpoint - // from instances associated with the security group. - PrefixListIDs []*PrefixListID `locationName:"prefixListIds" locationNameList:"item" type:"list"` - - // The end of port range for the TCP and UDP protocols, or an ICMP code. A value - // of -1 indicates all ICMP codes for the specified ICMP type. - ToPort *int64 `locationName:"toPort" type:"integer"` - - // One or more security group and AWS account ID pairs. - UserIDGroupPairs []*UserIDGroupPair `locationName:"groups" locationNameList:"item" type:"list"` - - metadataIPPermission `json:"-" xml:"-"` -} - -type metadataIPPermission struct { - SDKShapeTraits bool `type:"structure"` -} - -// String returns the string representation -func (s IPPermission) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s IPPermission) GoString() string { - return s.String() -} - -// Describes an IP range. -type IPRange struct { - // The CIDR range. You can either specify a CIDR range or a source security - // group, not both. - CIDRIP *string `locationName:"cidrIp" type:"string"` - - metadataIPRange `json:"-" xml:"-"` -} - -type metadataIPRange struct { - SDKShapeTraits bool `type:"structure"` -} - -// String returns the string representation -func (s IPRange) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s IPRange) GoString() string { +func (s IcmpTypeCode) GoString() string { return s.String() } @@ -16748,7 +16768,7 @@ type Image struct { Hypervisor *string `locationName:"hypervisor" type:"string" enum:"HypervisorType"` // The ID of the AMI. - ImageID *string `locationName:"imageId" type:"string"` + ImageId *string `locationName:"imageId" type:"string"` // The location of the AMI. ImageLocation *string `locationName:"imageLocation" type:"string"` @@ -16762,13 +16782,13 @@ type Image struct { // The kernel associated with the image, if any. Only applicable for machine // images. - KernelID *string `locationName:"kernelId" type:"string"` + KernelId *string `locationName:"kernelId" type:"string"` // The name of the AMI that was provided during image creation. Name *string `locationName:"name" type:"string"` // The AWS account ID of the image owner. - OwnerID *string `locationName:"imageOwnerId" type:"string"` + OwnerId *string `locationName:"imageOwnerId" type:"string"` // The value is Windows for Windows AMIs; otherwise blank. Platform *string `locationName:"platform" type:"string" enum:"PlatformValues"` @@ -16783,7 +16803,7 @@ type Image struct { // The RAM disk associated with the image, if any. Only applicable for machine // images. - RAMDiskID *string `locationName:"ramdiskId" type:"string"` + RamdiskId *string `locationName:"ramdiskId" type:"string"` // The device name of the root device (for example, /dev/sda1 or /dev/xvda). RootDeviceName *string `locationName:"rootDeviceName" type:"string"` @@ -16793,7 +16813,7 @@ type Image struct { RootDeviceType *string `locationName:"rootDeviceType" type:"string" enum:"DeviceType"` // Specifies whether enhanced networking is enabled. - SRIOVNetSupport *string `locationName:"sriovNetSupport" type:"string"` + SriovNetSupport *string `locationName:"sriovNetSupport" type:"string"` // The current state of the AMI. If the state is available, the image is successfully // registered and can be used to launch an instance. @@ -16839,11 +16859,11 @@ type ImageDiskContainer struct { Format *string `type:"string"` // The ID of the EBS snapshot to be used for importing the snapshot. - SnapshotID *string `locationName:"SnapshotId" type:"string"` + SnapshotId *string `type:"string"` // The URL to the Amazon S3-based disk image being imported. The URL can either // be a https URL (https://..) or an Amazon S3 URL (s3://..) - URL *string `locationName:"Url" type:"string"` + Url *string `type:"string"` // The S3 bucket for the disk image. UserBucket *UserBucket `type:"structure"` @@ -16940,10 +16960,10 @@ type ImportImageOutput struct { Hypervisor *string `locationName:"hypervisor" type:"string"` // The ID of the Amazon Machine Image (AMI) created by the import task. - ImageID *string `locationName:"imageId" type:"string"` + ImageId *string `locationName:"imageId" type:"string"` // The task ID of the import image task. - ImportTaskID *string `locationName:"importTaskId" type:"string"` + ImportTaskId *string `locationName:"importTaskId" type:"string"` // The license type of the virtual machine. LicenseType *string `locationName:"licenseType" type:"string"` @@ -16996,10 +17016,10 @@ type ImportImageTask struct { Hypervisor *string `locationName:"hypervisor" type:"string"` // The ID of the Amazon Machine Image (AMI) of the imported virtual machine. - ImageID *string `locationName:"imageId" type:"string"` + ImageId *string `locationName:"imageId" type:"string"` // The ID of the import image task. - ImportTaskID *string `locationName:"importTaskId" type:"string"` + ImportTaskId *string `locationName:"importTaskId" type:"string"` // The license type of the virtual machine. LicenseType *string `locationName:"licenseType" type:"string"` @@ -17081,7 +17101,7 @@ type ImportInstanceLaunchSpecification struct { Architecture *string `locationName:"architecture" type:"string" enum:"ArchitectureValues"` // One or more security group IDs. - GroupIDs []*string `locationName:"GroupId" locationNameList:"SecurityGroupId" type:"list"` + GroupIds []*string `locationName:"GroupId" locationNameList:"SecurityGroupId" type:"list"` // One or more security group names. GroupNames []*string `locationName:"GroupName" locationNameList:"SecurityGroup" type:"list"` @@ -17102,10 +17122,10 @@ type ImportInstanceLaunchSpecification struct { Placement *Placement `locationName:"placement" type:"structure"` // [EC2-VPC] An available IP address from the IP address range of the subnet. - PrivateIPAddress *string `locationName:"privateIpAddress" type:"string"` + PrivateIpAddress *string `locationName:"privateIpAddress" type:"string"` // [EC2-VPC] The ID of the subnet in which to launch the instance. - SubnetID *string `locationName:"subnetId" type:"string"` + SubnetId *string `locationName:"subnetId" type:"string"` // The Base64-encoded MIME user data to be made available to the instance. UserData *UserData `locationName:"userData" type:"structure"` @@ -17154,7 +17174,7 @@ type ImportInstanceTaskDetails struct { Description *string `locationName:"description" type:"string"` // The ID of the instance. - InstanceID *string `locationName:"instanceId" type:"string"` + InstanceId *string `locationName:"instanceId" type:"string"` // The instance operating system. Platform *string `locationName:"platform" type:"string" enum:"PlatformValues"` @@ -17318,7 +17338,7 @@ type ImportSnapshotOutput struct { Description *string `locationName:"description" type:"string"` // The ID of the import snapshot task. - ImportTaskID *string `locationName:"importTaskId" type:"string"` + ImportTaskId *string `locationName:"importTaskId" type:"string"` // Information about the import snapshot task. SnapshotTaskDetail *SnapshotTaskDetail `locationName:"snapshotTaskDetail" type:"structure"` @@ -17346,7 +17366,7 @@ type ImportSnapshotTask struct { Description *string `locationName:"description" type:"string"` // The ID of the import snapshot task. - ImportTaskID *string `locationName:"importTaskId" type:"string"` + ImportTaskId *string `locationName:"importTaskId" type:"string"` // Describes an import snapshot task. SnapshotTaskDetail *SnapshotTaskDetail `locationName:"snapshotTaskDetail" type:"structure"` @@ -17463,7 +17483,7 @@ func (s ImportVolumeTaskDetails) GoString() string { type Instance struct { // The AMI launch index, which can be used to find this instance in the launch // group. - AMILaunchIndex *int64 `locationName:"amiLaunchIndex" type:"integer"` + AmiLaunchIndex *int64 `locationName:"amiLaunchIndex" type:"integer"` // The architecture of the image. Architecture *string `locationName:"architecture" type:"string" enum:"ArchitectureValues"` @@ -17479,19 +17499,19 @@ type Instance struct { // stack to provide optimal I/O performance. This optimization isn't available // with all instance types. Additional usage charges apply when using an EBS // Optimized instance. - EBSOptimized *bool `locationName:"ebsOptimized" type:"boolean"` + EbsOptimized *bool `locationName:"ebsOptimized" type:"boolean"` // The hypervisor type of the instance. Hypervisor *string `locationName:"hypervisor" type:"string" enum:"HypervisorType"` // The IAM instance profile associated with the instance. - IAMInstanceProfile *IAMInstanceProfile `locationName:"iamInstanceProfile" type:"structure"` + IamInstanceProfile *IamInstanceProfile `locationName:"iamInstanceProfile" type:"structure"` // The ID of the AMI used to launch the instance. - ImageID *string `locationName:"imageId" type:"string"` + ImageId *string `locationName:"imageId" type:"string"` // The ID of the instance. - InstanceID *string `locationName:"instanceId" type:"string"` + InstanceId *string `locationName:"instanceId" type:"string"` // Indicates whether this is a Spot Instance. InstanceLifecycle *string `locationName:"instanceLifecycle" type:"string" enum:"InstanceLifecycleType"` @@ -17500,7 +17520,7 @@ type Instance struct { InstanceType *string `locationName:"instanceType" type:"string" enum:"InstanceType"` // The kernel associated with this instance. - KernelID *string `locationName:"kernelId" type:"string"` + KernelId *string `locationName:"kernelId" type:"string"` // The name of the key pair, if this instance was launched with an associated // key pair. @@ -17524,23 +17544,23 @@ type Instance struct { // The private DNS name assigned to the instance. This DNS name can only be // used inside the Amazon EC2 network. This name is not available until the // instance enters the running state. - PrivateDNSName *string `locationName:"privateDnsName" type:"string"` + PrivateDnsName *string `locationName:"privateDnsName" type:"string"` // The private IP address assigned to the instance. - PrivateIPAddress *string `locationName:"privateIpAddress" type:"string"` + PrivateIpAddress *string `locationName:"privateIpAddress" type:"string"` // The product codes attached to this instance. ProductCodes []*ProductCode `locationName:"productCodes" locationNameList:"item" type:"list"` // The public DNS name assigned to the instance. This name is not available // until the instance enters the running state. - PublicDNSName *string `locationName:"dnsName" type:"string"` + PublicDnsName *string `locationName:"dnsName" type:"string"` // The public IP address assigned to the instance. - PublicIPAddress *string `locationName:"ipAddress" type:"string"` + PublicIpAddress *string `locationName:"ipAddress" type:"string"` // The RAM disk associated with this instance. - RAMDiskID *string `locationName:"ramdiskId" type:"string"` + RamdiskId *string `locationName:"ramdiskId" type:"string"` // The root device name (for example, /dev/sda1 or /dev/xvda). RootDeviceName *string `locationName:"rootDeviceName" type:"string"` @@ -17549,9 +17569,6 @@ type Instance struct { // instance store volume. RootDeviceType *string `locationName:"rootDeviceType" type:"string" enum:"DeviceType"` - // Specifies whether enhanced networking is enabled. - SRIOVNetSupport *string `locationName:"sriovNetSupport" type:"string"` - // One or more security groups for the instance. SecurityGroups []*GroupIdentifier `locationName:"groupSet" locationNameList:"item" type:"list"` @@ -17564,7 +17581,10 @@ type Instance struct { SourceDestCheck *bool `locationName:"sourceDestCheck" type:"boolean"` // The ID of the Spot Instance request. - SpotInstanceRequestID *string `locationName:"spotInstanceRequestId" type:"string"` + SpotInstanceRequestId *string `locationName:"spotInstanceRequestId" type:"string"` + + // Specifies whether enhanced networking is enabled. + SriovNetSupport *string `locationName:"sriovNetSupport" type:"string"` // The current state of the instance. State *InstanceState `locationName:"instanceState" type:"structure"` @@ -17576,17 +17596,17 @@ type Instance struct { StateTransitionReason *string `locationName:"reason" type:"string"` // The ID of the subnet in which the instance is running. - SubnetID *string `locationName:"subnetId" type:"string"` + SubnetId *string `locationName:"subnetId" type:"string"` // Any tags assigned to the instance. Tags []*Tag `locationName:"tagSet" locationNameList:"item" type:"list"` - // The ID of the VPC in which the instance is running. - VPCID *string `locationName:"vpcId" type:"string"` - // The virtualization type of the instance. VirtualizationType *string `locationName:"virtualizationType" type:"string" enum:"VirtualizationType"` + // The ID of the VPC in which the instance is running. + VpcId *string `locationName:"vpcId" type:"string"` + metadataInstance `json:"-" xml:"-"` } @@ -17611,7 +17631,7 @@ type InstanceBlockDeviceMapping struct { // Parameters used to automatically set up EBS volumes when the instance is // launched. - EBS *EBSInstanceBlockDevice `locationName:"ebs" type:"structure"` + Ebs *EbsInstanceBlockDevice `locationName:"ebs" type:"structure"` metadataInstanceBlockDeviceMapping `json:"-" xml:"-"` } @@ -17637,7 +17657,7 @@ type InstanceBlockDeviceMappingSpecification struct { // Parameters used to automatically set up EBS volumes when the instance is // launched. - EBS *EBSInstanceBlockDeviceSpecification `locationName:"ebs" type:"structure"` + Ebs *EbsInstanceBlockDeviceSpecification `locationName:"ebs" type:"structure"` // suppress the specified device included in the block device mapping. NoDevice *string `locationName:"noDevice" type:"string"` @@ -17690,7 +17710,7 @@ func (s InstanceCount) GoString() string { // Describes an instance to export. type InstanceExportDetails struct { // The ID of the resource being exported. - InstanceID *string `locationName:"instanceId" type:"string"` + InstanceId *string `locationName:"instanceId" type:"string"` // The target virtualization environment. TargetEnvironment *string `locationName:"targetEnvironment" type:"string" enum:"ExportEnvironment"` @@ -17715,7 +17735,7 @@ func (s InstanceExportDetails) GoString() string { // Describes the monitoring information of the instance. type InstanceMonitoring struct { // The ID of the instance. - InstanceID *string `locationName:"instanceId" type:"string"` + InstanceId *string `locationName:"instanceId" type:"string"` // The monitoring information. Monitoring *Monitoring `locationName:"monitoring" type:"structure"` @@ -17753,22 +17773,22 @@ type InstanceNetworkInterface struct { Groups []*GroupIdentifier `locationName:"groupSet" locationNameList:"item" type:"list"` // The MAC address. - MACAddress *string `locationName:"macAddress" type:"string"` + MacAddress *string `locationName:"macAddress" type:"string"` // The ID of the network interface. - NetworkInterfaceID *string `locationName:"networkInterfaceId" type:"string"` + NetworkInterfaceId *string `locationName:"networkInterfaceId" type:"string"` // The ID of the AWS account that created the network interface. - OwnerID *string `locationName:"ownerId" type:"string"` + OwnerId *string `locationName:"ownerId" type:"string"` // The private DNS name. - PrivateDNSName *string `locationName:"privateDnsName" type:"string"` + PrivateDnsName *string `locationName:"privateDnsName" type:"string"` // The IP address of the network interface within the subnet. - PrivateIPAddress *string `locationName:"privateIpAddress" type:"string"` + PrivateIpAddress *string `locationName:"privateIpAddress" type:"string"` // The private IP addresses associated with the network interface. - PrivateIPAddresses []*InstancePrivateIPAddress `locationName:"privateIpAddressesSet" locationNameList:"item" type:"list"` + PrivateIpAddresses []*InstancePrivateIpAddress `locationName:"privateIpAddressesSet" locationNameList:"item" type:"list"` // Indicates whether to validate network traffic to or from this network interface. SourceDestCheck *bool `locationName:"sourceDestCheck" type:"boolean"` @@ -17777,10 +17797,10 @@ type InstanceNetworkInterface struct { Status *string `locationName:"status" type:"string" enum:"NetworkInterfaceStatus"` // The ID of the subnet. - SubnetID *string `locationName:"subnetId" type:"string"` + SubnetId *string `locationName:"subnetId" type:"string"` // The ID of the VPC. - VPCID *string `locationName:"vpcId" type:"string"` + VpcId *string `locationName:"vpcId" type:"string"` metadataInstanceNetworkInterface `json:"-" xml:"-"` } @@ -17802,13 +17822,13 @@ func (s InstanceNetworkInterface) GoString() string { // Describes association information for an Elastic IP address. type InstanceNetworkInterfaceAssociation struct { // The ID of the owner of the Elastic IP address. - IPOwnerID *string `locationName:"ipOwnerId" type:"string"` + IpOwnerId *string `locationName:"ipOwnerId" type:"string"` // The public DNS name. - PublicDNSName *string `locationName:"publicDnsName" type:"string"` + PublicDnsName *string `locationName:"publicDnsName" type:"string"` // The public IP address or Elastic IP address bound to the network interface. - PublicIP *string `locationName:"publicIp" type:"string"` + PublicIp *string `locationName:"publicIp" type:"string"` metadataInstanceNetworkInterfaceAssociation `json:"-" xml:"-"` } @@ -17833,7 +17853,7 @@ type InstanceNetworkInterfaceAttachment struct { AttachTime *time.Time `locationName:"attachTime" type:"timestamp" timestampFormat:"iso8601"` // The ID of the network interface attachment. - AttachmentID *string `locationName:"attachmentId" type:"string"` + AttachmentId *string `locationName:"attachmentId" type:"string"` // Indicates whether the network interface is deleted when the instance is terminated. DeleteOnTermination *bool `locationName:"deleteOnTermination" type:"boolean"` @@ -17868,7 +17888,7 @@ type InstanceNetworkInterfaceSpecification struct { // for eth0, and can only be assigned to a new network interface, not an existing // one. You cannot specify more than one network interface in the request. If // launching into a default subnet, the default value is true. - AssociatePublicIPAddress *bool `locationName:"associatePublicIpAddress" type:"boolean"` + AssociatePublicIpAddress *bool `locationName:"associatePublicIpAddress" type:"boolean"` // If set to true, the interface is deleted when the instance is terminated. // You can specify true only if creating a new network interface when launching @@ -17889,24 +17909,24 @@ type InstanceNetworkInterfaceSpecification struct { Groups []*string `locationName:"SecurityGroupId" locationNameList:"SecurityGroupId" type:"list"` // The ID of the network interface. - NetworkInterfaceID *string `locationName:"networkInterfaceId" type:"string"` + NetworkInterfaceId *string `locationName:"networkInterfaceId" type:"string"` // The private IP address of the network interface. Applies only if creating // a network interface when launching an instance. - PrivateIPAddress *string `locationName:"privateIpAddress" type:"string"` + PrivateIpAddress *string `locationName:"privateIpAddress" type:"string"` // One or more private IP addresses to assign to the network interface. Only // one private IP address can be designated as primary. - PrivateIPAddresses []*PrivateIPAddressSpecification `locationName:"privateIpAddressesSet" queryName:"PrivateIpAddresses" locationNameList:"item" type:"list"` + PrivateIpAddresses []*PrivateIpAddressSpecification `locationName:"privateIpAddressesSet" queryName:"PrivateIpAddresses" locationNameList:"item" type:"list"` // The number of secondary private IP addresses. You can't specify this option // and specify more than one private IP address using the private IP addresses // option. - SecondaryPrivateIPAddressCount *int64 `locationName:"secondaryPrivateIpAddressCount" type:"integer"` + SecondaryPrivateIpAddressCount *int64 `locationName:"secondaryPrivateIpAddressCount" type:"integer"` // The ID of the subnet associated with the network string. Applies only if // creating a network interface when launching an instance. - SubnetID *string `locationName:"subnetId" type:"string"` + SubnetId *string `locationName:"subnetId" type:"string"` metadataInstanceNetworkInterfaceSpecification `json:"-" xml:"-"` } @@ -17926,7 +17946,7 @@ func (s InstanceNetworkInterfaceSpecification) GoString() string { } // Describes a private IP address. -type InstancePrivateIPAddress struct { +type InstancePrivateIpAddress struct { // The association information for an Elastic IP address for the network interface. Association *InstanceNetworkInterfaceAssociation `locationName:"association" type:"structure"` @@ -17935,25 +17955,25 @@ type InstancePrivateIPAddress struct { Primary *bool `locationName:"primary" type:"boolean"` // The private DNS name. - PrivateDNSName *string `locationName:"privateDnsName" type:"string"` + PrivateDnsName *string `locationName:"privateDnsName" type:"string"` // The private IP address of the network interface. - PrivateIPAddress *string `locationName:"privateIpAddress" type:"string"` + PrivateIpAddress *string `locationName:"privateIpAddress" type:"string"` - metadataInstancePrivateIPAddress `json:"-" xml:"-"` + metadataInstancePrivateIpAddress `json:"-" xml:"-"` } -type metadataInstancePrivateIPAddress struct { +type metadataInstancePrivateIpAddress struct { SDKShapeTraits bool `type:"structure"` } // String returns the string representation -func (s InstancePrivateIPAddress) String() string { +func (s InstancePrivateIpAddress) String() string { return awsutil.Prettify(s) } // GoString returns the string representation -func (s InstancePrivateIPAddress) GoString() string { +func (s InstancePrivateIpAddress) GoString() string { return s.String() } @@ -18001,7 +18021,7 @@ type InstanceStateChange struct { CurrentState *InstanceState `locationName:"currentState" type:"structure"` // The ID of the instance. - InstanceID *string `locationName:"instanceId" type:"string"` + InstanceId *string `locationName:"instanceId" type:"string"` // The previous state of the instance. PreviousState *InstanceState `locationName:"previousState" type:"structure"` @@ -18032,7 +18052,7 @@ type InstanceStatus struct { Events []*InstanceStatusEvent `locationName:"eventsSet" locationNameList:"item" type:"list"` // The ID of the instance. - InstanceID *string `locationName:"instanceId" type:"string"` + InstanceId *string `locationName:"instanceId" type:"string"` // The intended state of the instance. DescribeInstanceStatus requires that // an instance be in the running state. @@ -18159,7 +18179,7 @@ type InternetGateway struct { Attachments []*InternetGatewayAttachment `locationName:"attachmentSet" locationNameList:"item" type:"list"` // The ID of the Internet gateway. - InternetGatewayID *string `locationName:"internetGatewayId" type:"string"` + InternetGatewayId *string `locationName:"internetGatewayId" type:"string"` // Any tags assigned to the Internet gateway. Tags []*Tag `locationName:"tagSet" locationNameList:"item" type:"list"` @@ -18187,7 +18207,7 @@ type InternetGatewayAttachment struct { State *string `locationName:"state" type:"string" enum:"AttachmentStatus"` // The ID of the VPC. - VPCID *string `locationName:"vpcId" type:"string"` + VpcId *string `locationName:"vpcId" type:"string"` metadataInternetGatewayAttachment `json:"-" xml:"-"` } @@ -18206,6 +18226,78 @@ func (s InternetGatewayAttachment) GoString() string { return s.String() } +// Describes a security group rule. +type IpPermission struct { + // The start of port range for the TCP and UDP protocols, or an ICMP type number. + // A value of -1 indicates all ICMP types. + FromPort *int64 `locationName:"fromPort" type:"integer"` + + // The protocol. + // + // When you call DescribeSecurityGroups, the protocol value returned is the + // number. Exception: For TCP, UDP, and ICMP, the value returned is the name + // (for example, tcp, udp, or icmp). For a list of protocol numbers, see Protocol + // Numbers (http://www.iana.org/assignments/protocol-numbers/protocol-numbers.xhtml). + // (VPC only) When you call AuthorizeSecurityGroupIngress, you can use -1 to + // specify all. + IpProtocol *string `locationName:"ipProtocol" type:"string"` + + // One or more IP ranges. + IpRanges []*IpRange `locationName:"ipRanges" locationNameList:"item" type:"list"` + + // (Valid for AuthorizeSecurityGroupEgress, RevokeSecurityGroupEgress and DescribeSecurityGroups + // only) One or more prefix list IDs for an AWS service. In an AuthorizeSecurityGroupEgress + // request, this is the AWS service that you want to access through a VPC endpoint + // from instances associated with the security group. + PrefixListIds []*PrefixListId `locationName:"prefixListIds" locationNameList:"item" type:"list"` + + // The end of port range for the TCP and UDP protocols, or an ICMP code. A value + // of -1 indicates all ICMP codes for the specified ICMP type. + ToPort *int64 `locationName:"toPort" type:"integer"` + + // One or more security group and AWS account ID pairs. + UserIdGroupPairs []*UserIdGroupPair `locationName:"groups" locationNameList:"item" type:"list"` + + metadataIpPermission `json:"-" xml:"-"` +} + +type metadataIpPermission struct { + SDKShapeTraits bool `type:"structure"` +} + +// String returns the string representation +func (s IpPermission) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s IpPermission) GoString() string { + return s.String() +} + +// Describes an IP range. +type IpRange struct { + // The CIDR range. You can either specify a CIDR range or a source security + // group, not both. + CidrIp *string `locationName:"cidrIp" type:"string"` + + metadataIpRange `json:"-" xml:"-"` +} + +type metadataIpRange struct { + SDKShapeTraits bool `type:"structure"` +} + +// String returns the string representation +func (s IpRange) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s IpRange) GoString() string { + return s.String() +} + // Describes a key pair. type KeyPairInfo struct { // If you used CreateKeyPair to create the key pair, this is the SHA-1 digest @@ -18240,7 +18332,7 @@ type LaunchPermission struct { Group *string `locationName:"group" type:"string" enum:"PermissionGroup"` // The AWS account ID. - UserID *string `locationName:"userId" type:"string"` + UserId *string `locationName:"userId" type:"string"` metadataLaunchPermission `json:"-" xml:"-"` } @@ -18300,19 +18392,19 @@ type LaunchSpecification struct { // Optimized instance. // // Default: false - EBSOptimized *bool `locationName:"ebsOptimized" type:"boolean"` + EbsOptimized *bool `locationName:"ebsOptimized" type:"boolean"` // The IAM instance profile. - IAMInstanceProfile *IAMInstanceProfileSpecification `locationName:"iamInstanceProfile" type:"structure"` + IamInstanceProfile *IamInstanceProfileSpecification `locationName:"iamInstanceProfile" type:"structure"` // The ID of the AMI. - ImageID *string `locationName:"imageId" type:"string"` + ImageId *string `locationName:"imageId" type:"string"` // The instance type. InstanceType *string `locationName:"instanceType" type:"string" enum:"InstanceType"` // The ID of the kernel. - KernelID *string `locationName:"kernelId" type:"string"` + KernelId *string `locationName:"kernelId" type:"string"` // The name of the key pair. KeyName *string `locationName:"keyName" type:"string"` @@ -18327,16 +18419,15 @@ type LaunchSpecification struct { Placement *SpotPlacement `locationName:"placement" type:"structure"` // The ID of the RAM disk. - RAMDiskID *string `locationName:"ramdiskId" type:"string"` + RamdiskId *string `locationName:"ramdiskId" type:"string"` - // One or more security groups. To request an instance in a nondefault VPC, - // you must specify the ID of the security group. To request an instance in - // EC2-Classic or a default VPC, you can specify the name or the ID of the security - // group. + // One or more security groups. When requesting instances in a VPC, you must + // specify the IDs of the security groups. When requesting instances in EC2-Classic, + // you can specify the names or the IDs of the security groups. SecurityGroups []*GroupIdentifier `locationName:"groupSet" locationNameList:"item" type:"list"` // The ID of the subnet in which to launch the instance. - SubnetID *string `locationName:"subnetId" type:"string"` + SubnetId *string `locationName:"subnetId" type:"string"` // The Base64-encoded MIME user data to make available to the instances. UserData *string `locationName:"userData" type:"string"` @@ -18372,13 +18463,13 @@ type ModifyImageAttributeInput struct { DryRun *bool `locationName:"dryRun" type:"boolean"` // The ID of the AMI. - ImageID *string `locationName:"ImageId" type:"string" required:"true"` + ImageId *string `type:"string" required:"true"` // A launch permission modification. LaunchPermission *LaunchPermissionModifications `type:"structure"` // The operation type. - OperationType *string `type:"string"` + OperationType *string `type:"string" enum:"OperationType"` // One or more product codes. After you add a product code to an AMI, it can't // be removed. This is only valid when modifying the productCodes attribute. @@ -18390,7 +18481,7 @@ type ModifyImageAttributeInput struct { // One or more AWS account IDs. This is only valid when modifying the launchPermission // attribute. - UserIDs []*string `locationName:"UserId" locationNameList:"UserId" type:"list"` + UserIds []*string `locationName:"UserId" locationNameList:"UserId" type:"list"` // The value of the attribute being modified. This is only valid when modifying // the description attribute. @@ -18447,8 +18538,9 @@ type ModifyInstanceAttributeInput struct { BlockDeviceMappings []*InstanceBlockDeviceMappingSpecification `locationName:"blockDeviceMapping" locationNameList:"item" type:"list"` // If the value is true, you can't terminate the instance using the Amazon EC2 - // console, CLI, or API; otherwise, you can. - DisableAPITermination *AttributeBooleanValue `locationName:"disableApiTermination" type:"structure"` + // console, CLI, or API; otherwise, you can. You cannot use this paramater for + // Spot Instances. + DisableApiTermination *AttributeBooleanValue `locationName:"disableApiTermination" type:"structure"` // Checks whether you have the required permissions for the action, without // actually making the request, and provides an error response. If you have @@ -18461,7 +18553,7 @@ type ModifyInstanceAttributeInput struct { // stack to provide optimal EBS I/O performance. This optimization isn't available // with all instance types. Additional usage charges apply when using an EBS // Optimized instance. - EBSOptimized *AttributeBooleanValue `locationName:"ebsOptimized" type:"structure"` + EbsOptimized *AttributeBooleanValue `locationName:"ebsOptimized" type:"structure"` // [EC2-VPC] Changes the security groups of the instance. You must specify at // least one security group, even if it's just the default security group for @@ -18469,7 +18561,7 @@ type ModifyInstanceAttributeInput struct { Groups []*string `locationName:"GroupId" locationNameList:"groupId" type:"list"` // The ID of the instance. - InstanceID *string `locationName:"instanceId" type:"string" required:"true"` + InstanceId *string `locationName:"instanceId" type:"string" required:"true"` // Specifies whether an instance stops or terminates when you initiate shutdown // from the instance (using the operating system command for system shutdown). @@ -18488,7 +18580,12 @@ type ModifyInstanceAttributeInput struct { // Changes the instance's RAM disk to the specified value. We recommend that // you use PV-GRUB instead of kernels and RAM disks. For more information, see // PV-GRUB (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/UserProvidedKernels.html). - RAMDisk *AttributeValue `locationName:"ramdisk" type:"structure"` + Ramdisk *AttributeValue `locationName:"ramdisk" type:"structure"` + + // Specifies whether source/destination checking is enabled. A value of true + // means that checking is enabled, and false means checking is disabled. This + // value must be false for a NAT instance to perform NAT. + SourceDestCheck *AttributeBooleanValue `type:"structure"` // Set to simple to enable enhanced networking for the instance. // @@ -18496,18 +18593,13 @@ type ModifyInstanceAttributeInput struct { // // This option is supported only for HVM instances. Specifying this option // with a PV instance can make it unreachable. - SRIOVNetSupport *AttributeValue `locationName:"sriovNetSupport" type:"structure"` - - // Specifies whether source/destination checking is enabled. A value of true - // means that checking is enabled, and false means checking is disabled. This - // value must be false for a NAT instance to perform NAT. - SourceDestCheck *AttributeBooleanValue `type:"structure"` + SriovNetSupport *AttributeValue `locationName:"sriovNetSupport" type:"structure"` // Changes the instance's user data to the specified value. UserData *BlobAttributeValue `locationName:"userData" type:"structure"` // A new value for the attribute. Use only with the kernel, ramdisk, userData, - // disableApiTermination, or intanceInitiateShutdownBehavior attribute. + // disableApiTermination, or instanceInitiatedShutdownBehavior attribute. Value *string `locationName:"value" type:"string"` metadataModifyInstanceAttributeInput `json:"-" xml:"-"` @@ -18566,7 +18658,7 @@ type ModifyNetworkInterfaceAttributeInput struct { Groups []*string `locationName:"SecurityGroupId" locationNameList:"SecurityGroupId" type:"list"` // The ID of the network interface. - NetworkInterfaceID *string `locationName:"networkInterfaceId" type:"string" required:"true"` + NetworkInterfaceId *string `locationName:"networkInterfaceId" type:"string" required:"true"` // Indicates whether source/destination checking is enabled. A value of true // means checking is enabled, and false means checking is disabled. This value @@ -18616,7 +18708,7 @@ type ModifyReservedInstancesInput struct { ClientToken *string `locationName:"clientToken" type:"string"` // The IDs of the Reserved Instances to modify. - ReservedInstancesIDs []*string `locationName:"ReservedInstancesId" locationNameList:"ReservedInstancesId" type:"list" required:"true"` + ReservedInstancesIds []*string `locationName:"ReservedInstancesId" locationNameList:"ReservedInstancesId" type:"list" required:"true"` // The configuration settings for the Reserved Instances to modify. TargetConfigurations []*ReservedInstancesConfiguration `locationName:"ReservedInstancesConfigurationSetItemType" locationNameList:"item" type:"list" required:"true"` @@ -18640,7 +18732,7 @@ func (s ModifyReservedInstancesInput) GoString() string { type ModifyReservedInstancesOutput struct { // The ID for the modification. - ReservedInstancesModificationID *string `locationName:"reservedInstancesModificationId" type:"string"` + ReservedInstancesModificationId *string `locationName:"reservedInstancesModificationId" type:"string"` metadataModifyReservedInstancesOutput `json:"-" xml:"-"` } @@ -18678,13 +18770,13 @@ type ModifySnapshotAttributeInput struct { GroupNames []*string `locationName:"UserGroup" locationNameList:"GroupName" type:"list"` // The type of operation to perform to the attribute. - OperationType *string `type:"string"` + OperationType *string `type:"string" enum:"OperationType"` // The ID of the snapshot. - SnapshotID *string `locationName:"SnapshotId" type:"string" required:"true"` + SnapshotId *string `type:"string" required:"true"` // The account ID to modify for the snapshot. - UserIDs []*string `locationName:"UserId" locationNameList:"UserId" type:"list"` + UserIds []*string `locationName:"UserId" locationNameList:"UserId" type:"list"` metadataModifySnapshotAttributeInput `json:"-" xml:"-"` } @@ -18721,13 +18813,65 @@ func (s ModifySnapshotAttributeOutput) GoString() string { return s.String() } +// Contains the parameters for ModifySpotFleetRequest. +type ModifySpotFleetRequestInput struct { + // Indicates whether running Spot instances should be terminated if the target + // capacity of the Spot fleet request is decreased below the current size of + // the Spot fleet. + ExcessCapacityTerminationPolicy *string `locationName:"excessCapacityTerminationPolicy" type:"string" enum:"ExcessCapacityTerminationPolicy"` + + // The ID of the Spot fleet request. + SpotFleetRequestId *string `locationName:"spotFleetRequestId" type:"string" required:"true"` + + // The size of the fleet. + TargetCapacity *int64 `locationName:"targetCapacity" type:"integer"` + + metadataModifySpotFleetRequestInput `json:"-" xml:"-"` +} + +type metadataModifySpotFleetRequestInput struct { + SDKShapeTraits bool `type:"structure"` +} + +// String returns the string representation +func (s ModifySpotFleetRequestInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s ModifySpotFleetRequestInput) GoString() string { + return s.String() +} + +// Contains the output of ModifySpotFleetRequest. +type ModifySpotFleetRequestOutput struct { + // Is true if the request succeeds, and an error otherwise. + Return *bool `locationName:"return" type:"boolean"` + + metadataModifySpotFleetRequestOutput `json:"-" xml:"-"` +} + +type metadataModifySpotFleetRequestOutput struct { + SDKShapeTraits bool `type:"structure"` +} + +// String returns the string representation +func (s ModifySpotFleetRequestOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s ModifySpotFleetRequestOutput) GoString() string { + return s.String() +} + type ModifySubnetAttributeInput struct { // Specify true to indicate that instances launched into the specified subnet // should be assigned public IP address. - MapPublicIPOnLaunch *AttributeBooleanValue `locationName:"MapPublicIpOnLaunch" type:"structure"` + MapPublicIpOnLaunch *AttributeBooleanValue `type:"structure"` // The ID of the subnet. - SubnetID *string `locationName:"subnetId" type:"string" required:"true"` + SubnetId *string `locationName:"subnetId" type:"string" required:"true"` metadataModifySubnetAttributeInput `json:"-" xml:"-"` } @@ -18764,120 +18908,6 @@ func (s ModifySubnetAttributeOutput) GoString() string { return s.String() } -type ModifyVPCAttributeInput struct { - // Indicates whether the instances launched in the VPC get DNS hostnames. If - // enabled, instances in the VPC get DNS hostnames; otherwise, they do not. - // - // You can only enable DNS hostnames if you also enable DNS support. - EnableDNSHostnames *AttributeBooleanValue `locationName:"EnableDnsHostnames" type:"structure"` - - // Indicates whether the DNS resolution is supported for the VPC. If enabled, - // queries to the Amazon provided DNS server at the 169.254.169.253 IP address, - // or the reserved IP address at the base of the VPC network range "plus two" - // will succeed. If disabled, the Amazon provided DNS service in the VPC that - // resolves public DNS hostnames to IP addresses is not enabled. - EnableDNSSupport *AttributeBooleanValue `locationName:"EnableDnsSupport" type:"structure"` - - // The ID of the VPC. - VPCID *string `locationName:"vpcId" type:"string" required:"true"` - - metadataModifyVPCAttributeInput `json:"-" xml:"-"` -} - -type metadataModifyVPCAttributeInput struct { - SDKShapeTraits bool `type:"structure"` -} - -// String returns the string representation -func (s ModifyVPCAttributeInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s ModifyVPCAttributeInput) GoString() string { - return s.String() -} - -type ModifyVPCAttributeOutput struct { - metadataModifyVPCAttributeOutput `json:"-" xml:"-"` -} - -type metadataModifyVPCAttributeOutput struct { - SDKShapeTraits bool `type:"structure"` -} - -// String returns the string representation -func (s ModifyVPCAttributeOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s ModifyVPCAttributeOutput) GoString() string { - return s.String() -} - -type ModifyVPCEndpointInput struct { - // One or more route tables IDs to associate with the endpoint. - AddRouteTableIDs []*string `locationName:"AddRouteTableId" locationNameList:"item" type:"list"` - - // Checks whether you have the required permissions for the action, without - // actually making the request, and provides an error response. If you have - // the required permissions, the error response is DryRunOperation. Otherwise, - // it is UnauthorizedOperation. - DryRun *bool `type:"boolean"` - - // A policy document to attach to the endpoint. The policy must be in valid - // JSON format. - PolicyDocument *string `type:"string"` - - // One or more route table IDs to disassociate from the endpoint. - RemoveRouteTableIDs []*string `locationName:"RemoveRouteTableId" locationNameList:"item" type:"list"` - - // Specify true to reset the policy document to the default policy. The default - // policy allows access to the service. - ResetPolicy *bool `type:"boolean"` - - // The ID of the endpoint. - VPCEndpointID *string `locationName:"VpcEndpointId" type:"string" required:"true"` - - metadataModifyVPCEndpointInput `json:"-" xml:"-"` -} - -type metadataModifyVPCEndpointInput struct { - SDKShapeTraits bool `type:"structure"` -} - -// String returns the string representation -func (s ModifyVPCEndpointInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s ModifyVPCEndpointInput) GoString() string { - return s.String() -} - -type ModifyVPCEndpointOutput struct { - // Returns true if the request succeeds; otherwise, it returns an error. - Return *bool `locationName:"return" type:"boolean"` - - metadataModifyVPCEndpointOutput `json:"-" xml:"-"` -} - -type metadataModifyVPCEndpointOutput struct { - SDKShapeTraits bool `type:"structure"` -} - -// String returns the string representation -func (s ModifyVPCEndpointOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s ModifyVPCEndpointOutput) GoString() string { - return s.String() -} - type ModifyVolumeAttributeInput struct { // Indicates whether the volume should be auto-enabled for I/O operations. AutoEnableIO *AttributeBooleanValue `type:"structure"` @@ -18889,7 +18919,7 @@ type ModifyVolumeAttributeInput struct { DryRun *bool `locationName:"dryRun" type:"boolean"` // The ID of the volume. - VolumeID *string `locationName:"VolumeId" type:"string" required:"true"` + VolumeId *string `type:"string" required:"true"` metadataModifyVolumeAttributeInput `json:"-" xml:"-"` } @@ -18926,6 +18956,120 @@ func (s ModifyVolumeAttributeOutput) GoString() string { return s.String() } +type ModifyVpcAttributeInput struct { + // Indicates whether the instances launched in the VPC get DNS hostnames. If + // enabled, instances in the VPC get DNS hostnames; otherwise, they do not. + // + // You can only enable DNS hostnames if you also enable DNS support. + EnableDnsHostnames *AttributeBooleanValue `type:"structure"` + + // Indicates whether the DNS resolution is supported for the VPC. If enabled, + // queries to the Amazon provided DNS server at the 169.254.169.253 IP address, + // or the reserved IP address at the base of the VPC network range "plus two" + // will succeed. If disabled, the Amazon provided DNS service in the VPC that + // resolves public DNS hostnames to IP addresses is not enabled. + EnableDnsSupport *AttributeBooleanValue `type:"structure"` + + // The ID of the VPC. + VpcId *string `locationName:"vpcId" type:"string" required:"true"` + + metadataModifyVpcAttributeInput `json:"-" xml:"-"` +} + +type metadataModifyVpcAttributeInput struct { + SDKShapeTraits bool `type:"structure"` +} + +// String returns the string representation +func (s ModifyVpcAttributeInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s ModifyVpcAttributeInput) GoString() string { + return s.String() +} + +type ModifyVpcAttributeOutput struct { + metadataModifyVpcAttributeOutput `json:"-" xml:"-"` +} + +type metadataModifyVpcAttributeOutput struct { + SDKShapeTraits bool `type:"structure"` +} + +// String returns the string representation +func (s ModifyVpcAttributeOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s ModifyVpcAttributeOutput) GoString() string { + return s.String() +} + +type ModifyVpcEndpointInput struct { + // One or more route tables IDs to associate with the endpoint. + AddRouteTableIds []*string `locationName:"AddRouteTableId" locationNameList:"item" type:"list"` + + // Checks whether you have the required permissions for the action, without + // actually making the request, and provides an error response. If you have + // the required permissions, the error response is DryRunOperation. Otherwise, + // it is UnauthorizedOperation. + DryRun *bool `type:"boolean"` + + // A policy document to attach to the endpoint. The policy must be in valid + // JSON format. + PolicyDocument *string `type:"string"` + + // One or more route table IDs to disassociate from the endpoint. + RemoveRouteTableIds []*string `locationName:"RemoveRouteTableId" locationNameList:"item" type:"list"` + + // Specify true to reset the policy document to the default policy. The default + // policy allows access to the service. + ResetPolicy *bool `type:"boolean"` + + // The ID of the endpoint. + VpcEndpointId *string `type:"string" required:"true"` + + metadataModifyVpcEndpointInput `json:"-" xml:"-"` +} + +type metadataModifyVpcEndpointInput struct { + SDKShapeTraits bool `type:"structure"` +} + +// String returns the string representation +func (s ModifyVpcEndpointInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s ModifyVpcEndpointInput) GoString() string { + return s.String() +} + +type ModifyVpcEndpointOutput struct { + // Returns true if the request succeeds; otherwise, it returns an error. + Return *bool `locationName:"return" type:"boolean"` + + metadataModifyVpcEndpointOutput `json:"-" xml:"-"` +} + +type metadataModifyVpcEndpointOutput struct { + SDKShapeTraits bool `type:"structure"` +} + +// String returns the string representation +func (s ModifyVpcEndpointOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s ModifyVpcEndpointOutput) GoString() string { + return s.String() +} + type MonitorInstancesInput struct { // Checks whether you have the required permissions for the action, without // actually making the request, and provides an error response. If you have @@ -18934,7 +19078,7 @@ type MonitorInstancesInput struct { DryRun *bool `locationName:"dryRun" type:"boolean"` // One or more instance IDs. - InstanceIDs []*string `locationName:"InstanceId" locationNameList:"InstanceId" type:"list" required:"true"` + InstanceIds []*string `locationName:"InstanceId" locationNameList:"InstanceId" type:"list" required:"true"` metadataMonitorInstancesInput `json:"-" xml:"-"` } @@ -18996,7 +19140,7 @@ func (s Monitoring) GoString() string { return s.String() } -type MoveAddressToVPCInput struct { +type MoveAddressToVpcInput struct { // Checks whether you have the required permissions for the action, without // actually making the request, and provides an error response. If you have // the required permissions, the error response is DryRunOperation. Otherwise, @@ -19004,46 +19148,46 @@ type MoveAddressToVPCInput struct { DryRun *bool `locationName:"dryRun" type:"boolean"` // The Elastic IP address. - PublicIP *string `locationName:"publicIp" type:"string" required:"true"` + PublicIp *string `locationName:"publicIp" type:"string" required:"true"` - metadataMoveAddressToVPCInput `json:"-" xml:"-"` + metadataMoveAddressToVpcInput `json:"-" xml:"-"` } -type metadataMoveAddressToVPCInput struct { +type metadataMoveAddressToVpcInput struct { SDKShapeTraits bool `type:"structure"` } // String returns the string representation -func (s MoveAddressToVPCInput) String() string { +func (s MoveAddressToVpcInput) String() string { return awsutil.Prettify(s) } // GoString returns the string representation -func (s MoveAddressToVPCInput) GoString() string { +func (s MoveAddressToVpcInput) GoString() string { return s.String() } -type MoveAddressToVPCOutput struct { +type MoveAddressToVpcOutput struct { // The allocation ID for the Elastic IP address. - AllocationID *string `locationName:"allocationId" type:"string"` + AllocationId *string `locationName:"allocationId" type:"string"` // The status of the move of the IP address. Status *string `locationName:"status" type:"string" enum:"Status"` - metadataMoveAddressToVPCOutput `json:"-" xml:"-"` + metadataMoveAddressToVpcOutput `json:"-" xml:"-"` } -type metadataMoveAddressToVPCOutput struct { +type metadataMoveAddressToVpcOutput struct { SDKShapeTraits bool `type:"structure"` } // String returns the string representation -func (s MoveAddressToVPCOutput) String() string { +func (s MoveAddressToVpcOutput) String() string { return awsutil.Prettify(s) } // GoString returns the string representation -func (s MoveAddressToVPCOutput) GoString() string { +func (s MoveAddressToVpcOutput) GoString() string { return s.String() } @@ -19054,7 +19198,7 @@ type MovingAddressStatus struct { MoveStatus *string `locationName:"moveStatus" type:"string" enum:"MoveStatus"` // The Elastic IP address. - PublicIP *string `locationName:"publicIp" type:"string"` + PublicIp *string `locationName:"publicIp" type:"string"` metadataMovingAddressStatus `json:"-" xml:"-"` } @@ -19074,81 +19218,81 @@ func (s MovingAddressStatus) GoString() string { } // Describes a network ACL. -type NetworkACL struct { +type NetworkAcl struct { // Any associations between the network ACL and one or more subnets - Associations []*NetworkACLAssociation `locationName:"associationSet" locationNameList:"item" type:"list"` + Associations []*NetworkAclAssociation `locationName:"associationSet" locationNameList:"item" type:"list"` // One or more entries (rules) in the network ACL. - Entries []*NetworkACLEntry `locationName:"entrySet" locationNameList:"item" type:"list"` + Entries []*NetworkAclEntry `locationName:"entrySet" locationNameList:"item" type:"list"` // Indicates whether this is the default network ACL for the VPC. IsDefault *bool `locationName:"default" type:"boolean"` // The ID of the network ACL. - NetworkACLID *string `locationName:"networkAclId" type:"string"` + NetworkAclId *string `locationName:"networkAclId" type:"string"` // Any tags assigned to the network ACL. Tags []*Tag `locationName:"tagSet" locationNameList:"item" type:"list"` // The ID of the VPC for the network ACL. - VPCID *string `locationName:"vpcId" type:"string"` + VpcId *string `locationName:"vpcId" type:"string"` - metadataNetworkACL `json:"-" xml:"-"` + metadataNetworkAcl `json:"-" xml:"-"` } -type metadataNetworkACL struct { +type metadataNetworkAcl struct { SDKShapeTraits bool `type:"structure"` } // String returns the string representation -func (s NetworkACL) String() string { +func (s NetworkAcl) String() string { return awsutil.Prettify(s) } // GoString returns the string representation -func (s NetworkACL) GoString() string { +func (s NetworkAcl) GoString() string { return s.String() } // Describes an association between a network ACL and a subnet. -type NetworkACLAssociation struct { +type NetworkAclAssociation struct { // The ID of the association between a network ACL and a subnet. - NetworkACLAssociationID *string `locationName:"networkAclAssociationId" type:"string"` + NetworkAclAssociationId *string `locationName:"networkAclAssociationId" type:"string"` // The ID of the network ACL. - NetworkACLID *string `locationName:"networkAclId" type:"string"` + NetworkAclId *string `locationName:"networkAclId" type:"string"` // The ID of the subnet. - SubnetID *string `locationName:"subnetId" type:"string"` + SubnetId *string `locationName:"subnetId" type:"string"` - metadataNetworkACLAssociation `json:"-" xml:"-"` + metadataNetworkAclAssociation `json:"-" xml:"-"` } -type metadataNetworkACLAssociation struct { +type metadataNetworkAclAssociation struct { SDKShapeTraits bool `type:"structure"` } // String returns the string representation -func (s NetworkACLAssociation) String() string { +func (s NetworkAclAssociation) String() string { return awsutil.Prettify(s) } // GoString returns the string representation -func (s NetworkACLAssociation) GoString() string { +func (s NetworkAclAssociation) GoString() string { return s.String() } // Describes an entry in a network ACL. -type NetworkACLEntry struct { +type NetworkAclEntry struct { // The network range to allow or deny, in CIDR notation. - CIDRBlock *string `locationName:"cidrBlock" type:"string"` + CidrBlock *string `locationName:"cidrBlock" type:"string"` // Indicates whether the rule is an egress rule (applied to traffic leaving // the subnet). Egress *bool `locationName:"egress" type:"boolean"` // ICMP protocol: The ICMP type and code. - ICMPTypeCode *ICMPTypeCode `locationName:"icmpTypeCode" type:"structure"` + IcmpTypeCode *IcmpTypeCode `locationName:"icmpTypeCode" type:"structure"` // TCP or UDP protocols: The range of ports the rule applies to. PortRange *PortRange `locationName:"portRange" type:"structure"` @@ -19163,20 +19307,20 @@ type NetworkACLEntry struct { // by rule number. RuleNumber *int64 `locationName:"ruleNumber" type:"integer"` - metadataNetworkACLEntry `json:"-" xml:"-"` + metadataNetworkAclEntry `json:"-" xml:"-"` } -type metadataNetworkACLEntry struct { +type metadataNetworkAclEntry struct { SDKShapeTraits bool `type:"structure"` } // String returns the string representation -func (s NetworkACLEntry) String() string { +func (s NetworkAclEntry) String() string { return awsutil.Prettify(s) } // GoString returns the string representation -func (s NetworkACLEntry) GoString() string { +func (s NetworkAclEntry) GoString() string { return s.String() } @@ -19199,26 +19343,26 @@ type NetworkInterface struct { Groups []*GroupIdentifier `locationName:"groupSet" locationNameList:"item" type:"list"` // The MAC address. - MACAddress *string `locationName:"macAddress" type:"string"` + MacAddress *string `locationName:"macAddress" type:"string"` // The ID of the network interface. - NetworkInterfaceID *string `locationName:"networkInterfaceId" type:"string"` + NetworkInterfaceId *string `locationName:"networkInterfaceId" type:"string"` // The AWS account ID of the owner of the network interface. - OwnerID *string `locationName:"ownerId" type:"string"` + OwnerId *string `locationName:"ownerId" type:"string"` // The private DNS name. - PrivateDNSName *string `locationName:"privateDnsName" type:"string"` + PrivateDnsName *string `locationName:"privateDnsName" type:"string"` // The IP address of the network interface within the subnet. - PrivateIPAddress *string `locationName:"privateIpAddress" type:"string"` + PrivateIpAddress *string `locationName:"privateIpAddress" type:"string"` // The private IP addresses associated with the network interface. - PrivateIPAddresses []*NetworkInterfacePrivateIPAddress `locationName:"privateIpAddressesSet" locationNameList:"item" type:"list"` + PrivateIpAddresses []*NetworkInterfacePrivateIpAddress `locationName:"privateIpAddressesSet" locationNameList:"item" type:"list"` // The ID of the entity that launched the instance on your behalf (for example, // AWS Management Console or Auto Scaling). - RequesterID *string `locationName:"requesterId" type:"string"` + RequesterId *string `locationName:"requesterId" type:"string"` // Indicates whether the network interface is being managed by AWS. RequesterManaged *bool `locationName:"requesterManaged" type:"boolean"` @@ -19230,13 +19374,13 @@ type NetworkInterface struct { Status *string `locationName:"status" type:"string" enum:"NetworkInterfaceStatus"` // The ID of the subnet. - SubnetID *string `locationName:"subnetId" type:"string"` + SubnetId *string `locationName:"subnetId" type:"string"` // Any tags assigned to the network interface. TagSet []*Tag `locationName:"tagSet" locationNameList:"item" type:"list"` // The ID of the VPC. - VPCID *string `locationName:"vpcId" type:"string"` + VpcId *string `locationName:"vpcId" type:"string"` metadataNetworkInterface `json:"-" xml:"-"` } @@ -19258,19 +19402,19 @@ func (s NetworkInterface) GoString() string { // Describes association information for an Elastic IP address. type NetworkInterfaceAssociation struct { // The allocation ID. - AllocationID *string `locationName:"allocationId" type:"string"` + AllocationId *string `locationName:"allocationId" type:"string"` // The association ID. - AssociationID *string `locationName:"associationId" type:"string"` + AssociationId *string `locationName:"associationId" type:"string"` // The ID of the Elastic IP address owner. - IPOwnerID *string `locationName:"ipOwnerId" type:"string"` + IpOwnerId *string `locationName:"ipOwnerId" type:"string"` // The public DNS name. - PublicDNSName *string `locationName:"publicDnsName" type:"string"` + PublicDnsName *string `locationName:"publicDnsName" type:"string"` // The address of the Elastic IP address bound to the network interface. - PublicIP *string `locationName:"publicIp" type:"string"` + PublicIp *string `locationName:"publicIp" type:"string"` metadataNetworkInterfaceAssociation `json:"-" xml:"-"` } @@ -19295,7 +19439,7 @@ type NetworkInterfaceAttachment struct { AttachTime *time.Time `locationName:"attachTime" type:"timestamp" timestampFormat:"iso8601"` // The ID of the network interface attachment. - AttachmentID *string `locationName:"attachmentId" type:"string"` + AttachmentId *string `locationName:"attachmentId" type:"string"` // Indicates whether the network interface is deleted when the instance is terminated. DeleteOnTermination *bool `locationName:"deleteOnTermination" type:"boolean"` @@ -19304,10 +19448,10 @@ type NetworkInterfaceAttachment struct { DeviceIndex *int64 `locationName:"deviceIndex" type:"integer"` // The ID of the instance. - InstanceID *string `locationName:"instanceId" type:"string"` + InstanceId *string `locationName:"instanceId" type:"string"` // The AWS account ID of the owner of the instance. - InstanceOwnerID *string `locationName:"instanceOwnerId" type:"string"` + InstanceOwnerId *string `locationName:"instanceOwnerId" type:"string"` // The attachment state. Status *string `locationName:"status" type:"string" enum:"AttachmentStatus"` @@ -19332,7 +19476,7 @@ func (s NetworkInterfaceAttachment) GoString() string { // Describes an attachment change. type NetworkInterfaceAttachmentChanges struct { // The ID of the network interface attachment. - AttachmentID *string `locationName:"attachmentId" type:"string"` + AttachmentId *string `locationName:"attachmentId" type:"string"` // Indicates whether the network interface is deleted when the instance is terminated. DeleteOnTermination *bool `locationName:"deleteOnTermination" type:"boolean"` @@ -19355,7 +19499,7 @@ func (s NetworkInterfaceAttachmentChanges) GoString() string { } // Describes the private IP address of a network interface. -type NetworkInterfacePrivateIPAddress struct { +type NetworkInterfacePrivateIpAddress struct { // The association information for an Elastic IP address associated with the // network interface. Association *NetworkInterfaceAssociation `locationName:"association" type:"structure"` @@ -19365,47 +19509,47 @@ type NetworkInterfacePrivateIPAddress struct { Primary *bool `locationName:"primary" type:"boolean"` // The private DNS name. - PrivateDNSName *string `locationName:"privateDnsName" type:"string"` + PrivateDnsName *string `locationName:"privateDnsName" type:"string"` // The private IP address. - PrivateIPAddress *string `locationName:"privateIpAddress" type:"string"` + PrivateIpAddress *string `locationName:"privateIpAddress" type:"string"` - metadataNetworkInterfacePrivateIPAddress `json:"-" xml:"-"` + metadataNetworkInterfacePrivateIpAddress `json:"-" xml:"-"` } -type metadataNetworkInterfacePrivateIPAddress struct { +type metadataNetworkInterfacePrivateIpAddress struct { SDKShapeTraits bool `type:"structure"` } // String returns the string representation -func (s NetworkInterfacePrivateIPAddress) String() string { +func (s NetworkInterfacePrivateIpAddress) String() string { return awsutil.Prettify(s) } // GoString returns the string representation -func (s NetworkInterfacePrivateIPAddress) GoString() string { +func (s NetworkInterfacePrivateIpAddress) GoString() string { return s.String() } -type NewDHCPConfiguration struct { +type NewDhcpConfiguration struct { Key *string `locationName:"key" type:"string"` Values []*string `locationName:"Value" locationNameList:"item" type:"list"` - metadataNewDHCPConfiguration `json:"-" xml:"-"` + metadataNewDhcpConfiguration `json:"-" xml:"-"` } -type metadataNewDHCPConfiguration struct { +type metadataNewDhcpConfiguration struct { SDKShapeTraits bool `type:"structure"` } // String returns the string representation -func (s NewDHCPConfiguration) String() string { +func (s NewDhcpConfiguration) String() string { return awsutil.Prettify(s) } // GoString returns the string representation -func (s NewDHCPConfiguration) GoString() string { +func (s NewDhcpConfiguration) GoString() string { return s.String() } @@ -19494,10 +19638,10 @@ func (s PortRange) GoString() string { // Describes prefixes for AWS services. type PrefixList struct { // The IP address range of the AWS service. - CIDRs []*string `locationName:"cidrSet" locationNameList:"item" type:"list"` + Cidrs []*string `locationName:"cidrSet" locationNameList:"item" type:"list"` // The ID of the prefix. - PrefixListID *string `locationName:"prefixListId" type:"string"` + PrefixListId *string `locationName:"prefixListId" type:"string"` // The name of the prefix. PrefixListName *string `locationName:"prefixListName" type:"string"` @@ -19520,24 +19664,24 @@ func (s PrefixList) GoString() string { } // The ID of the prefix. -type PrefixListID struct { +type PrefixListId struct { // The ID of the prefix. - PrefixListID *string `locationName:"prefixListId" type:"string"` + PrefixListId *string `locationName:"prefixListId" type:"string"` - metadataPrefixListID `json:"-" xml:"-"` + metadataPrefixListId `json:"-" xml:"-"` } -type metadataPrefixListID struct { +type metadataPrefixListId struct { SDKShapeTraits bool `type:"structure"` } // String returns the string representation -func (s PrefixListID) String() string { +func (s PrefixListId) String() string { return awsutil.Prettify(s) } // GoString returns the string representation -func (s PrefixListID) GoString() string { +func (s PrefixListId) GoString() string { return s.String() } @@ -19639,35 +19783,35 @@ func (s PricingDetail) GoString() string { } // Describes a secondary private IP address for a network interface. -type PrivateIPAddressSpecification struct { +type PrivateIpAddressSpecification struct { // Indicates whether the private IP address is the primary private IP address. // Only one IP address can be designated as primary. Primary *bool `locationName:"primary" type:"boolean"` // The private IP addresses. - PrivateIPAddress *string `locationName:"privateIpAddress" type:"string" required:"true"` + PrivateIpAddress *string `locationName:"privateIpAddress" type:"string" required:"true"` - metadataPrivateIPAddressSpecification `json:"-" xml:"-"` + metadataPrivateIpAddressSpecification `json:"-" xml:"-"` } -type metadataPrivateIPAddressSpecification struct { +type metadataPrivateIpAddressSpecification struct { SDKShapeTraits bool `type:"structure"` } // String returns the string representation -func (s PrivateIPAddressSpecification) String() string { +func (s PrivateIpAddressSpecification) String() string { return awsutil.Prettify(s) } // GoString returns the string representation -func (s PrivateIPAddressSpecification) GoString() string { +func (s PrivateIpAddressSpecification) GoString() string { return s.String() } // Describes a product code. type ProductCode struct { // The product code. - ProductCodeID *string `locationName:"productCode" type:"string"` + ProductCodeId *string `locationName:"productCode" type:"string"` // The type of product code. ProductCodeType *string `locationName:"type" type:"string" enum:"ProductCodeValues"` @@ -19690,24 +19834,24 @@ func (s ProductCode) GoString() string { } // Describes a virtual private gateway propagating route. -type PropagatingVGW struct { +type PropagatingVgw struct { // The ID of the virtual private gateway (VGW). - GatewayID *string `locationName:"gatewayId" type:"string"` + GatewayId *string `locationName:"gatewayId" type:"string"` - metadataPropagatingVGW `json:"-" xml:"-"` + metadataPropagatingVgw `json:"-" xml:"-"` } -type metadataPropagatingVGW struct { +type metadataPropagatingVgw struct { SDKShapeTraits bool `type:"structure"` } // String returns the string representation -func (s PropagatingVGW) String() string { +func (s PropagatingVgw) String() string { return awsutil.Prettify(s) } // GoString returns the string representation -func (s PropagatingVGW) GoString() string { +func (s PropagatingVgw) GoString() string { return s.String() } @@ -19727,7 +19871,7 @@ type PurchaseReservedInstancesOfferingInput struct { LimitPrice *ReservedInstanceLimitPrice `locationName:"limitPrice" type:"structure"` // The ID of the Reserved Instance offering to purchase. - ReservedInstancesOfferingID *string `locationName:"ReservedInstancesOfferingId" type:"string" required:"true"` + ReservedInstancesOfferingId *string `type:"string" required:"true"` metadataPurchaseReservedInstancesOfferingInput `json:"-" xml:"-"` } @@ -19748,7 +19892,7 @@ func (s PurchaseReservedInstancesOfferingInput) GoString() string { type PurchaseReservedInstancesOfferingOutput struct { // The IDs of the purchased Reserved Instances. - ReservedInstancesID *string `locationName:"reservedInstancesId" type:"string"` + ReservedInstancesId *string `locationName:"reservedInstancesId" type:"string"` metadataPurchaseReservedInstancesOfferingOutput `json:"-" xml:"-"` } @@ -19775,7 +19919,7 @@ type RebootInstancesInput struct { DryRun *bool `locationName:"dryRun" type:"boolean"` // One or more instance IDs. - InstanceIDs []*string `locationName:"InstanceId" locationNameList:"InstanceId" type:"list" required:"true"` + InstanceIds []*string `locationName:"InstanceId" locationNameList:"InstanceId" type:"list" required:"true"` metadataRebootInstancesInput `json:"-" xml:"-"` } @@ -19885,7 +20029,7 @@ type RegisterImageInput struct { ImageLocation *string `type:"string"` // The ID of the kernel. - KernelID *string `locationName:"kernelId" type:"string"` + KernelId *string `locationName:"kernelId" type:"string"` // A name for your AMI. // @@ -19895,7 +20039,7 @@ type RegisterImageInput struct { Name *string `locationName:"name" type:"string" required:"true"` // The ID of the RAM disk. - RAMDiskID *string `locationName:"ramdiskId" type:"string"` + RamdiskId *string `locationName:"ramdiskId" type:"string"` // The name of the root device (for example, /dev/sda1, or /dev/xvda). RootDeviceName *string `locationName:"rootDeviceName" type:"string"` @@ -19907,7 +20051,7 @@ type RegisterImageInput struct { // // This option is supported only for HVM AMIs. Specifying this option with // a PV AMI can make instances launched from the AMI unreachable. - SRIOVNetSupport *string `locationName:"sriovNetSupport" type:"string"` + SriovNetSupport *string `locationName:"sriovNetSupport" type:"string"` // The type of virtualization. // @@ -19933,7 +20077,7 @@ func (s RegisterImageInput) GoString() string { type RegisterImageOutput struct { // The ID of the newly registered AMI. - ImageID *string `locationName:"imageId" type:"string"` + ImageId *string `locationName:"imageId" type:"string"` metadataRegisterImageOutput `json:"-" xml:"-"` } @@ -19952,7 +20096,7 @@ func (s RegisterImageOutput) GoString() string { return s.String() } -type RejectVPCPeeringConnectionInput struct { +type RejectVpcPeeringConnectionInput struct { // Checks whether you have the required permissions for the action, without // actually making the request, and provides an error response. If you have // the required permissions, the error response is DryRunOperation. Otherwise, @@ -19960,49 +20104,49 @@ type RejectVPCPeeringConnectionInput struct { DryRun *bool `locationName:"dryRun" type:"boolean"` // The ID of the VPC peering connection. - VPCPeeringConnectionID *string `locationName:"vpcPeeringConnectionId" type:"string" required:"true"` + VpcPeeringConnectionId *string `locationName:"vpcPeeringConnectionId" type:"string" required:"true"` - metadataRejectVPCPeeringConnectionInput `json:"-" xml:"-"` + metadataRejectVpcPeeringConnectionInput `json:"-" xml:"-"` } -type metadataRejectVPCPeeringConnectionInput struct { +type metadataRejectVpcPeeringConnectionInput struct { SDKShapeTraits bool `type:"structure"` } // String returns the string representation -func (s RejectVPCPeeringConnectionInput) String() string { +func (s RejectVpcPeeringConnectionInput) String() string { return awsutil.Prettify(s) } // GoString returns the string representation -func (s RejectVPCPeeringConnectionInput) GoString() string { +func (s RejectVpcPeeringConnectionInput) GoString() string { return s.String() } -type RejectVPCPeeringConnectionOutput struct { +type RejectVpcPeeringConnectionOutput struct { // Returns true if the request succeeds; otherwise, it returns an error. Return *bool `locationName:"return" type:"boolean"` - metadataRejectVPCPeeringConnectionOutput `json:"-" xml:"-"` + metadataRejectVpcPeeringConnectionOutput `json:"-" xml:"-"` } -type metadataRejectVPCPeeringConnectionOutput struct { +type metadataRejectVpcPeeringConnectionOutput struct { SDKShapeTraits bool `type:"structure"` } // String returns the string representation -func (s RejectVPCPeeringConnectionOutput) String() string { +func (s RejectVpcPeeringConnectionOutput) String() string { return awsutil.Prettify(s) } // GoString returns the string representation -func (s RejectVPCPeeringConnectionOutput) GoString() string { +func (s RejectVpcPeeringConnectionOutput) GoString() string { return s.String() } type ReleaseAddressInput struct { // [EC2-VPC] The allocation ID. Required for EC2-VPC. - AllocationID *string `locationName:"AllocationId" type:"string"` + AllocationId *string `type:"string"` // Checks whether you have the required permissions for the action, without // actually making the request, and provides an error response. If you have @@ -20011,7 +20155,7 @@ type ReleaseAddressInput struct { DryRun *bool `locationName:"dryRun" type:"boolean"` // [EC2-Classic] The Elastic IP address. Required for EC2-Classic. - PublicIP *string `locationName:"PublicIp" type:"string"` + PublicIp *string `type:"string"` metadataReleaseAddressInput `json:"-" xml:"-"` } @@ -20048,10 +20192,10 @@ func (s ReleaseAddressOutput) GoString() string { return s.String() } -type ReplaceNetworkACLAssociationInput struct { +type ReplaceNetworkAclAssociationInput struct { // The ID of the current association between the original network ACL and the // subnet. - AssociationID *string `locationName:"associationId" type:"string" required:"true"` + AssociationId *string `locationName:"associationId" type:"string" required:"true"` // Checks whether you have the required permissions for the action, without // actually making the request, and provides an error response. If you have @@ -20060,49 +20204,49 @@ type ReplaceNetworkACLAssociationInput struct { DryRun *bool `locationName:"dryRun" type:"boolean"` // The ID of the new network ACL to associate with the subnet. - NetworkACLID *string `locationName:"networkAclId" type:"string" required:"true"` + NetworkAclId *string `locationName:"networkAclId" type:"string" required:"true"` - metadataReplaceNetworkACLAssociationInput `json:"-" xml:"-"` + metadataReplaceNetworkAclAssociationInput `json:"-" xml:"-"` } -type metadataReplaceNetworkACLAssociationInput struct { +type metadataReplaceNetworkAclAssociationInput struct { SDKShapeTraits bool `type:"structure"` } // String returns the string representation -func (s ReplaceNetworkACLAssociationInput) String() string { +func (s ReplaceNetworkAclAssociationInput) String() string { return awsutil.Prettify(s) } // GoString returns the string representation -func (s ReplaceNetworkACLAssociationInput) GoString() string { +func (s ReplaceNetworkAclAssociationInput) GoString() string { return s.String() } -type ReplaceNetworkACLAssociationOutput struct { +type ReplaceNetworkAclAssociationOutput struct { // The ID of the new association. - NewAssociationID *string `locationName:"newAssociationId" type:"string"` + NewAssociationId *string `locationName:"newAssociationId" type:"string"` - metadataReplaceNetworkACLAssociationOutput `json:"-" xml:"-"` + metadataReplaceNetworkAclAssociationOutput `json:"-" xml:"-"` } -type metadataReplaceNetworkACLAssociationOutput struct { +type metadataReplaceNetworkAclAssociationOutput struct { SDKShapeTraits bool `type:"structure"` } // String returns the string representation -func (s ReplaceNetworkACLAssociationOutput) String() string { +func (s ReplaceNetworkAclAssociationOutput) String() string { return awsutil.Prettify(s) } // GoString returns the string representation -func (s ReplaceNetworkACLAssociationOutput) GoString() string { +func (s ReplaceNetworkAclAssociationOutput) GoString() string { return s.String() } -type ReplaceNetworkACLEntryInput struct { +type ReplaceNetworkAclEntryInput struct { // The network range to allow or deny, in CIDR notation. - CIDRBlock *string `locationName:"cidrBlock" type:"string" required:"true"` + CidrBlock *string `locationName:"cidrBlock" type:"string" required:"true"` // Checks whether you have the required permissions for the action, without // actually making the request, and provides an error response. If you have @@ -20117,10 +20261,10 @@ type ReplaceNetworkACLEntryInput struct { // ICMP protocol: The ICMP type and code. Required if specifying 1 (ICMP) for // the protocol. - ICMPTypeCode *ICMPTypeCode `locationName:"Icmp" type:"structure"` + IcmpTypeCode *IcmpTypeCode `locationName:"Icmp" type:"structure"` // The ID of the ACL. - NetworkACLID *string `locationName:"networkAclId" type:"string" required:"true"` + NetworkAclId *string `locationName:"networkAclId" type:"string" required:"true"` // TCP or UDP protocols: The range of ports the rule applies to. Required if // specifying 6 (TCP) or 17 (UDP) for the protocol. @@ -20135,45 +20279,45 @@ type ReplaceNetworkACLEntryInput struct { // The rule number of the entry to replace. RuleNumber *int64 `locationName:"ruleNumber" type:"integer" required:"true"` - metadataReplaceNetworkACLEntryInput `json:"-" xml:"-"` + metadataReplaceNetworkAclEntryInput `json:"-" xml:"-"` } -type metadataReplaceNetworkACLEntryInput struct { +type metadataReplaceNetworkAclEntryInput struct { SDKShapeTraits bool `type:"structure"` } // String returns the string representation -func (s ReplaceNetworkACLEntryInput) String() string { +func (s ReplaceNetworkAclEntryInput) String() string { return awsutil.Prettify(s) } // GoString returns the string representation -func (s ReplaceNetworkACLEntryInput) GoString() string { +func (s ReplaceNetworkAclEntryInput) GoString() string { return s.String() } -type ReplaceNetworkACLEntryOutput struct { - metadataReplaceNetworkACLEntryOutput `json:"-" xml:"-"` +type ReplaceNetworkAclEntryOutput struct { + metadataReplaceNetworkAclEntryOutput `json:"-" xml:"-"` } -type metadataReplaceNetworkACLEntryOutput struct { +type metadataReplaceNetworkAclEntryOutput struct { SDKShapeTraits bool `type:"structure"` } // String returns the string representation -func (s ReplaceNetworkACLEntryOutput) String() string { +func (s ReplaceNetworkAclEntryOutput) String() string { return awsutil.Prettify(s) } // GoString returns the string representation -func (s ReplaceNetworkACLEntryOutput) GoString() string { +func (s ReplaceNetworkAclEntryOutput) GoString() string { return s.String() } type ReplaceRouteInput struct { // The CIDR address block used for the destination match. The value you provide // must match the CIDR of an existing route in the table. - DestinationCIDRBlock *string `locationName:"destinationCidrBlock" type:"string" required:"true"` + DestinationCidrBlock *string `locationName:"destinationCidrBlock" type:"string" required:"true"` // Checks whether you have the required permissions for the action, without // actually making the request, and provides an error response. If you have @@ -20182,19 +20326,19 @@ type ReplaceRouteInput struct { DryRun *bool `locationName:"dryRun" type:"boolean"` // The ID of an Internet gateway or virtual private gateway. - GatewayID *string `locationName:"gatewayId" type:"string"` + GatewayId *string `locationName:"gatewayId" type:"string"` // The ID of a NAT instance in your VPC. - InstanceID *string `locationName:"instanceId" type:"string"` + InstanceId *string `locationName:"instanceId" type:"string"` // The ID of a network interface. - NetworkInterfaceID *string `locationName:"networkInterfaceId" type:"string"` + NetworkInterfaceId *string `locationName:"networkInterfaceId" type:"string"` // The ID of the route table. - RouteTableID *string `locationName:"routeTableId" type:"string" required:"true"` + RouteTableId *string `locationName:"routeTableId" type:"string" required:"true"` // The ID of a VPC peering connection. - VPCPeeringConnectionID *string `locationName:"vpcPeeringConnectionId" type:"string"` + VpcPeeringConnectionId *string `locationName:"vpcPeeringConnectionId" type:"string"` metadataReplaceRouteInput `json:"-" xml:"-"` } @@ -20233,7 +20377,7 @@ func (s ReplaceRouteOutput) GoString() string { type ReplaceRouteTableAssociationInput struct { // The association ID. - AssociationID *string `locationName:"associationId" type:"string" required:"true"` + AssociationId *string `locationName:"associationId" type:"string" required:"true"` // Checks whether you have the required permissions for the action, without // actually making the request, and provides an error response. If you have @@ -20242,7 +20386,7 @@ type ReplaceRouteTableAssociationInput struct { DryRun *bool `locationName:"dryRun" type:"boolean"` // The ID of the new route table to associate with the subnet. - RouteTableID *string `locationName:"routeTableId" type:"string" required:"true"` + RouteTableId *string `locationName:"routeTableId" type:"string" required:"true"` metadataReplaceRouteTableAssociationInput `json:"-" xml:"-"` } @@ -20263,7 +20407,7 @@ func (s ReplaceRouteTableAssociationInput) GoString() string { type ReplaceRouteTableAssociationOutput struct { // The ID of the new association. - NewAssociationID *string `locationName:"newAssociationId" type:"string"` + NewAssociationId *string `locationName:"newAssociationId" type:"string"` metadataReplaceRouteTableAssociationOutput `json:"-" xml:"-"` } @@ -20394,7 +20538,7 @@ func (s RequestSpotFleetInput) GoString() string { // Contains the output of RequestSpotFleet. type RequestSpotFleetOutput struct { // The ID of the Spot fleet request. - SpotFleetRequestID *string `locationName:"spotFleetRequestId" type:"string" required:"true"` + SpotFleetRequestId *string `locationName:"spotFleetRequestId" type:"string" required:"true"` metadataRequestSpotFleetOutput `json:"-" xml:"-"` } @@ -20418,24 +20562,36 @@ type RequestSpotInstancesInput struct { // The user-specified name for a logical grouping of bids. // // When you specify an Availability Zone group in a Spot Instance request, - // all Spot Instances in the request are launched in the same Availability Zone. + // all Spot instances in the request are launched in the same Availability Zone. // Instance proximity is maintained with this parameter, but the choice of Availability // Zone is not. The group applies only to bids for Spot Instances of the same - // instance type. Any additional Spot Instance requests that are specified with + // instance type. Any additional Spot instance requests that are specified with // the same Availability Zone group name are launched in that same Availability // Zone, as long as at least one instance from the group is still active. // // If there is no active instance running in the Availability Zone group that - // you specify for a new Spot Instance request (all instances are terminated, + // you specify for a new Spot instance request (all instances are terminated, // the bid is expired, or the bid falls below current market), then Amazon EC2 // launches the instance in any Availability Zone where the constraint can be - // met. Consequently, the subsequent set of Spot Instances could be placed in + // met. Consequently, the subsequent set of Spot instances could be placed in // a different zone from the original request, even if you specified the same // Availability Zone group. // // Default: Instances are launched in any available Availability Zone. AvailabilityZoneGroup *string `locationName:"availabilityZoneGroup" type:"string"` + // The required duration for the Spot instances, in minutes. This value must + // be a multiple of 60 (60, 120, 180, 240, 300, or 360). + // + // The duration period starts as soon as your Spot instance receives its instance + // ID. At the end of the duration period, Amazon EC2 marks the Spot instance + // for termination and provides a Spot instance termination notice, which gives + // the instance a two-minute warning before it terminates. + // + // Note that you can't specify an Availability Zone group or a launch group + // if you specify a required duration. + BlockDurationMinutes *int64 `locationName:"blockDurationMinutes" type:"integer"` + // Unique, case-sensitive identifier that you provide to ensure the idempotency // of the request. For more information, see How to Ensure Idempotency (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Run_Instance_Idempotency.html) // in the Amazon Elastic Compute Cloud User Guide. @@ -20447,12 +20603,12 @@ type RequestSpotInstancesInput struct { // it is UnauthorizedOperation. DryRun *bool `locationName:"dryRun" type:"boolean"` - // The maximum number of Spot Instances to launch. + // The maximum number of Spot instances to launch. // // Default: 1 InstanceCount *int64 `locationName:"instanceCount" type:"integer"` - // The instance launch group. Launch groups are Spot Instances that launch together + // The instance launch group. Launch groups are Spot instances that launch together // and terminate together. // // Default: Instances are launched and terminated individually @@ -20461,11 +20617,11 @@ type RequestSpotInstancesInput struct { // Describes the launch specification for an instance. LaunchSpecification *RequestSpotLaunchSpecification `type:"structure"` - // The maximum hourly price (bid) for any Spot Instance launched to fulfill + // The maximum hourly price (bid) for any Spot instance launched to fulfill // the request. SpotPrice *string `locationName:"spotPrice" type:"string" required:"true"` - // The Spot Instance request type. + // The Spot instance request type. // // Default: one-time Type *string `locationName:"type" type:"string" enum:"SpotInstanceType"` @@ -20506,7 +20662,7 @@ func (s RequestSpotInstancesInput) GoString() string { // Contains the output of RequestSpotInstances. type RequestSpotInstancesOutput struct { - // One or more Spot Instance requests. + // One or more Spot instance requests. SpotInstanceRequests []*SpotInstanceRequest `locationName:"spotInstanceRequestSet" locationNameList:"item" type:"list"` metadataRequestSpotInstancesOutput `json:"-" xml:"-"` @@ -20541,19 +20697,19 @@ type RequestSpotLaunchSpecification struct { // Optimized instance. // // Default: false - EBSOptimized *bool `locationName:"ebsOptimized" type:"boolean"` + EbsOptimized *bool `locationName:"ebsOptimized" type:"boolean"` // The IAM instance profile. - IAMInstanceProfile *IAMInstanceProfileSpecification `locationName:"iamInstanceProfile" type:"structure"` + IamInstanceProfile *IamInstanceProfileSpecification `locationName:"iamInstanceProfile" type:"structure"` // The ID of the AMI. - ImageID *string `locationName:"imageId" type:"string"` + ImageId *string `locationName:"imageId" type:"string"` // The instance type. InstanceType *string `locationName:"instanceType" type:"string" enum:"InstanceType"` // The ID of the kernel. - KernelID *string `locationName:"kernelId" type:"string"` + KernelId *string `locationName:"kernelId" type:"string"` // The name of the key pair. KeyName *string `locationName:"keyName" type:"string"` @@ -20568,14 +20724,14 @@ type RequestSpotLaunchSpecification struct { Placement *SpotPlacement `locationName:"placement" type:"structure"` // The ID of the RAM disk. - RAMDiskID *string `locationName:"ramdiskId" type:"string"` + RamdiskId *string `locationName:"ramdiskId" type:"string"` - SecurityGroupIDs []*string `locationName:"SecurityGroupId" locationNameList:"item" type:"list"` + SecurityGroupIds []*string `locationName:"SecurityGroupId" locationNameList:"item" type:"list"` SecurityGroups []*string `locationName:"SecurityGroup" locationNameList:"item" type:"list"` // The ID of the subnet in which to launch the instance. - SubnetID *string `locationName:"subnetId" type:"string"` + SubnetId *string `locationName:"subnetId" type:"string"` // The Base64-encoded MIME user data to make available to the instances. UserData *string `locationName:"userData" type:"string"` @@ -20606,14 +20762,14 @@ type Reservation struct { Instances []*Instance `locationName:"instancesSet" locationNameList:"item" type:"list"` // The ID of the AWS account that owns the reservation. - OwnerID *string `locationName:"ownerId" type:"string"` + OwnerId *string `locationName:"ownerId" type:"string"` // The ID of the requester that launched the instances on your behalf (for example, // AWS Management Console or Auto Scaling). - RequesterID *string `locationName:"requesterId" type:"string"` + RequesterId *string `locationName:"requesterId" type:"string"` // The ID of the reservation. - ReservationID *string `locationName:"reservationId" type:"string"` + ReservationId *string `locationName:"reservationId" type:"string"` metadataReservation `json:"-" xml:"-"` } @@ -20696,7 +20852,7 @@ type ReservedInstances struct { RecurringCharges []*RecurringCharge `locationName:"recurringCharges" locationNameList:"item" type:"list"` // The ID of the Reserved Instance. - ReservedInstancesID *string `locationName:"reservedInstancesId" type:"string"` + ReservedInstancesId *string `locationName:"reservedInstancesId" type:"string"` // The date and time the Reserved Instance started. Start *time.Time `locationName:"start" type:"timestamp" timestampFormat:"iso8601"` @@ -20760,24 +20916,24 @@ func (s ReservedInstancesConfiguration) GoString() string { } // Describes the ID of a Reserved Instance. -type ReservedInstancesID struct { +type ReservedInstancesId struct { // The ID of the Reserved Instance. - ReservedInstancesID *string `locationName:"reservedInstancesId" type:"string"` + ReservedInstancesId *string `locationName:"reservedInstancesId" type:"string"` - metadataReservedInstancesID `json:"-" xml:"-"` + metadataReservedInstancesId `json:"-" xml:"-"` } -type metadataReservedInstancesID struct { +type metadataReservedInstancesId struct { SDKShapeTraits bool `type:"structure"` } // String returns the string representation -func (s ReservedInstancesID) String() string { +func (s ReservedInstancesId) String() string { return awsutil.Prettify(s) } // GoString returns the string representation -func (s ReservedInstancesID) GoString() string { +func (s ReservedInstancesId) GoString() string { return s.String() } @@ -20797,10 +20953,10 @@ type ReservedInstancesListing struct { PriceSchedules []*PriceSchedule `locationName:"priceSchedules" locationNameList:"item" type:"list"` // The ID of the Reserved Instance. - ReservedInstancesID *string `locationName:"reservedInstancesId" type:"string"` + ReservedInstancesId *string `locationName:"reservedInstancesId" type:"string"` // The ID of the Reserved Instance listing. - ReservedInstancesListingID *string `locationName:"reservedInstancesListingId" type:"string"` + ReservedInstancesListingId *string `locationName:"reservedInstancesListingId" type:"string"` // The status of the Reserved Instance listing. Status *string `locationName:"status" type:"string" enum:"ListingStatus"` @@ -20849,10 +21005,10 @@ type ReservedInstancesModification struct { ModificationResults []*ReservedInstancesModificationResult `locationName:"modificationResultSet" locationNameList:"item" type:"list"` // The IDs of one or more Reserved Instances. - ReservedInstancesIDs []*ReservedInstancesID `locationName:"reservedInstancesSet" locationNameList:"item" type:"list"` + ReservedInstancesIds []*ReservedInstancesId `locationName:"reservedInstancesSet" locationNameList:"item" type:"list"` // A unique ID for the Reserved Instance modification. - ReservedInstancesModificationID *string `locationName:"reservedInstancesModificationId" type:"string"` + ReservedInstancesModificationId *string `locationName:"reservedInstancesModificationId" type:"string"` // The status of the Reserved Instances modification request. Status *string `locationName:"status" type:"string"` @@ -20883,7 +21039,7 @@ func (s ReservedInstancesModification) GoString() string { type ReservedInstancesModificationResult struct { // The ID for the Reserved Instances that were created as part of the modification // request. This field is only available when the modification is fulfilled. - ReservedInstancesID *string `locationName:"reservedInstancesId" type:"string"` + ReservedInstancesId *string `locationName:"reservedInstancesId" type:"string"` // The target Reserved Instances configurations supplied as part of the modification // request. @@ -20946,7 +21102,7 @@ type ReservedInstancesOffering struct { RecurringCharges []*RecurringCharge `locationName:"recurringCharges" locationNameList:"item" type:"list"` // The ID of the Reserved Instance offering. - ReservedInstancesOfferingID *string `locationName:"reservedInstancesOfferingId" type:"string"` + ReservedInstancesOfferingId *string `locationName:"reservedInstancesOfferingId" type:"string"` // The usage price of the Reserved Instance, per hour. UsagePrice *float64 `locationName:"usagePrice" type:"float"` @@ -20980,7 +21136,7 @@ type ResetImageAttributeInput struct { DryRun *bool `locationName:"dryRun" type:"boolean"` // The ID of the AMI. - ImageID *string `locationName:"ImageId" type:"string" required:"true"` + ImageId *string `type:"string" required:"true"` metadataResetImageAttributeInput `json:"-" xml:"-"` } @@ -21028,7 +21184,7 @@ type ResetInstanceAttributeInput struct { DryRun *bool `locationName:"dryRun" type:"boolean"` // The ID of the instance. - InstanceID *string `locationName:"instanceId" type:"string" required:"true"` + InstanceId *string `locationName:"instanceId" type:"string" required:"true"` metadataResetInstanceAttributeInput `json:"-" xml:"-"` } @@ -21073,7 +21229,7 @@ type ResetNetworkInterfaceAttributeInput struct { DryRun *bool `locationName:"dryRun" type:"boolean"` // The ID of the network interface. - NetworkInterfaceID *string `locationName:"networkInterfaceId" type:"string" required:"true"` + NetworkInterfaceId *string `locationName:"networkInterfaceId" type:"string" required:"true"` // The source/destination checking attribute. Resets the value to true. SourceDestCheck *string `locationName:"sourceDestCheck" type:"string"` @@ -21125,7 +21281,7 @@ type ResetSnapshotAttributeInput struct { DryRun *bool `locationName:"dryRun" type:"boolean"` // The ID of the snapshot. - SnapshotID *string `locationName:"SnapshotId" type:"string" required:"true"` + SnapshotId *string `type:"string" required:"true"` metadataResetSnapshotAttributeInput `json:"-" xml:"-"` } @@ -21170,7 +21326,7 @@ type RestoreAddressToClassicInput struct { DryRun *bool `locationName:"dryRun" type:"boolean"` // The Elastic IP address. - PublicIP *string `locationName:"publicIp" type:"string" required:"true"` + PublicIp *string `locationName:"publicIp" type:"string" required:"true"` metadataRestoreAddressToClassicInput `json:"-" xml:"-"` } @@ -21191,7 +21347,7 @@ func (s RestoreAddressToClassicInput) GoString() string { type RestoreAddressToClassicOutput struct { // The Elastic IP address. - PublicIP *string `locationName:"publicIp" type:"string"` + PublicIp *string `locationName:"publicIp" type:"string"` // The move status for the IP address. Status *string `locationName:"status" type:"string" enum:"Status"` @@ -21216,7 +21372,7 @@ func (s RestoreAddressToClassicOutput) GoString() string { type RevokeSecurityGroupEgressInput struct { // The CIDR IP address range. You can't specify this parameter when specifying // a source security group. - CIDRIP *string `locationName:"cidrIp" type:"string"` + CidrIp *string `locationName:"cidrIp" type:"string"` // Checks whether you have the required permissions for the action, without // actually making the request, and provides an error response. If you have @@ -21229,15 +21385,15 @@ type RevokeSecurityGroupEgressInput struct { FromPort *int64 `locationName:"fromPort" type:"integer"` // The ID of the security group. - GroupID *string `locationName:"groupId" type:"string" required:"true"` + GroupId *string `locationName:"groupId" type:"string" required:"true"` // A set of IP permissions. You can't specify a destination security group and // a CIDR IP address range. - IPPermissions []*IPPermission `locationName:"ipPermissions" locationNameList:"item" type:"list"` + IpPermissions []*IpPermission `locationName:"ipPermissions" locationNameList:"item" type:"list"` // The IP protocol name (tcp, udp, icmp) or number (see Protocol Numbers (http://www.iana.org/assignments/protocol-numbers/protocol-numbers.xhtml)). // Use -1 to specify all. - IPProtocol *string `locationName:"ipProtocol" type:"string"` + IpProtocol *string `locationName:"ipProtocol" type:"string"` // The name of a destination security group. To revoke outbound access to a // destination security group, we recommend that you use a set of IP permissions @@ -21247,7 +21403,7 @@ type RevokeSecurityGroupEgressInput struct { // The AWS account number for a destination security group. To revoke outbound // access to a destination security group, we recommend that you use a set of // IP permissions instead. - SourceSecurityGroupOwnerID *string `locationName:"sourceSecurityGroupOwnerId" type:"string"` + SourceSecurityGroupOwnerId *string `locationName:"sourceSecurityGroupOwnerId" type:"string"` // The end of port range for the TCP and UDP protocols, or an ICMP code number. // For the ICMP code number, use -1 to specify all ICMP codes for the ICMP type. @@ -21291,7 +21447,7 @@ func (s RevokeSecurityGroupEgressOutput) GoString() string { type RevokeSecurityGroupIngressInput struct { // The CIDR IP address range. You can't specify this parameter when specifying // a source security group. - CIDRIP *string `locationName:"CidrIp" type:"string"` + CidrIp *string `type:"string"` // Checks whether you have the required permissions for the action, without // actually making the request, and provides an error response. If you have @@ -21305,18 +21461,18 @@ type RevokeSecurityGroupIngressInput struct { // The ID of the security group. Required for a security group in a nondefault // VPC. - GroupID *string `locationName:"GroupId" type:"string"` + GroupId *string `type:"string"` // [EC2-Classic, default VPC] The name of the security group. GroupName *string `type:"string"` // A set of IP permissions. You can't specify a source security group and a // CIDR IP address range. - IPPermissions []*IPPermission `locationName:"IpPermissions" locationNameList:"item" type:"list"` + IpPermissions []*IpPermission `locationNameList:"item" type:"list"` // The IP protocol name (tcp, udp, icmp) or number (see Protocol Numbers (http://www.iana.org/assignments/protocol-numbers/protocol-numbers.xhtml)). // Use -1 to specify all. - IPProtocol *string `locationName:"IpProtocol" type:"string"` + IpProtocol *string `type:"string"` // [EC2-Classic, default VPC] The name of the source security group. You can't // specify this parameter in combination with the following parameters: the @@ -21331,7 +21487,7 @@ type RevokeSecurityGroupIngressInput struct { // CIDR IP address range, the IP protocol, the start of the port range, and // the end of the port range. To revoke a specific rule for an IP protocol and // port range, use a set of IP permissions instead. - SourceSecurityGroupOwnerID *string `locationName:"SourceSecurityGroupOwnerId" type:"string"` + SourceSecurityGroupOwnerId *string `type:"string"` // The end of port range for the TCP and UDP protocols, or an ICMP code number. // For the ICMP code number, use -1 to specify all ICMP codes for the ICMP type. @@ -21375,22 +21531,22 @@ func (s RevokeSecurityGroupIngressOutput) GoString() string { // Describes a route in a route table. type Route struct { // The CIDR block used for the destination match. - DestinationCIDRBlock *string `locationName:"destinationCidrBlock" type:"string"` + DestinationCidrBlock *string `locationName:"destinationCidrBlock" type:"string"` // The prefix of the AWS service. - DestinationPrefixListID *string `locationName:"destinationPrefixListId" type:"string"` + DestinationPrefixListId *string `locationName:"destinationPrefixListId" type:"string"` // The ID of a gateway attached to your VPC. - GatewayID *string `locationName:"gatewayId" type:"string"` + GatewayId *string `locationName:"gatewayId" type:"string"` // The ID of a NAT instance in your VPC. - InstanceID *string `locationName:"instanceId" type:"string"` + InstanceId *string `locationName:"instanceId" type:"string"` // The AWS account ID of the owner of the instance. - InstanceOwnerID *string `locationName:"instanceOwnerId" type:"string"` + InstanceOwnerId *string `locationName:"instanceOwnerId" type:"string"` // The ID of the network interface. - NetworkInterfaceID *string `locationName:"networkInterfaceId" type:"string"` + NetworkInterfaceId *string `locationName:"networkInterfaceId" type:"string"` // Describes how the route was created. // @@ -21406,7 +21562,7 @@ type Route struct { State *string `locationName:"state" type:"string" enum:"RouteState"` // The ID of the VPC peering connection. - VPCPeeringConnectionID *string `locationName:"vpcPeeringConnectionId" type:"string"` + VpcPeeringConnectionId *string `locationName:"vpcPeeringConnectionId" type:"string"` metadataRoute `json:"-" xml:"-"` } @@ -21431,10 +21587,10 @@ type RouteTable struct { Associations []*RouteTableAssociation `locationName:"associationSet" locationNameList:"item" type:"list"` // Any virtual private gateway (VGW) propagating routes. - PropagatingVGWs []*PropagatingVGW `locationName:"propagatingVgwSet" locationNameList:"item" type:"list"` + PropagatingVgws []*PropagatingVgw `locationName:"propagatingVgwSet" locationNameList:"item" type:"list"` // The ID of the route table. - RouteTableID *string `locationName:"routeTableId" type:"string"` + RouteTableId *string `locationName:"routeTableId" type:"string"` // The routes in the route table. Routes []*Route `locationName:"routeSet" locationNameList:"item" type:"list"` @@ -21443,7 +21599,7 @@ type RouteTable struct { Tags []*Tag `locationName:"tagSet" locationNameList:"item" type:"list"` // The ID of the VPC. - VPCID *string `locationName:"vpcId" type:"string"` + VpcId *string `locationName:"vpcId" type:"string"` metadataRouteTable `json:"-" xml:"-"` } @@ -21468,13 +21624,13 @@ type RouteTableAssociation struct { Main *bool `locationName:"main" type:"boolean"` // The ID of the association between a route table and a subnet. - RouteTableAssociationID *string `locationName:"routeTableAssociationId" type:"string"` + RouteTableAssociationId *string `locationName:"routeTableAssociationId" type:"string"` // The ID of the route table. - RouteTableID *string `locationName:"routeTableId" type:"string"` + RouteTableId *string `locationName:"routeTableId" type:"string"` // The ID of the subnet. A subnet ID is not returned for an implicit association. - SubnetID *string `locationName:"subnetId" type:"string"` + SubnetId *string `locationName:"subnetId" type:"string"` metadataRouteTableAssociation `json:"-" xml:"-"` } @@ -21515,7 +21671,7 @@ type RunInstancesInput struct { // from the instance. // // Default: false - DisableAPITermination *bool `locationName:"disableApiTermination" type:"boolean"` + DisableApiTermination *bool `locationName:"disableApiTermination" type:"boolean"` // Checks whether you have the required permissions for the action, without // actually making the request, and provides an error response. If you have @@ -21530,13 +21686,13 @@ type RunInstancesInput struct { // instance. // // Default: false - EBSOptimized *bool `locationName:"ebsOptimized" type:"boolean"` + EbsOptimized *bool `locationName:"ebsOptimized" type:"boolean"` // The IAM instance profile. - IAMInstanceProfile *IAMInstanceProfileSpecification `locationName:"iamInstanceProfile" type:"structure"` + IamInstanceProfile *IamInstanceProfileSpecification `locationName:"iamInstanceProfile" type:"structure"` // The ID of the AMI, which you can get by calling DescribeImages. - ImageID *string `locationName:"ImageId" type:"string" required:"true"` + ImageId *string `type:"string" required:"true"` // Indicates whether an instance stops or terminates when you initiate shutdown // from the instance (using the operating system command for system shutdown). @@ -21555,7 +21711,7 @@ type RunInstancesInput struct { // We recommend that you use PV-GRUB instead of kernels and RAM disks. For // more information, see PV-GRUB (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/UserProvidedkernels.html) // in the Amazon Elastic Compute Cloud User Guide. - KernelID *string `locationName:"KernelId" type:"string"` + KernelId *string `type:"string"` // The name of the key pair. You can create a key pair using CreateKeyPair or // ImportKeyPair. @@ -21601,19 +21757,19 @@ type RunInstancesInput struct { // and PrivateIpAddresses.n.PrivateIpAddress is set to an IP address. // // Default: We select an IP address from the IP address range of the subnet. - PrivateIPAddress *string `locationName:"privateIpAddress" type:"string"` + PrivateIpAddress *string `locationName:"privateIpAddress" type:"string"` // The ID of the RAM disk. // // We recommend that you use PV-GRUB instead of kernels and RAM disks. For // more information, see PV-GRUB (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/UserProvidedkernels.html) // in the Amazon Elastic Compute Cloud User Guide. - RAMDiskID *string `locationName:"RamdiskId" type:"string"` + RamdiskId *string `type:"string"` // One or more security group IDs. You can create a security group using CreateSecurityGroup. // // Default: Amazon EC2 uses the default security group. - SecurityGroupIDs []*string `locationName:"SecurityGroupId" locationNameList:"SecurityGroupId" type:"list"` + SecurityGroupIds []*string `locationName:"SecurityGroupId" locationNameList:"SecurityGroupId" type:"list"` // [EC2-Classic, default VPC] One or more security group names. For a nondefault // VPC, you must use security group IDs instead. @@ -21622,7 +21778,7 @@ type RunInstancesInput struct { SecurityGroups []*string `locationName:"SecurityGroup" locationNameList:"SecurityGroup" type:"list"` // [EC2-VPC] The ID of the subnet to launch the instance into. - SubnetID *string `locationName:"SubnetId" type:"string"` + SubnetId *string `type:"string"` // The Base64-encoded MIME user data for the instances. UserData *string `type:"string"` @@ -21672,7 +21828,7 @@ type S3Storage struct { // The access key ID of the owner of the bucket. Before you specify a value // for your access key ID, review and follow the guidance in Best Practices // for Managing AWS Access Keys (http://docs.aws.amazon.com/general/latest/gr/aws-access-keys-best-practices.html). - AWSAccessKeyID *string `locationName:"AWSAccessKeyId" type:"string"` + AWSAccessKeyId *string `type:"string"` // The bucket in which to store the AMI. You can specify a bucket that you already // own or a new bucket that Amazon EC2 creates on your behalf. If you specify @@ -21712,25 +21868,25 @@ type SecurityGroup struct { Description *string `locationName:"groupDescription" type:"string"` // The ID of the security group. - GroupID *string `locationName:"groupId" type:"string"` + GroupId *string `locationName:"groupId" type:"string"` // The name of the security group. GroupName *string `locationName:"groupName" type:"string"` // One or more inbound rules associated with the security group. - IPPermissions []*IPPermission `locationName:"ipPermissions" locationNameList:"item" type:"list"` + IpPermissions []*IpPermission `locationName:"ipPermissions" locationNameList:"item" type:"list"` // [EC2-VPC] One or more outbound rules associated with the security group. - IPPermissionsEgress []*IPPermission `locationName:"ipPermissionsEgress" locationNameList:"item" type:"list"` + IpPermissionsEgress []*IpPermission `locationName:"ipPermissionsEgress" locationNameList:"item" type:"list"` // The AWS account ID of the owner of the security group. - OwnerID *string `locationName:"ownerId" type:"string"` + OwnerId *string `locationName:"ownerId" type:"string"` // Any tags assigned to the security group. Tags []*Tag `locationName:"tagSet" locationNameList:"item" type:"list"` // [EC2-VPC] The ID of the VPC for the security group. - VPCID *string `locationName:"vpcId" type:"string"` + VpcId *string `locationName:"vpcId" type:"string"` metadataSecurityGroup `json:"-" xml:"-"` } @@ -21751,6 +21907,14 @@ func (s SecurityGroup) GoString() string { // Describes a snapshot. type Snapshot struct { + // The data encryption key identifier for the snapshot. This value is a unique + // identifier that corresponds to the data encryption key that was used to encrypt + // the original volume or snapshot copy. Because data encryption keys are inherited + // by volumes created from snapshots, and vice versa, if snapshots share the + // same data encryption key identifier, then they belong to the same volume/snapshot + // lineage. This parameter is only returned by the DescribeSnapshots API operation. + DataEncryptionKeyId *string `locationName:"dataEncryptionKeyId" type:"string"` + // The description for the snapshot. Description *string `locationName:"description" type:"string"` @@ -21760,20 +21924,21 @@ type Snapshot struct { // The full ARN of the AWS Key Management Service (AWS KMS) customer master // key (CMK) that was used to protect the volume encryption key for the parent // volume. - KMSKeyID *string `locationName:"kmsKeyId" type:"string"` + KmsKeyId *string `locationName:"kmsKeyId" type:"string"` // The AWS account alias (for example, amazon, self) or AWS account ID that // owns the snapshot. OwnerAlias *string `locationName:"ownerAlias" type:"string"` // The AWS account ID of the EBS snapshot owner. - OwnerID *string `locationName:"ownerId" type:"string"` + OwnerId *string `locationName:"ownerId" type:"string"` // The progress of the snapshot, as a percentage. Progress *string `locationName:"progress" type:"string"` - // The ID of the snapshot. - SnapshotID *string `locationName:"snapshotId" type:"string"` + // The ID of the snapshot. Each snapshot receives a unique identifier when it + // is created. + SnapshotId *string `locationName:"snapshotId" type:"string"` // The time stamp when the snapshot was initiated. StartTime *time.Time `locationName:"startTime" type:"timestamp" timestampFormat:"iso8601"` @@ -21781,11 +21946,18 @@ type Snapshot struct { // The snapshot state. State *string `locationName:"status" type:"string" enum:"SnapshotState"` + // Encrypted Amazon EBS snapshots are copied asynchronously. If a snapshot copy + // operation fails (for example, if the proper AWS Key Management Service (AWS + // KMS) permissions are not obtained) this field displays error state details + // to help you diagnose why the error occurred. This parameter is only returned + // by the DescribeSnapshots API operation. + StateMessage *string `locationName:"statusMessage" type:"string"` + // Any tags assigned to the snapshot. Tags []*Tag `locationName:"tagSet" locationNameList:"item" type:"list"` - // The ID of the volume. - VolumeID *string `locationName:"volumeId" type:"string"` + // The ID of the volume that was used to create the snapshot. + VolumeId *string `locationName:"volumeId" type:"string"` // The size of the volume, in GiB. VolumeSize *int64 `locationName:"volumeSize" type:"integer"` @@ -21825,7 +21997,7 @@ type SnapshotDetail struct { Progress *string `locationName:"progress" type:"string"` // The snapshot ID of the disk being imported. - SnapshotID *string `locationName:"snapshotId" type:"string"` + SnapshotId *string `locationName:"snapshotId" type:"string"` // A brief status of the snapshot creation. Status *string `locationName:"status" type:"string"` @@ -21834,7 +22006,7 @@ type SnapshotDetail struct { StatusMessage *string `locationName:"statusMessage" type:"string"` // The URL used to access the disk image. - URL *string `locationName:"url" type:"string"` + Url *string `locationName:"url" type:"string"` // Describes the S3 bucket for the disk image. UserBucket *UserBucketDetails `locationName:"userBucket" type:"structure"` @@ -21868,7 +22040,7 @@ type SnapshotDiskContainer struct { // The URL to the Amazon S3-based disk image being imported. It can either be // a https URL (https://..) or an Amazon S3 URL (s3://..). - URL *string `locationName:"Url" type:"string"` + Url *string `type:"string"` // Describes the S3 bucket for the disk image. UserBucket *UserBucket `type:"structure"` @@ -21905,7 +22077,7 @@ type SnapshotTaskDetail struct { Progress *string `locationName:"progress" type:"string"` // The snapshot ID of the disk being imported. - SnapshotID *string `locationName:"snapshotId" type:"string"` + SnapshotId *string `locationName:"snapshotId" type:"string"` // A brief status for the import snapshot task. Status *string `locationName:"status" type:"string"` @@ -21914,7 +22086,7 @@ type SnapshotTaskDetail struct { StatusMessage *string `locationName:"statusMessage" type:"string"` // The URL of the disk image from which the snapshot is created. - URL *string `locationName:"url" type:"string"` + Url *string `locationName:"url" type:"string"` // The S3 bucket for the disk image. UserBucket *UserBucketDetails `locationName:"userBucket" type:"structure"` @@ -21936,21 +22108,21 @@ func (s SnapshotTaskDetail) GoString() string { return s.String() } -// Describes the data feed for a Spot Instance. +// Describes the data feed for a Spot instance. type SpotDatafeedSubscription struct { - // The Amazon S3 bucket where the Spot Instance data feed is located. + // The Amazon S3 bucket where the Spot instance data feed is located. Bucket *string `locationName:"bucket" type:"string"` - // The fault codes for the Spot Instance request, if any. + // The fault codes for the Spot instance request, if any. Fault *SpotInstanceStateFault `locationName:"fault" type:"structure"` // The AWS account ID of the account. - OwnerID *string `locationName:"ownerId" type:"string"` + OwnerId *string `locationName:"ownerId" type:"string"` // The prefix that is prepended to data feed files. Prefix *string `locationName:"prefix" type:"string"` - // The state of the Spot Instance data feed subscription. + // The state of the Spot instance data feed subscription. State *string `locationName:"state" type:"string" enum:"DatafeedSubscriptionState"` metadataSpotDatafeedSubscription `json:"-" xml:"-"` @@ -21970,7 +22142,7 @@ func (s SpotDatafeedSubscription) GoString() string { return s.String() } -// Describes the launch specification for an instance. +// Describes the launch specification for one or more Spot instances. type SpotFleetLaunchSpecification struct { // Deprecated. AddressingType *string `locationName:"addressingType" type:"string"` @@ -21978,54 +22150,68 @@ type SpotFleetLaunchSpecification struct { // One or more block device mapping entries. BlockDeviceMappings []*BlockDeviceMapping `locationName:"blockDeviceMapping" locationNameList:"item" type:"list"` - // Indicates whether the instance is optimized for EBS I/O. This optimization + // Indicates whether the instances are optimized for EBS I/O. This optimization // provides dedicated throughput to Amazon EBS and an optimized configuration // stack to provide optimal EBS I/O performance. This optimization isn't available // with all instance types. Additional usage charges apply when using an EBS // Optimized instance. // // Default: false - EBSOptimized *bool `locationName:"ebsOptimized" type:"boolean"` + EbsOptimized *bool `locationName:"ebsOptimized" type:"boolean"` - // Describes an IAM instance profile. - IAMInstanceProfile *IAMInstanceProfileSpecification `locationName:"iamInstanceProfile" type:"structure"` + // The IAM instance profile. + IamInstanceProfile *IamInstanceProfileSpecification `locationName:"iamInstanceProfile" type:"structure"` // The ID of the AMI. - ImageID *string `locationName:"imageId" type:"string"` + ImageId *string `locationName:"imageId" type:"string"` // The instance type. InstanceType *string `locationName:"instanceType" type:"string" enum:"InstanceType"` // The ID of the kernel. - KernelID *string `locationName:"kernelId" type:"string"` + KernelId *string `locationName:"kernelId" type:"string"` // The name of the key pair. KeyName *string `locationName:"keyName" type:"string"` - // Enable or disable monitoring for the instance. + // Enable or disable monitoring for the instances. Monitoring *SpotFleetMonitoring `locationName:"monitoring" type:"structure"` // One or more network interfaces. NetworkInterfaces []*InstanceNetworkInterfaceSpecification `locationName:"networkInterfaceSet" locationNameList:"item" type:"list"` - // Describes Spot Instance placement. + // The placement information. Placement *SpotPlacement `locationName:"placement" type:"structure"` // The ID of the RAM disk. - RAMDiskID *string `locationName:"ramdiskId" type:"string"` + RamdiskId *string `locationName:"ramdiskId" type:"string"` - // One or more security groups. To request an instance in a nondefault VPC, - // you must specify the ID of the security group. To request an instance in - // EC2-Classic or a default VPC, you can specify the name or the ID of the security - // group. + // One or more security groups. When requesting instances in a VPC, you must + // specify the IDs of the security groups. When requesting instances in EC2-Classic, + // you can specify the names or the IDs of the security groups. SecurityGroups []*GroupIdentifier `locationName:"groupSet" locationNameList:"item" type:"list"` - // The ID of the subnet in which to launch the instance. - SubnetID *string `locationName:"subnetId" type:"string"` + // The bid price per unit hour for the specified instance type. If this value + // is not specified, the default is the Spot bid price specified for the fleet. + // To determine the bid price per unit hour, divide the Spot bid price by the + // value of WeightedCapacity. + SpotPrice *string `locationName:"spotPrice" type:"string"` + + // The ID of the subnet in which to launch the instances. + SubnetId *string `locationName:"subnetId" type:"string"` // The Base64-encoded MIME user data to make available to the instances. UserData *string `locationName:"userData" type:"string"` + // The number of units provided by the specified instance type. These are the + // same units that you chose to set the target capacity in terms (instances + // or a performance characteristic such as vCPUs, memory, or I/O). + // + // If the target capacity divided by this value is not a whole number, we round + // the number of instances to the next whole number. If this value is not specified, + // the default is 1. + WeightedCapacity *float64 `locationName:"weightedCapacity" type:"double"` + metadataSpotFleetLaunchSpecification `json:"-" xml:"-"` } @@ -22069,11 +22255,14 @@ func (s SpotFleetMonitoring) GoString() string { // Describes a Spot fleet request. type SpotFleetRequestConfig struct { + // The creation date and time of the request. + CreateTime *time.Time `locationName:"createTime" type:"timestamp" timestampFormat:"iso8601" required:"true"` + // Information about the configuration of the Spot fleet request. SpotFleetRequestConfig *SpotFleetRequestConfigData `locationName:"spotFleetRequestConfig" type:"structure" required:"true"` // The ID of the Spot fleet request. - SpotFleetRequestID *string `locationName:"spotFleetRequestId" type:"string" required:"true"` + SpotFleetRequestId *string `locationName:"spotFleetRequestId" type:"string" required:"true"` // The state of the Spot fleet request. SpotFleetRequestState *string `locationName:"spotFleetRequestState" type:"string" required:"true" enum:"BatchState"` @@ -22097,28 +22286,38 @@ func (s SpotFleetRequestConfig) GoString() string { // Describes the configuration of a Spot fleet request. type SpotFleetRequestConfigData struct { + // Indicates how to allocate the target capacity across the Spot pools specified + // by the Spot fleet request. The default is lowestPrice. + AllocationStrategy *string `locationName:"allocationStrategy" type:"string" enum:"AllocationStrategy"` + // A unique, case-sensitive identifier you provide to ensure idempotency of // your listings. This helps avoid duplicate listings. For more information, // see Ensuring Idempotency (http://docs.aws.amazon.com/AWSEC2/latest/APIReference/Run_Instance_Idempotency.html). ClientToken *string `locationName:"clientToken" type:"string"` - // Grants the Spot fleet service permission to terminate instances on your behalf - // when you cancel a Spot fleet request using CancelSpotFleetRequests or when + // Indicates whether running Spot instances should be terminated if the target + // capacity of the Spot fleet request is decreased below the current size of + // the Spot fleet. + ExcessCapacityTerminationPolicy *string `locationName:"excessCapacityTerminationPolicy" type:"string" enum:"ExcessCapacityTerminationPolicy"` + + // Grants the Spot fleet permission to terminate Spot instances on your behalf + // when you cancel its Spot fleet request using CancelSpotFleetRequests or when // the Spot fleet request expires, if you set terminateInstancesWithExpiration. - IAMFleetRole *string `locationName:"iamFleetRole" type:"string" required:"true"` + IamFleetRole *string `locationName:"iamFleetRole" type:"string" required:"true"` - // Information about the launch specifications for the instances. - LaunchSpecifications []*SpotFleetLaunchSpecification `locationName:"launchSpecifications" locationNameList:"item" type:"list" required:"true"` + // Information about the launch specifications for the Spot fleet request. + LaunchSpecifications []*SpotFleetLaunchSpecification `locationName:"launchSpecifications" locationNameList:"item" min:"1" type:"list" required:"true"` - // The maximum hourly price (bid) for any Spot Instance launched to fulfill - // the request. + // The bid price per unit hour. SpotPrice *string `locationName:"spotPrice" type:"string" required:"true"` - // The maximum number of Spot Instances to launch. + // The number of units to request. You can choose to set the target capacity + // in terms of instances or a performance characteristic that is important to + // your application workload, such as vCPUs, memory, or I/O. TargetCapacity *int64 `locationName:"targetCapacity" type:"integer" required:"true"` - // Indicates whether running instances should be terminated when the Spot fleet - // request expires. + // Indicates whether running Spot instances should be terminated when the Spot + // fleet request expires. TerminateInstancesWithExpiration *bool `locationName:"terminateInstancesWithExpiration" type:"boolean"` // The start date and time of the request, in UTC format (for example, YYYY-MM-DDTHH:MM:SSZ). @@ -22126,7 +22325,7 @@ type SpotFleetRequestConfigData struct { ValidFrom *time.Time `locationName:"validFrom" type:"timestamp" timestampFormat:"iso8601"` // The end date and time of the request, in UTC format (for example, YYYY-MM-DDTHH:MM:SSZ). - // At this point, no new Spot Instance requests are placed or enabled to fulfill + // At this point, no new Spot instance requests are placed or enabled to fulfill // the request. ValidUntil *time.Time `locationName:"validUntil" type:"timestamp" timestampFormat:"iso8601"` @@ -22147,25 +22346,32 @@ func (s SpotFleetRequestConfigData) GoString() string { return s.String() } -// Describe a Spot Instance request. +// Describes a Spot instance request. type SpotInstanceRequest struct { + // If you specified a required duration and your request was fulfilled, this + // is the fixed hourly price in effect for the Spot instance while it runs. + ActualBlockHourlyPrice *string `locationName:"actualBlockHourlyPrice" type:"string"` + // The Availability Zone group. If you specify the same Availability Zone group - // for all Spot Instance requests, all Spot Instances are launched in the same + // for all Spot instance requests, all Spot instances are launched in the same // Availability Zone. AvailabilityZoneGroup *string `locationName:"availabilityZoneGroup" type:"string"` - // The date and time when the Spot Instance request was created, in UTC format + // The required duration for the Spot instance, in minutes. + BlockDurationMinutes *int64 `locationName:"blockDurationMinutes" type:"integer"` + + // The date and time when the Spot instance request was created, in UTC format // (for example, YYYY-MM-DDTHH:MM:SSZ). CreateTime *time.Time `locationName:"createTime" type:"timestamp" timestampFormat:"iso8601"` - // The fault codes for the Spot Instance request, if any. + // The fault codes for the Spot instance request, if any. Fault *SpotInstanceStateFault `locationName:"fault" type:"structure"` - // The instance ID, if an instance has been launched to fulfill the Spot Instance + // The instance ID, if an instance has been launched to fulfill the Spot instance // request. - InstanceID *string `locationName:"instanceId" type:"string"` + InstanceId *string `locationName:"instanceId" type:"string"` - // The instance launch group. Launch groups are Spot Instances that launch together + // The instance launch group. Launch groups are Spot instances that launch together // and terminate together. LaunchGroup *string `locationName:"launchGroup" type:"string"` @@ -22175,42 +22381,39 @@ type SpotInstanceRequest struct { // The Availability Zone in which the bid is launched. LaunchedAvailabilityZone *string `locationName:"launchedAvailabilityZone" type:"string"` - // The product description associated with the Spot Instance. + // The product description associated with the Spot instance. ProductDescription *string `locationName:"productDescription" type:"string" enum:"RIProductDescription"` - // The ID of the Spot Instance request. - SpotInstanceRequestID *string `locationName:"spotInstanceRequestId" type:"string"` + // The ID of the Spot instance request. + SpotInstanceRequestId *string `locationName:"spotInstanceRequestId" type:"string"` - // The maximum hourly price (bid) for any Spot Instance launched to fulfill + // The maximum hourly price (bid) for the Spot instance launched to fulfill // the request. SpotPrice *string `locationName:"spotPrice" type:"string"` - // The state of the Spot Instance request. Spot bid status information can help - // you track your Spot Instance requests. For more information, see Spot Bid + // The state of the Spot instance request. Spot bid status information can help + // you track your Spot instance requests. For more information, see Spot Bid // Status (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/spot-bid-status.html) // in the Amazon Elastic Compute Cloud User Guide. State *string `locationName:"state" type:"string" enum:"SpotInstanceState"` - // The status code and status message describing the Spot Instance request. + // The status code and status message describing the Spot instance request. Status *SpotInstanceStatus `locationName:"status" type:"structure"` // Any tags assigned to the resource. Tags []*Tag `locationName:"tagSet" locationNameList:"item" type:"list"` - // The Spot Instance request type. + // The Spot instance request type. Type *string `locationName:"type" type:"string" enum:"SpotInstanceType"` // The start date of the request, in UTC format (for example, YYYY-MM-DDTHH:MM:SSZ). - // If this is a one-time request, the request becomes active at this date and - // time and remains active until all instances launch, the request expires, - // or the request is canceled. If the request is persistent, the request becomes - // active at this date and time and remains active until it expires or is canceled. + // The request becomes active at this date and time. ValidFrom *time.Time `locationName:"validFrom" type:"timestamp" timestampFormat:"iso8601"` // The end date of the request, in UTC format (for example, YYYY-MM-DDTHH:MM:SSZ). - // If this is a one-time request, the request remains active until all instances - // launch, the request is canceled, or this date is reached. If the request - // is persistent, it remains active until it is canceled or this date is reached. + // If this is a one-time request, it remains active until all instances launch, + // the request is canceled, or this date is reached. If the request is persistent, + // it remains active until it is canceled or this date is reached. ValidUntil *time.Time `locationName:"validUntil" type:"timestamp" timestampFormat:"iso8601"` metadataSpotInstanceRequest `json:"-" xml:"-"` @@ -22230,12 +22433,12 @@ func (s SpotInstanceRequest) GoString() string { return s.String() } -// Describes a Spot Instance state change. +// Describes a Spot instance state change. type SpotInstanceStateFault struct { - // The reason code for the Spot Instance state change. + // The reason code for the Spot instance state change. Code *string `locationName:"code" type:"string"` - // The message for the Spot Instance state change. + // The message for the Spot instance state change. Message *string `locationName:"message" type:"string"` metadataSpotInstanceStateFault `json:"-" xml:"-"` @@ -22255,7 +22458,7 @@ func (s SpotInstanceStateFault) GoString() string { return s.String() } -// Describes the status of a Spot Instance request. +// Describes the status of a Spot instance request. type SpotInstanceStatus struct { // The status code. Code *string `locationName:"code" type:"string"` @@ -22284,7 +22487,7 @@ func (s SpotInstanceStatus) GoString() string { return s.String() } -// Describes Spot Instance placement. +// Describes Spot instance placement. type SpotPlacement struct { // The Availability Zone. AvailabilityZone *string `locationName:"availabilityZone" type:"string"` @@ -22309,7 +22512,7 @@ func (s SpotPlacement) GoString() string { return s.String() } -// Describes the maximum hourly price (bid) for any Spot Instance launched to +// Describes the maximum hourly price (bid) for any Spot instance launched to // fulfill the request. type SpotPrice struct { // The Availability Zone. @@ -22321,7 +22524,7 @@ type SpotPrice struct { // A general description of the AMI. ProductDescription *string `locationName:"productDescription" type:"string" enum:"RIProductDescription"` - // The maximum price (bid) that you are willing to pay for a Spot Instance. + // The maximum price (bid) that you are willing to pay for a Spot instance. SpotPrice *string `locationName:"spotPrice" type:"string"` // The date and time the request was created, in UTC format (for example, YYYY-MM-DDTHH:MM:SSZ). @@ -22355,7 +22558,7 @@ type StartInstancesInput struct { DryRun *bool `locationName:"dryRun" type:"boolean"` // One or more instance IDs. - InstanceIDs []*string `locationName:"InstanceId" locationNameList:"InstanceId" type:"list" required:"true"` + InstanceIds []*string `locationName:"InstanceId" locationNameList:"InstanceId" type:"list" required:"true"` metadataStartInstancesInput `json:"-" xml:"-"` } @@ -22458,7 +22661,7 @@ type StopInstancesInput struct { Force *bool `locationName:"force" type:"boolean"` // One or more instance IDs. - InstanceIDs []*string `locationName:"InstanceId" locationNameList:"InstanceId" type:"list" required:"true"` + InstanceIds []*string `locationName:"InstanceId" locationNameList:"InstanceId" type:"list" required:"true"` metadataStopInstancesInput `json:"-" xml:"-"` } @@ -22527,28 +22730,28 @@ type Subnet struct { // The number of unused IP addresses in the subnet. Note that the IP addresses // for any stopped instances are considered unavailable. - AvailableIPAddressCount *int64 `locationName:"availableIpAddressCount" type:"integer"` + AvailableIpAddressCount *int64 `locationName:"availableIpAddressCount" type:"integer"` // The CIDR block assigned to the subnet. - CIDRBlock *string `locationName:"cidrBlock" type:"string"` + CidrBlock *string `locationName:"cidrBlock" type:"string"` // Indicates whether this is the default subnet for the Availability Zone. - DefaultForAZ *bool `locationName:"defaultForAz" type:"boolean"` + DefaultForAz *bool `locationName:"defaultForAz" type:"boolean"` // Indicates whether instances launched in this subnet receive a public IP address. - MapPublicIPOnLaunch *bool `locationName:"mapPublicIpOnLaunch" type:"boolean"` + MapPublicIpOnLaunch *bool `locationName:"mapPublicIpOnLaunch" type:"boolean"` // The current state of the subnet. State *string `locationName:"state" type:"string" enum:"SubnetState"` // The ID of the subnet. - SubnetID *string `locationName:"subnetId" type:"string"` + SubnetId *string `locationName:"subnetId" type:"string"` // Any tags assigned to the subnet. Tags []*Tag `locationName:"tagSet" locationNameList:"item" type:"list"` // The ID of the VPC the subnet is in. - VPCID *string `locationName:"vpcId" type:"string"` + VpcId *string `locationName:"vpcId" type:"string"` metadataSubnet `json:"-" xml:"-"` } @@ -22604,7 +22807,7 @@ type TagDescription struct { Key *string `locationName:"key" type:"string"` // The ID of the resource. For example, ami-1a2b3c4d. - ResourceID *string `locationName:"resourceId" type:"string"` + ResourceId *string `locationName:"resourceId" type:"string"` // The resource type. ResourceType *string `locationName:"resourceType" type:"string" enum:"ResourceType"` @@ -22637,7 +22840,7 @@ type TerminateInstancesInput struct { DryRun *bool `locationName:"dryRun" type:"boolean"` // One or more instance IDs. - InstanceIDs []*string `locationName:"InstanceId" locationNameList:"InstanceId" type:"list" required:"true"` + InstanceIds []*string `locationName:"InstanceId" locationNameList:"InstanceId" type:"list" required:"true"` metadataTerminateInstancesInput `json:"-" xml:"-"` } @@ -22677,46 +22880,46 @@ func (s TerminateInstancesOutput) GoString() string { return s.String() } -type UnassignPrivateIPAddressesInput struct { +type UnassignPrivateIpAddressesInput struct { // The ID of the network interface. - NetworkInterfaceID *string `locationName:"networkInterfaceId" type:"string" required:"true"` + NetworkInterfaceId *string `locationName:"networkInterfaceId" type:"string" required:"true"` // The secondary private IP addresses to unassign from the network interface. // You can specify this option multiple times to unassign more than one IP address. - PrivateIPAddresses []*string `locationName:"privateIpAddress" locationNameList:"PrivateIpAddress" type:"list" required:"true"` + PrivateIpAddresses []*string `locationName:"privateIpAddress" locationNameList:"PrivateIpAddress" type:"list" required:"true"` - metadataUnassignPrivateIPAddressesInput `json:"-" xml:"-"` + metadataUnassignPrivateIpAddressesInput `json:"-" xml:"-"` } -type metadataUnassignPrivateIPAddressesInput struct { +type metadataUnassignPrivateIpAddressesInput struct { SDKShapeTraits bool `type:"structure"` } // String returns the string representation -func (s UnassignPrivateIPAddressesInput) String() string { +func (s UnassignPrivateIpAddressesInput) String() string { return awsutil.Prettify(s) } // GoString returns the string representation -func (s UnassignPrivateIPAddressesInput) GoString() string { +func (s UnassignPrivateIpAddressesInput) GoString() string { return s.String() } -type UnassignPrivateIPAddressesOutput struct { - metadataUnassignPrivateIPAddressesOutput `json:"-" xml:"-"` +type UnassignPrivateIpAddressesOutput struct { + metadataUnassignPrivateIpAddressesOutput `json:"-" xml:"-"` } -type metadataUnassignPrivateIPAddressesOutput struct { +type metadataUnassignPrivateIpAddressesOutput struct { SDKShapeTraits bool `type:"structure"` } // String returns the string representation -func (s UnassignPrivateIPAddressesOutput) String() string { +func (s UnassignPrivateIpAddressesOutput) String() string { return awsutil.Prettify(s) } // GoString returns the string representation -func (s UnassignPrivateIPAddressesOutput) GoString() string { +func (s UnassignPrivateIpAddressesOutput) GoString() string { return s.String() } @@ -22728,7 +22931,7 @@ type UnmonitorInstancesInput struct { DryRun *bool `locationName:"dryRun" type:"boolean"` // One or more instance IDs. - InstanceIDs []*string `locationName:"InstanceId" locationNameList:"InstanceId" type:"list" required:"true"` + InstanceIds []*string `locationName:"InstanceId" locationNameList:"InstanceId" type:"list" required:"true"` metadataUnmonitorInstancesInput `json:"-" xml:"-"` } @@ -22774,7 +22977,7 @@ type UnsuccessfulItem struct { Error *UnsuccessfulItemError `locationName:"error" type:"structure" required:"true"` // The ID of the resource. - ResourceID *string `locationName:"resourceId" type:"string"` + ResourceId *string `locationName:"resourceId" type:"string"` metadataUnsuccessfulItem `json:"-" xml:"-"` } @@ -22793,7 +22996,7 @@ func (s UnsuccessfulItem) GoString() string { return s.String() } -// Information about the error that occured. For more information about errors, +// Information about the error that occurred. For more information about errors, // see Error Codes (http://docs.aws.amazon.com/AWSEC2/latest/APIReference/errors-overview.html). type UnsuccessfulItemError struct { // The error code. @@ -22892,9 +23095,9 @@ func (s UserData) GoString() string { } // Describes a security group and AWS account ID pair. -type UserIDGroupPair struct { +type UserIdGroupPair struct { // The ID of the security group. - GroupID *string `locationName:"groupId" type:"string"` + GroupId *string `locationName:"groupId" type:"string"` // The name of the security group. In a request, use this parameter for a security // group in EC2-Classic or a default VPC only. For a security group in a nondefault @@ -22902,27 +23105,27 @@ type UserIDGroupPair struct { GroupName *string `locationName:"groupName" type:"string"` // The ID of an AWS account. EC2-Classic only. - UserID *string `locationName:"userId" type:"string"` + UserId *string `locationName:"userId" type:"string"` - metadataUserIDGroupPair `json:"-" xml:"-"` + metadataUserIdGroupPair `json:"-" xml:"-"` } -type metadataUserIDGroupPair struct { +type metadataUserIdGroupPair struct { SDKShapeTraits bool `type:"structure"` } // String returns the string representation -func (s UserIDGroupPair) String() string { +func (s UserIdGroupPair) String() string { return awsutil.Prettify(s) } // GoString returns the string representation -func (s UserIDGroupPair) GoString() string { +func (s UserIdGroupPair) GoString() string { return s.String() } // Describes telemetry for a VPN tunnel. -type VGWTelemetry struct { +type VgwTelemetry struct { // The number of accepted routes. AcceptedRouteCount *int64 `locationName:"acceptedRouteCount" type:"integer"` @@ -22931,7 +23134,7 @@ type VGWTelemetry struct { // The Internet-routable IP address of the virtual private gateway's outside // interface. - OutsideIPAddress *string `locationName:"outsideIpAddress" type:"string"` + OutsideIpAddress *string `locationName:"outsideIpAddress" type:"string"` // The status of the VPN tunnel. Status *string `locationName:"status" type:"string" enum:"TelemetryStatus"` @@ -22939,407 +23142,20 @@ type VGWTelemetry struct { // If an error occurs, a description of the error. StatusMessage *string `locationName:"statusMessage" type:"string"` - metadataVGWTelemetry `json:"-" xml:"-"` + metadataVgwTelemetry `json:"-" xml:"-"` } -type metadataVGWTelemetry struct { +type metadataVgwTelemetry struct { SDKShapeTraits bool `type:"structure"` } // String returns the string representation -func (s VGWTelemetry) String() string { +func (s VgwTelemetry) String() string { return awsutil.Prettify(s) } // GoString returns the string representation -func (s VGWTelemetry) GoString() string { - return s.String() -} - -// Describes a VPC. -type VPC struct { - // The CIDR block for the VPC. - CIDRBlock *string `locationName:"cidrBlock" type:"string"` - - // The ID of the set of DHCP options you've associated with the VPC (or default - // if the default options are associated with the VPC). - DHCPOptionsID *string `locationName:"dhcpOptionsId" type:"string"` - - // The allowed tenancy of instances launched into the VPC. - InstanceTenancy *string `locationName:"instanceTenancy" type:"string" enum:"Tenancy"` - - // Indicates whether the VPC is the default VPC. - IsDefault *bool `locationName:"isDefault" type:"boolean"` - - // The current state of the VPC. - State *string `locationName:"state" type:"string" enum:"VpcState"` - - // Any tags assigned to the VPC. - Tags []*Tag `locationName:"tagSet" locationNameList:"item" type:"list"` - - // The ID of the VPC. - VPCID *string `locationName:"vpcId" type:"string"` - - metadataVPC `json:"-" xml:"-"` -} - -type metadataVPC struct { - SDKShapeTraits bool `type:"structure"` -} - -// String returns the string representation -func (s VPC) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s VPC) GoString() string { - return s.String() -} - -// Describes an attachment between a virtual private gateway and a VPC. -type VPCAttachment struct { - // The current state of the attachment. - State *string `locationName:"state" type:"string" enum:"AttachmentStatus"` - - // The ID of the VPC. - VPCID *string `locationName:"vpcId" type:"string"` - - metadataVPCAttachment `json:"-" xml:"-"` -} - -type metadataVPCAttachment struct { - SDKShapeTraits bool `type:"structure"` -} - -// String returns the string representation -func (s VPCAttachment) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s VPCAttachment) GoString() string { - return s.String() -} - -// Describes whether a VPC is enabled for ClassicLink. -type VPCClassicLink struct { - // Indicates whether the VPC is enabled for ClassicLink. - ClassicLinkEnabled *bool `locationName:"classicLinkEnabled" type:"boolean"` - - // Any tags assigned to the VPC. - Tags []*Tag `locationName:"tagSet" locationNameList:"item" type:"list"` - - // The ID of the VPC. - VPCID *string `locationName:"vpcId" type:"string"` - - metadataVPCClassicLink `json:"-" xml:"-"` -} - -type metadataVPCClassicLink struct { - SDKShapeTraits bool `type:"structure"` -} - -// String returns the string representation -func (s VPCClassicLink) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s VPCClassicLink) GoString() string { - return s.String() -} - -// Describes a VPC endpoint. -type VPCEndpoint struct { - // The date and time the VPC endpoint was created. - CreationTimestamp *time.Time `locationName:"creationTimestamp" type:"timestamp" timestampFormat:"iso8601"` - - // The policy document associated with the endpoint. - PolicyDocument *string `locationName:"policyDocument" type:"string"` - - // One or more route tables associated with the endpoint. - RouteTableIDs []*string `locationName:"routeTableIdSet" locationNameList:"item" type:"list"` - - // The name of the AWS service to which the endpoint is associated. - ServiceName *string `locationName:"serviceName" type:"string"` - - // The state of the VPC endpoint. - State *string `locationName:"state" type:"string" enum:"State"` - - // The ID of the VPC endpoint. - VPCEndpointID *string `locationName:"vpcEndpointId" type:"string"` - - // The ID of the VPC to which the endpoint is associated. - VPCID *string `locationName:"vpcId" type:"string"` - - metadataVPCEndpoint `json:"-" xml:"-"` -} - -type metadataVPCEndpoint struct { - SDKShapeTraits bool `type:"structure"` -} - -// String returns the string representation -func (s VPCEndpoint) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s VPCEndpoint) GoString() string { - return s.String() -} - -// Describes a VPC peering connection. -type VPCPeeringConnection struct { - // The information of the peer VPC. - AccepterVPCInfo *VPCPeeringConnectionVPCInfo `locationName:"accepterVpcInfo" type:"structure"` - - // The time that an unaccepted VPC peering connection will expire. - ExpirationTime *time.Time `locationName:"expirationTime" type:"timestamp" timestampFormat:"iso8601"` - - // The information of the requester VPC. - RequesterVPCInfo *VPCPeeringConnectionVPCInfo `locationName:"requesterVpcInfo" type:"structure"` - - // The status of the VPC peering connection. - Status *VPCPeeringConnectionStateReason `locationName:"status" type:"structure"` - - // Any tags assigned to the resource. - Tags []*Tag `locationName:"tagSet" locationNameList:"item" type:"list"` - - // The ID of the VPC peering connection. - VPCPeeringConnectionID *string `locationName:"vpcPeeringConnectionId" type:"string"` - - metadataVPCPeeringConnection `json:"-" xml:"-"` -} - -type metadataVPCPeeringConnection struct { - SDKShapeTraits bool `type:"structure"` -} - -// String returns the string representation -func (s VPCPeeringConnection) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s VPCPeeringConnection) GoString() string { - return s.String() -} - -// Describes the status of a VPC peering connection. -type VPCPeeringConnectionStateReason struct { - // The status of the VPC peering connection. - Code *string `locationName:"code" type:"string" enum:"VpcPeeringConnectionStateReasonCode"` - - // A message that provides more information about the status, if applicable. - Message *string `locationName:"message" type:"string"` - - metadataVPCPeeringConnectionStateReason `json:"-" xml:"-"` -} - -type metadataVPCPeeringConnectionStateReason struct { - SDKShapeTraits bool `type:"structure"` -} - -// String returns the string representation -func (s VPCPeeringConnectionStateReason) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s VPCPeeringConnectionStateReason) GoString() string { - return s.String() -} - -// Describes a VPC in a VPC peering connection. -type VPCPeeringConnectionVPCInfo struct { - // The CIDR block for the VPC. - CIDRBlock *string `locationName:"cidrBlock" type:"string"` - - // The AWS account ID of the VPC owner. - OwnerID *string `locationName:"ownerId" type:"string"` - - // The ID of the VPC. - VPCID *string `locationName:"vpcId" type:"string"` - - metadataVPCPeeringConnectionVPCInfo `json:"-" xml:"-"` -} - -type metadataVPCPeeringConnectionVPCInfo struct { - SDKShapeTraits bool `type:"structure"` -} - -// String returns the string representation -func (s VPCPeeringConnectionVPCInfo) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s VPCPeeringConnectionVPCInfo) GoString() string { - return s.String() -} - -// Describes a VPN connection. -type VPNConnection struct { - // The configuration information for the VPN connection's customer gateway (in - // the native XML format). This element is always present in the CreateVpnConnection - // response; however, it's present in the DescribeVpnConnections response only - // if the VPN connection is in the pending or available state. - CustomerGatewayConfiguration *string `locationName:"customerGatewayConfiguration" type:"string"` - - // The ID of the customer gateway at your end of the VPN connection. - CustomerGatewayID *string `locationName:"customerGatewayId" type:"string"` - - // The VPN connection options. - Options *VPNConnectionOptions `locationName:"options" type:"structure"` - - // The static routes associated with the VPN connection. - Routes []*VPNStaticRoute `locationName:"routes" locationNameList:"item" type:"list"` - - // The current state of the VPN connection. - State *string `locationName:"state" type:"string" enum:"VpnState"` - - // Any tags assigned to the VPN connection. - Tags []*Tag `locationName:"tagSet" locationNameList:"item" type:"list"` - - // The type of VPN connection. - Type *string `locationName:"type" type:"string" enum:"GatewayType"` - - // Information about the VPN tunnel. - VGWTelemetry []*VGWTelemetry `locationName:"vgwTelemetry" locationNameList:"item" type:"list"` - - // The ID of the VPN connection. - VPNConnectionID *string `locationName:"vpnConnectionId" type:"string"` - - // The ID of the virtual private gateway at the AWS side of the VPN connection. - VPNGatewayID *string `locationName:"vpnGatewayId" type:"string"` - - metadataVPNConnection `json:"-" xml:"-"` -} - -type metadataVPNConnection struct { - SDKShapeTraits bool `type:"structure"` -} - -// String returns the string representation -func (s VPNConnection) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s VPNConnection) GoString() string { - return s.String() -} - -// Describes VPN connection options. -type VPNConnectionOptions struct { - // Indicates whether the VPN connection uses static routes only. Static routes - // must be used for devices that don't support BGP. - StaticRoutesOnly *bool `locationName:"staticRoutesOnly" type:"boolean"` - - metadataVPNConnectionOptions `json:"-" xml:"-"` -} - -type metadataVPNConnectionOptions struct { - SDKShapeTraits bool `type:"structure"` -} - -// String returns the string representation -func (s VPNConnectionOptions) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s VPNConnectionOptions) GoString() string { - return s.String() -} - -// Describes VPN connection options. -type VPNConnectionOptionsSpecification struct { - // Indicates whether the VPN connection uses static routes only. Static routes - // must be used for devices that don't support BGP. - StaticRoutesOnly *bool `locationName:"staticRoutesOnly" type:"boolean"` - - metadataVPNConnectionOptionsSpecification `json:"-" xml:"-"` -} - -type metadataVPNConnectionOptionsSpecification struct { - SDKShapeTraits bool `type:"structure"` -} - -// String returns the string representation -func (s VPNConnectionOptionsSpecification) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s VPNConnectionOptionsSpecification) GoString() string { - return s.String() -} - -// Describes a virtual private gateway. -type VPNGateway struct { - // The Availability Zone where the virtual private gateway was created. - AvailabilityZone *string `locationName:"availabilityZone" type:"string"` - - // The current state of the virtual private gateway. - State *string `locationName:"state" type:"string" enum:"VpnState"` - - // Any tags assigned to the virtual private gateway. - Tags []*Tag `locationName:"tagSet" locationNameList:"item" type:"list"` - - // The type of VPN connection the virtual private gateway supports. - Type *string `locationName:"type" type:"string" enum:"GatewayType"` - - // Any VPCs attached to the virtual private gateway. - VPCAttachments []*VPCAttachment `locationName:"attachments" locationNameList:"item" type:"list"` - - // The ID of the virtual private gateway. - VPNGatewayID *string `locationName:"vpnGatewayId" type:"string"` - - metadataVPNGateway `json:"-" xml:"-"` -} - -type metadataVPNGateway struct { - SDKShapeTraits bool `type:"structure"` -} - -// String returns the string representation -func (s VPNGateway) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s VPNGateway) GoString() string { - return s.String() -} - -// Describes a static route for a VPN connection. -type VPNStaticRoute struct { - // The CIDR block associated with the local subnet of the customer data center. - DestinationCIDRBlock *string `locationName:"destinationCidrBlock" type:"string"` - - // Indicates how the routes were provided. - Source *string `locationName:"source" type:"string" enum:"VpnStaticRouteSource"` - - // The current state of the static route. - State *string `locationName:"state" type:"string" enum:"VpnState"` - - metadataVPNStaticRoute `json:"-" xml:"-"` -} - -type metadataVPNStaticRoute struct { - SDKShapeTraits bool `type:"structure"` -} - -// String returns the string representation -func (s VPNStaticRoute) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s VPNStaticRoute) GoString() string { +func (s VgwTelemetry) GoString() string { return s.String() } @@ -23370,17 +23186,17 @@ type Volume struct { // // Condition: This parameter is required for requests to create io1 volumes; // it is not used in requests to create standard or gp2 volumes. - IOPS *int64 `locationName:"iops" type:"integer"` + Iops *int64 `locationName:"iops" type:"integer"` // The full ARN of the AWS Key Management Service (AWS KMS) customer master // key (CMK) that was used to protect the volume encryption key for the volume. - KMSKeyID *string `locationName:"kmsKeyId" type:"string"` + KmsKeyId *string `locationName:"kmsKeyId" type:"string"` // The size of the volume, in GiBs. Size *int64 `locationName:"size" type:"integer"` // The snapshot from which the volume was created, if applicable. - SnapshotID *string `locationName:"snapshotId" type:"string"` + SnapshotId *string `locationName:"snapshotId" type:"string"` // The volume state. State *string `locationName:"status" type:"string" enum:"VolumeState"` @@ -23389,7 +23205,7 @@ type Volume struct { Tags []*Tag `locationName:"tagSet" locationNameList:"item" type:"list"` // The ID of the volume. - VolumeID *string `locationName:"volumeId" type:"string"` + VolumeId *string `locationName:"volumeId" type:"string"` // The volume type. This can be gp2 for General Purpose (SSD) volumes, io1 for // Provisioned IOPS (SSD) volumes, or standard for Magnetic volumes. @@ -23424,13 +23240,13 @@ type VolumeAttachment struct { Device *string `locationName:"device" type:"string"` // The ID of the instance. - InstanceID *string `locationName:"instanceId" type:"string"` + InstanceId *string `locationName:"instanceId" type:"string"` // The attachment state of the volume. State *string `locationName:"status" type:"string" enum:"VolumeAttachmentState"` // The ID of the volume. - VolumeID *string `locationName:"volumeId" type:"string"` + VolumeId *string `locationName:"volumeId" type:"string"` metadataVolumeAttachment `json:"-" xml:"-"` } @@ -23480,7 +23296,7 @@ type VolumeStatusAction struct { Description *string `locationName:"description" type:"string"` // The ID of the event associated with this operation. - EventID *string `locationName:"eventId" type:"string"` + EventId *string `locationName:"eventId" type:"string"` // The event type associated with this operation. EventType *string `locationName:"eventType" type:"string"` @@ -23533,7 +23349,7 @@ type VolumeStatusEvent struct { Description *string `locationName:"description" type:"string"` // The ID of this event. - EventID *string `locationName:"eventId" type:"string"` + EventId *string `locationName:"eventId" type:"string"` // The type of this event. EventType *string `locationName:"eventType" type:"string"` @@ -23598,7 +23414,7 @@ type VolumeStatusItem struct { Events []*VolumeStatusEvent `locationName:"eventsSet" locationNameList:"item" type:"list"` // The volume ID. - VolumeID *string `locationName:"volumeId" type:"string"` + VolumeId *string `locationName:"volumeId" type:"string"` // The volume status. VolumeStatus *VolumeStatusInfo `locationName:"volumeStatus" type:"structure"` @@ -23620,6 +23436,393 @@ func (s VolumeStatusItem) GoString() string { return s.String() } +// Describes a VPC. +type Vpc struct { + // The CIDR block for the VPC. + CidrBlock *string `locationName:"cidrBlock" type:"string"` + + // The ID of the set of DHCP options you've associated with the VPC (or default + // if the default options are associated with the VPC). + DhcpOptionsId *string `locationName:"dhcpOptionsId" type:"string"` + + // The allowed tenancy of instances launched into the VPC. + InstanceTenancy *string `locationName:"instanceTenancy" type:"string" enum:"Tenancy"` + + // Indicates whether the VPC is the default VPC. + IsDefault *bool `locationName:"isDefault" type:"boolean"` + + // The current state of the VPC. + State *string `locationName:"state" type:"string" enum:"VpcState"` + + // Any tags assigned to the VPC. + Tags []*Tag `locationName:"tagSet" locationNameList:"item" type:"list"` + + // The ID of the VPC. + VpcId *string `locationName:"vpcId" type:"string"` + + metadataVpc `json:"-" xml:"-"` +} + +type metadataVpc struct { + SDKShapeTraits bool `type:"structure"` +} + +// String returns the string representation +func (s Vpc) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s Vpc) GoString() string { + return s.String() +} + +// Describes an attachment between a virtual private gateway and a VPC. +type VpcAttachment struct { + // The current state of the attachment. + State *string `locationName:"state" type:"string" enum:"AttachmentStatus"` + + // The ID of the VPC. + VpcId *string `locationName:"vpcId" type:"string"` + + metadataVpcAttachment `json:"-" xml:"-"` +} + +type metadataVpcAttachment struct { + SDKShapeTraits bool `type:"structure"` +} + +// String returns the string representation +func (s VpcAttachment) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s VpcAttachment) GoString() string { + return s.String() +} + +// Describes whether a VPC is enabled for ClassicLink. +type VpcClassicLink struct { + // Indicates whether the VPC is enabled for ClassicLink. + ClassicLinkEnabled *bool `locationName:"classicLinkEnabled" type:"boolean"` + + // Any tags assigned to the VPC. + Tags []*Tag `locationName:"tagSet" locationNameList:"item" type:"list"` + + // The ID of the VPC. + VpcId *string `locationName:"vpcId" type:"string"` + + metadataVpcClassicLink `json:"-" xml:"-"` +} + +type metadataVpcClassicLink struct { + SDKShapeTraits bool `type:"structure"` +} + +// String returns the string representation +func (s VpcClassicLink) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s VpcClassicLink) GoString() string { + return s.String() +} + +// Describes a VPC endpoint. +type VpcEndpoint struct { + // The date and time the VPC endpoint was created. + CreationTimestamp *time.Time `locationName:"creationTimestamp" type:"timestamp" timestampFormat:"iso8601"` + + // The policy document associated with the endpoint. + PolicyDocument *string `locationName:"policyDocument" type:"string"` + + // One or more route tables associated with the endpoint. + RouteTableIds []*string `locationName:"routeTableIdSet" locationNameList:"item" type:"list"` + + // The name of the AWS service to which the endpoint is associated. + ServiceName *string `locationName:"serviceName" type:"string"` + + // The state of the VPC endpoint. + State *string `locationName:"state" type:"string" enum:"State"` + + // The ID of the VPC endpoint. + VpcEndpointId *string `locationName:"vpcEndpointId" type:"string"` + + // The ID of the VPC to which the endpoint is associated. + VpcId *string `locationName:"vpcId" type:"string"` + + metadataVpcEndpoint `json:"-" xml:"-"` +} + +type metadataVpcEndpoint struct { + SDKShapeTraits bool `type:"structure"` +} + +// String returns the string representation +func (s VpcEndpoint) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s VpcEndpoint) GoString() string { + return s.String() +} + +// Describes a VPC peering connection. +type VpcPeeringConnection struct { + // The information of the peer VPC. + AccepterVpcInfo *VpcPeeringConnectionVpcInfo `locationName:"accepterVpcInfo" type:"structure"` + + // The time that an unaccepted VPC peering connection will expire. + ExpirationTime *time.Time `locationName:"expirationTime" type:"timestamp" timestampFormat:"iso8601"` + + // The information of the requester VPC. + RequesterVpcInfo *VpcPeeringConnectionVpcInfo `locationName:"requesterVpcInfo" type:"structure"` + + // The status of the VPC peering connection. + Status *VpcPeeringConnectionStateReason `locationName:"status" type:"structure"` + + // Any tags assigned to the resource. + Tags []*Tag `locationName:"tagSet" locationNameList:"item" type:"list"` + + // The ID of the VPC peering connection. + VpcPeeringConnectionId *string `locationName:"vpcPeeringConnectionId" type:"string"` + + metadataVpcPeeringConnection `json:"-" xml:"-"` +} + +type metadataVpcPeeringConnection struct { + SDKShapeTraits bool `type:"structure"` +} + +// String returns the string representation +func (s VpcPeeringConnection) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s VpcPeeringConnection) GoString() string { + return s.String() +} + +// Describes the status of a VPC peering connection. +type VpcPeeringConnectionStateReason struct { + // The status of the VPC peering connection. + Code *string `locationName:"code" type:"string" enum:"VpcPeeringConnectionStateReasonCode"` + + // A message that provides more information about the status, if applicable. + Message *string `locationName:"message" type:"string"` + + metadataVpcPeeringConnectionStateReason `json:"-" xml:"-"` +} + +type metadataVpcPeeringConnectionStateReason struct { + SDKShapeTraits bool `type:"structure"` +} + +// String returns the string representation +func (s VpcPeeringConnectionStateReason) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s VpcPeeringConnectionStateReason) GoString() string { + return s.String() +} + +// Describes a VPC in a VPC peering connection. +type VpcPeeringConnectionVpcInfo struct { + // The CIDR block for the VPC. + CidrBlock *string `locationName:"cidrBlock" type:"string"` + + // The AWS account ID of the VPC owner. + OwnerId *string `locationName:"ownerId" type:"string"` + + // The ID of the VPC. + VpcId *string `locationName:"vpcId" type:"string"` + + metadataVpcPeeringConnectionVpcInfo `json:"-" xml:"-"` +} + +type metadataVpcPeeringConnectionVpcInfo struct { + SDKShapeTraits bool `type:"structure"` +} + +// String returns the string representation +func (s VpcPeeringConnectionVpcInfo) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s VpcPeeringConnectionVpcInfo) GoString() string { + return s.String() +} + +// Describes a VPN connection. +type VpnConnection struct { + // The configuration information for the VPN connection's customer gateway (in + // the native XML format). This element is always present in the CreateVpnConnection + // response; however, it's present in the DescribeVpnConnections response only + // if the VPN connection is in the pending or available state. + CustomerGatewayConfiguration *string `locationName:"customerGatewayConfiguration" type:"string"` + + // The ID of the customer gateway at your end of the VPN connection. + CustomerGatewayId *string `locationName:"customerGatewayId" type:"string"` + + // The VPN connection options. + Options *VpnConnectionOptions `locationName:"options" type:"structure"` + + // The static routes associated with the VPN connection. + Routes []*VpnStaticRoute `locationName:"routes" locationNameList:"item" type:"list"` + + // The current state of the VPN connection. + State *string `locationName:"state" type:"string" enum:"VpnState"` + + // Any tags assigned to the VPN connection. + Tags []*Tag `locationName:"tagSet" locationNameList:"item" type:"list"` + + // The type of VPN connection. + Type *string `locationName:"type" type:"string" enum:"GatewayType"` + + // Information about the VPN tunnel. + VgwTelemetry []*VgwTelemetry `locationName:"vgwTelemetry" locationNameList:"item" type:"list"` + + // The ID of the VPN connection. + VpnConnectionId *string `locationName:"vpnConnectionId" type:"string"` + + // The ID of the virtual private gateway at the AWS side of the VPN connection. + VpnGatewayId *string `locationName:"vpnGatewayId" type:"string"` + + metadataVpnConnection `json:"-" xml:"-"` +} + +type metadataVpnConnection struct { + SDKShapeTraits bool `type:"structure"` +} + +// String returns the string representation +func (s VpnConnection) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s VpnConnection) GoString() string { + return s.String() +} + +// Describes VPN connection options. +type VpnConnectionOptions struct { + // Indicates whether the VPN connection uses static routes only. Static routes + // must be used for devices that don't support BGP. + StaticRoutesOnly *bool `locationName:"staticRoutesOnly" type:"boolean"` + + metadataVpnConnectionOptions `json:"-" xml:"-"` +} + +type metadataVpnConnectionOptions struct { + SDKShapeTraits bool `type:"structure"` +} + +// String returns the string representation +func (s VpnConnectionOptions) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s VpnConnectionOptions) GoString() string { + return s.String() +} + +// Describes VPN connection options. +type VpnConnectionOptionsSpecification struct { + // Indicates whether the VPN connection uses static routes only. Static routes + // must be used for devices that don't support BGP. + StaticRoutesOnly *bool `locationName:"staticRoutesOnly" type:"boolean"` + + metadataVpnConnectionOptionsSpecification `json:"-" xml:"-"` +} + +type metadataVpnConnectionOptionsSpecification struct { + SDKShapeTraits bool `type:"structure"` +} + +// String returns the string representation +func (s VpnConnectionOptionsSpecification) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s VpnConnectionOptionsSpecification) GoString() string { + return s.String() +} + +// Describes a virtual private gateway. +type VpnGateway struct { + // The Availability Zone where the virtual private gateway was created. + AvailabilityZone *string `locationName:"availabilityZone" type:"string"` + + // The current state of the virtual private gateway. + State *string `locationName:"state" type:"string" enum:"VpnState"` + + // Any tags assigned to the virtual private gateway. + Tags []*Tag `locationName:"tagSet" locationNameList:"item" type:"list"` + + // The type of VPN connection the virtual private gateway supports. + Type *string `locationName:"type" type:"string" enum:"GatewayType"` + + // Any VPCs attached to the virtual private gateway. + VpcAttachments []*VpcAttachment `locationName:"attachments" locationNameList:"item" type:"list"` + + // The ID of the virtual private gateway. + VpnGatewayId *string `locationName:"vpnGatewayId" type:"string"` + + metadataVpnGateway `json:"-" xml:"-"` +} + +type metadataVpnGateway struct { + SDKShapeTraits bool `type:"structure"` +} + +// String returns the string representation +func (s VpnGateway) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s VpnGateway) GoString() string { + return s.String() +} + +// Describes a static route for a VPN connection. +type VpnStaticRoute struct { + // The CIDR block associated with the local subnet of the customer data center. + DestinationCidrBlock *string `locationName:"destinationCidrBlock" type:"string"` + + // Indicates how the routes were provided. + Source *string `locationName:"source" type:"string" enum:"VpnStaticRouteSource"` + + // The current state of the static route. + State *string `locationName:"state" type:"string" enum:"VpnState"` + + metadataVpnStaticRoute `json:"-" xml:"-"` +} + +type metadataVpnStaticRoute struct { + SDKShapeTraits bool `type:"structure"` +} + +// String returns the string representation +func (s VpnStaticRoute) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s VpnStaticRoute) GoString() string { + return s.String() +} + const ( // @enum AccountAttributeName AccountAttributeNameSupportedPlatforms = "supported-platforms" @@ -23627,6 +23830,13 @@ const ( AccountAttributeNameDefaultVpc = "default-vpc" ) +const ( + // @enum AllocationStrategy + AllocationStrategyLowestPrice = "lowestPrice" + // @enum AllocationStrategy + AllocationStrategyDiversified = "diversified" +) + const ( // @enum ArchitectureValues ArchitectureValuesI386 = "i386" @@ -23648,6 +23858,12 @@ const ( const ( // @enum AvailabilityZoneState AvailabilityZoneStateAvailable = "available" + // @enum AvailabilityZoneState + AvailabilityZoneStateInformation = "information" + // @enum AvailabilityZoneState + AvailabilityZoneStateImpaired = "impaired" + // @enum AvailabilityZoneState + AvailabilityZoneStateUnavailable = "unavailable" ) const ( @@ -23663,6 +23879,8 @@ const ( BatchStateCancelledRunning = "cancelled_running" // @enum BatchState BatchStateCancelledTerminating = "cancelled_terminating" + // @enum BatchState + BatchStateModifying = "modifying" ) const ( @@ -23779,6 +23997,13 @@ const ( EventTypeError = "error" ) +const ( + // @enum ExcessCapacityTerminationPolicy + ExcessCapacityTerminationPolicyNoTermination = "noTermination" + // @enum ExcessCapacityTerminationPolicy + ExcessCapacityTerminationPolicyDefault = "default" +) + const ( // @enum ExportEnvironment ExportEnvironmentCitrix = "citrix" @@ -24098,6 +24323,13 @@ const ( OfferingTypeValuesAllUpfront = "All Upfront" ) +const ( + // @enum OperationType + OperationTypeAdd = "add" + // @enum OperationType + OperationTypeRemove = "remove" +) + const ( // @enum PermissionGroup PermissionGroupAll = "all" diff --git a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/service/ec2/customizations.go b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/service/ec2/customizations.go index f3233e42e27..99f0820477e 100644 --- a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/service/ec2/customizations.go +++ b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/service/ec2/customizations.go @@ -3,19 +3,19 @@ package ec2 import ( "time" - "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/aws/awsutil" + "github.com/aws/aws-sdk-go/aws/request" ) func init() { - initRequest = func(r *aws.Request) { + initRequest = func(r *request.Request) { if r.Operation.Name == opCopySnapshot { // fill the PresignedURL parameter r.Handlers.Build.PushFront(fillPresignedURL) } } } -func fillPresignedURL(r *aws.Request) { +func fillPresignedURL(r *request.Request) { if !r.ParamsFilled() { return } @@ -23,7 +23,7 @@ func fillPresignedURL(r *aws.Request) { params := r.Params.(*CopySnapshotInput) // Stop if PresignedURL/DestinationRegion is set - if params.PresignedURL != nil || params.DestinationRegion != nil { + if params.PresignedUrl != nil || params.DestinationRegion != nil { return } @@ -53,5 +53,5 @@ func fillPresignedURL(r *aws.Request) { } // We have our URL, set it on params - params.PresignedURL = &url + params.PresignedUrl = &url } diff --git a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/service/ec2/customizations_test.go b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/service/ec2/customizations_test.go index 2233ba7a295..0fbd49b9a2c 100644 --- a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/service/ec2/customizations_test.go +++ b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/service/ec2/customizations_test.go @@ -6,7 +6,7 @@ import ( "testing" "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/internal/test/unit" + "github.com/aws/aws-sdk-go/awstesting/unit" "github.com/aws/aws-sdk-go/service/ec2" "github.com/stretchr/testify/assert" ) @@ -24,7 +24,7 @@ func TestCopySnapshotPresignedURL(t *testing.T) { req, _ := svc.CopySnapshotRequest(&ec2.CopySnapshotInput{ SourceRegion: aws.String("us-west-1"), - SourceSnapshotID: aws.String("snap-id"), + SourceSnapshotId: aws.String("snap-id"), }) req.Sign() diff --git a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/service/ec2/ec2iface/interface.go b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/service/ec2/ec2iface/interface.go index cf5ed743131..88a209d1608 100644 --- a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/service/ec2/ec2iface/interface.go +++ b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/service/ec2/ec2iface/interface.go @@ -4,753 +4,757 @@ package ec2iface import ( - "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/aws/request" "github.com/aws/aws-sdk-go/service/ec2" ) // EC2API is the interface type for ec2.EC2. type EC2API interface { - AcceptVPCPeeringConnectionRequest(*ec2.AcceptVPCPeeringConnectionInput) (*aws.Request, *ec2.AcceptVPCPeeringConnectionOutput) + AcceptVpcPeeringConnectionRequest(*ec2.AcceptVpcPeeringConnectionInput) (*request.Request, *ec2.AcceptVpcPeeringConnectionOutput) - AcceptVPCPeeringConnection(*ec2.AcceptVPCPeeringConnectionInput) (*ec2.AcceptVPCPeeringConnectionOutput, error) + AcceptVpcPeeringConnection(*ec2.AcceptVpcPeeringConnectionInput) (*ec2.AcceptVpcPeeringConnectionOutput, error) - AllocateAddressRequest(*ec2.AllocateAddressInput) (*aws.Request, *ec2.AllocateAddressOutput) + AllocateAddressRequest(*ec2.AllocateAddressInput) (*request.Request, *ec2.AllocateAddressOutput) AllocateAddress(*ec2.AllocateAddressInput) (*ec2.AllocateAddressOutput, error) - AssignPrivateIPAddressesRequest(*ec2.AssignPrivateIPAddressesInput) (*aws.Request, *ec2.AssignPrivateIPAddressesOutput) + AssignPrivateIpAddressesRequest(*ec2.AssignPrivateIpAddressesInput) (*request.Request, *ec2.AssignPrivateIpAddressesOutput) - AssignPrivateIPAddresses(*ec2.AssignPrivateIPAddressesInput) (*ec2.AssignPrivateIPAddressesOutput, error) + AssignPrivateIpAddresses(*ec2.AssignPrivateIpAddressesInput) (*ec2.AssignPrivateIpAddressesOutput, error) - AssociateAddressRequest(*ec2.AssociateAddressInput) (*aws.Request, *ec2.AssociateAddressOutput) + AssociateAddressRequest(*ec2.AssociateAddressInput) (*request.Request, *ec2.AssociateAddressOutput) AssociateAddress(*ec2.AssociateAddressInput) (*ec2.AssociateAddressOutput, error) - AssociateDHCPOptionsRequest(*ec2.AssociateDHCPOptionsInput) (*aws.Request, *ec2.AssociateDHCPOptionsOutput) + AssociateDhcpOptionsRequest(*ec2.AssociateDhcpOptionsInput) (*request.Request, *ec2.AssociateDhcpOptionsOutput) - AssociateDHCPOptions(*ec2.AssociateDHCPOptionsInput) (*ec2.AssociateDHCPOptionsOutput, error) + AssociateDhcpOptions(*ec2.AssociateDhcpOptionsInput) (*ec2.AssociateDhcpOptionsOutput, error) - AssociateRouteTableRequest(*ec2.AssociateRouteTableInput) (*aws.Request, *ec2.AssociateRouteTableOutput) + AssociateRouteTableRequest(*ec2.AssociateRouteTableInput) (*request.Request, *ec2.AssociateRouteTableOutput) AssociateRouteTable(*ec2.AssociateRouteTableInput) (*ec2.AssociateRouteTableOutput, error) - AttachClassicLinkVPCRequest(*ec2.AttachClassicLinkVPCInput) (*aws.Request, *ec2.AttachClassicLinkVPCOutput) + AttachClassicLinkVpcRequest(*ec2.AttachClassicLinkVpcInput) (*request.Request, *ec2.AttachClassicLinkVpcOutput) - AttachClassicLinkVPC(*ec2.AttachClassicLinkVPCInput) (*ec2.AttachClassicLinkVPCOutput, error) + AttachClassicLinkVpc(*ec2.AttachClassicLinkVpcInput) (*ec2.AttachClassicLinkVpcOutput, error) - AttachInternetGatewayRequest(*ec2.AttachInternetGatewayInput) (*aws.Request, *ec2.AttachInternetGatewayOutput) + AttachInternetGatewayRequest(*ec2.AttachInternetGatewayInput) (*request.Request, *ec2.AttachInternetGatewayOutput) AttachInternetGateway(*ec2.AttachInternetGatewayInput) (*ec2.AttachInternetGatewayOutput, error) - AttachNetworkInterfaceRequest(*ec2.AttachNetworkInterfaceInput) (*aws.Request, *ec2.AttachNetworkInterfaceOutput) + AttachNetworkInterfaceRequest(*ec2.AttachNetworkInterfaceInput) (*request.Request, *ec2.AttachNetworkInterfaceOutput) AttachNetworkInterface(*ec2.AttachNetworkInterfaceInput) (*ec2.AttachNetworkInterfaceOutput, error) - AttachVPNGatewayRequest(*ec2.AttachVPNGatewayInput) (*aws.Request, *ec2.AttachVPNGatewayOutput) - - AttachVPNGateway(*ec2.AttachVPNGatewayInput) (*ec2.AttachVPNGatewayOutput, error) - - AttachVolumeRequest(*ec2.AttachVolumeInput) (*aws.Request, *ec2.VolumeAttachment) + AttachVolumeRequest(*ec2.AttachVolumeInput) (*request.Request, *ec2.VolumeAttachment) AttachVolume(*ec2.AttachVolumeInput) (*ec2.VolumeAttachment, error) - AuthorizeSecurityGroupEgressRequest(*ec2.AuthorizeSecurityGroupEgressInput) (*aws.Request, *ec2.AuthorizeSecurityGroupEgressOutput) + AttachVpnGatewayRequest(*ec2.AttachVpnGatewayInput) (*request.Request, *ec2.AttachVpnGatewayOutput) + + AttachVpnGateway(*ec2.AttachVpnGatewayInput) (*ec2.AttachVpnGatewayOutput, error) + + AuthorizeSecurityGroupEgressRequest(*ec2.AuthorizeSecurityGroupEgressInput) (*request.Request, *ec2.AuthorizeSecurityGroupEgressOutput) AuthorizeSecurityGroupEgress(*ec2.AuthorizeSecurityGroupEgressInput) (*ec2.AuthorizeSecurityGroupEgressOutput, error) - AuthorizeSecurityGroupIngressRequest(*ec2.AuthorizeSecurityGroupIngressInput) (*aws.Request, *ec2.AuthorizeSecurityGroupIngressOutput) + AuthorizeSecurityGroupIngressRequest(*ec2.AuthorizeSecurityGroupIngressInput) (*request.Request, *ec2.AuthorizeSecurityGroupIngressOutput) AuthorizeSecurityGroupIngress(*ec2.AuthorizeSecurityGroupIngressInput) (*ec2.AuthorizeSecurityGroupIngressOutput, error) - BundleInstanceRequest(*ec2.BundleInstanceInput) (*aws.Request, *ec2.BundleInstanceOutput) + BundleInstanceRequest(*ec2.BundleInstanceInput) (*request.Request, *ec2.BundleInstanceOutput) BundleInstance(*ec2.BundleInstanceInput) (*ec2.BundleInstanceOutput, error) - CancelBundleTaskRequest(*ec2.CancelBundleTaskInput) (*aws.Request, *ec2.CancelBundleTaskOutput) + CancelBundleTaskRequest(*ec2.CancelBundleTaskInput) (*request.Request, *ec2.CancelBundleTaskOutput) CancelBundleTask(*ec2.CancelBundleTaskInput) (*ec2.CancelBundleTaskOutput, error) - CancelConversionTaskRequest(*ec2.CancelConversionTaskInput) (*aws.Request, *ec2.CancelConversionTaskOutput) + CancelConversionTaskRequest(*ec2.CancelConversionTaskInput) (*request.Request, *ec2.CancelConversionTaskOutput) CancelConversionTask(*ec2.CancelConversionTaskInput) (*ec2.CancelConversionTaskOutput, error) - CancelExportTaskRequest(*ec2.CancelExportTaskInput) (*aws.Request, *ec2.CancelExportTaskOutput) + CancelExportTaskRequest(*ec2.CancelExportTaskInput) (*request.Request, *ec2.CancelExportTaskOutput) CancelExportTask(*ec2.CancelExportTaskInput) (*ec2.CancelExportTaskOutput, error) - CancelImportTaskRequest(*ec2.CancelImportTaskInput) (*aws.Request, *ec2.CancelImportTaskOutput) + CancelImportTaskRequest(*ec2.CancelImportTaskInput) (*request.Request, *ec2.CancelImportTaskOutput) CancelImportTask(*ec2.CancelImportTaskInput) (*ec2.CancelImportTaskOutput, error) - CancelReservedInstancesListingRequest(*ec2.CancelReservedInstancesListingInput) (*aws.Request, *ec2.CancelReservedInstancesListingOutput) + CancelReservedInstancesListingRequest(*ec2.CancelReservedInstancesListingInput) (*request.Request, *ec2.CancelReservedInstancesListingOutput) CancelReservedInstancesListing(*ec2.CancelReservedInstancesListingInput) (*ec2.CancelReservedInstancesListingOutput, error) - CancelSpotFleetRequestsRequest(*ec2.CancelSpotFleetRequestsInput) (*aws.Request, *ec2.CancelSpotFleetRequestsOutput) + CancelSpotFleetRequestsRequest(*ec2.CancelSpotFleetRequestsInput) (*request.Request, *ec2.CancelSpotFleetRequestsOutput) CancelSpotFleetRequests(*ec2.CancelSpotFleetRequestsInput) (*ec2.CancelSpotFleetRequestsOutput, error) - CancelSpotInstanceRequestsRequest(*ec2.CancelSpotInstanceRequestsInput) (*aws.Request, *ec2.CancelSpotInstanceRequestsOutput) + CancelSpotInstanceRequestsRequest(*ec2.CancelSpotInstanceRequestsInput) (*request.Request, *ec2.CancelSpotInstanceRequestsOutput) CancelSpotInstanceRequests(*ec2.CancelSpotInstanceRequestsInput) (*ec2.CancelSpotInstanceRequestsOutput, error) - ConfirmProductInstanceRequest(*ec2.ConfirmProductInstanceInput) (*aws.Request, *ec2.ConfirmProductInstanceOutput) + ConfirmProductInstanceRequest(*ec2.ConfirmProductInstanceInput) (*request.Request, *ec2.ConfirmProductInstanceOutput) ConfirmProductInstance(*ec2.ConfirmProductInstanceInput) (*ec2.ConfirmProductInstanceOutput, error) - CopyImageRequest(*ec2.CopyImageInput) (*aws.Request, *ec2.CopyImageOutput) + CopyImageRequest(*ec2.CopyImageInput) (*request.Request, *ec2.CopyImageOutput) CopyImage(*ec2.CopyImageInput) (*ec2.CopyImageOutput, error) - CopySnapshotRequest(*ec2.CopySnapshotInput) (*aws.Request, *ec2.CopySnapshotOutput) + CopySnapshotRequest(*ec2.CopySnapshotInput) (*request.Request, *ec2.CopySnapshotOutput) CopySnapshot(*ec2.CopySnapshotInput) (*ec2.CopySnapshotOutput, error) - CreateCustomerGatewayRequest(*ec2.CreateCustomerGatewayInput) (*aws.Request, *ec2.CreateCustomerGatewayOutput) + CreateCustomerGatewayRequest(*ec2.CreateCustomerGatewayInput) (*request.Request, *ec2.CreateCustomerGatewayOutput) CreateCustomerGateway(*ec2.CreateCustomerGatewayInput) (*ec2.CreateCustomerGatewayOutput, error) - CreateDHCPOptionsRequest(*ec2.CreateDHCPOptionsInput) (*aws.Request, *ec2.CreateDHCPOptionsOutput) + CreateDhcpOptionsRequest(*ec2.CreateDhcpOptionsInput) (*request.Request, *ec2.CreateDhcpOptionsOutput) - CreateDHCPOptions(*ec2.CreateDHCPOptionsInput) (*ec2.CreateDHCPOptionsOutput, error) + CreateDhcpOptions(*ec2.CreateDhcpOptionsInput) (*ec2.CreateDhcpOptionsOutput, error) - CreateFlowLogsRequest(*ec2.CreateFlowLogsInput) (*aws.Request, *ec2.CreateFlowLogsOutput) + CreateFlowLogsRequest(*ec2.CreateFlowLogsInput) (*request.Request, *ec2.CreateFlowLogsOutput) CreateFlowLogs(*ec2.CreateFlowLogsInput) (*ec2.CreateFlowLogsOutput, error) - CreateImageRequest(*ec2.CreateImageInput) (*aws.Request, *ec2.CreateImageOutput) + CreateImageRequest(*ec2.CreateImageInput) (*request.Request, *ec2.CreateImageOutput) CreateImage(*ec2.CreateImageInput) (*ec2.CreateImageOutput, error) - CreateInstanceExportTaskRequest(*ec2.CreateInstanceExportTaskInput) (*aws.Request, *ec2.CreateInstanceExportTaskOutput) + CreateInstanceExportTaskRequest(*ec2.CreateInstanceExportTaskInput) (*request.Request, *ec2.CreateInstanceExportTaskOutput) CreateInstanceExportTask(*ec2.CreateInstanceExportTaskInput) (*ec2.CreateInstanceExportTaskOutput, error) - CreateInternetGatewayRequest(*ec2.CreateInternetGatewayInput) (*aws.Request, *ec2.CreateInternetGatewayOutput) + CreateInternetGatewayRequest(*ec2.CreateInternetGatewayInput) (*request.Request, *ec2.CreateInternetGatewayOutput) CreateInternetGateway(*ec2.CreateInternetGatewayInput) (*ec2.CreateInternetGatewayOutput, error) - CreateKeyPairRequest(*ec2.CreateKeyPairInput) (*aws.Request, *ec2.CreateKeyPairOutput) + CreateKeyPairRequest(*ec2.CreateKeyPairInput) (*request.Request, *ec2.CreateKeyPairOutput) CreateKeyPair(*ec2.CreateKeyPairInput) (*ec2.CreateKeyPairOutput, error) - CreateNetworkACLRequest(*ec2.CreateNetworkACLInput) (*aws.Request, *ec2.CreateNetworkACLOutput) + CreateNetworkAclRequest(*ec2.CreateNetworkAclInput) (*request.Request, *ec2.CreateNetworkAclOutput) - CreateNetworkACL(*ec2.CreateNetworkACLInput) (*ec2.CreateNetworkACLOutput, error) + CreateNetworkAcl(*ec2.CreateNetworkAclInput) (*ec2.CreateNetworkAclOutput, error) - CreateNetworkACLEntryRequest(*ec2.CreateNetworkACLEntryInput) (*aws.Request, *ec2.CreateNetworkACLEntryOutput) + CreateNetworkAclEntryRequest(*ec2.CreateNetworkAclEntryInput) (*request.Request, *ec2.CreateNetworkAclEntryOutput) - CreateNetworkACLEntry(*ec2.CreateNetworkACLEntryInput) (*ec2.CreateNetworkACLEntryOutput, error) + CreateNetworkAclEntry(*ec2.CreateNetworkAclEntryInput) (*ec2.CreateNetworkAclEntryOutput, error) - CreateNetworkInterfaceRequest(*ec2.CreateNetworkInterfaceInput) (*aws.Request, *ec2.CreateNetworkInterfaceOutput) + CreateNetworkInterfaceRequest(*ec2.CreateNetworkInterfaceInput) (*request.Request, *ec2.CreateNetworkInterfaceOutput) CreateNetworkInterface(*ec2.CreateNetworkInterfaceInput) (*ec2.CreateNetworkInterfaceOutput, error) - CreatePlacementGroupRequest(*ec2.CreatePlacementGroupInput) (*aws.Request, *ec2.CreatePlacementGroupOutput) + CreatePlacementGroupRequest(*ec2.CreatePlacementGroupInput) (*request.Request, *ec2.CreatePlacementGroupOutput) CreatePlacementGroup(*ec2.CreatePlacementGroupInput) (*ec2.CreatePlacementGroupOutput, error) - CreateReservedInstancesListingRequest(*ec2.CreateReservedInstancesListingInput) (*aws.Request, *ec2.CreateReservedInstancesListingOutput) + CreateReservedInstancesListingRequest(*ec2.CreateReservedInstancesListingInput) (*request.Request, *ec2.CreateReservedInstancesListingOutput) CreateReservedInstancesListing(*ec2.CreateReservedInstancesListingInput) (*ec2.CreateReservedInstancesListingOutput, error) - CreateRouteRequest(*ec2.CreateRouteInput) (*aws.Request, *ec2.CreateRouteOutput) + CreateRouteRequest(*ec2.CreateRouteInput) (*request.Request, *ec2.CreateRouteOutput) CreateRoute(*ec2.CreateRouteInput) (*ec2.CreateRouteOutput, error) - CreateRouteTableRequest(*ec2.CreateRouteTableInput) (*aws.Request, *ec2.CreateRouteTableOutput) + CreateRouteTableRequest(*ec2.CreateRouteTableInput) (*request.Request, *ec2.CreateRouteTableOutput) CreateRouteTable(*ec2.CreateRouteTableInput) (*ec2.CreateRouteTableOutput, error) - CreateSecurityGroupRequest(*ec2.CreateSecurityGroupInput) (*aws.Request, *ec2.CreateSecurityGroupOutput) + CreateSecurityGroupRequest(*ec2.CreateSecurityGroupInput) (*request.Request, *ec2.CreateSecurityGroupOutput) CreateSecurityGroup(*ec2.CreateSecurityGroupInput) (*ec2.CreateSecurityGroupOutput, error) - CreateSnapshotRequest(*ec2.CreateSnapshotInput) (*aws.Request, *ec2.Snapshot) + CreateSnapshotRequest(*ec2.CreateSnapshotInput) (*request.Request, *ec2.Snapshot) CreateSnapshot(*ec2.CreateSnapshotInput) (*ec2.Snapshot, error) - CreateSpotDatafeedSubscriptionRequest(*ec2.CreateSpotDatafeedSubscriptionInput) (*aws.Request, *ec2.CreateSpotDatafeedSubscriptionOutput) + CreateSpotDatafeedSubscriptionRequest(*ec2.CreateSpotDatafeedSubscriptionInput) (*request.Request, *ec2.CreateSpotDatafeedSubscriptionOutput) CreateSpotDatafeedSubscription(*ec2.CreateSpotDatafeedSubscriptionInput) (*ec2.CreateSpotDatafeedSubscriptionOutput, error) - CreateSubnetRequest(*ec2.CreateSubnetInput) (*aws.Request, *ec2.CreateSubnetOutput) + CreateSubnetRequest(*ec2.CreateSubnetInput) (*request.Request, *ec2.CreateSubnetOutput) CreateSubnet(*ec2.CreateSubnetInput) (*ec2.CreateSubnetOutput, error) - CreateTagsRequest(*ec2.CreateTagsInput) (*aws.Request, *ec2.CreateTagsOutput) + CreateTagsRequest(*ec2.CreateTagsInput) (*request.Request, *ec2.CreateTagsOutput) CreateTags(*ec2.CreateTagsInput) (*ec2.CreateTagsOutput, error) - CreateVPCRequest(*ec2.CreateVPCInput) (*aws.Request, *ec2.CreateVPCOutput) - - CreateVPC(*ec2.CreateVPCInput) (*ec2.CreateVPCOutput, error) - - CreateVPCEndpointRequest(*ec2.CreateVPCEndpointInput) (*aws.Request, *ec2.CreateVPCEndpointOutput) - - CreateVPCEndpoint(*ec2.CreateVPCEndpointInput) (*ec2.CreateVPCEndpointOutput, error) - - CreateVPCPeeringConnectionRequest(*ec2.CreateVPCPeeringConnectionInput) (*aws.Request, *ec2.CreateVPCPeeringConnectionOutput) - - CreateVPCPeeringConnection(*ec2.CreateVPCPeeringConnectionInput) (*ec2.CreateVPCPeeringConnectionOutput, error) - - CreateVPNConnectionRequest(*ec2.CreateVPNConnectionInput) (*aws.Request, *ec2.CreateVPNConnectionOutput) - - CreateVPNConnection(*ec2.CreateVPNConnectionInput) (*ec2.CreateVPNConnectionOutput, error) - - CreateVPNConnectionRouteRequest(*ec2.CreateVPNConnectionRouteInput) (*aws.Request, *ec2.CreateVPNConnectionRouteOutput) - - CreateVPNConnectionRoute(*ec2.CreateVPNConnectionRouteInput) (*ec2.CreateVPNConnectionRouteOutput, error) - - CreateVPNGatewayRequest(*ec2.CreateVPNGatewayInput) (*aws.Request, *ec2.CreateVPNGatewayOutput) - - CreateVPNGateway(*ec2.CreateVPNGatewayInput) (*ec2.CreateVPNGatewayOutput, error) - - CreateVolumeRequest(*ec2.CreateVolumeInput) (*aws.Request, *ec2.Volume) + CreateVolumeRequest(*ec2.CreateVolumeInput) (*request.Request, *ec2.Volume) CreateVolume(*ec2.CreateVolumeInput) (*ec2.Volume, error) - DeleteCustomerGatewayRequest(*ec2.DeleteCustomerGatewayInput) (*aws.Request, *ec2.DeleteCustomerGatewayOutput) + CreateVpcRequest(*ec2.CreateVpcInput) (*request.Request, *ec2.CreateVpcOutput) + + CreateVpc(*ec2.CreateVpcInput) (*ec2.CreateVpcOutput, error) + + CreateVpcEndpointRequest(*ec2.CreateVpcEndpointInput) (*request.Request, *ec2.CreateVpcEndpointOutput) + + CreateVpcEndpoint(*ec2.CreateVpcEndpointInput) (*ec2.CreateVpcEndpointOutput, error) + + CreateVpcPeeringConnectionRequest(*ec2.CreateVpcPeeringConnectionInput) (*request.Request, *ec2.CreateVpcPeeringConnectionOutput) + + CreateVpcPeeringConnection(*ec2.CreateVpcPeeringConnectionInput) (*ec2.CreateVpcPeeringConnectionOutput, error) + + CreateVpnConnectionRequest(*ec2.CreateVpnConnectionInput) (*request.Request, *ec2.CreateVpnConnectionOutput) + + CreateVpnConnection(*ec2.CreateVpnConnectionInput) (*ec2.CreateVpnConnectionOutput, error) + + CreateVpnConnectionRouteRequest(*ec2.CreateVpnConnectionRouteInput) (*request.Request, *ec2.CreateVpnConnectionRouteOutput) + + CreateVpnConnectionRoute(*ec2.CreateVpnConnectionRouteInput) (*ec2.CreateVpnConnectionRouteOutput, error) + + CreateVpnGatewayRequest(*ec2.CreateVpnGatewayInput) (*request.Request, *ec2.CreateVpnGatewayOutput) + + CreateVpnGateway(*ec2.CreateVpnGatewayInput) (*ec2.CreateVpnGatewayOutput, error) + + DeleteCustomerGatewayRequest(*ec2.DeleteCustomerGatewayInput) (*request.Request, *ec2.DeleteCustomerGatewayOutput) DeleteCustomerGateway(*ec2.DeleteCustomerGatewayInput) (*ec2.DeleteCustomerGatewayOutput, error) - DeleteDHCPOptionsRequest(*ec2.DeleteDHCPOptionsInput) (*aws.Request, *ec2.DeleteDHCPOptionsOutput) + DeleteDhcpOptionsRequest(*ec2.DeleteDhcpOptionsInput) (*request.Request, *ec2.DeleteDhcpOptionsOutput) - DeleteDHCPOptions(*ec2.DeleteDHCPOptionsInput) (*ec2.DeleteDHCPOptionsOutput, error) + DeleteDhcpOptions(*ec2.DeleteDhcpOptionsInput) (*ec2.DeleteDhcpOptionsOutput, error) - DeleteFlowLogsRequest(*ec2.DeleteFlowLogsInput) (*aws.Request, *ec2.DeleteFlowLogsOutput) + DeleteFlowLogsRequest(*ec2.DeleteFlowLogsInput) (*request.Request, *ec2.DeleteFlowLogsOutput) DeleteFlowLogs(*ec2.DeleteFlowLogsInput) (*ec2.DeleteFlowLogsOutput, error) - DeleteInternetGatewayRequest(*ec2.DeleteInternetGatewayInput) (*aws.Request, *ec2.DeleteInternetGatewayOutput) + DeleteInternetGatewayRequest(*ec2.DeleteInternetGatewayInput) (*request.Request, *ec2.DeleteInternetGatewayOutput) DeleteInternetGateway(*ec2.DeleteInternetGatewayInput) (*ec2.DeleteInternetGatewayOutput, error) - DeleteKeyPairRequest(*ec2.DeleteKeyPairInput) (*aws.Request, *ec2.DeleteKeyPairOutput) + DeleteKeyPairRequest(*ec2.DeleteKeyPairInput) (*request.Request, *ec2.DeleteKeyPairOutput) DeleteKeyPair(*ec2.DeleteKeyPairInput) (*ec2.DeleteKeyPairOutput, error) - DeleteNetworkACLRequest(*ec2.DeleteNetworkACLInput) (*aws.Request, *ec2.DeleteNetworkACLOutput) + DeleteNetworkAclRequest(*ec2.DeleteNetworkAclInput) (*request.Request, *ec2.DeleteNetworkAclOutput) - DeleteNetworkACL(*ec2.DeleteNetworkACLInput) (*ec2.DeleteNetworkACLOutput, error) + DeleteNetworkAcl(*ec2.DeleteNetworkAclInput) (*ec2.DeleteNetworkAclOutput, error) - DeleteNetworkACLEntryRequest(*ec2.DeleteNetworkACLEntryInput) (*aws.Request, *ec2.DeleteNetworkACLEntryOutput) + DeleteNetworkAclEntryRequest(*ec2.DeleteNetworkAclEntryInput) (*request.Request, *ec2.DeleteNetworkAclEntryOutput) - DeleteNetworkACLEntry(*ec2.DeleteNetworkACLEntryInput) (*ec2.DeleteNetworkACLEntryOutput, error) + DeleteNetworkAclEntry(*ec2.DeleteNetworkAclEntryInput) (*ec2.DeleteNetworkAclEntryOutput, error) - DeleteNetworkInterfaceRequest(*ec2.DeleteNetworkInterfaceInput) (*aws.Request, *ec2.DeleteNetworkInterfaceOutput) + DeleteNetworkInterfaceRequest(*ec2.DeleteNetworkInterfaceInput) (*request.Request, *ec2.DeleteNetworkInterfaceOutput) DeleteNetworkInterface(*ec2.DeleteNetworkInterfaceInput) (*ec2.DeleteNetworkInterfaceOutput, error) - DeletePlacementGroupRequest(*ec2.DeletePlacementGroupInput) (*aws.Request, *ec2.DeletePlacementGroupOutput) + DeletePlacementGroupRequest(*ec2.DeletePlacementGroupInput) (*request.Request, *ec2.DeletePlacementGroupOutput) DeletePlacementGroup(*ec2.DeletePlacementGroupInput) (*ec2.DeletePlacementGroupOutput, error) - DeleteRouteRequest(*ec2.DeleteRouteInput) (*aws.Request, *ec2.DeleteRouteOutput) + DeleteRouteRequest(*ec2.DeleteRouteInput) (*request.Request, *ec2.DeleteRouteOutput) DeleteRoute(*ec2.DeleteRouteInput) (*ec2.DeleteRouteOutput, error) - DeleteRouteTableRequest(*ec2.DeleteRouteTableInput) (*aws.Request, *ec2.DeleteRouteTableOutput) + DeleteRouteTableRequest(*ec2.DeleteRouteTableInput) (*request.Request, *ec2.DeleteRouteTableOutput) DeleteRouteTable(*ec2.DeleteRouteTableInput) (*ec2.DeleteRouteTableOutput, error) - DeleteSecurityGroupRequest(*ec2.DeleteSecurityGroupInput) (*aws.Request, *ec2.DeleteSecurityGroupOutput) + DeleteSecurityGroupRequest(*ec2.DeleteSecurityGroupInput) (*request.Request, *ec2.DeleteSecurityGroupOutput) DeleteSecurityGroup(*ec2.DeleteSecurityGroupInput) (*ec2.DeleteSecurityGroupOutput, error) - DeleteSnapshotRequest(*ec2.DeleteSnapshotInput) (*aws.Request, *ec2.DeleteSnapshotOutput) + DeleteSnapshotRequest(*ec2.DeleteSnapshotInput) (*request.Request, *ec2.DeleteSnapshotOutput) DeleteSnapshot(*ec2.DeleteSnapshotInput) (*ec2.DeleteSnapshotOutput, error) - DeleteSpotDatafeedSubscriptionRequest(*ec2.DeleteSpotDatafeedSubscriptionInput) (*aws.Request, *ec2.DeleteSpotDatafeedSubscriptionOutput) + DeleteSpotDatafeedSubscriptionRequest(*ec2.DeleteSpotDatafeedSubscriptionInput) (*request.Request, *ec2.DeleteSpotDatafeedSubscriptionOutput) DeleteSpotDatafeedSubscription(*ec2.DeleteSpotDatafeedSubscriptionInput) (*ec2.DeleteSpotDatafeedSubscriptionOutput, error) - DeleteSubnetRequest(*ec2.DeleteSubnetInput) (*aws.Request, *ec2.DeleteSubnetOutput) + DeleteSubnetRequest(*ec2.DeleteSubnetInput) (*request.Request, *ec2.DeleteSubnetOutput) DeleteSubnet(*ec2.DeleteSubnetInput) (*ec2.DeleteSubnetOutput, error) - DeleteTagsRequest(*ec2.DeleteTagsInput) (*aws.Request, *ec2.DeleteTagsOutput) + DeleteTagsRequest(*ec2.DeleteTagsInput) (*request.Request, *ec2.DeleteTagsOutput) DeleteTags(*ec2.DeleteTagsInput) (*ec2.DeleteTagsOutput, error) - DeleteVPCRequest(*ec2.DeleteVPCInput) (*aws.Request, *ec2.DeleteVPCOutput) - - DeleteVPC(*ec2.DeleteVPCInput) (*ec2.DeleteVPCOutput, error) - - DeleteVPCEndpointsRequest(*ec2.DeleteVPCEndpointsInput) (*aws.Request, *ec2.DeleteVPCEndpointsOutput) - - DeleteVPCEndpoints(*ec2.DeleteVPCEndpointsInput) (*ec2.DeleteVPCEndpointsOutput, error) - - DeleteVPCPeeringConnectionRequest(*ec2.DeleteVPCPeeringConnectionInput) (*aws.Request, *ec2.DeleteVPCPeeringConnectionOutput) - - DeleteVPCPeeringConnection(*ec2.DeleteVPCPeeringConnectionInput) (*ec2.DeleteVPCPeeringConnectionOutput, error) - - DeleteVPNConnectionRequest(*ec2.DeleteVPNConnectionInput) (*aws.Request, *ec2.DeleteVPNConnectionOutput) - - DeleteVPNConnection(*ec2.DeleteVPNConnectionInput) (*ec2.DeleteVPNConnectionOutput, error) - - DeleteVPNConnectionRouteRequest(*ec2.DeleteVPNConnectionRouteInput) (*aws.Request, *ec2.DeleteVPNConnectionRouteOutput) - - DeleteVPNConnectionRoute(*ec2.DeleteVPNConnectionRouteInput) (*ec2.DeleteVPNConnectionRouteOutput, error) - - DeleteVPNGatewayRequest(*ec2.DeleteVPNGatewayInput) (*aws.Request, *ec2.DeleteVPNGatewayOutput) - - DeleteVPNGateway(*ec2.DeleteVPNGatewayInput) (*ec2.DeleteVPNGatewayOutput, error) - - DeleteVolumeRequest(*ec2.DeleteVolumeInput) (*aws.Request, *ec2.DeleteVolumeOutput) + DeleteVolumeRequest(*ec2.DeleteVolumeInput) (*request.Request, *ec2.DeleteVolumeOutput) DeleteVolume(*ec2.DeleteVolumeInput) (*ec2.DeleteVolumeOutput, error) - DeregisterImageRequest(*ec2.DeregisterImageInput) (*aws.Request, *ec2.DeregisterImageOutput) + DeleteVpcRequest(*ec2.DeleteVpcInput) (*request.Request, *ec2.DeleteVpcOutput) + + DeleteVpc(*ec2.DeleteVpcInput) (*ec2.DeleteVpcOutput, error) + + DeleteVpcEndpointsRequest(*ec2.DeleteVpcEndpointsInput) (*request.Request, *ec2.DeleteVpcEndpointsOutput) + + DeleteVpcEndpoints(*ec2.DeleteVpcEndpointsInput) (*ec2.DeleteVpcEndpointsOutput, error) + + DeleteVpcPeeringConnectionRequest(*ec2.DeleteVpcPeeringConnectionInput) (*request.Request, *ec2.DeleteVpcPeeringConnectionOutput) + + DeleteVpcPeeringConnection(*ec2.DeleteVpcPeeringConnectionInput) (*ec2.DeleteVpcPeeringConnectionOutput, error) + + DeleteVpnConnectionRequest(*ec2.DeleteVpnConnectionInput) (*request.Request, *ec2.DeleteVpnConnectionOutput) + + DeleteVpnConnection(*ec2.DeleteVpnConnectionInput) (*ec2.DeleteVpnConnectionOutput, error) + + DeleteVpnConnectionRouteRequest(*ec2.DeleteVpnConnectionRouteInput) (*request.Request, *ec2.DeleteVpnConnectionRouteOutput) + + DeleteVpnConnectionRoute(*ec2.DeleteVpnConnectionRouteInput) (*ec2.DeleteVpnConnectionRouteOutput, error) + + DeleteVpnGatewayRequest(*ec2.DeleteVpnGatewayInput) (*request.Request, *ec2.DeleteVpnGatewayOutput) + + DeleteVpnGateway(*ec2.DeleteVpnGatewayInput) (*ec2.DeleteVpnGatewayOutput, error) + + DeregisterImageRequest(*ec2.DeregisterImageInput) (*request.Request, *ec2.DeregisterImageOutput) DeregisterImage(*ec2.DeregisterImageInput) (*ec2.DeregisterImageOutput, error) - DescribeAccountAttributesRequest(*ec2.DescribeAccountAttributesInput) (*aws.Request, *ec2.DescribeAccountAttributesOutput) + DescribeAccountAttributesRequest(*ec2.DescribeAccountAttributesInput) (*request.Request, *ec2.DescribeAccountAttributesOutput) DescribeAccountAttributes(*ec2.DescribeAccountAttributesInput) (*ec2.DescribeAccountAttributesOutput, error) - DescribeAddressesRequest(*ec2.DescribeAddressesInput) (*aws.Request, *ec2.DescribeAddressesOutput) + DescribeAddressesRequest(*ec2.DescribeAddressesInput) (*request.Request, *ec2.DescribeAddressesOutput) DescribeAddresses(*ec2.DescribeAddressesInput) (*ec2.DescribeAddressesOutput, error) - DescribeAvailabilityZonesRequest(*ec2.DescribeAvailabilityZonesInput) (*aws.Request, *ec2.DescribeAvailabilityZonesOutput) + DescribeAvailabilityZonesRequest(*ec2.DescribeAvailabilityZonesInput) (*request.Request, *ec2.DescribeAvailabilityZonesOutput) DescribeAvailabilityZones(*ec2.DescribeAvailabilityZonesInput) (*ec2.DescribeAvailabilityZonesOutput, error) - DescribeBundleTasksRequest(*ec2.DescribeBundleTasksInput) (*aws.Request, *ec2.DescribeBundleTasksOutput) + DescribeBundleTasksRequest(*ec2.DescribeBundleTasksInput) (*request.Request, *ec2.DescribeBundleTasksOutput) DescribeBundleTasks(*ec2.DescribeBundleTasksInput) (*ec2.DescribeBundleTasksOutput, error) - DescribeClassicLinkInstancesRequest(*ec2.DescribeClassicLinkInstancesInput) (*aws.Request, *ec2.DescribeClassicLinkInstancesOutput) + DescribeClassicLinkInstancesRequest(*ec2.DescribeClassicLinkInstancesInput) (*request.Request, *ec2.DescribeClassicLinkInstancesOutput) DescribeClassicLinkInstances(*ec2.DescribeClassicLinkInstancesInput) (*ec2.DescribeClassicLinkInstancesOutput, error) - DescribeConversionTasksRequest(*ec2.DescribeConversionTasksInput) (*aws.Request, *ec2.DescribeConversionTasksOutput) + DescribeConversionTasksRequest(*ec2.DescribeConversionTasksInput) (*request.Request, *ec2.DescribeConversionTasksOutput) DescribeConversionTasks(*ec2.DescribeConversionTasksInput) (*ec2.DescribeConversionTasksOutput, error) - DescribeCustomerGatewaysRequest(*ec2.DescribeCustomerGatewaysInput) (*aws.Request, *ec2.DescribeCustomerGatewaysOutput) + DescribeCustomerGatewaysRequest(*ec2.DescribeCustomerGatewaysInput) (*request.Request, *ec2.DescribeCustomerGatewaysOutput) DescribeCustomerGateways(*ec2.DescribeCustomerGatewaysInput) (*ec2.DescribeCustomerGatewaysOutput, error) - DescribeDHCPOptionsRequest(*ec2.DescribeDHCPOptionsInput) (*aws.Request, *ec2.DescribeDHCPOptionsOutput) + DescribeDhcpOptionsRequest(*ec2.DescribeDhcpOptionsInput) (*request.Request, *ec2.DescribeDhcpOptionsOutput) - DescribeDHCPOptions(*ec2.DescribeDHCPOptionsInput) (*ec2.DescribeDHCPOptionsOutput, error) + DescribeDhcpOptions(*ec2.DescribeDhcpOptionsInput) (*ec2.DescribeDhcpOptionsOutput, error) - DescribeExportTasksRequest(*ec2.DescribeExportTasksInput) (*aws.Request, *ec2.DescribeExportTasksOutput) + DescribeExportTasksRequest(*ec2.DescribeExportTasksInput) (*request.Request, *ec2.DescribeExportTasksOutput) DescribeExportTasks(*ec2.DescribeExportTasksInput) (*ec2.DescribeExportTasksOutput, error) - DescribeFlowLogsRequest(*ec2.DescribeFlowLogsInput) (*aws.Request, *ec2.DescribeFlowLogsOutput) + DescribeFlowLogsRequest(*ec2.DescribeFlowLogsInput) (*request.Request, *ec2.DescribeFlowLogsOutput) DescribeFlowLogs(*ec2.DescribeFlowLogsInput) (*ec2.DescribeFlowLogsOutput, error) - DescribeImageAttributeRequest(*ec2.DescribeImageAttributeInput) (*aws.Request, *ec2.DescribeImageAttributeOutput) + DescribeImageAttributeRequest(*ec2.DescribeImageAttributeInput) (*request.Request, *ec2.DescribeImageAttributeOutput) DescribeImageAttribute(*ec2.DescribeImageAttributeInput) (*ec2.DescribeImageAttributeOutput, error) - DescribeImagesRequest(*ec2.DescribeImagesInput) (*aws.Request, *ec2.DescribeImagesOutput) + DescribeImagesRequest(*ec2.DescribeImagesInput) (*request.Request, *ec2.DescribeImagesOutput) DescribeImages(*ec2.DescribeImagesInput) (*ec2.DescribeImagesOutput, error) - DescribeImportImageTasksRequest(*ec2.DescribeImportImageTasksInput) (*aws.Request, *ec2.DescribeImportImageTasksOutput) + DescribeImportImageTasksRequest(*ec2.DescribeImportImageTasksInput) (*request.Request, *ec2.DescribeImportImageTasksOutput) DescribeImportImageTasks(*ec2.DescribeImportImageTasksInput) (*ec2.DescribeImportImageTasksOutput, error) - DescribeImportSnapshotTasksRequest(*ec2.DescribeImportSnapshotTasksInput) (*aws.Request, *ec2.DescribeImportSnapshotTasksOutput) + DescribeImportSnapshotTasksRequest(*ec2.DescribeImportSnapshotTasksInput) (*request.Request, *ec2.DescribeImportSnapshotTasksOutput) DescribeImportSnapshotTasks(*ec2.DescribeImportSnapshotTasksInput) (*ec2.DescribeImportSnapshotTasksOutput, error) - DescribeInstanceAttributeRequest(*ec2.DescribeInstanceAttributeInput) (*aws.Request, *ec2.DescribeInstanceAttributeOutput) + DescribeInstanceAttributeRequest(*ec2.DescribeInstanceAttributeInput) (*request.Request, *ec2.DescribeInstanceAttributeOutput) DescribeInstanceAttribute(*ec2.DescribeInstanceAttributeInput) (*ec2.DescribeInstanceAttributeOutput, error) - DescribeInstanceStatusRequest(*ec2.DescribeInstanceStatusInput) (*aws.Request, *ec2.DescribeInstanceStatusOutput) + DescribeInstanceStatusRequest(*ec2.DescribeInstanceStatusInput) (*request.Request, *ec2.DescribeInstanceStatusOutput) DescribeInstanceStatus(*ec2.DescribeInstanceStatusInput) (*ec2.DescribeInstanceStatusOutput, error) DescribeInstanceStatusPages(*ec2.DescribeInstanceStatusInput, func(*ec2.DescribeInstanceStatusOutput, bool) bool) error - DescribeInstancesRequest(*ec2.DescribeInstancesInput) (*aws.Request, *ec2.DescribeInstancesOutput) + DescribeInstancesRequest(*ec2.DescribeInstancesInput) (*request.Request, *ec2.DescribeInstancesOutput) DescribeInstances(*ec2.DescribeInstancesInput) (*ec2.DescribeInstancesOutput, error) DescribeInstancesPages(*ec2.DescribeInstancesInput, func(*ec2.DescribeInstancesOutput, bool) bool) error - DescribeInternetGatewaysRequest(*ec2.DescribeInternetGatewaysInput) (*aws.Request, *ec2.DescribeInternetGatewaysOutput) + DescribeInternetGatewaysRequest(*ec2.DescribeInternetGatewaysInput) (*request.Request, *ec2.DescribeInternetGatewaysOutput) DescribeInternetGateways(*ec2.DescribeInternetGatewaysInput) (*ec2.DescribeInternetGatewaysOutput, error) - DescribeKeyPairsRequest(*ec2.DescribeKeyPairsInput) (*aws.Request, *ec2.DescribeKeyPairsOutput) + DescribeKeyPairsRequest(*ec2.DescribeKeyPairsInput) (*request.Request, *ec2.DescribeKeyPairsOutput) DescribeKeyPairs(*ec2.DescribeKeyPairsInput) (*ec2.DescribeKeyPairsOutput, error) - DescribeMovingAddressesRequest(*ec2.DescribeMovingAddressesInput) (*aws.Request, *ec2.DescribeMovingAddressesOutput) + DescribeMovingAddressesRequest(*ec2.DescribeMovingAddressesInput) (*request.Request, *ec2.DescribeMovingAddressesOutput) DescribeMovingAddresses(*ec2.DescribeMovingAddressesInput) (*ec2.DescribeMovingAddressesOutput, error) - DescribeNetworkACLsRequest(*ec2.DescribeNetworkACLsInput) (*aws.Request, *ec2.DescribeNetworkACLsOutput) + DescribeNetworkAclsRequest(*ec2.DescribeNetworkAclsInput) (*request.Request, *ec2.DescribeNetworkAclsOutput) - DescribeNetworkACLs(*ec2.DescribeNetworkACLsInput) (*ec2.DescribeNetworkACLsOutput, error) + DescribeNetworkAcls(*ec2.DescribeNetworkAclsInput) (*ec2.DescribeNetworkAclsOutput, error) - DescribeNetworkInterfaceAttributeRequest(*ec2.DescribeNetworkInterfaceAttributeInput) (*aws.Request, *ec2.DescribeNetworkInterfaceAttributeOutput) + DescribeNetworkInterfaceAttributeRequest(*ec2.DescribeNetworkInterfaceAttributeInput) (*request.Request, *ec2.DescribeNetworkInterfaceAttributeOutput) DescribeNetworkInterfaceAttribute(*ec2.DescribeNetworkInterfaceAttributeInput) (*ec2.DescribeNetworkInterfaceAttributeOutput, error) - DescribeNetworkInterfacesRequest(*ec2.DescribeNetworkInterfacesInput) (*aws.Request, *ec2.DescribeNetworkInterfacesOutput) + DescribeNetworkInterfacesRequest(*ec2.DescribeNetworkInterfacesInput) (*request.Request, *ec2.DescribeNetworkInterfacesOutput) DescribeNetworkInterfaces(*ec2.DescribeNetworkInterfacesInput) (*ec2.DescribeNetworkInterfacesOutput, error) - DescribePlacementGroupsRequest(*ec2.DescribePlacementGroupsInput) (*aws.Request, *ec2.DescribePlacementGroupsOutput) + DescribePlacementGroupsRequest(*ec2.DescribePlacementGroupsInput) (*request.Request, *ec2.DescribePlacementGroupsOutput) DescribePlacementGroups(*ec2.DescribePlacementGroupsInput) (*ec2.DescribePlacementGroupsOutput, error) - DescribePrefixListsRequest(*ec2.DescribePrefixListsInput) (*aws.Request, *ec2.DescribePrefixListsOutput) + DescribePrefixListsRequest(*ec2.DescribePrefixListsInput) (*request.Request, *ec2.DescribePrefixListsOutput) DescribePrefixLists(*ec2.DescribePrefixListsInput) (*ec2.DescribePrefixListsOutput, error) - DescribeRegionsRequest(*ec2.DescribeRegionsInput) (*aws.Request, *ec2.DescribeRegionsOutput) + DescribeRegionsRequest(*ec2.DescribeRegionsInput) (*request.Request, *ec2.DescribeRegionsOutput) DescribeRegions(*ec2.DescribeRegionsInput) (*ec2.DescribeRegionsOutput, error) - DescribeReservedInstancesRequest(*ec2.DescribeReservedInstancesInput) (*aws.Request, *ec2.DescribeReservedInstancesOutput) + DescribeReservedInstancesRequest(*ec2.DescribeReservedInstancesInput) (*request.Request, *ec2.DescribeReservedInstancesOutput) DescribeReservedInstances(*ec2.DescribeReservedInstancesInput) (*ec2.DescribeReservedInstancesOutput, error) - DescribeReservedInstancesListingsRequest(*ec2.DescribeReservedInstancesListingsInput) (*aws.Request, *ec2.DescribeReservedInstancesListingsOutput) + DescribeReservedInstancesListingsRequest(*ec2.DescribeReservedInstancesListingsInput) (*request.Request, *ec2.DescribeReservedInstancesListingsOutput) DescribeReservedInstancesListings(*ec2.DescribeReservedInstancesListingsInput) (*ec2.DescribeReservedInstancesListingsOutput, error) - DescribeReservedInstancesModificationsRequest(*ec2.DescribeReservedInstancesModificationsInput) (*aws.Request, *ec2.DescribeReservedInstancesModificationsOutput) + DescribeReservedInstancesModificationsRequest(*ec2.DescribeReservedInstancesModificationsInput) (*request.Request, *ec2.DescribeReservedInstancesModificationsOutput) DescribeReservedInstancesModifications(*ec2.DescribeReservedInstancesModificationsInput) (*ec2.DescribeReservedInstancesModificationsOutput, error) DescribeReservedInstancesModificationsPages(*ec2.DescribeReservedInstancesModificationsInput, func(*ec2.DescribeReservedInstancesModificationsOutput, bool) bool) error - DescribeReservedInstancesOfferingsRequest(*ec2.DescribeReservedInstancesOfferingsInput) (*aws.Request, *ec2.DescribeReservedInstancesOfferingsOutput) + DescribeReservedInstancesOfferingsRequest(*ec2.DescribeReservedInstancesOfferingsInput) (*request.Request, *ec2.DescribeReservedInstancesOfferingsOutput) DescribeReservedInstancesOfferings(*ec2.DescribeReservedInstancesOfferingsInput) (*ec2.DescribeReservedInstancesOfferingsOutput, error) DescribeReservedInstancesOfferingsPages(*ec2.DescribeReservedInstancesOfferingsInput, func(*ec2.DescribeReservedInstancesOfferingsOutput, bool) bool) error - DescribeRouteTablesRequest(*ec2.DescribeRouteTablesInput) (*aws.Request, *ec2.DescribeRouteTablesOutput) + DescribeRouteTablesRequest(*ec2.DescribeRouteTablesInput) (*request.Request, *ec2.DescribeRouteTablesOutput) DescribeRouteTables(*ec2.DescribeRouteTablesInput) (*ec2.DescribeRouteTablesOutput, error) - DescribeSecurityGroupsRequest(*ec2.DescribeSecurityGroupsInput) (*aws.Request, *ec2.DescribeSecurityGroupsOutput) + DescribeSecurityGroupsRequest(*ec2.DescribeSecurityGroupsInput) (*request.Request, *ec2.DescribeSecurityGroupsOutput) DescribeSecurityGroups(*ec2.DescribeSecurityGroupsInput) (*ec2.DescribeSecurityGroupsOutput, error) - DescribeSnapshotAttributeRequest(*ec2.DescribeSnapshotAttributeInput) (*aws.Request, *ec2.DescribeSnapshotAttributeOutput) + DescribeSnapshotAttributeRequest(*ec2.DescribeSnapshotAttributeInput) (*request.Request, *ec2.DescribeSnapshotAttributeOutput) DescribeSnapshotAttribute(*ec2.DescribeSnapshotAttributeInput) (*ec2.DescribeSnapshotAttributeOutput, error) - DescribeSnapshotsRequest(*ec2.DescribeSnapshotsInput) (*aws.Request, *ec2.DescribeSnapshotsOutput) + DescribeSnapshotsRequest(*ec2.DescribeSnapshotsInput) (*request.Request, *ec2.DescribeSnapshotsOutput) DescribeSnapshots(*ec2.DescribeSnapshotsInput) (*ec2.DescribeSnapshotsOutput, error) DescribeSnapshotsPages(*ec2.DescribeSnapshotsInput, func(*ec2.DescribeSnapshotsOutput, bool) bool) error - DescribeSpotDatafeedSubscriptionRequest(*ec2.DescribeSpotDatafeedSubscriptionInput) (*aws.Request, *ec2.DescribeSpotDatafeedSubscriptionOutput) + DescribeSpotDatafeedSubscriptionRequest(*ec2.DescribeSpotDatafeedSubscriptionInput) (*request.Request, *ec2.DescribeSpotDatafeedSubscriptionOutput) DescribeSpotDatafeedSubscription(*ec2.DescribeSpotDatafeedSubscriptionInput) (*ec2.DescribeSpotDatafeedSubscriptionOutput, error) - DescribeSpotFleetInstancesRequest(*ec2.DescribeSpotFleetInstancesInput) (*aws.Request, *ec2.DescribeSpotFleetInstancesOutput) + DescribeSpotFleetInstancesRequest(*ec2.DescribeSpotFleetInstancesInput) (*request.Request, *ec2.DescribeSpotFleetInstancesOutput) DescribeSpotFleetInstances(*ec2.DescribeSpotFleetInstancesInput) (*ec2.DescribeSpotFleetInstancesOutput, error) - DescribeSpotFleetRequestHistoryRequest(*ec2.DescribeSpotFleetRequestHistoryInput) (*aws.Request, *ec2.DescribeSpotFleetRequestHistoryOutput) + DescribeSpotFleetRequestHistoryRequest(*ec2.DescribeSpotFleetRequestHistoryInput) (*request.Request, *ec2.DescribeSpotFleetRequestHistoryOutput) DescribeSpotFleetRequestHistory(*ec2.DescribeSpotFleetRequestHistoryInput) (*ec2.DescribeSpotFleetRequestHistoryOutput, error) - DescribeSpotFleetRequestsRequest(*ec2.DescribeSpotFleetRequestsInput) (*aws.Request, *ec2.DescribeSpotFleetRequestsOutput) + DescribeSpotFleetRequestsRequest(*ec2.DescribeSpotFleetRequestsInput) (*request.Request, *ec2.DescribeSpotFleetRequestsOutput) DescribeSpotFleetRequests(*ec2.DescribeSpotFleetRequestsInput) (*ec2.DescribeSpotFleetRequestsOutput, error) - DescribeSpotInstanceRequestsRequest(*ec2.DescribeSpotInstanceRequestsInput) (*aws.Request, *ec2.DescribeSpotInstanceRequestsOutput) + DescribeSpotInstanceRequestsRequest(*ec2.DescribeSpotInstanceRequestsInput) (*request.Request, *ec2.DescribeSpotInstanceRequestsOutput) DescribeSpotInstanceRequests(*ec2.DescribeSpotInstanceRequestsInput) (*ec2.DescribeSpotInstanceRequestsOutput, error) - DescribeSpotPriceHistoryRequest(*ec2.DescribeSpotPriceHistoryInput) (*aws.Request, *ec2.DescribeSpotPriceHistoryOutput) + DescribeSpotPriceHistoryRequest(*ec2.DescribeSpotPriceHistoryInput) (*request.Request, *ec2.DescribeSpotPriceHistoryOutput) DescribeSpotPriceHistory(*ec2.DescribeSpotPriceHistoryInput) (*ec2.DescribeSpotPriceHistoryOutput, error) DescribeSpotPriceHistoryPages(*ec2.DescribeSpotPriceHistoryInput, func(*ec2.DescribeSpotPriceHistoryOutput, bool) bool) error - DescribeSubnetsRequest(*ec2.DescribeSubnetsInput) (*aws.Request, *ec2.DescribeSubnetsOutput) + DescribeSubnetsRequest(*ec2.DescribeSubnetsInput) (*request.Request, *ec2.DescribeSubnetsOutput) DescribeSubnets(*ec2.DescribeSubnetsInput) (*ec2.DescribeSubnetsOutput, error) - DescribeTagsRequest(*ec2.DescribeTagsInput) (*aws.Request, *ec2.DescribeTagsOutput) + DescribeTagsRequest(*ec2.DescribeTagsInput) (*request.Request, *ec2.DescribeTagsOutput) DescribeTags(*ec2.DescribeTagsInput) (*ec2.DescribeTagsOutput, error) - DescribeVPCAttributeRequest(*ec2.DescribeVPCAttributeInput) (*aws.Request, *ec2.DescribeVPCAttributeOutput) - - DescribeVPCAttribute(*ec2.DescribeVPCAttributeInput) (*ec2.DescribeVPCAttributeOutput, error) - - DescribeVPCClassicLinkRequest(*ec2.DescribeVPCClassicLinkInput) (*aws.Request, *ec2.DescribeVPCClassicLinkOutput) - - DescribeVPCClassicLink(*ec2.DescribeVPCClassicLinkInput) (*ec2.DescribeVPCClassicLinkOutput, error) - - DescribeVPCEndpointServicesRequest(*ec2.DescribeVPCEndpointServicesInput) (*aws.Request, *ec2.DescribeVPCEndpointServicesOutput) - - DescribeVPCEndpointServices(*ec2.DescribeVPCEndpointServicesInput) (*ec2.DescribeVPCEndpointServicesOutput, error) - - DescribeVPCEndpointsRequest(*ec2.DescribeVPCEndpointsInput) (*aws.Request, *ec2.DescribeVPCEndpointsOutput) - - DescribeVPCEndpoints(*ec2.DescribeVPCEndpointsInput) (*ec2.DescribeVPCEndpointsOutput, error) - - DescribeVPCPeeringConnectionsRequest(*ec2.DescribeVPCPeeringConnectionsInput) (*aws.Request, *ec2.DescribeVPCPeeringConnectionsOutput) - - DescribeVPCPeeringConnections(*ec2.DescribeVPCPeeringConnectionsInput) (*ec2.DescribeVPCPeeringConnectionsOutput, error) - - DescribeVPCsRequest(*ec2.DescribeVPCsInput) (*aws.Request, *ec2.DescribeVPCsOutput) - - DescribeVPCs(*ec2.DescribeVPCsInput) (*ec2.DescribeVPCsOutput, error) - - DescribeVPNConnectionsRequest(*ec2.DescribeVPNConnectionsInput) (*aws.Request, *ec2.DescribeVPNConnectionsOutput) - - DescribeVPNConnections(*ec2.DescribeVPNConnectionsInput) (*ec2.DescribeVPNConnectionsOutput, error) - - DescribeVPNGatewaysRequest(*ec2.DescribeVPNGatewaysInput) (*aws.Request, *ec2.DescribeVPNGatewaysOutput) - - DescribeVPNGateways(*ec2.DescribeVPNGatewaysInput) (*ec2.DescribeVPNGatewaysOutput, error) - - DescribeVolumeAttributeRequest(*ec2.DescribeVolumeAttributeInput) (*aws.Request, *ec2.DescribeVolumeAttributeOutput) + DescribeVolumeAttributeRequest(*ec2.DescribeVolumeAttributeInput) (*request.Request, *ec2.DescribeVolumeAttributeOutput) DescribeVolumeAttribute(*ec2.DescribeVolumeAttributeInput) (*ec2.DescribeVolumeAttributeOutput, error) - DescribeVolumeStatusRequest(*ec2.DescribeVolumeStatusInput) (*aws.Request, *ec2.DescribeVolumeStatusOutput) + DescribeVolumeStatusRequest(*ec2.DescribeVolumeStatusInput) (*request.Request, *ec2.DescribeVolumeStatusOutput) DescribeVolumeStatus(*ec2.DescribeVolumeStatusInput) (*ec2.DescribeVolumeStatusOutput, error) DescribeVolumeStatusPages(*ec2.DescribeVolumeStatusInput, func(*ec2.DescribeVolumeStatusOutput, bool) bool) error - DescribeVolumesRequest(*ec2.DescribeVolumesInput) (*aws.Request, *ec2.DescribeVolumesOutput) + DescribeVolumesRequest(*ec2.DescribeVolumesInput) (*request.Request, *ec2.DescribeVolumesOutput) DescribeVolumes(*ec2.DescribeVolumesInput) (*ec2.DescribeVolumesOutput, error) DescribeVolumesPages(*ec2.DescribeVolumesInput, func(*ec2.DescribeVolumesOutput, bool) bool) error - DetachClassicLinkVPCRequest(*ec2.DetachClassicLinkVPCInput) (*aws.Request, *ec2.DetachClassicLinkVPCOutput) + DescribeVpcAttributeRequest(*ec2.DescribeVpcAttributeInput) (*request.Request, *ec2.DescribeVpcAttributeOutput) - DetachClassicLinkVPC(*ec2.DetachClassicLinkVPCInput) (*ec2.DetachClassicLinkVPCOutput, error) + DescribeVpcAttribute(*ec2.DescribeVpcAttributeInput) (*ec2.DescribeVpcAttributeOutput, error) - DetachInternetGatewayRequest(*ec2.DetachInternetGatewayInput) (*aws.Request, *ec2.DetachInternetGatewayOutput) + DescribeVpcClassicLinkRequest(*ec2.DescribeVpcClassicLinkInput) (*request.Request, *ec2.DescribeVpcClassicLinkOutput) + + DescribeVpcClassicLink(*ec2.DescribeVpcClassicLinkInput) (*ec2.DescribeVpcClassicLinkOutput, error) + + DescribeVpcEndpointServicesRequest(*ec2.DescribeVpcEndpointServicesInput) (*request.Request, *ec2.DescribeVpcEndpointServicesOutput) + + DescribeVpcEndpointServices(*ec2.DescribeVpcEndpointServicesInput) (*ec2.DescribeVpcEndpointServicesOutput, error) + + DescribeVpcEndpointsRequest(*ec2.DescribeVpcEndpointsInput) (*request.Request, *ec2.DescribeVpcEndpointsOutput) + + DescribeVpcEndpoints(*ec2.DescribeVpcEndpointsInput) (*ec2.DescribeVpcEndpointsOutput, error) + + DescribeVpcPeeringConnectionsRequest(*ec2.DescribeVpcPeeringConnectionsInput) (*request.Request, *ec2.DescribeVpcPeeringConnectionsOutput) + + DescribeVpcPeeringConnections(*ec2.DescribeVpcPeeringConnectionsInput) (*ec2.DescribeVpcPeeringConnectionsOutput, error) + + DescribeVpcsRequest(*ec2.DescribeVpcsInput) (*request.Request, *ec2.DescribeVpcsOutput) + + DescribeVpcs(*ec2.DescribeVpcsInput) (*ec2.DescribeVpcsOutput, error) + + DescribeVpnConnectionsRequest(*ec2.DescribeVpnConnectionsInput) (*request.Request, *ec2.DescribeVpnConnectionsOutput) + + DescribeVpnConnections(*ec2.DescribeVpnConnectionsInput) (*ec2.DescribeVpnConnectionsOutput, error) + + DescribeVpnGatewaysRequest(*ec2.DescribeVpnGatewaysInput) (*request.Request, *ec2.DescribeVpnGatewaysOutput) + + DescribeVpnGateways(*ec2.DescribeVpnGatewaysInput) (*ec2.DescribeVpnGatewaysOutput, error) + + DetachClassicLinkVpcRequest(*ec2.DetachClassicLinkVpcInput) (*request.Request, *ec2.DetachClassicLinkVpcOutput) + + DetachClassicLinkVpc(*ec2.DetachClassicLinkVpcInput) (*ec2.DetachClassicLinkVpcOutput, error) + + DetachInternetGatewayRequest(*ec2.DetachInternetGatewayInput) (*request.Request, *ec2.DetachInternetGatewayOutput) DetachInternetGateway(*ec2.DetachInternetGatewayInput) (*ec2.DetachInternetGatewayOutput, error) - DetachNetworkInterfaceRequest(*ec2.DetachNetworkInterfaceInput) (*aws.Request, *ec2.DetachNetworkInterfaceOutput) + DetachNetworkInterfaceRequest(*ec2.DetachNetworkInterfaceInput) (*request.Request, *ec2.DetachNetworkInterfaceOutput) DetachNetworkInterface(*ec2.DetachNetworkInterfaceInput) (*ec2.DetachNetworkInterfaceOutput, error) - DetachVPNGatewayRequest(*ec2.DetachVPNGatewayInput) (*aws.Request, *ec2.DetachVPNGatewayOutput) - - DetachVPNGateway(*ec2.DetachVPNGatewayInput) (*ec2.DetachVPNGatewayOutput, error) - - DetachVolumeRequest(*ec2.DetachVolumeInput) (*aws.Request, *ec2.VolumeAttachment) + DetachVolumeRequest(*ec2.DetachVolumeInput) (*request.Request, *ec2.VolumeAttachment) DetachVolume(*ec2.DetachVolumeInput) (*ec2.VolumeAttachment, error) - DisableVGWRoutePropagationRequest(*ec2.DisableVGWRoutePropagationInput) (*aws.Request, *ec2.DisableVGWRoutePropagationOutput) + DetachVpnGatewayRequest(*ec2.DetachVpnGatewayInput) (*request.Request, *ec2.DetachVpnGatewayOutput) - DisableVGWRoutePropagation(*ec2.DisableVGWRoutePropagationInput) (*ec2.DisableVGWRoutePropagationOutput, error) + DetachVpnGateway(*ec2.DetachVpnGatewayInput) (*ec2.DetachVpnGatewayOutput, error) - DisableVPCClassicLinkRequest(*ec2.DisableVPCClassicLinkInput) (*aws.Request, *ec2.DisableVPCClassicLinkOutput) + DisableVgwRoutePropagationRequest(*ec2.DisableVgwRoutePropagationInput) (*request.Request, *ec2.DisableVgwRoutePropagationOutput) - DisableVPCClassicLink(*ec2.DisableVPCClassicLinkInput) (*ec2.DisableVPCClassicLinkOutput, error) + DisableVgwRoutePropagation(*ec2.DisableVgwRoutePropagationInput) (*ec2.DisableVgwRoutePropagationOutput, error) - DisassociateAddressRequest(*ec2.DisassociateAddressInput) (*aws.Request, *ec2.DisassociateAddressOutput) + DisableVpcClassicLinkRequest(*ec2.DisableVpcClassicLinkInput) (*request.Request, *ec2.DisableVpcClassicLinkOutput) + + DisableVpcClassicLink(*ec2.DisableVpcClassicLinkInput) (*ec2.DisableVpcClassicLinkOutput, error) + + DisassociateAddressRequest(*ec2.DisassociateAddressInput) (*request.Request, *ec2.DisassociateAddressOutput) DisassociateAddress(*ec2.DisassociateAddressInput) (*ec2.DisassociateAddressOutput, error) - DisassociateRouteTableRequest(*ec2.DisassociateRouteTableInput) (*aws.Request, *ec2.DisassociateRouteTableOutput) + DisassociateRouteTableRequest(*ec2.DisassociateRouteTableInput) (*request.Request, *ec2.DisassociateRouteTableOutput) DisassociateRouteTable(*ec2.DisassociateRouteTableInput) (*ec2.DisassociateRouteTableOutput, error) - EnableVGWRoutePropagationRequest(*ec2.EnableVGWRoutePropagationInput) (*aws.Request, *ec2.EnableVGWRoutePropagationOutput) + EnableVgwRoutePropagationRequest(*ec2.EnableVgwRoutePropagationInput) (*request.Request, *ec2.EnableVgwRoutePropagationOutput) - EnableVGWRoutePropagation(*ec2.EnableVGWRoutePropagationInput) (*ec2.EnableVGWRoutePropagationOutput, error) + EnableVgwRoutePropagation(*ec2.EnableVgwRoutePropagationInput) (*ec2.EnableVgwRoutePropagationOutput, error) - EnableVPCClassicLinkRequest(*ec2.EnableVPCClassicLinkInput) (*aws.Request, *ec2.EnableVPCClassicLinkOutput) - - EnableVPCClassicLink(*ec2.EnableVPCClassicLinkInput) (*ec2.EnableVPCClassicLinkOutput, error) - - EnableVolumeIORequest(*ec2.EnableVolumeIOInput) (*aws.Request, *ec2.EnableVolumeIOOutput) + EnableVolumeIORequest(*ec2.EnableVolumeIOInput) (*request.Request, *ec2.EnableVolumeIOOutput) EnableVolumeIO(*ec2.EnableVolumeIOInput) (*ec2.EnableVolumeIOOutput, error) - GetConsoleOutputRequest(*ec2.GetConsoleOutputInput) (*aws.Request, *ec2.GetConsoleOutputOutput) + EnableVpcClassicLinkRequest(*ec2.EnableVpcClassicLinkInput) (*request.Request, *ec2.EnableVpcClassicLinkOutput) + + EnableVpcClassicLink(*ec2.EnableVpcClassicLinkInput) (*ec2.EnableVpcClassicLinkOutput, error) + + GetConsoleOutputRequest(*ec2.GetConsoleOutputInput) (*request.Request, *ec2.GetConsoleOutputOutput) GetConsoleOutput(*ec2.GetConsoleOutputInput) (*ec2.GetConsoleOutputOutput, error) - GetPasswordDataRequest(*ec2.GetPasswordDataInput) (*aws.Request, *ec2.GetPasswordDataOutput) + GetPasswordDataRequest(*ec2.GetPasswordDataInput) (*request.Request, *ec2.GetPasswordDataOutput) GetPasswordData(*ec2.GetPasswordDataInput) (*ec2.GetPasswordDataOutput, error) - ImportImageRequest(*ec2.ImportImageInput) (*aws.Request, *ec2.ImportImageOutput) + ImportImageRequest(*ec2.ImportImageInput) (*request.Request, *ec2.ImportImageOutput) ImportImage(*ec2.ImportImageInput) (*ec2.ImportImageOutput, error) - ImportInstanceRequest(*ec2.ImportInstanceInput) (*aws.Request, *ec2.ImportInstanceOutput) + ImportInstanceRequest(*ec2.ImportInstanceInput) (*request.Request, *ec2.ImportInstanceOutput) ImportInstance(*ec2.ImportInstanceInput) (*ec2.ImportInstanceOutput, error) - ImportKeyPairRequest(*ec2.ImportKeyPairInput) (*aws.Request, *ec2.ImportKeyPairOutput) + ImportKeyPairRequest(*ec2.ImportKeyPairInput) (*request.Request, *ec2.ImportKeyPairOutput) ImportKeyPair(*ec2.ImportKeyPairInput) (*ec2.ImportKeyPairOutput, error) - ImportSnapshotRequest(*ec2.ImportSnapshotInput) (*aws.Request, *ec2.ImportSnapshotOutput) + ImportSnapshotRequest(*ec2.ImportSnapshotInput) (*request.Request, *ec2.ImportSnapshotOutput) ImportSnapshot(*ec2.ImportSnapshotInput) (*ec2.ImportSnapshotOutput, error) - ImportVolumeRequest(*ec2.ImportVolumeInput) (*aws.Request, *ec2.ImportVolumeOutput) + ImportVolumeRequest(*ec2.ImportVolumeInput) (*request.Request, *ec2.ImportVolumeOutput) ImportVolume(*ec2.ImportVolumeInput) (*ec2.ImportVolumeOutput, error) - ModifyImageAttributeRequest(*ec2.ModifyImageAttributeInput) (*aws.Request, *ec2.ModifyImageAttributeOutput) + ModifyImageAttributeRequest(*ec2.ModifyImageAttributeInput) (*request.Request, *ec2.ModifyImageAttributeOutput) ModifyImageAttribute(*ec2.ModifyImageAttributeInput) (*ec2.ModifyImageAttributeOutput, error) - ModifyInstanceAttributeRequest(*ec2.ModifyInstanceAttributeInput) (*aws.Request, *ec2.ModifyInstanceAttributeOutput) + ModifyInstanceAttributeRequest(*ec2.ModifyInstanceAttributeInput) (*request.Request, *ec2.ModifyInstanceAttributeOutput) ModifyInstanceAttribute(*ec2.ModifyInstanceAttributeInput) (*ec2.ModifyInstanceAttributeOutput, error) - ModifyNetworkInterfaceAttributeRequest(*ec2.ModifyNetworkInterfaceAttributeInput) (*aws.Request, *ec2.ModifyNetworkInterfaceAttributeOutput) + ModifyNetworkInterfaceAttributeRequest(*ec2.ModifyNetworkInterfaceAttributeInput) (*request.Request, *ec2.ModifyNetworkInterfaceAttributeOutput) ModifyNetworkInterfaceAttribute(*ec2.ModifyNetworkInterfaceAttributeInput) (*ec2.ModifyNetworkInterfaceAttributeOutput, error) - ModifyReservedInstancesRequest(*ec2.ModifyReservedInstancesInput) (*aws.Request, *ec2.ModifyReservedInstancesOutput) + ModifyReservedInstancesRequest(*ec2.ModifyReservedInstancesInput) (*request.Request, *ec2.ModifyReservedInstancesOutput) ModifyReservedInstances(*ec2.ModifyReservedInstancesInput) (*ec2.ModifyReservedInstancesOutput, error) - ModifySnapshotAttributeRequest(*ec2.ModifySnapshotAttributeInput) (*aws.Request, *ec2.ModifySnapshotAttributeOutput) + ModifySnapshotAttributeRequest(*ec2.ModifySnapshotAttributeInput) (*request.Request, *ec2.ModifySnapshotAttributeOutput) ModifySnapshotAttribute(*ec2.ModifySnapshotAttributeInput) (*ec2.ModifySnapshotAttributeOutput, error) - ModifySubnetAttributeRequest(*ec2.ModifySubnetAttributeInput) (*aws.Request, *ec2.ModifySubnetAttributeOutput) + ModifySpotFleetRequestRequest(*ec2.ModifySpotFleetRequestInput) (*request.Request, *ec2.ModifySpotFleetRequestOutput) + + ModifySpotFleetRequest(*ec2.ModifySpotFleetRequestInput) (*ec2.ModifySpotFleetRequestOutput, error) + + ModifySubnetAttributeRequest(*ec2.ModifySubnetAttributeInput) (*request.Request, *ec2.ModifySubnetAttributeOutput) ModifySubnetAttribute(*ec2.ModifySubnetAttributeInput) (*ec2.ModifySubnetAttributeOutput, error) - ModifyVPCAttributeRequest(*ec2.ModifyVPCAttributeInput) (*aws.Request, *ec2.ModifyVPCAttributeOutput) - - ModifyVPCAttribute(*ec2.ModifyVPCAttributeInput) (*ec2.ModifyVPCAttributeOutput, error) - - ModifyVPCEndpointRequest(*ec2.ModifyVPCEndpointInput) (*aws.Request, *ec2.ModifyVPCEndpointOutput) - - ModifyVPCEndpoint(*ec2.ModifyVPCEndpointInput) (*ec2.ModifyVPCEndpointOutput, error) - - ModifyVolumeAttributeRequest(*ec2.ModifyVolumeAttributeInput) (*aws.Request, *ec2.ModifyVolumeAttributeOutput) + ModifyVolumeAttributeRequest(*ec2.ModifyVolumeAttributeInput) (*request.Request, *ec2.ModifyVolumeAttributeOutput) ModifyVolumeAttribute(*ec2.ModifyVolumeAttributeInput) (*ec2.ModifyVolumeAttributeOutput, error) - MonitorInstancesRequest(*ec2.MonitorInstancesInput) (*aws.Request, *ec2.MonitorInstancesOutput) + ModifyVpcAttributeRequest(*ec2.ModifyVpcAttributeInput) (*request.Request, *ec2.ModifyVpcAttributeOutput) + + ModifyVpcAttribute(*ec2.ModifyVpcAttributeInput) (*ec2.ModifyVpcAttributeOutput, error) + + ModifyVpcEndpointRequest(*ec2.ModifyVpcEndpointInput) (*request.Request, *ec2.ModifyVpcEndpointOutput) + + ModifyVpcEndpoint(*ec2.ModifyVpcEndpointInput) (*ec2.ModifyVpcEndpointOutput, error) + + MonitorInstancesRequest(*ec2.MonitorInstancesInput) (*request.Request, *ec2.MonitorInstancesOutput) MonitorInstances(*ec2.MonitorInstancesInput) (*ec2.MonitorInstancesOutput, error) - MoveAddressToVPCRequest(*ec2.MoveAddressToVPCInput) (*aws.Request, *ec2.MoveAddressToVPCOutput) + MoveAddressToVpcRequest(*ec2.MoveAddressToVpcInput) (*request.Request, *ec2.MoveAddressToVpcOutput) - MoveAddressToVPC(*ec2.MoveAddressToVPCInput) (*ec2.MoveAddressToVPCOutput, error) + MoveAddressToVpc(*ec2.MoveAddressToVpcInput) (*ec2.MoveAddressToVpcOutput, error) - PurchaseReservedInstancesOfferingRequest(*ec2.PurchaseReservedInstancesOfferingInput) (*aws.Request, *ec2.PurchaseReservedInstancesOfferingOutput) + PurchaseReservedInstancesOfferingRequest(*ec2.PurchaseReservedInstancesOfferingInput) (*request.Request, *ec2.PurchaseReservedInstancesOfferingOutput) PurchaseReservedInstancesOffering(*ec2.PurchaseReservedInstancesOfferingInput) (*ec2.PurchaseReservedInstancesOfferingOutput, error) - RebootInstancesRequest(*ec2.RebootInstancesInput) (*aws.Request, *ec2.RebootInstancesOutput) + RebootInstancesRequest(*ec2.RebootInstancesInput) (*request.Request, *ec2.RebootInstancesOutput) RebootInstances(*ec2.RebootInstancesInput) (*ec2.RebootInstancesOutput, error) - RegisterImageRequest(*ec2.RegisterImageInput) (*aws.Request, *ec2.RegisterImageOutput) + RegisterImageRequest(*ec2.RegisterImageInput) (*request.Request, *ec2.RegisterImageOutput) RegisterImage(*ec2.RegisterImageInput) (*ec2.RegisterImageOutput, error) - RejectVPCPeeringConnectionRequest(*ec2.RejectVPCPeeringConnectionInput) (*aws.Request, *ec2.RejectVPCPeeringConnectionOutput) + RejectVpcPeeringConnectionRequest(*ec2.RejectVpcPeeringConnectionInput) (*request.Request, *ec2.RejectVpcPeeringConnectionOutput) - RejectVPCPeeringConnection(*ec2.RejectVPCPeeringConnectionInput) (*ec2.RejectVPCPeeringConnectionOutput, error) + RejectVpcPeeringConnection(*ec2.RejectVpcPeeringConnectionInput) (*ec2.RejectVpcPeeringConnectionOutput, error) - ReleaseAddressRequest(*ec2.ReleaseAddressInput) (*aws.Request, *ec2.ReleaseAddressOutput) + ReleaseAddressRequest(*ec2.ReleaseAddressInput) (*request.Request, *ec2.ReleaseAddressOutput) ReleaseAddress(*ec2.ReleaseAddressInput) (*ec2.ReleaseAddressOutput, error) - ReplaceNetworkACLAssociationRequest(*ec2.ReplaceNetworkACLAssociationInput) (*aws.Request, *ec2.ReplaceNetworkACLAssociationOutput) + ReplaceNetworkAclAssociationRequest(*ec2.ReplaceNetworkAclAssociationInput) (*request.Request, *ec2.ReplaceNetworkAclAssociationOutput) - ReplaceNetworkACLAssociation(*ec2.ReplaceNetworkACLAssociationInput) (*ec2.ReplaceNetworkACLAssociationOutput, error) + ReplaceNetworkAclAssociation(*ec2.ReplaceNetworkAclAssociationInput) (*ec2.ReplaceNetworkAclAssociationOutput, error) - ReplaceNetworkACLEntryRequest(*ec2.ReplaceNetworkACLEntryInput) (*aws.Request, *ec2.ReplaceNetworkACLEntryOutput) + ReplaceNetworkAclEntryRequest(*ec2.ReplaceNetworkAclEntryInput) (*request.Request, *ec2.ReplaceNetworkAclEntryOutput) - ReplaceNetworkACLEntry(*ec2.ReplaceNetworkACLEntryInput) (*ec2.ReplaceNetworkACLEntryOutput, error) + ReplaceNetworkAclEntry(*ec2.ReplaceNetworkAclEntryInput) (*ec2.ReplaceNetworkAclEntryOutput, error) - ReplaceRouteRequest(*ec2.ReplaceRouteInput) (*aws.Request, *ec2.ReplaceRouteOutput) + ReplaceRouteRequest(*ec2.ReplaceRouteInput) (*request.Request, *ec2.ReplaceRouteOutput) ReplaceRoute(*ec2.ReplaceRouteInput) (*ec2.ReplaceRouteOutput, error) - ReplaceRouteTableAssociationRequest(*ec2.ReplaceRouteTableAssociationInput) (*aws.Request, *ec2.ReplaceRouteTableAssociationOutput) + ReplaceRouteTableAssociationRequest(*ec2.ReplaceRouteTableAssociationInput) (*request.Request, *ec2.ReplaceRouteTableAssociationOutput) ReplaceRouteTableAssociation(*ec2.ReplaceRouteTableAssociationInput) (*ec2.ReplaceRouteTableAssociationOutput, error) - ReportInstanceStatusRequest(*ec2.ReportInstanceStatusInput) (*aws.Request, *ec2.ReportInstanceStatusOutput) + ReportInstanceStatusRequest(*ec2.ReportInstanceStatusInput) (*request.Request, *ec2.ReportInstanceStatusOutput) ReportInstanceStatus(*ec2.ReportInstanceStatusInput) (*ec2.ReportInstanceStatusOutput, error) - RequestSpotFleetRequest(*ec2.RequestSpotFleetInput) (*aws.Request, *ec2.RequestSpotFleetOutput) + RequestSpotFleetRequest(*ec2.RequestSpotFleetInput) (*request.Request, *ec2.RequestSpotFleetOutput) RequestSpotFleet(*ec2.RequestSpotFleetInput) (*ec2.RequestSpotFleetOutput, error) - RequestSpotInstancesRequest(*ec2.RequestSpotInstancesInput) (*aws.Request, *ec2.RequestSpotInstancesOutput) + RequestSpotInstancesRequest(*ec2.RequestSpotInstancesInput) (*request.Request, *ec2.RequestSpotInstancesOutput) RequestSpotInstances(*ec2.RequestSpotInstancesInput) (*ec2.RequestSpotInstancesOutput, error) - ResetImageAttributeRequest(*ec2.ResetImageAttributeInput) (*aws.Request, *ec2.ResetImageAttributeOutput) + ResetImageAttributeRequest(*ec2.ResetImageAttributeInput) (*request.Request, *ec2.ResetImageAttributeOutput) ResetImageAttribute(*ec2.ResetImageAttributeInput) (*ec2.ResetImageAttributeOutput, error) - ResetInstanceAttributeRequest(*ec2.ResetInstanceAttributeInput) (*aws.Request, *ec2.ResetInstanceAttributeOutput) + ResetInstanceAttributeRequest(*ec2.ResetInstanceAttributeInput) (*request.Request, *ec2.ResetInstanceAttributeOutput) ResetInstanceAttribute(*ec2.ResetInstanceAttributeInput) (*ec2.ResetInstanceAttributeOutput, error) - ResetNetworkInterfaceAttributeRequest(*ec2.ResetNetworkInterfaceAttributeInput) (*aws.Request, *ec2.ResetNetworkInterfaceAttributeOutput) + ResetNetworkInterfaceAttributeRequest(*ec2.ResetNetworkInterfaceAttributeInput) (*request.Request, *ec2.ResetNetworkInterfaceAttributeOutput) ResetNetworkInterfaceAttribute(*ec2.ResetNetworkInterfaceAttributeInput) (*ec2.ResetNetworkInterfaceAttributeOutput, error) - ResetSnapshotAttributeRequest(*ec2.ResetSnapshotAttributeInput) (*aws.Request, *ec2.ResetSnapshotAttributeOutput) + ResetSnapshotAttributeRequest(*ec2.ResetSnapshotAttributeInput) (*request.Request, *ec2.ResetSnapshotAttributeOutput) ResetSnapshotAttribute(*ec2.ResetSnapshotAttributeInput) (*ec2.ResetSnapshotAttributeOutput, error) - RestoreAddressToClassicRequest(*ec2.RestoreAddressToClassicInput) (*aws.Request, *ec2.RestoreAddressToClassicOutput) + RestoreAddressToClassicRequest(*ec2.RestoreAddressToClassicInput) (*request.Request, *ec2.RestoreAddressToClassicOutput) RestoreAddressToClassic(*ec2.RestoreAddressToClassicInput) (*ec2.RestoreAddressToClassicOutput, error) - RevokeSecurityGroupEgressRequest(*ec2.RevokeSecurityGroupEgressInput) (*aws.Request, *ec2.RevokeSecurityGroupEgressOutput) + RevokeSecurityGroupEgressRequest(*ec2.RevokeSecurityGroupEgressInput) (*request.Request, *ec2.RevokeSecurityGroupEgressOutput) RevokeSecurityGroupEgress(*ec2.RevokeSecurityGroupEgressInput) (*ec2.RevokeSecurityGroupEgressOutput, error) - RevokeSecurityGroupIngressRequest(*ec2.RevokeSecurityGroupIngressInput) (*aws.Request, *ec2.RevokeSecurityGroupIngressOutput) + RevokeSecurityGroupIngressRequest(*ec2.RevokeSecurityGroupIngressInput) (*request.Request, *ec2.RevokeSecurityGroupIngressOutput) RevokeSecurityGroupIngress(*ec2.RevokeSecurityGroupIngressInput) (*ec2.RevokeSecurityGroupIngressOutput, error) - RunInstancesRequest(*ec2.RunInstancesInput) (*aws.Request, *ec2.Reservation) + RunInstancesRequest(*ec2.RunInstancesInput) (*request.Request, *ec2.Reservation) RunInstances(*ec2.RunInstancesInput) (*ec2.Reservation, error) - StartInstancesRequest(*ec2.StartInstancesInput) (*aws.Request, *ec2.StartInstancesOutput) + StartInstancesRequest(*ec2.StartInstancesInput) (*request.Request, *ec2.StartInstancesOutput) StartInstances(*ec2.StartInstancesInput) (*ec2.StartInstancesOutput, error) - StopInstancesRequest(*ec2.StopInstancesInput) (*aws.Request, *ec2.StopInstancesOutput) + StopInstancesRequest(*ec2.StopInstancesInput) (*request.Request, *ec2.StopInstancesOutput) StopInstances(*ec2.StopInstancesInput) (*ec2.StopInstancesOutput, error) - TerminateInstancesRequest(*ec2.TerminateInstancesInput) (*aws.Request, *ec2.TerminateInstancesOutput) + TerminateInstancesRequest(*ec2.TerminateInstancesInput) (*request.Request, *ec2.TerminateInstancesOutput) TerminateInstances(*ec2.TerminateInstancesInput) (*ec2.TerminateInstancesOutput, error) - UnassignPrivateIPAddressesRequest(*ec2.UnassignPrivateIPAddressesInput) (*aws.Request, *ec2.UnassignPrivateIPAddressesOutput) + UnassignPrivateIpAddressesRequest(*ec2.UnassignPrivateIpAddressesInput) (*request.Request, *ec2.UnassignPrivateIpAddressesOutput) - UnassignPrivateIPAddresses(*ec2.UnassignPrivateIPAddressesInput) (*ec2.UnassignPrivateIPAddressesOutput, error) + UnassignPrivateIpAddresses(*ec2.UnassignPrivateIpAddressesInput) (*ec2.UnassignPrivateIpAddressesOutput, error) - UnmonitorInstancesRequest(*ec2.UnmonitorInstancesInput) (*aws.Request, *ec2.UnmonitorInstancesOutput) + UnmonitorInstancesRequest(*ec2.UnmonitorInstancesInput) (*request.Request, *ec2.UnmonitorInstancesOutput) UnmonitorInstances(*ec2.UnmonitorInstancesInput) (*ec2.UnmonitorInstancesOutput, error) } diff --git a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/service/ec2/examples_test.go b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/service/ec2/examples_test.go index 01840e53938..3a827ef3f23 100644 --- a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/service/ec2/examples_test.go +++ b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/service/ec2/examples_test.go @@ -8,40 +8,30 @@ import ( "time" "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/awserr" - "github.com/aws/aws-sdk-go/aws/awsutil" "github.com/aws/aws-sdk-go/service/ec2" ) var _ time.Duration var _ bytes.Buffer -func ExampleEC2_AcceptVPCPeeringConnection() { +func ExampleEC2_AcceptVpcPeeringConnection() { svc := ec2.New(nil) - params := &ec2.AcceptVPCPeeringConnectionInput{ + params := &ec2.AcceptVpcPeeringConnectionInput{ DryRun: aws.Bool(true), - VPCPeeringConnectionID: aws.String("String"), + VpcPeeringConnectionId: aws.String("String"), } - resp, err := svc.AcceptVPCPeeringConnection(params) + resp, err := svc.AcceptVpcPeeringConnection(params) if err != nil { - if awsErr, ok := err.(awserr.Error); ok { - // Generic AWS error with Code, Message, and original error (if any) - fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) - if reqErr, ok := err.(awserr.RequestFailure); ok { - // A service error occurred - fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) - } - } else { - // This case should never be hit, the SDK should always return an - // error which satisfies the awserr.Error interface. - fmt.Println(err.Error()) - } + // Print the error, cast err to awserr.Error to get the Code and + // Message from an error. + fmt.Println(err.Error()) + return } // Pretty-print the response data. - fmt.Println(awsutil.Prettify(resp)) + fmt.Println(resp) } func ExampleEC2_AllocateAddress() { @@ -54,208 +44,152 @@ func ExampleEC2_AllocateAddress() { resp, err := svc.AllocateAddress(params) if err != nil { - if awsErr, ok := err.(awserr.Error); ok { - // Generic AWS error with Code, Message, and original error (if any) - fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) - if reqErr, ok := err.(awserr.RequestFailure); ok { - // A service error occurred - fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) - } - } else { - // This case should never be hit, the SDK should always return an - // error which satisfies the awserr.Error interface. - fmt.Println(err.Error()) - } + // Print the error, cast err to awserr.Error to get the Code and + // Message from an error. + fmt.Println(err.Error()) + return } // Pretty-print the response data. - fmt.Println(awsutil.Prettify(resp)) + fmt.Println(resp) } -func ExampleEC2_AssignPrivateIPAddresses() { +func ExampleEC2_AssignPrivateIpAddresses() { svc := ec2.New(nil) - params := &ec2.AssignPrivateIPAddressesInput{ - NetworkInterfaceID: aws.String("String"), // Required + params := &ec2.AssignPrivateIpAddressesInput{ + NetworkInterfaceId: aws.String("String"), // Required AllowReassignment: aws.Bool(true), - PrivateIPAddresses: []*string{ + PrivateIpAddresses: []*string{ aws.String("String"), // Required // More values... }, - SecondaryPrivateIPAddressCount: aws.Int64(1), + SecondaryPrivateIpAddressCount: aws.Int64(1), } - resp, err := svc.AssignPrivateIPAddresses(params) + resp, err := svc.AssignPrivateIpAddresses(params) if err != nil { - if awsErr, ok := err.(awserr.Error); ok { - // Generic AWS error with Code, Message, and original error (if any) - fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) - if reqErr, ok := err.(awserr.RequestFailure); ok { - // A service error occurred - fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) - } - } else { - // This case should never be hit, the SDK should always return an - // error which satisfies the awserr.Error interface. - fmt.Println(err.Error()) - } + // Print the error, cast err to awserr.Error to get the Code and + // Message from an error. + fmt.Println(err.Error()) + return } // Pretty-print the response data. - fmt.Println(awsutil.Prettify(resp)) + fmt.Println(resp) } func ExampleEC2_AssociateAddress() { svc := ec2.New(nil) params := &ec2.AssociateAddressInput{ - AllocationID: aws.String("String"), + AllocationId: aws.String("String"), AllowReassociation: aws.Bool(true), DryRun: aws.Bool(true), - InstanceID: aws.String("String"), - NetworkInterfaceID: aws.String("String"), - PrivateIPAddress: aws.String("String"), - PublicIP: aws.String("String"), + InstanceId: aws.String("String"), + NetworkInterfaceId: aws.String("String"), + PrivateIpAddress: aws.String("String"), + PublicIp: aws.String("String"), } resp, err := svc.AssociateAddress(params) if err != nil { - if awsErr, ok := err.(awserr.Error); ok { - // Generic AWS error with Code, Message, and original error (if any) - fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) - if reqErr, ok := err.(awserr.RequestFailure); ok { - // A service error occurred - fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) - } - } else { - // This case should never be hit, the SDK should always return an - // error which satisfies the awserr.Error interface. - fmt.Println(err.Error()) - } + // Print the error, cast err to awserr.Error to get the Code and + // Message from an error. + fmt.Println(err.Error()) + return } // Pretty-print the response data. - fmt.Println(awsutil.Prettify(resp)) + fmt.Println(resp) } -func ExampleEC2_AssociateDHCPOptions() { +func ExampleEC2_AssociateDhcpOptions() { svc := ec2.New(nil) - params := &ec2.AssociateDHCPOptionsInput{ - DHCPOptionsID: aws.String("String"), // Required - VPCID: aws.String("String"), // Required + params := &ec2.AssociateDhcpOptionsInput{ + DhcpOptionsId: aws.String("String"), // Required + VpcId: aws.String("String"), // Required DryRun: aws.Bool(true), } - resp, err := svc.AssociateDHCPOptions(params) + resp, err := svc.AssociateDhcpOptions(params) if err != nil { - if awsErr, ok := err.(awserr.Error); ok { - // Generic AWS error with Code, Message, and original error (if any) - fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) - if reqErr, ok := err.(awserr.RequestFailure); ok { - // A service error occurred - fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) - } - } else { - // This case should never be hit, the SDK should always return an - // error which satisfies the awserr.Error interface. - fmt.Println(err.Error()) - } + // Print the error, cast err to awserr.Error to get the Code and + // Message from an error. + fmt.Println(err.Error()) + return } // Pretty-print the response data. - fmt.Println(awsutil.Prettify(resp)) + fmt.Println(resp) } func ExampleEC2_AssociateRouteTable() { svc := ec2.New(nil) params := &ec2.AssociateRouteTableInput{ - RouteTableID: aws.String("String"), // Required - SubnetID: aws.String("String"), // Required + RouteTableId: aws.String("String"), // Required + SubnetId: aws.String("String"), // Required DryRun: aws.Bool(true), } resp, err := svc.AssociateRouteTable(params) if err != nil { - if awsErr, ok := err.(awserr.Error); ok { - // Generic AWS error with Code, Message, and original error (if any) - fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) - if reqErr, ok := err.(awserr.RequestFailure); ok { - // A service error occurred - fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) - } - } else { - // This case should never be hit, the SDK should always return an - // error which satisfies the awserr.Error interface. - fmt.Println(err.Error()) - } + // Print the error, cast err to awserr.Error to get the Code and + // Message from an error. + fmt.Println(err.Error()) + return } // Pretty-print the response data. - fmt.Println(awsutil.Prettify(resp)) + fmt.Println(resp) } -func ExampleEC2_AttachClassicLinkVPC() { +func ExampleEC2_AttachClassicLinkVpc() { svc := ec2.New(nil) - params := &ec2.AttachClassicLinkVPCInput{ + params := &ec2.AttachClassicLinkVpcInput{ Groups: []*string{ // Required aws.String("String"), // Required // More values... }, - InstanceID: aws.String("String"), // Required - VPCID: aws.String("String"), // Required + InstanceId: aws.String("String"), // Required + VpcId: aws.String("String"), // Required DryRun: aws.Bool(true), } - resp, err := svc.AttachClassicLinkVPC(params) + resp, err := svc.AttachClassicLinkVpc(params) if err != nil { - if awsErr, ok := err.(awserr.Error); ok { - // Generic AWS error with Code, Message, and original error (if any) - fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) - if reqErr, ok := err.(awserr.RequestFailure); ok { - // A service error occurred - fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) - } - } else { - // This case should never be hit, the SDK should always return an - // error which satisfies the awserr.Error interface. - fmt.Println(err.Error()) - } + // Print the error, cast err to awserr.Error to get the Code and + // Message from an error. + fmt.Println(err.Error()) + return } // Pretty-print the response data. - fmt.Println(awsutil.Prettify(resp)) + fmt.Println(resp) } func ExampleEC2_AttachInternetGateway() { svc := ec2.New(nil) params := &ec2.AttachInternetGatewayInput{ - InternetGatewayID: aws.String("String"), // Required - VPCID: aws.String("String"), // Required + InternetGatewayId: aws.String("String"), // Required + VpcId: aws.String("String"), // Required DryRun: aws.Bool(true), } resp, err := svc.AttachInternetGateway(params) if err != nil { - if awsErr, ok := err.(awserr.Error); ok { - // Generic AWS error with Code, Message, and original error (if any) - fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) - if reqErr, ok := err.(awserr.RequestFailure); ok { - // A service error occurred - fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) - } - } else { - // This case should never be hit, the SDK should always return an - // error which satisfies the awserr.Error interface. - fmt.Println(err.Error()) - } + // Print the error, cast err to awserr.Error to get the Code and + // Message from an error. + fmt.Println(err.Error()) + return } // Pretty-print the response data. - fmt.Println(awsutil.Prettify(resp)) + fmt.Println(resp) } func ExampleEC2_AttachNetworkInterface() { @@ -263,58 +197,21 @@ func ExampleEC2_AttachNetworkInterface() { params := &ec2.AttachNetworkInterfaceInput{ DeviceIndex: aws.Int64(1), // Required - InstanceID: aws.String("String"), // Required - NetworkInterfaceID: aws.String("String"), // Required + InstanceId: aws.String("String"), // Required + NetworkInterfaceId: aws.String("String"), // Required DryRun: aws.Bool(true), } resp, err := svc.AttachNetworkInterface(params) if err != nil { - if awsErr, ok := err.(awserr.Error); ok { - // Generic AWS error with Code, Message, and original error (if any) - fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) - if reqErr, ok := err.(awserr.RequestFailure); ok { - // A service error occurred - fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) - } - } else { - // This case should never be hit, the SDK should always return an - // error which satisfies the awserr.Error interface. - fmt.Println(err.Error()) - } + // Print the error, cast err to awserr.Error to get the Code and + // Message from an error. + fmt.Println(err.Error()) + return } // Pretty-print the response data. - fmt.Println(awsutil.Prettify(resp)) -} - -func ExampleEC2_AttachVPNGateway() { - svc := ec2.New(nil) - - params := &ec2.AttachVPNGatewayInput{ - VPCID: aws.String("String"), // Required - VPNGatewayID: aws.String("String"), // Required - DryRun: aws.Bool(true), - } - resp, err := svc.AttachVPNGateway(params) - - if err != nil { - if awsErr, ok := err.(awserr.Error); ok { - // Generic AWS error with Code, Message, and original error (if any) - fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) - if reqErr, ok := err.(awserr.RequestFailure); ok { - // A service error occurred - fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) - } - } else { - // This case should never be hit, the SDK should always return an - // error which satisfies the awserr.Error interface. - fmt.Println(err.Error()) - } - } - - // Pretty-print the response data. - fmt.Println(awsutil.Prettify(resp)) + fmt.Println(resp) } func ExampleEC2_AttachVolume() { @@ -322,164 +219,161 @@ func ExampleEC2_AttachVolume() { params := &ec2.AttachVolumeInput{ Device: aws.String("String"), // Required - InstanceID: aws.String("String"), // Required - VolumeID: aws.String("String"), // Required + InstanceId: aws.String("String"), // Required + VolumeId: aws.String("String"), // Required DryRun: aws.Bool(true), } resp, err := svc.AttachVolume(params) if err != nil { - if awsErr, ok := err.(awserr.Error); ok { - // Generic AWS error with Code, Message, and original error (if any) - fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) - if reqErr, ok := err.(awserr.RequestFailure); ok { - // A service error occurred - fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) - } - } else { - // This case should never be hit, the SDK should always return an - // error which satisfies the awserr.Error interface. - fmt.Println(err.Error()) - } + // Print the error, cast err to awserr.Error to get the Code and + // Message from an error. + fmt.Println(err.Error()) + return } // Pretty-print the response data. - fmt.Println(awsutil.Prettify(resp)) + fmt.Println(resp) +} + +func ExampleEC2_AttachVpnGateway() { + svc := ec2.New(nil) + + params := &ec2.AttachVpnGatewayInput{ + VpcId: aws.String("String"), // Required + VpnGatewayId: aws.String("String"), // Required + DryRun: aws.Bool(true), + } + resp, err := svc.AttachVpnGateway(params) + + if err != nil { + // Print the error, cast err to awserr.Error to get the Code and + // Message from an error. + fmt.Println(err.Error()) + return + } + + // Pretty-print the response data. + fmt.Println(resp) } func ExampleEC2_AuthorizeSecurityGroupEgress() { svc := ec2.New(nil) params := &ec2.AuthorizeSecurityGroupEgressInput{ - GroupID: aws.String("String"), // Required - CIDRIP: aws.String("String"), + GroupId: aws.String("String"), // Required + CidrIp: aws.String("String"), DryRun: aws.Bool(true), FromPort: aws.Int64(1), - IPPermissions: []*ec2.IPPermission{ + IpPermissions: []*ec2.IpPermission{ { // Required FromPort: aws.Int64(1), - IPProtocol: aws.String("String"), - IPRanges: []*ec2.IPRange{ + IpProtocol: aws.String("String"), + IpRanges: []*ec2.IpRange{ { // Required - CIDRIP: aws.String("String"), + CidrIp: aws.String("String"), }, // More values... }, - PrefixListIDs: []*ec2.PrefixListID{ + PrefixListIds: []*ec2.PrefixListId{ { // Required - PrefixListID: aws.String("String"), + PrefixListId: aws.String("String"), }, // More values... }, ToPort: aws.Int64(1), - UserIDGroupPairs: []*ec2.UserIDGroupPair{ + UserIdGroupPairs: []*ec2.UserIdGroupPair{ { // Required - GroupID: aws.String("String"), + GroupId: aws.String("String"), GroupName: aws.String("String"), - UserID: aws.String("String"), + UserId: aws.String("String"), }, // More values... }, }, // More values... }, - IPProtocol: aws.String("String"), + IpProtocol: aws.String("String"), SourceSecurityGroupName: aws.String("String"), - SourceSecurityGroupOwnerID: aws.String("String"), + SourceSecurityGroupOwnerId: aws.String("String"), ToPort: aws.Int64(1), } resp, err := svc.AuthorizeSecurityGroupEgress(params) if err != nil { - if awsErr, ok := err.(awserr.Error); ok { - // Generic AWS error with Code, Message, and original error (if any) - fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) - if reqErr, ok := err.(awserr.RequestFailure); ok { - // A service error occurred - fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) - } - } else { - // This case should never be hit, the SDK should always return an - // error which satisfies the awserr.Error interface. - fmt.Println(err.Error()) - } + // Print the error, cast err to awserr.Error to get the Code and + // Message from an error. + fmt.Println(err.Error()) + return } // Pretty-print the response data. - fmt.Println(awsutil.Prettify(resp)) + fmt.Println(resp) } func ExampleEC2_AuthorizeSecurityGroupIngress() { svc := ec2.New(nil) params := &ec2.AuthorizeSecurityGroupIngressInput{ - CIDRIP: aws.String("String"), + CidrIp: aws.String("String"), DryRun: aws.Bool(true), FromPort: aws.Int64(1), - GroupID: aws.String("String"), + GroupId: aws.String("String"), GroupName: aws.String("String"), - IPPermissions: []*ec2.IPPermission{ + IpPermissions: []*ec2.IpPermission{ { // Required FromPort: aws.Int64(1), - IPProtocol: aws.String("String"), - IPRanges: []*ec2.IPRange{ + IpProtocol: aws.String("String"), + IpRanges: []*ec2.IpRange{ { // Required - CIDRIP: aws.String("String"), + CidrIp: aws.String("String"), }, // More values... }, - PrefixListIDs: []*ec2.PrefixListID{ + PrefixListIds: []*ec2.PrefixListId{ { // Required - PrefixListID: aws.String("String"), + PrefixListId: aws.String("String"), }, // More values... }, ToPort: aws.Int64(1), - UserIDGroupPairs: []*ec2.UserIDGroupPair{ + UserIdGroupPairs: []*ec2.UserIdGroupPair{ { // Required - GroupID: aws.String("String"), + GroupId: aws.String("String"), GroupName: aws.String("String"), - UserID: aws.String("String"), + UserId: aws.String("String"), }, // More values... }, }, // More values... }, - IPProtocol: aws.String("String"), + IpProtocol: aws.String("String"), SourceSecurityGroupName: aws.String("String"), - SourceSecurityGroupOwnerID: aws.String("String"), + SourceSecurityGroupOwnerId: aws.String("String"), ToPort: aws.Int64(1), } resp, err := svc.AuthorizeSecurityGroupIngress(params) if err != nil { - if awsErr, ok := err.(awserr.Error); ok { - // Generic AWS error with Code, Message, and original error (if any) - fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) - if reqErr, ok := err.(awserr.RequestFailure); ok { - // A service error occurred - fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) - } - } else { - // This case should never be hit, the SDK should always return an - // error which satisfies the awserr.Error interface. - fmt.Println(err.Error()) - } + // Print the error, cast err to awserr.Error to get the Code and + // Message from an error. + fmt.Println(err.Error()) + return } // Pretty-print the response data. - fmt.Println(awsutil.Prettify(resp)) + fmt.Println(resp) } func ExampleEC2_BundleInstance() { svc := ec2.New(nil) params := &ec2.BundleInstanceInput{ - InstanceID: aws.String("String"), // Required + InstanceId: aws.String("String"), // Required Storage: &ec2.Storage{ // Required S3: &ec2.S3Storage{ - AWSAccessKeyID: aws.String("String"), + AWSAccessKeyId: aws.String("String"), Bucket: aws.String("String"), Prefix: aws.String("String"), UploadPolicy: []byte("PAYLOAD"), @@ -491,106 +385,74 @@ func ExampleEC2_BundleInstance() { resp, err := svc.BundleInstance(params) if err != nil { - if awsErr, ok := err.(awserr.Error); ok { - // Generic AWS error with Code, Message, and original error (if any) - fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) - if reqErr, ok := err.(awserr.RequestFailure); ok { - // A service error occurred - fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) - } - } else { - // This case should never be hit, the SDK should always return an - // error which satisfies the awserr.Error interface. - fmt.Println(err.Error()) - } + // Print the error, cast err to awserr.Error to get the Code and + // Message from an error. + fmt.Println(err.Error()) + return } // Pretty-print the response data. - fmt.Println(awsutil.Prettify(resp)) + fmt.Println(resp) } func ExampleEC2_CancelBundleTask() { svc := ec2.New(nil) params := &ec2.CancelBundleTaskInput{ - BundleID: aws.String("String"), // Required + BundleId: aws.String("String"), // Required DryRun: aws.Bool(true), } resp, err := svc.CancelBundleTask(params) if err != nil { - if awsErr, ok := err.(awserr.Error); ok { - // Generic AWS error with Code, Message, and original error (if any) - fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) - if reqErr, ok := err.(awserr.RequestFailure); ok { - // A service error occurred - fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) - } - } else { - // This case should never be hit, the SDK should always return an - // error which satisfies the awserr.Error interface. - fmt.Println(err.Error()) - } + // Print the error, cast err to awserr.Error to get the Code and + // Message from an error. + fmt.Println(err.Error()) + return } // Pretty-print the response data. - fmt.Println(awsutil.Prettify(resp)) + fmt.Println(resp) } func ExampleEC2_CancelConversionTask() { svc := ec2.New(nil) params := &ec2.CancelConversionTaskInput{ - ConversionTaskID: aws.String("String"), // Required + ConversionTaskId: aws.String("String"), // Required DryRun: aws.Bool(true), ReasonMessage: aws.String("String"), } resp, err := svc.CancelConversionTask(params) if err != nil { - if awsErr, ok := err.(awserr.Error); ok { - // Generic AWS error with Code, Message, and original error (if any) - fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) - if reqErr, ok := err.(awserr.RequestFailure); ok { - // A service error occurred - fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) - } - } else { - // This case should never be hit, the SDK should always return an - // error which satisfies the awserr.Error interface. - fmt.Println(err.Error()) - } + // Print the error, cast err to awserr.Error to get the Code and + // Message from an error. + fmt.Println(err.Error()) + return } // Pretty-print the response data. - fmt.Println(awsutil.Prettify(resp)) + fmt.Println(resp) } func ExampleEC2_CancelExportTask() { svc := ec2.New(nil) params := &ec2.CancelExportTaskInput{ - ExportTaskID: aws.String("String"), // Required + ExportTaskId: aws.String("String"), // Required } resp, err := svc.CancelExportTask(params) if err != nil { - if awsErr, ok := err.(awserr.Error); ok { - // Generic AWS error with Code, Message, and original error (if any) - fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) - if reqErr, ok := err.(awserr.RequestFailure); ok { - // A service error occurred - fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) - } - } else { - // This case should never be hit, the SDK should always return an - // error which satisfies the awserr.Error interface. - fmt.Println(err.Error()) - } + // Print the error, cast err to awserr.Error to get the Code and + // Message from an error. + fmt.Println(err.Error()) + return } // Pretty-print the response data. - fmt.Println(awsutil.Prettify(resp)) + fmt.Println(resp) } func ExampleEC2_CancelImportTask() { @@ -599,61 +461,45 @@ func ExampleEC2_CancelImportTask() { params := &ec2.CancelImportTaskInput{ CancelReason: aws.String("String"), DryRun: aws.Bool(true), - ImportTaskID: aws.String("String"), + ImportTaskId: aws.String("String"), } resp, err := svc.CancelImportTask(params) if err != nil { - if awsErr, ok := err.(awserr.Error); ok { - // Generic AWS error with Code, Message, and original error (if any) - fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) - if reqErr, ok := err.(awserr.RequestFailure); ok { - // A service error occurred - fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) - } - } else { - // This case should never be hit, the SDK should always return an - // error which satisfies the awserr.Error interface. - fmt.Println(err.Error()) - } + // Print the error, cast err to awserr.Error to get the Code and + // Message from an error. + fmt.Println(err.Error()) + return } // Pretty-print the response data. - fmt.Println(awsutil.Prettify(resp)) + fmt.Println(resp) } func ExampleEC2_CancelReservedInstancesListing() { svc := ec2.New(nil) params := &ec2.CancelReservedInstancesListingInput{ - ReservedInstancesListingID: aws.String("String"), // Required + ReservedInstancesListingId: aws.String("String"), // Required } resp, err := svc.CancelReservedInstancesListing(params) if err != nil { - if awsErr, ok := err.(awserr.Error); ok { - // Generic AWS error with Code, Message, and original error (if any) - fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) - if reqErr, ok := err.(awserr.RequestFailure); ok { - // A service error occurred - fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) - } - } else { - // This case should never be hit, the SDK should always return an - // error which satisfies the awserr.Error interface. - fmt.Println(err.Error()) - } + // Print the error, cast err to awserr.Error to get the Code and + // Message from an error. + fmt.Println(err.Error()) + return } // Pretty-print the response data. - fmt.Println(awsutil.Prettify(resp)) + fmt.Println(resp) } func ExampleEC2_CancelSpotFleetRequests() { svc := ec2.New(nil) params := &ec2.CancelSpotFleetRequestsInput{ - SpotFleetRequestIDs: []*string{ // Required + SpotFleetRequestIds: []*string{ // Required aws.String("String"), // Required // More values... }, @@ -663,29 +509,21 @@ func ExampleEC2_CancelSpotFleetRequests() { resp, err := svc.CancelSpotFleetRequests(params) if err != nil { - if awsErr, ok := err.(awserr.Error); ok { - // Generic AWS error with Code, Message, and original error (if any) - fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) - if reqErr, ok := err.(awserr.RequestFailure); ok { - // A service error occurred - fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) - } - } else { - // This case should never be hit, the SDK should always return an - // error which satisfies the awserr.Error interface. - fmt.Println(err.Error()) - } + // Print the error, cast err to awserr.Error to get the Code and + // Message from an error. + fmt.Println(err.Error()) + return } // Pretty-print the response data. - fmt.Println(awsutil.Prettify(resp)) + fmt.Println(resp) } func ExampleEC2_CancelSpotInstanceRequests() { svc := ec2.New(nil) params := &ec2.CancelSpotInstanceRequestsInput{ - SpotInstanceRequestIDs: []*string{ // Required + SpotInstanceRequestIds: []*string{ // Required aws.String("String"), // Required // More values... }, @@ -694,51 +532,35 @@ func ExampleEC2_CancelSpotInstanceRequests() { resp, err := svc.CancelSpotInstanceRequests(params) if err != nil { - if awsErr, ok := err.(awserr.Error); ok { - // Generic AWS error with Code, Message, and original error (if any) - fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) - if reqErr, ok := err.(awserr.RequestFailure); ok { - // A service error occurred - fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) - } - } else { - // This case should never be hit, the SDK should always return an - // error which satisfies the awserr.Error interface. - fmt.Println(err.Error()) - } + // Print the error, cast err to awserr.Error to get the Code and + // Message from an error. + fmt.Println(err.Error()) + return } // Pretty-print the response data. - fmt.Println(awsutil.Prettify(resp)) + fmt.Println(resp) } func ExampleEC2_ConfirmProductInstance() { svc := ec2.New(nil) params := &ec2.ConfirmProductInstanceInput{ - InstanceID: aws.String("String"), // Required + InstanceId: aws.String("String"), // Required ProductCode: aws.String("String"), // Required DryRun: aws.Bool(true), } resp, err := svc.ConfirmProductInstance(params) if err != nil { - if awsErr, ok := err.(awserr.Error); ok { - // Generic AWS error with Code, Message, and original error (if any) - fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) - if reqErr, ok := err.(awserr.RequestFailure); ok { - // A service error occurred - fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) - } - } else { - // This case should never be hit, the SDK should always return an - // error which satisfies the awserr.Error interface. - fmt.Println(err.Error()) - } + // Print the error, cast err to awserr.Error to get the Code and + // Message from an error. + fmt.Println(err.Error()) + return } // Pretty-print the response data. - fmt.Println(awsutil.Prettify(resp)) + fmt.Println(resp) } func ExampleEC2_CopyImage() { @@ -746,7 +568,7 @@ func ExampleEC2_CopyImage() { params := &ec2.CopyImageInput{ Name: aws.String("String"), // Required - SourceImageID: aws.String("String"), // Required + SourceImageId: aws.String("String"), // Required SourceRegion: aws.String("String"), // Required ClientToken: aws.String("String"), Description: aws.String("String"), @@ -755,22 +577,14 @@ func ExampleEC2_CopyImage() { resp, err := svc.CopyImage(params) if err != nil { - if awsErr, ok := err.(awserr.Error); ok { - // Generic AWS error with Code, Message, and original error (if any) - fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) - if reqErr, ok := err.(awserr.RequestFailure); ok { - // A service error occurred - fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) - } - } else { - // This case should never be hit, the SDK should always return an - // error which satisfies the awserr.Error interface. - fmt.Println(err.Error()) - } + // Print the error, cast err to awserr.Error to get the Code and + // Message from an error. + fmt.Println(err.Error()) + return } // Pretty-print the response data. - fmt.Println(awsutil.Prettify(resp)) + fmt.Println(resp) } func ExampleEC2_CopySnapshot() { @@ -778,70 +592,54 @@ func ExampleEC2_CopySnapshot() { params := &ec2.CopySnapshotInput{ SourceRegion: aws.String("String"), // Required - SourceSnapshotID: aws.String("String"), // Required + SourceSnapshotId: aws.String("String"), // Required Description: aws.String("String"), DestinationRegion: aws.String("String"), DryRun: aws.Bool(true), Encrypted: aws.Bool(true), - KMSKeyID: aws.String("String"), - PresignedURL: aws.String("String"), + KmsKeyId: aws.String("String"), + PresignedUrl: aws.String("String"), } resp, err := svc.CopySnapshot(params) if err != nil { - if awsErr, ok := err.(awserr.Error); ok { - // Generic AWS error with Code, Message, and original error (if any) - fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) - if reqErr, ok := err.(awserr.RequestFailure); ok { - // A service error occurred - fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) - } - } else { - // This case should never be hit, the SDK should always return an - // error which satisfies the awserr.Error interface. - fmt.Println(err.Error()) - } + // Print the error, cast err to awserr.Error to get the Code and + // Message from an error. + fmt.Println(err.Error()) + return } // Pretty-print the response data. - fmt.Println(awsutil.Prettify(resp)) + fmt.Println(resp) } func ExampleEC2_CreateCustomerGateway() { svc := ec2.New(nil) params := &ec2.CreateCustomerGatewayInput{ - BGPASN: aws.Int64(1), // Required - PublicIP: aws.String("String"), // Required + BgpAsn: aws.Int64(1), // Required + PublicIp: aws.String("String"), // Required Type: aws.String("GatewayType"), // Required DryRun: aws.Bool(true), } resp, err := svc.CreateCustomerGateway(params) if err != nil { - if awsErr, ok := err.(awserr.Error); ok { - // Generic AWS error with Code, Message, and original error (if any) - fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) - if reqErr, ok := err.(awserr.RequestFailure); ok { - // A service error occurred - fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) - } - } else { - // This case should never be hit, the SDK should always return an - // error which satisfies the awserr.Error interface. - fmt.Println(err.Error()) - } + // Print the error, cast err to awserr.Error to get the Code and + // Message from an error. + fmt.Println(err.Error()) + return } // Pretty-print the response data. - fmt.Println(awsutil.Prettify(resp)) + fmt.Println(resp) } -func ExampleEC2_CreateDHCPOptions() { +func ExampleEC2_CreateDhcpOptions() { svc := ec2.New(nil) - params := &ec2.CreateDHCPOptionsInput{ - DHCPConfigurations: []*ec2.NewDHCPConfiguration{ // Required + params := &ec2.CreateDhcpOptionsInput{ + DhcpConfigurations: []*ec2.NewDhcpConfiguration{ // Required { // Required Key: aws.String("String"), Values: []*string{ @@ -853,34 +651,26 @@ func ExampleEC2_CreateDHCPOptions() { }, DryRun: aws.Bool(true), } - resp, err := svc.CreateDHCPOptions(params) + resp, err := svc.CreateDhcpOptions(params) if err != nil { - if awsErr, ok := err.(awserr.Error); ok { - // Generic AWS error with Code, Message, and original error (if any) - fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) - if reqErr, ok := err.(awserr.RequestFailure); ok { - // A service error occurred - fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) - } - } else { - // This case should never be hit, the SDK should always return an - // error which satisfies the awserr.Error interface. - fmt.Println(err.Error()) - } + // Print the error, cast err to awserr.Error to get the Code and + // Message from an error. + fmt.Println(err.Error()) + return } // Pretty-print the response data. - fmt.Println(awsutil.Prettify(resp)) + fmt.Println(resp) } func ExampleEC2_CreateFlowLogs() { svc := ec2.New(nil) params := &ec2.CreateFlowLogsInput{ - DeliverLogsPermissionARN: aws.String("String"), // Required + DeliverLogsPermissionArn: aws.String("String"), // Required LogGroupName: aws.String("String"), // Required - ResourceIDs: []*string{ // Required + ResourceIds: []*string{ // Required aws.String("String"), // Required // More values... }, @@ -891,38 +681,30 @@ func ExampleEC2_CreateFlowLogs() { resp, err := svc.CreateFlowLogs(params) if err != nil { - if awsErr, ok := err.(awserr.Error); ok { - // Generic AWS error with Code, Message, and original error (if any) - fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) - if reqErr, ok := err.(awserr.RequestFailure); ok { - // A service error occurred - fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) - } - } else { - // This case should never be hit, the SDK should always return an - // error which satisfies the awserr.Error interface. - fmt.Println(err.Error()) - } + // Print the error, cast err to awserr.Error to get the Code and + // Message from an error. + fmt.Println(err.Error()) + return } // Pretty-print the response data. - fmt.Println(awsutil.Prettify(resp)) + fmt.Println(resp) } func ExampleEC2_CreateImage() { svc := ec2.New(nil) params := &ec2.CreateImageInput{ - InstanceID: aws.String("String"), // Required + InstanceId: aws.String("String"), // Required Name: aws.String("String"), // Required BlockDeviceMappings: []*ec2.BlockDeviceMapping{ { // Required DeviceName: aws.String("String"), - EBS: &ec2.EBSBlockDevice{ + Ebs: &ec2.EbsBlockDevice{ DeleteOnTermination: aws.Bool(true), Encrypted: aws.Bool(true), - IOPS: aws.Int64(1), - SnapshotID: aws.String("String"), + Iops: aws.Int64(1), + SnapshotId: aws.String("String"), VolumeSize: aws.Int64(1), VolumeType: aws.String("VolumeType"), }, @@ -938,29 +720,21 @@ func ExampleEC2_CreateImage() { resp, err := svc.CreateImage(params) if err != nil { - if awsErr, ok := err.(awserr.Error); ok { - // Generic AWS error with Code, Message, and original error (if any) - fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) - if reqErr, ok := err.(awserr.RequestFailure); ok { - // A service error occurred - fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) - } - } else { - // This case should never be hit, the SDK should always return an - // error which satisfies the awserr.Error interface. - fmt.Println(err.Error()) - } + // Print the error, cast err to awserr.Error to get the Code and + // Message from an error. + fmt.Println(err.Error()) + return } // Pretty-print the response data. - fmt.Println(awsutil.Prettify(resp)) + fmt.Println(resp) } func ExampleEC2_CreateInstanceExportTask() { svc := ec2.New(nil) params := &ec2.CreateInstanceExportTaskInput{ - InstanceID: aws.String("String"), // Required + InstanceId: aws.String("String"), // Required Description: aws.String("String"), ExportToS3Task: &ec2.ExportToS3TaskSpecification{ ContainerFormat: aws.String("ContainerFormat"), @@ -973,22 +747,14 @@ func ExampleEC2_CreateInstanceExportTask() { resp, err := svc.CreateInstanceExportTask(params) if err != nil { - if awsErr, ok := err.(awserr.Error); ok { - // Generic AWS error with Code, Message, and original error (if any) - fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) - if reqErr, ok := err.(awserr.RequestFailure); ok { - // A service error occurred - fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) - } - } else { - // This case should never be hit, the SDK should always return an - // error which satisfies the awserr.Error interface. - fmt.Println(err.Error()) - } + // Print the error, cast err to awserr.Error to get the Code and + // Message from an error. + fmt.Println(err.Error()) + return } // Pretty-print the response data. - fmt.Println(awsutil.Prettify(resp)) + fmt.Println(resp) } func ExampleEC2_CreateInternetGateway() { @@ -1000,22 +766,14 @@ func ExampleEC2_CreateInternetGateway() { resp, err := svc.CreateInternetGateway(params) if err != nil { - if awsErr, ok := err.(awserr.Error); ok { - // Generic AWS error with Code, Message, and original error (if any) - fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) - if reqErr, ok := err.(awserr.RequestFailure); ok { - // A service error occurred - fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) - } - } else { - // This case should never be hit, the SDK should always return an - // error which satisfies the awserr.Error interface. - fmt.Println(err.Error()) - } + // Print the error, cast err to awserr.Error to get the Code and + // Message from an error. + fmt.Println(err.Error()) + return } // Pretty-print the response data. - fmt.Println(awsutil.Prettify(resp)) + fmt.Println(resp) } func ExampleEC2_CreateKeyPair() { @@ -1028,64 +786,48 @@ func ExampleEC2_CreateKeyPair() { resp, err := svc.CreateKeyPair(params) if err != nil { - if awsErr, ok := err.(awserr.Error); ok { - // Generic AWS error with Code, Message, and original error (if any) - fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) - if reqErr, ok := err.(awserr.RequestFailure); ok { - // A service error occurred - fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) - } - } else { - // This case should never be hit, the SDK should always return an - // error which satisfies the awserr.Error interface. - fmt.Println(err.Error()) - } + // Print the error, cast err to awserr.Error to get the Code and + // Message from an error. + fmt.Println(err.Error()) + return } // Pretty-print the response data. - fmt.Println(awsutil.Prettify(resp)) + fmt.Println(resp) } -func ExampleEC2_CreateNetworkACL() { +func ExampleEC2_CreateNetworkAcl() { svc := ec2.New(nil) - params := &ec2.CreateNetworkACLInput{ - VPCID: aws.String("String"), // Required + params := &ec2.CreateNetworkAclInput{ + VpcId: aws.String("String"), // Required DryRun: aws.Bool(true), } - resp, err := svc.CreateNetworkACL(params) + resp, err := svc.CreateNetworkAcl(params) if err != nil { - if awsErr, ok := err.(awserr.Error); ok { - // Generic AWS error with Code, Message, and original error (if any) - fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) - if reqErr, ok := err.(awserr.RequestFailure); ok { - // A service error occurred - fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) - } - } else { - // This case should never be hit, the SDK should always return an - // error which satisfies the awserr.Error interface. - fmt.Println(err.Error()) - } + // Print the error, cast err to awserr.Error to get the Code and + // Message from an error. + fmt.Println(err.Error()) + return } // Pretty-print the response data. - fmt.Println(awsutil.Prettify(resp)) + fmt.Println(resp) } -func ExampleEC2_CreateNetworkACLEntry() { +func ExampleEC2_CreateNetworkAclEntry() { svc := ec2.New(nil) - params := &ec2.CreateNetworkACLEntryInput{ - CIDRBlock: aws.String("String"), // Required + params := &ec2.CreateNetworkAclEntryInput{ + CidrBlock: aws.String("String"), // Required Egress: aws.Bool(true), // Required - NetworkACLID: aws.String("String"), // Required + NetworkAclId: aws.String("String"), // Required Protocol: aws.String("String"), // Required RuleAction: aws.String("RuleAction"), // Required RuleNumber: aws.Int64(1), // Required DryRun: aws.Bool(true), - ICMPTypeCode: &ec2.ICMPTypeCode{ + IcmpTypeCode: &ec2.IcmpTypeCode{ Code: aws.Int64(1), Type: aws.Int64(1), }, @@ -1094,67 +836,51 @@ func ExampleEC2_CreateNetworkACLEntry() { To: aws.Int64(1), }, } - resp, err := svc.CreateNetworkACLEntry(params) + resp, err := svc.CreateNetworkAclEntry(params) if err != nil { - if awsErr, ok := err.(awserr.Error); ok { - // Generic AWS error with Code, Message, and original error (if any) - fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) - if reqErr, ok := err.(awserr.RequestFailure); ok { - // A service error occurred - fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) - } - } else { - // This case should never be hit, the SDK should always return an - // error which satisfies the awserr.Error interface. - fmt.Println(err.Error()) - } + // Print the error, cast err to awserr.Error to get the Code and + // Message from an error. + fmt.Println(err.Error()) + return } // Pretty-print the response data. - fmt.Println(awsutil.Prettify(resp)) + fmt.Println(resp) } func ExampleEC2_CreateNetworkInterface() { svc := ec2.New(nil) params := &ec2.CreateNetworkInterfaceInput{ - SubnetID: aws.String("String"), // Required + SubnetId: aws.String("String"), // Required Description: aws.String("String"), DryRun: aws.Bool(true), Groups: []*string{ aws.String("String"), // Required // More values... }, - PrivateIPAddress: aws.String("String"), - PrivateIPAddresses: []*ec2.PrivateIPAddressSpecification{ + PrivateIpAddress: aws.String("String"), + PrivateIpAddresses: []*ec2.PrivateIpAddressSpecification{ { // Required - PrivateIPAddress: aws.String("String"), // Required + PrivateIpAddress: aws.String("String"), // Required Primary: aws.Bool(true), }, // More values... }, - SecondaryPrivateIPAddressCount: aws.Int64(1), + SecondaryPrivateIpAddressCount: aws.Int64(1), } resp, err := svc.CreateNetworkInterface(params) if err != nil { - if awsErr, ok := err.(awserr.Error); ok { - // Generic AWS error with Code, Message, and original error (if any) - fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) - if reqErr, ok := err.(awserr.RequestFailure); ok { - // A service error occurred - fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) - } - } else { - // This case should never be hit, the SDK should always return an - // error which satisfies the awserr.Error interface. - fmt.Println(err.Error()) - } + // Print the error, cast err to awserr.Error to get the Code and + // Message from an error. + fmt.Println(err.Error()) + return } // Pretty-print the response data. - fmt.Println(awsutil.Prettify(resp)) + fmt.Println(resp) } func ExampleEC2_CreatePlacementGroup() { @@ -1168,22 +894,14 @@ func ExampleEC2_CreatePlacementGroup() { resp, err := svc.CreatePlacementGroup(params) if err != nil { - if awsErr, ok := err.(awserr.Error); ok { - // Generic AWS error with Code, Message, and original error (if any) - fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) - if reqErr, ok := err.(awserr.RequestFailure); ok { - // A service error occurred - fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) - } - } else { - // This case should never be hit, the SDK should always return an - // error which satisfies the awserr.Error interface. - fmt.Println(err.Error()) - } + // Print the error, cast err to awserr.Error to get the Code and + // Message from an error. + fmt.Println(err.Error()) + return } // Pretty-print the response data. - fmt.Println(awsutil.Prettify(resp)) + fmt.Println(resp) } func ExampleEC2_CreateReservedInstancesListing() { @@ -1200,88 +918,64 @@ func ExampleEC2_CreateReservedInstancesListing() { }, // More values... }, - ReservedInstancesID: aws.String("String"), // Required + ReservedInstancesId: aws.String("String"), // Required } resp, err := svc.CreateReservedInstancesListing(params) if err != nil { - if awsErr, ok := err.(awserr.Error); ok { - // Generic AWS error with Code, Message, and original error (if any) - fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) - if reqErr, ok := err.(awserr.RequestFailure); ok { - // A service error occurred - fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) - } - } else { - // This case should never be hit, the SDK should always return an - // error which satisfies the awserr.Error interface. - fmt.Println(err.Error()) - } + // Print the error, cast err to awserr.Error to get the Code and + // Message from an error. + fmt.Println(err.Error()) + return } // Pretty-print the response data. - fmt.Println(awsutil.Prettify(resp)) + fmt.Println(resp) } func ExampleEC2_CreateRoute() { svc := ec2.New(nil) params := &ec2.CreateRouteInput{ - DestinationCIDRBlock: aws.String("String"), // Required - RouteTableID: aws.String("String"), // Required + DestinationCidrBlock: aws.String("String"), // Required + RouteTableId: aws.String("String"), // Required DryRun: aws.Bool(true), - GatewayID: aws.String("String"), - InstanceID: aws.String("String"), - NetworkInterfaceID: aws.String("String"), - VPCPeeringConnectionID: aws.String("String"), + GatewayId: aws.String("String"), + InstanceId: aws.String("String"), + NetworkInterfaceId: aws.String("String"), + VpcPeeringConnectionId: aws.String("String"), } resp, err := svc.CreateRoute(params) if err != nil { - if awsErr, ok := err.(awserr.Error); ok { - // Generic AWS error with Code, Message, and original error (if any) - fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) - if reqErr, ok := err.(awserr.RequestFailure); ok { - // A service error occurred - fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) - } - } else { - // This case should never be hit, the SDK should always return an - // error which satisfies the awserr.Error interface. - fmt.Println(err.Error()) - } + // Print the error, cast err to awserr.Error to get the Code and + // Message from an error. + fmt.Println(err.Error()) + return } // Pretty-print the response data. - fmt.Println(awsutil.Prettify(resp)) + fmt.Println(resp) } func ExampleEC2_CreateRouteTable() { svc := ec2.New(nil) params := &ec2.CreateRouteTableInput{ - VPCID: aws.String("String"), // Required + VpcId: aws.String("String"), // Required DryRun: aws.Bool(true), } resp, err := svc.CreateRouteTable(params) if err != nil { - if awsErr, ok := err.(awserr.Error); ok { - // Generic AWS error with Code, Message, and original error (if any) - fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) - if reqErr, ok := err.(awserr.RequestFailure); ok { - // A service error occurred - fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) - } - } else { - // This case should never be hit, the SDK should always return an - // error which satisfies the awserr.Error interface. - fmt.Println(err.Error()) - } + // Print the error, cast err to awserr.Error to get the Code and + // Message from an error. + fmt.Println(err.Error()) + return } // Pretty-print the response data. - fmt.Println(awsutil.Prettify(resp)) + fmt.Println(resp) } func ExampleEC2_CreateSecurityGroup() { @@ -1291,56 +985,40 @@ func ExampleEC2_CreateSecurityGroup() { Description: aws.String("String"), // Required GroupName: aws.String("String"), // Required DryRun: aws.Bool(true), - VPCID: aws.String("String"), + VpcId: aws.String("String"), } resp, err := svc.CreateSecurityGroup(params) if err != nil { - if awsErr, ok := err.(awserr.Error); ok { - // Generic AWS error with Code, Message, and original error (if any) - fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) - if reqErr, ok := err.(awserr.RequestFailure); ok { - // A service error occurred - fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) - } - } else { - // This case should never be hit, the SDK should always return an - // error which satisfies the awserr.Error interface. - fmt.Println(err.Error()) - } + // Print the error, cast err to awserr.Error to get the Code and + // Message from an error. + fmt.Println(err.Error()) + return } // Pretty-print the response data. - fmt.Println(awsutil.Prettify(resp)) + fmt.Println(resp) } func ExampleEC2_CreateSnapshot() { svc := ec2.New(nil) params := &ec2.CreateSnapshotInput{ - VolumeID: aws.String("String"), // Required + VolumeId: aws.String("String"), // Required Description: aws.String("String"), DryRun: aws.Bool(true), } resp, err := svc.CreateSnapshot(params) if err != nil { - if awsErr, ok := err.(awserr.Error); ok { - // Generic AWS error with Code, Message, and original error (if any) - fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) - if reqErr, ok := err.(awserr.RequestFailure); ok { - // A service error occurred - fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) - } - } else { - // This case should never be hit, the SDK should always return an - // error which satisfies the awserr.Error interface. - fmt.Println(err.Error()) - } + // Print the error, cast err to awserr.Error to get the Code and + // Message from an error. + fmt.Println(err.Error()) + return } // Pretty-print the response data. - fmt.Println(awsutil.Prettify(resp)) + fmt.Println(resp) } func ExampleEC2_CreateSpotDatafeedSubscription() { @@ -1354,52 +1032,36 @@ func ExampleEC2_CreateSpotDatafeedSubscription() { resp, err := svc.CreateSpotDatafeedSubscription(params) if err != nil { - if awsErr, ok := err.(awserr.Error); ok { - // Generic AWS error with Code, Message, and original error (if any) - fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) - if reqErr, ok := err.(awserr.RequestFailure); ok { - // A service error occurred - fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) - } - } else { - // This case should never be hit, the SDK should always return an - // error which satisfies the awserr.Error interface. - fmt.Println(err.Error()) - } + // Print the error, cast err to awserr.Error to get the Code and + // Message from an error. + fmt.Println(err.Error()) + return } // Pretty-print the response data. - fmt.Println(awsutil.Prettify(resp)) + fmt.Println(resp) } func ExampleEC2_CreateSubnet() { svc := ec2.New(nil) params := &ec2.CreateSubnetInput{ - CIDRBlock: aws.String("String"), // Required - VPCID: aws.String("String"), // Required + CidrBlock: aws.String("String"), // Required + VpcId: aws.String("String"), // Required AvailabilityZone: aws.String("String"), DryRun: aws.Bool(true), } resp, err := svc.CreateSubnet(params) if err != nil { - if awsErr, ok := err.(awserr.Error); ok { - // Generic AWS error with Code, Message, and original error (if any) - fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) - if reqErr, ok := err.(awserr.RequestFailure); ok { - // A service error occurred - fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) - } - } else { - // This case should never be hit, the SDK should always return an - // error which satisfies the awserr.Error interface. - fmt.Println(err.Error()) - } + // Print the error, cast err to awserr.Error to get the Code and + // Message from an error. + fmt.Println(err.Error()) + return } // Pretty-print the response data. - fmt.Println(awsutil.Prettify(resp)) + fmt.Println(resp) } func ExampleEC2_CreateTags() { @@ -1422,206 +1084,14 @@ func ExampleEC2_CreateTags() { resp, err := svc.CreateTags(params) if err != nil { - if awsErr, ok := err.(awserr.Error); ok { - // Generic AWS error with Code, Message, and original error (if any) - fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) - if reqErr, ok := err.(awserr.RequestFailure); ok { - // A service error occurred - fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) - } - } else { - // This case should never be hit, the SDK should always return an - // error which satisfies the awserr.Error interface. - fmt.Println(err.Error()) - } + // Print the error, cast err to awserr.Error to get the Code and + // Message from an error. + fmt.Println(err.Error()) + return } // Pretty-print the response data. - fmt.Println(awsutil.Prettify(resp)) -} - -func ExampleEC2_CreateVPC() { - svc := ec2.New(nil) - - params := &ec2.CreateVPCInput{ - CIDRBlock: aws.String("String"), // Required - DryRun: aws.Bool(true), - InstanceTenancy: aws.String("Tenancy"), - } - resp, err := svc.CreateVPC(params) - - if err != nil { - if awsErr, ok := err.(awserr.Error); ok { - // Generic AWS error with Code, Message, and original error (if any) - fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) - if reqErr, ok := err.(awserr.RequestFailure); ok { - // A service error occurred - fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) - } - } else { - // This case should never be hit, the SDK should always return an - // error which satisfies the awserr.Error interface. - fmt.Println(err.Error()) - } - } - - // Pretty-print the response data. - fmt.Println(awsutil.Prettify(resp)) -} - -func ExampleEC2_CreateVPCEndpoint() { - svc := ec2.New(nil) - - params := &ec2.CreateVPCEndpointInput{ - ServiceName: aws.String("String"), // Required - VPCID: aws.String("String"), // Required - ClientToken: aws.String("String"), - DryRun: aws.Bool(true), - PolicyDocument: aws.String("String"), - RouteTableIDs: []*string{ - aws.String("String"), // Required - // More values... - }, - } - resp, err := svc.CreateVPCEndpoint(params) - - if err != nil { - if awsErr, ok := err.(awserr.Error); ok { - // Generic AWS error with Code, Message, and original error (if any) - fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) - if reqErr, ok := err.(awserr.RequestFailure); ok { - // A service error occurred - fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) - } - } else { - // This case should never be hit, the SDK should always return an - // error which satisfies the awserr.Error interface. - fmt.Println(err.Error()) - } - } - - // Pretty-print the response data. - fmt.Println(awsutil.Prettify(resp)) -} - -func ExampleEC2_CreateVPCPeeringConnection() { - svc := ec2.New(nil) - - params := &ec2.CreateVPCPeeringConnectionInput{ - DryRun: aws.Bool(true), - PeerOwnerID: aws.String("String"), - PeerVPCID: aws.String("String"), - VPCID: aws.String("String"), - } - resp, err := svc.CreateVPCPeeringConnection(params) - - if err != nil { - if awsErr, ok := err.(awserr.Error); ok { - // Generic AWS error with Code, Message, and original error (if any) - fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) - if reqErr, ok := err.(awserr.RequestFailure); ok { - // A service error occurred - fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) - } - } else { - // This case should never be hit, the SDK should always return an - // error which satisfies the awserr.Error interface. - fmt.Println(err.Error()) - } - } - - // Pretty-print the response data. - fmt.Println(awsutil.Prettify(resp)) -} - -func ExampleEC2_CreateVPNConnection() { - svc := ec2.New(nil) - - params := &ec2.CreateVPNConnectionInput{ - CustomerGatewayID: aws.String("String"), // Required - Type: aws.String("String"), // Required - VPNGatewayID: aws.String("String"), // Required - DryRun: aws.Bool(true), - Options: &ec2.VPNConnectionOptionsSpecification{ - StaticRoutesOnly: aws.Bool(true), - }, - } - resp, err := svc.CreateVPNConnection(params) - - if err != nil { - if awsErr, ok := err.(awserr.Error); ok { - // Generic AWS error with Code, Message, and original error (if any) - fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) - if reqErr, ok := err.(awserr.RequestFailure); ok { - // A service error occurred - fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) - } - } else { - // This case should never be hit, the SDK should always return an - // error which satisfies the awserr.Error interface. - fmt.Println(err.Error()) - } - } - - // Pretty-print the response data. - fmt.Println(awsutil.Prettify(resp)) -} - -func ExampleEC2_CreateVPNConnectionRoute() { - svc := ec2.New(nil) - - params := &ec2.CreateVPNConnectionRouteInput{ - DestinationCIDRBlock: aws.String("String"), // Required - VPNConnectionID: aws.String("String"), // Required - } - resp, err := svc.CreateVPNConnectionRoute(params) - - if err != nil { - if awsErr, ok := err.(awserr.Error); ok { - // Generic AWS error with Code, Message, and original error (if any) - fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) - if reqErr, ok := err.(awserr.RequestFailure); ok { - // A service error occurred - fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) - } - } else { - // This case should never be hit, the SDK should always return an - // error which satisfies the awserr.Error interface. - fmt.Println(err.Error()) - } - } - - // Pretty-print the response data. - fmt.Println(awsutil.Prettify(resp)) -} - -func ExampleEC2_CreateVPNGateway() { - svc := ec2.New(nil) - - params := &ec2.CreateVPNGatewayInput{ - Type: aws.String("GatewayType"), // Required - AvailabilityZone: aws.String("String"), - DryRun: aws.Bool(true), - } - resp, err := svc.CreateVPNGateway(params) - - if err != nil { - if awsErr, ok := err.(awserr.Error); ok { - // Generic AWS error with Code, Message, and original error (if any) - fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) - if reqErr, ok := err.(awserr.RequestFailure); ok { - // A service error occurred - fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) - } - } else { - // This case should never be hit, the SDK should always return an - // error which satisfies the awserr.Error interface. - fmt.Println(err.Error()) - } - } - - // Pretty-print the response data. - fmt.Println(awsutil.Prettify(resp)) + fmt.Println(resp) } func ExampleEC2_CreateVolume() { @@ -1631,94 +1101,206 @@ func ExampleEC2_CreateVolume() { AvailabilityZone: aws.String("String"), // Required DryRun: aws.Bool(true), Encrypted: aws.Bool(true), - IOPS: aws.Int64(1), - KMSKeyID: aws.String("String"), + Iops: aws.Int64(1), + KmsKeyId: aws.String("String"), Size: aws.Int64(1), - SnapshotID: aws.String("String"), + SnapshotId: aws.String("String"), VolumeType: aws.String("VolumeType"), } resp, err := svc.CreateVolume(params) if err != nil { - if awsErr, ok := err.(awserr.Error); ok { - // Generic AWS error with Code, Message, and original error (if any) - fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) - if reqErr, ok := err.(awserr.RequestFailure); ok { - // A service error occurred - fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) - } - } else { - // This case should never be hit, the SDK should always return an - // error which satisfies the awserr.Error interface. - fmt.Println(err.Error()) - } + // Print the error, cast err to awserr.Error to get the Code and + // Message from an error. + fmt.Println(err.Error()) + return } // Pretty-print the response data. - fmt.Println(awsutil.Prettify(resp)) + fmt.Println(resp) +} + +func ExampleEC2_CreateVpc() { + svc := ec2.New(nil) + + params := &ec2.CreateVpcInput{ + CidrBlock: aws.String("String"), // Required + DryRun: aws.Bool(true), + InstanceTenancy: aws.String("Tenancy"), + } + resp, err := svc.CreateVpc(params) + + if err != nil { + // Print the error, cast err to awserr.Error to get the Code and + // Message from an error. + fmt.Println(err.Error()) + return + } + + // Pretty-print the response data. + fmt.Println(resp) +} + +func ExampleEC2_CreateVpcEndpoint() { + svc := ec2.New(nil) + + params := &ec2.CreateVpcEndpointInput{ + ServiceName: aws.String("String"), // Required + VpcId: aws.String("String"), // Required + ClientToken: aws.String("String"), + DryRun: aws.Bool(true), + PolicyDocument: aws.String("String"), + RouteTableIds: []*string{ + aws.String("String"), // Required + // More values... + }, + } + resp, err := svc.CreateVpcEndpoint(params) + + if err != nil { + // Print the error, cast err to awserr.Error to get the Code and + // Message from an error. + fmt.Println(err.Error()) + return + } + + // Pretty-print the response data. + fmt.Println(resp) +} + +func ExampleEC2_CreateVpcPeeringConnection() { + svc := ec2.New(nil) + + params := &ec2.CreateVpcPeeringConnectionInput{ + DryRun: aws.Bool(true), + PeerOwnerId: aws.String("String"), + PeerVpcId: aws.String("String"), + VpcId: aws.String("String"), + } + resp, err := svc.CreateVpcPeeringConnection(params) + + if err != nil { + // Print the error, cast err to awserr.Error to get the Code and + // Message from an error. + fmt.Println(err.Error()) + return + } + + // Pretty-print the response data. + fmt.Println(resp) +} + +func ExampleEC2_CreateVpnConnection() { + svc := ec2.New(nil) + + params := &ec2.CreateVpnConnectionInput{ + CustomerGatewayId: aws.String("String"), // Required + Type: aws.String("String"), // Required + VpnGatewayId: aws.String("String"), // Required + DryRun: aws.Bool(true), + Options: &ec2.VpnConnectionOptionsSpecification{ + StaticRoutesOnly: aws.Bool(true), + }, + } + resp, err := svc.CreateVpnConnection(params) + + if err != nil { + // Print the error, cast err to awserr.Error to get the Code and + // Message from an error. + fmt.Println(err.Error()) + return + } + + // Pretty-print the response data. + fmt.Println(resp) +} + +func ExampleEC2_CreateVpnConnectionRoute() { + svc := ec2.New(nil) + + params := &ec2.CreateVpnConnectionRouteInput{ + DestinationCidrBlock: aws.String("String"), // Required + VpnConnectionId: aws.String("String"), // Required + } + resp, err := svc.CreateVpnConnectionRoute(params) + + if err != nil { + // Print the error, cast err to awserr.Error to get the Code and + // Message from an error. + fmt.Println(err.Error()) + return + } + + // Pretty-print the response data. + fmt.Println(resp) +} + +func ExampleEC2_CreateVpnGateway() { + svc := ec2.New(nil) + + params := &ec2.CreateVpnGatewayInput{ + Type: aws.String("GatewayType"), // Required + AvailabilityZone: aws.String("String"), + DryRun: aws.Bool(true), + } + resp, err := svc.CreateVpnGateway(params) + + if err != nil { + // Print the error, cast err to awserr.Error to get the Code and + // Message from an error. + fmt.Println(err.Error()) + return + } + + // Pretty-print the response data. + fmt.Println(resp) } func ExampleEC2_DeleteCustomerGateway() { svc := ec2.New(nil) params := &ec2.DeleteCustomerGatewayInput{ - CustomerGatewayID: aws.String("String"), // Required + CustomerGatewayId: aws.String("String"), // Required DryRun: aws.Bool(true), } resp, err := svc.DeleteCustomerGateway(params) if err != nil { - if awsErr, ok := err.(awserr.Error); ok { - // Generic AWS error with Code, Message, and original error (if any) - fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) - if reqErr, ok := err.(awserr.RequestFailure); ok { - // A service error occurred - fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) - } - } else { - // This case should never be hit, the SDK should always return an - // error which satisfies the awserr.Error interface. - fmt.Println(err.Error()) - } + // Print the error, cast err to awserr.Error to get the Code and + // Message from an error. + fmt.Println(err.Error()) + return } // Pretty-print the response data. - fmt.Println(awsutil.Prettify(resp)) + fmt.Println(resp) } -func ExampleEC2_DeleteDHCPOptions() { +func ExampleEC2_DeleteDhcpOptions() { svc := ec2.New(nil) - params := &ec2.DeleteDHCPOptionsInput{ - DHCPOptionsID: aws.String("String"), // Required + params := &ec2.DeleteDhcpOptionsInput{ + DhcpOptionsId: aws.String("String"), // Required DryRun: aws.Bool(true), } - resp, err := svc.DeleteDHCPOptions(params) + resp, err := svc.DeleteDhcpOptions(params) if err != nil { - if awsErr, ok := err.(awserr.Error); ok { - // Generic AWS error with Code, Message, and original error (if any) - fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) - if reqErr, ok := err.(awserr.RequestFailure); ok { - // A service error occurred - fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) - } - } else { - // This case should never be hit, the SDK should always return an - // error which satisfies the awserr.Error interface. - fmt.Println(err.Error()) - } + // Print the error, cast err to awserr.Error to get the Code and + // Message from an error. + fmt.Println(err.Error()) + return } // Pretty-print the response data. - fmt.Println(awsutil.Prettify(resp)) + fmt.Println(resp) } func ExampleEC2_DeleteFlowLogs() { svc := ec2.New(nil) params := &ec2.DeleteFlowLogsInput{ - FlowLogIDs: []*string{ // Required + FlowLogIds: []*string{ // Required aws.String("String"), // Required // More values... }, @@ -1726,50 +1308,34 @@ func ExampleEC2_DeleteFlowLogs() { resp, err := svc.DeleteFlowLogs(params) if err != nil { - if awsErr, ok := err.(awserr.Error); ok { - // Generic AWS error with Code, Message, and original error (if any) - fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) - if reqErr, ok := err.(awserr.RequestFailure); ok { - // A service error occurred - fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) - } - } else { - // This case should never be hit, the SDK should always return an - // error which satisfies the awserr.Error interface. - fmt.Println(err.Error()) - } + // Print the error, cast err to awserr.Error to get the Code and + // Message from an error. + fmt.Println(err.Error()) + return } // Pretty-print the response data. - fmt.Println(awsutil.Prettify(resp)) + fmt.Println(resp) } func ExampleEC2_DeleteInternetGateway() { svc := ec2.New(nil) params := &ec2.DeleteInternetGatewayInput{ - InternetGatewayID: aws.String("String"), // Required + InternetGatewayId: aws.String("String"), // Required DryRun: aws.Bool(true), } resp, err := svc.DeleteInternetGateway(params) if err != nil { - if awsErr, ok := err.(awserr.Error); ok { - // Generic AWS error with Code, Message, and original error (if any) - fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) - if reqErr, ok := err.(awserr.RequestFailure); ok { - // A service error occurred - fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) - } - } else { - // This case should never be hit, the SDK should always return an - // error which satisfies the awserr.Error interface. - fmt.Println(err.Error()) - } + // Print the error, cast err to awserr.Error to get the Code and + // Message from an error. + fmt.Println(err.Error()) + return } // Pretty-print the response data. - fmt.Println(awsutil.Prettify(resp)) + fmt.Println(resp) } func ExampleEC2_DeleteKeyPair() { @@ -1782,108 +1348,76 @@ func ExampleEC2_DeleteKeyPair() { resp, err := svc.DeleteKeyPair(params) if err != nil { - if awsErr, ok := err.(awserr.Error); ok { - // Generic AWS error with Code, Message, and original error (if any) - fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) - if reqErr, ok := err.(awserr.RequestFailure); ok { - // A service error occurred - fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) - } - } else { - // This case should never be hit, the SDK should always return an - // error which satisfies the awserr.Error interface. - fmt.Println(err.Error()) - } + // Print the error, cast err to awserr.Error to get the Code and + // Message from an error. + fmt.Println(err.Error()) + return } // Pretty-print the response data. - fmt.Println(awsutil.Prettify(resp)) + fmt.Println(resp) } -func ExampleEC2_DeleteNetworkACL() { +func ExampleEC2_DeleteNetworkAcl() { svc := ec2.New(nil) - params := &ec2.DeleteNetworkACLInput{ - NetworkACLID: aws.String("String"), // Required + params := &ec2.DeleteNetworkAclInput{ + NetworkAclId: aws.String("String"), // Required DryRun: aws.Bool(true), } - resp, err := svc.DeleteNetworkACL(params) + resp, err := svc.DeleteNetworkAcl(params) if err != nil { - if awsErr, ok := err.(awserr.Error); ok { - // Generic AWS error with Code, Message, and original error (if any) - fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) - if reqErr, ok := err.(awserr.RequestFailure); ok { - // A service error occurred - fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) - } - } else { - // This case should never be hit, the SDK should always return an - // error which satisfies the awserr.Error interface. - fmt.Println(err.Error()) - } + // Print the error, cast err to awserr.Error to get the Code and + // Message from an error. + fmt.Println(err.Error()) + return } // Pretty-print the response data. - fmt.Println(awsutil.Prettify(resp)) + fmt.Println(resp) } -func ExampleEC2_DeleteNetworkACLEntry() { +func ExampleEC2_DeleteNetworkAclEntry() { svc := ec2.New(nil) - params := &ec2.DeleteNetworkACLEntryInput{ + params := &ec2.DeleteNetworkAclEntryInput{ Egress: aws.Bool(true), // Required - NetworkACLID: aws.String("String"), // Required + NetworkAclId: aws.String("String"), // Required RuleNumber: aws.Int64(1), // Required DryRun: aws.Bool(true), } - resp, err := svc.DeleteNetworkACLEntry(params) + resp, err := svc.DeleteNetworkAclEntry(params) if err != nil { - if awsErr, ok := err.(awserr.Error); ok { - // Generic AWS error with Code, Message, and original error (if any) - fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) - if reqErr, ok := err.(awserr.RequestFailure); ok { - // A service error occurred - fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) - } - } else { - // This case should never be hit, the SDK should always return an - // error which satisfies the awserr.Error interface. - fmt.Println(err.Error()) - } + // Print the error, cast err to awserr.Error to get the Code and + // Message from an error. + fmt.Println(err.Error()) + return } // Pretty-print the response data. - fmt.Println(awsutil.Prettify(resp)) + fmt.Println(resp) } func ExampleEC2_DeleteNetworkInterface() { svc := ec2.New(nil) params := &ec2.DeleteNetworkInterfaceInput{ - NetworkInterfaceID: aws.String("String"), // Required + NetworkInterfaceId: aws.String("String"), // Required DryRun: aws.Bool(true), } resp, err := svc.DeleteNetworkInterface(params) if err != nil { - if awsErr, ok := err.(awserr.Error); ok { - // Generic AWS error with Code, Message, and original error (if any) - fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) - if reqErr, ok := err.(awserr.RequestFailure); ok { - // A service error occurred - fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) - } - } else { - // This case should never be hit, the SDK should always return an - // error which satisfies the awserr.Error interface. - fmt.Println(err.Error()) - } + // Print the error, cast err to awserr.Error to get the Code and + // Message from an error. + fmt.Println(err.Error()) + return } // Pretty-print the response data. - fmt.Println(awsutil.Prettify(resp)) + fmt.Println(resp) } func ExampleEC2_DeletePlacementGroup() { @@ -1896,79 +1430,55 @@ func ExampleEC2_DeletePlacementGroup() { resp, err := svc.DeletePlacementGroup(params) if err != nil { - if awsErr, ok := err.(awserr.Error); ok { - // Generic AWS error with Code, Message, and original error (if any) - fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) - if reqErr, ok := err.(awserr.RequestFailure); ok { - // A service error occurred - fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) - } - } else { - // This case should never be hit, the SDK should always return an - // error which satisfies the awserr.Error interface. - fmt.Println(err.Error()) - } + // Print the error, cast err to awserr.Error to get the Code and + // Message from an error. + fmt.Println(err.Error()) + return } // Pretty-print the response data. - fmt.Println(awsutil.Prettify(resp)) + fmt.Println(resp) } func ExampleEC2_DeleteRoute() { svc := ec2.New(nil) params := &ec2.DeleteRouteInput{ - DestinationCIDRBlock: aws.String("String"), // Required - RouteTableID: aws.String("String"), // Required + DestinationCidrBlock: aws.String("String"), // Required + RouteTableId: aws.String("String"), // Required DryRun: aws.Bool(true), } resp, err := svc.DeleteRoute(params) if err != nil { - if awsErr, ok := err.(awserr.Error); ok { - // Generic AWS error with Code, Message, and original error (if any) - fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) - if reqErr, ok := err.(awserr.RequestFailure); ok { - // A service error occurred - fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) - } - } else { - // This case should never be hit, the SDK should always return an - // error which satisfies the awserr.Error interface. - fmt.Println(err.Error()) - } + // Print the error, cast err to awserr.Error to get the Code and + // Message from an error. + fmt.Println(err.Error()) + return } // Pretty-print the response data. - fmt.Println(awsutil.Prettify(resp)) + fmt.Println(resp) } func ExampleEC2_DeleteRouteTable() { svc := ec2.New(nil) params := &ec2.DeleteRouteTableInput{ - RouteTableID: aws.String("String"), // Required + RouteTableId: aws.String("String"), // Required DryRun: aws.Bool(true), } resp, err := svc.DeleteRouteTable(params) if err != nil { - if awsErr, ok := err.(awserr.Error); ok { - // Generic AWS error with Code, Message, and original error (if any) - fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) - if reqErr, ok := err.(awserr.RequestFailure); ok { - // A service error occurred - fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) - } - } else { - // This case should never be hit, the SDK should always return an - // error which satisfies the awserr.Error interface. - fmt.Println(err.Error()) - } + // Print the error, cast err to awserr.Error to get the Code and + // Message from an error. + fmt.Println(err.Error()) + return } // Pretty-print the response data. - fmt.Println(awsutil.Prettify(resp)) + fmt.Println(resp) } func ExampleEC2_DeleteSecurityGroup() { @@ -1976,56 +1486,40 @@ func ExampleEC2_DeleteSecurityGroup() { params := &ec2.DeleteSecurityGroupInput{ DryRun: aws.Bool(true), - GroupID: aws.String("String"), + GroupId: aws.String("String"), GroupName: aws.String("String"), } resp, err := svc.DeleteSecurityGroup(params) if err != nil { - if awsErr, ok := err.(awserr.Error); ok { - // Generic AWS error with Code, Message, and original error (if any) - fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) - if reqErr, ok := err.(awserr.RequestFailure); ok { - // A service error occurred - fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) - } - } else { - // This case should never be hit, the SDK should always return an - // error which satisfies the awserr.Error interface. - fmt.Println(err.Error()) - } + // Print the error, cast err to awserr.Error to get the Code and + // Message from an error. + fmt.Println(err.Error()) + return } // Pretty-print the response data. - fmt.Println(awsutil.Prettify(resp)) + fmt.Println(resp) } func ExampleEC2_DeleteSnapshot() { svc := ec2.New(nil) params := &ec2.DeleteSnapshotInput{ - SnapshotID: aws.String("String"), // Required + SnapshotId: aws.String("String"), // Required DryRun: aws.Bool(true), } resp, err := svc.DeleteSnapshot(params) if err != nil { - if awsErr, ok := err.(awserr.Error); ok { - // Generic AWS error with Code, Message, and original error (if any) - fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) - if reqErr, ok := err.(awserr.RequestFailure); ok { - // A service error occurred - fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) - } - } else { - // This case should never be hit, the SDK should always return an - // error which satisfies the awserr.Error interface. - fmt.Println(err.Error()) - } + // Print the error, cast err to awserr.Error to get the Code and + // Message from an error. + fmt.Println(err.Error()) + return } // Pretty-print the response data. - fmt.Println(awsutil.Prettify(resp)) + fmt.Println(resp) } func ExampleEC2_DeleteSpotDatafeedSubscription() { @@ -2037,50 +1531,34 @@ func ExampleEC2_DeleteSpotDatafeedSubscription() { resp, err := svc.DeleteSpotDatafeedSubscription(params) if err != nil { - if awsErr, ok := err.(awserr.Error); ok { - // Generic AWS error with Code, Message, and original error (if any) - fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) - if reqErr, ok := err.(awserr.RequestFailure); ok { - // A service error occurred - fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) - } - } else { - // This case should never be hit, the SDK should always return an - // error which satisfies the awserr.Error interface. - fmt.Println(err.Error()) - } + // Print the error, cast err to awserr.Error to get the Code and + // Message from an error. + fmt.Println(err.Error()) + return } // Pretty-print the response data. - fmt.Println(awsutil.Prettify(resp)) + fmt.Println(resp) } func ExampleEC2_DeleteSubnet() { svc := ec2.New(nil) params := &ec2.DeleteSubnetInput{ - SubnetID: aws.String("String"), // Required + SubnetId: aws.String("String"), // Required DryRun: aws.Bool(true), } resp, err := svc.DeleteSubnet(params) if err != nil { - if awsErr, ok := err.(awserr.Error); ok { - // Generic AWS error with Code, Message, and original error (if any) - fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) - if reqErr, ok := err.(awserr.RequestFailure); ok { - // A service error occurred - fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) - } - } else { - // This case should never be hit, the SDK should always return an - // error which satisfies the awserr.Error interface. - fmt.Println(err.Error()) - } + // Print the error, cast err to awserr.Error to get the Code and + // Message from an error. + fmt.Println(err.Error()) + return } // Pretty-print the response data. - fmt.Println(awsutil.Prettify(resp)) + fmt.Println(resp) } func ExampleEC2_DeleteTags() { @@ -2103,249 +1581,177 @@ func ExampleEC2_DeleteTags() { resp, err := svc.DeleteTags(params) if err != nil { - if awsErr, ok := err.(awserr.Error); ok { - // Generic AWS error with Code, Message, and original error (if any) - fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) - if reqErr, ok := err.(awserr.RequestFailure); ok { - // A service error occurred - fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) - } - } else { - // This case should never be hit, the SDK should always return an - // error which satisfies the awserr.Error interface. - fmt.Println(err.Error()) - } + // Print the error, cast err to awserr.Error to get the Code and + // Message from an error. + fmt.Println(err.Error()) + return } // Pretty-print the response data. - fmt.Println(awsutil.Prettify(resp)) -} - -func ExampleEC2_DeleteVPC() { - svc := ec2.New(nil) - - params := &ec2.DeleteVPCInput{ - VPCID: aws.String("String"), // Required - DryRun: aws.Bool(true), - } - resp, err := svc.DeleteVPC(params) - - if err != nil { - if awsErr, ok := err.(awserr.Error); ok { - // Generic AWS error with Code, Message, and original error (if any) - fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) - if reqErr, ok := err.(awserr.RequestFailure); ok { - // A service error occurred - fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) - } - } else { - // This case should never be hit, the SDK should always return an - // error which satisfies the awserr.Error interface. - fmt.Println(err.Error()) - } - } - - // Pretty-print the response data. - fmt.Println(awsutil.Prettify(resp)) -} - -func ExampleEC2_DeleteVPCEndpoints() { - svc := ec2.New(nil) - - params := &ec2.DeleteVPCEndpointsInput{ - VPCEndpointIDs: []*string{ // Required - aws.String("String"), // Required - // More values... - }, - DryRun: aws.Bool(true), - } - resp, err := svc.DeleteVPCEndpoints(params) - - if err != nil { - if awsErr, ok := err.(awserr.Error); ok { - // Generic AWS error with Code, Message, and original error (if any) - fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) - if reqErr, ok := err.(awserr.RequestFailure); ok { - // A service error occurred - fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) - } - } else { - // This case should never be hit, the SDK should always return an - // error which satisfies the awserr.Error interface. - fmt.Println(err.Error()) - } - } - - // Pretty-print the response data. - fmt.Println(awsutil.Prettify(resp)) -} - -func ExampleEC2_DeleteVPCPeeringConnection() { - svc := ec2.New(nil) - - params := &ec2.DeleteVPCPeeringConnectionInput{ - VPCPeeringConnectionID: aws.String("String"), // Required - DryRun: aws.Bool(true), - } - resp, err := svc.DeleteVPCPeeringConnection(params) - - if err != nil { - if awsErr, ok := err.(awserr.Error); ok { - // Generic AWS error with Code, Message, and original error (if any) - fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) - if reqErr, ok := err.(awserr.RequestFailure); ok { - // A service error occurred - fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) - } - } else { - // This case should never be hit, the SDK should always return an - // error which satisfies the awserr.Error interface. - fmt.Println(err.Error()) - } - } - - // Pretty-print the response data. - fmt.Println(awsutil.Prettify(resp)) -} - -func ExampleEC2_DeleteVPNConnection() { - svc := ec2.New(nil) - - params := &ec2.DeleteVPNConnectionInput{ - VPNConnectionID: aws.String("String"), // Required - DryRun: aws.Bool(true), - } - resp, err := svc.DeleteVPNConnection(params) - - if err != nil { - if awsErr, ok := err.(awserr.Error); ok { - // Generic AWS error with Code, Message, and original error (if any) - fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) - if reqErr, ok := err.(awserr.RequestFailure); ok { - // A service error occurred - fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) - } - } else { - // This case should never be hit, the SDK should always return an - // error which satisfies the awserr.Error interface. - fmt.Println(err.Error()) - } - } - - // Pretty-print the response data. - fmt.Println(awsutil.Prettify(resp)) -} - -func ExampleEC2_DeleteVPNConnectionRoute() { - svc := ec2.New(nil) - - params := &ec2.DeleteVPNConnectionRouteInput{ - DestinationCIDRBlock: aws.String("String"), // Required - VPNConnectionID: aws.String("String"), // Required - } - resp, err := svc.DeleteVPNConnectionRoute(params) - - if err != nil { - if awsErr, ok := err.(awserr.Error); ok { - // Generic AWS error with Code, Message, and original error (if any) - fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) - if reqErr, ok := err.(awserr.RequestFailure); ok { - // A service error occurred - fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) - } - } else { - // This case should never be hit, the SDK should always return an - // error which satisfies the awserr.Error interface. - fmt.Println(err.Error()) - } - } - - // Pretty-print the response data. - fmt.Println(awsutil.Prettify(resp)) -} - -func ExampleEC2_DeleteVPNGateway() { - svc := ec2.New(nil) - - params := &ec2.DeleteVPNGatewayInput{ - VPNGatewayID: aws.String("String"), // Required - DryRun: aws.Bool(true), - } - resp, err := svc.DeleteVPNGateway(params) - - if err != nil { - if awsErr, ok := err.(awserr.Error); ok { - // Generic AWS error with Code, Message, and original error (if any) - fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) - if reqErr, ok := err.(awserr.RequestFailure); ok { - // A service error occurred - fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) - } - } else { - // This case should never be hit, the SDK should always return an - // error which satisfies the awserr.Error interface. - fmt.Println(err.Error()) - } - } - - // Pretty-print the response data. - fmt.Println(awsutil.Prettify(resp)) + fmt.Println(resp) } func ExampleEC2_DeleteVolume() { svc := ec2.New(nil) params := &ec2.DeleteVolumeInput{ - VolumeID: aws.String("String"), // Required + VolumeId: aws.String("String"), // Required DryRun: aws.Bool(true), } resp, err := svc.DeleteVolume(params) if err != nil { - if awsErr, ok := err.(awserr.Error); ok { - // Generic AWS error with Code, Message, and original error (if any) - fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) - if reqErr, ok := err.(awserr.RequestFailure); ok { - // A service error occurred - fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) - } - } else { - // This case should never be hit, the SDK should always return an - // error which satisfies the awserr.Error interface. - fmt.Println(err.Error()) - } + // Print the error, cast err to awserr.Error to get the Code and + // Message from an error. + fmt.Println(err.Error()) + return } // Pretty-print the response data. - fmt.Println(awsutil.Prettify(resp)) + fmt.Println(resp) +} + +func ExampleEC2_DeleteVpc() { + svc := ec2.New(nil) + + params := &ec2.DeleteVpcInput{ + VpcId: aws.String("String"), // Required + DryRun: aws.Bool(true), + } + resp, err := svc.DeleteVpc(params) + + if err != nil { + // Print the error, cast err to awserr.Error to get the Code and + // Message from an error. + fmt.Println(err.Error()) + return + } + + // Pretty-print the response data. + fmt.Println(resp) +} + +func ExampleEC2_DeleteVpcEndpoints() { + svc := ec2.New(nil) + + params := &ec2.DeleteVpcEndpointsInput{ + VpcEndpointIds: []*string{ // Required + aws.String("String"), // Required + // More values... + }, + DryRun: aws.Bool(true), + } + resp, err := svc.DeleteVpcEndpoints(params) + + if err != nil { + // Print the error, cast err to awserr.Error to get the Code and + // Message from an error. + fmt.Println(err.Error()) + return + } + + // Pretty-print the response data. + fmt.Println(resp) +} + +func ExampleEC2_DeleteVpcPeeringConnection() { + svc := ec2.New(nil) + + params := &ec2.DeleteVpcPeeringConnectionInput{ + VpcPeeringConnectionId: aws.String("String"), // Required + DryRun: aws.Bool(true), + } + resp, err := svc.DeleteVpcPeeringConnection(params) + + if err != nil { + // Print the error, cast err to awserr.Error to get the Code and + // Message from an error. + fmt.Println(err.Error()) + return + } + + // Pretty-print the response data. + fmt.Println(resp) +} + +func ExampleEC2_DeleteVpnConnection() { + svc := ec2.New(nil) + + params := &ec2.DeleteVpnConnectionInput{ + VpnConnectionId: aws.String("String"), // Required + DryRun: aws.Bool(true), + } + resp, err := svc.DeleteVpnConnection(params) + + if err != nil { + // Print the error, cast err to awserr.Error to get the Code and + // Message from an error. + fmt.Println(err.Error()) + return + } + + // Pretty-print the response data. + fmt.Println(resp) +} + +func ExampleEC2_DeleteVpnConnectionRoute() { + svc := ec2.New(nil) + + params := &ec2.DeleteVpnConnectionRouteInput{ + DestinationCidrBlock: aws.String("String"), // Required + VpnConnectionId: aws.String("String"), // Required + } + resp, err := svc.DeleteVpnConnectionRoute(params) + + if err != nil { + // Print the error, cast err to awserr.Error to get the Code and + // Message from an error. + fmt.Println(err.Error()) + return + } + + // Pretty-print the response data. + fmt.Println(resp) +} + +func ExampleEC2_DeleteVpnGateway() { + svc := ec2.New(nil) + + params := &ec2.DeleteVpnGatewayInput{ + VpnGatewayId: aws.String("String"), // Required + DryRun: aws.Bool(true), + } + resp, err := svc.DeleteVpnGateway(params) + + if err != nil { + // Print the error, cast err to awserr.Error to get the Code and + // Message from an error. + fmt.Println(err.Error()) + return + } + + // Pretty-print the response data. + fmt.Println(resp) } func ExampleEC2_DeregisterImage() { svc := ec2.New(nil) params := &ec2.DeregisterImageInput{ - ImageID: aws.String("String"), // Required + ImageId: aws.String("String"), // Required DryRun: aws.Bool(true), } resp, err := svc.DeregisterImage(params) if err != nil { - if awsErr, ok := err.(awserr.Error); ok { - // Generic AWS error with Code, Message, and original error (if any) - fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) - if reqErr, ok := err.(awserr.RequestFailure); ok { - // A service error occurred - fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) - } - } else { - // This case should never be hit, the SDK should always return an - // error which satisfies the awserr.Error interface. - fmt.Println(err.Error()) - } + // Print the error, cast err to awserr.Error to get the Code and + // Message from an error. + fmt.Println(err.Error()) + return } // Pretty-print the response data. - fmt.Println(awsutil.Prettify(resp)) + fmt.Println(resp) } func ExampleEC2_DescribeAccountAttributes() { @@ -2361,29 +1767,21 @@ func ExampleEC2_DescribeAccountAttributes() { resp, err := svc.DescribeAccountAttributes(params) if err != nil { - if awsErr, ok := err.(awserr.Error); ok { - // Generic AWS error with Code, Message, and original error (if any) - fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) - if reqErr, ok := err.(awserr.RequestFailure); ok { - // A service error occurred - fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) - } - } else { - // This case should never be hit, the SDK should always return an - // error which satisfies the awserr.Error interface. - fmt.Println(err.Error()) - } + // Print the error, cast err to awserr.Error to get the Code and + // Message from an error. + fmt.Println(err.Error()) + return } // Pretty-print the response data. - fmt.Println(awsutil.Prettify(resp)) + fmt.Println(resp) } func ExampleEC2_DescribeAddresses() { svc := ec2.New(nil) params := &ec2.DescribeAddressesInput{ - AllocationIDs: []*string{ + AllocationIds: []*string{ aws.String("String"), // Required // More values... }, @@ -2398,7 +1796,7 @@ func ExampleEC2_DescribeAddresses() { }, // More values... }, - PublicIPs: []*string{ + PublicIps: []*string{ aws.String("String"), // Required // More values... }, @@ -2406,22 +1804,14 @@ func ExampleEC2_DescribeAddresses() { resp, err := svc.DescribeAddresses(params) if err != nil { - if awsErr, ok := err.(awserr.Error); ok { - // Generic AWS error with Code, Message, and original error (if any) - fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) - if reqErr, ok := err.(awserr.RequestFailure); ok { - // A service error occurred - fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) - } - } else { - // This case should never be hit, the SDK should always return an - // error which satisfies the awserr.Error interface. - fmt.Println(err.Error()) - } + // Print the error, cast err to awserr.Error to get the Code and + // Message from an error. + fmt.Println(err.Error()) + return } // Pretty-print the response data. - fmt.Println(awsutil.Prettify(resp)) + fmt.Println(resp) } func ExampleEC2_DescribeAvailabilityZones() { @@ -2447,29 +1837,21 @@ func ExampleEC2_DescribeAvailabilityZones() { resp, err := svc.DescribeAvailabilityZones(params) if err != nil { - if awsErr, ok := err.(awserr.Error); ok { - // Generic AWS error with Code, Message, and original error (if any) - fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) - if reqErr, ok := err.(awserr.RequestFailure); ok { - // A service error occurred - fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) - } - } else { - // This case should never be hit, the SDK should always return an - // error which satisfies the awserr.Error interface. - fmt.Println(err.Error()) - } + // Print the error, cast err to awserr.Error to get the Code and + // Message from an error. + fmt.Println(err.Error()) + return } // Pretty-print the response data. - fmt.Println(awsutil.Prettify(resp)) + fmt.Println(resp) } func ExampleEC2_DescribeBundleTasks() { svc := ec2.New(nil) params := &ec2.DescribeBundleTasksInput{ - BundleIDs: []*string{ + BundleIds: []*string{ aws.String("String"), // Required // More values... }, @@ -2488,22 +1870,14 @@ func ExampleEC2_DescribeBundleTasks() { resp, err := svc.DescribeBundleTasks(params) if err != nil { - if awsErr, ok := err.(awserr.Error); ok { - // Generic AWS error with Code, Message, and original error (if any) - fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) - if reqErr, ok := err.(awserr.RequestFailure); ok { - // A service error occurred - fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) - } - } else { - // This case should never be hit, the SDK should always return an - // error which satisfies the awserr.Error interface. - fmt.Println(err.Error()) - } + // Print the error, cast err to awserr.Error to get the Code and + // Message from an error. + fmt.Println(err.Error()) + return } // Pretty-print the response data. - fmt.Println(awsutil.Prettify(resp)) + fmt.Println(resp) } func ExampleEC2_DescribeClassicLinkInstances() { @@ -2521,7 +1895,7 @@ func ExampleEC2_DescribeClassicLinkInstances() { }, // More values... }, - InstanceIDs: []*string{ + InstanceIds: []*string{ aws.String("String"), // Required // More values... }, @@ -2531,29 +1905,21 @@ func ExampleEC2_DescribeClassicLinkInstances() { resp, err := svc.DescribeClassicLinkInstances(params) if err != nil { - if awsErr, ok := err.(awserr.Error); ok { - // Generic AWS error with Code, Message, and original error (if any) - fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) - if reqErr, ok := err.(awserr.RequestFailure); ok { - // A service error occurred - fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) - } - } else { - // This case should never be hit, the SDK should always return an - // error which satisfies the awserr.Error interface. - fmt.Println(err.Error()) - } + // Print the error, cast err to awserr.Error to get the Code and + // Message from an error. + fmt.Println(err.Error()) + return } // Pretty-print the response data. - fmt.Println(awsutil.Prettify(resp)) + fmt.Println(resp) } func ExampleEC2_DescribeConversionTasks() { svc := ec2.New(nil) params := &ec2.DescribeConversionTasksInput{ - ConversionTaskIDs: []*string{ + ConversionTaskIds: []*string{ aws.String("String"), // Required // More values... }, @@ -2572,29 +1938,21 @@ func ExampleEC2_DescribeConversionTasks() { resp, err := svc.DescribeConversionTasks(params) if err != nil { - if awsErr, ok := err.(awserr.Error); ok { - // Generic AWS error with Code, Message, and original error (if any) - fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) - if reqErr, ok := err.(awserr.RequestFailure); ok { - // A service error occurred - fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) - } - } else { - // This case should never be hit, the SDK should always return an - // error which satisfies the awserr.Error interface. - fmt.Println(err.Error()) - } + // Print the error, cast err to awserr.Error to get the Code and + // Message from an error. + fmt.Println(err.Error()) + return } // Pretty-print the response data. - fmt.Println(awsutil.Prettify(resp)) + fmt.Println(resp) } func ExampleEC2_DescribeCustomerGateways() { svc := ec2.New(nil) params := &ec2.DescribeCustomerGatewaysInput{ - CustomerGatewayIDs: []*string{ + CustomerGatewayIds: []*string{ aws.String("String"), // Required // More values... }, @@ -2613,29 +1971,21 @@ func ExampleEC2_DescribeCustomerGateways() { resp, err := svc.DescribeCustomerGateways(params) if err != nil { - if awsErr, ok := err.(awserr.Error); ok { - // Generic AWS error with Code, Message, and original error (if any) - fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) - if reqErr, ok := err.(awserr.RequestFailure); ok { - // A service error occurred - fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) - } - } else { - // This case should never be hit, the SDK should always return an - // error which satisfies the awserr.Error interface. - fmt.Println(err.Error()) - } + // Print the error, cast err to awserr.Error to get the Code and + // Message from an error. + fmt.Println(err.Error()) + return } // Pretty-print the response data. - fmt.Println(awsutil.Prettify(resp)) + fmt.Println(resp) } -func ExampleEC2_DescribeDHCPOptions() { +func ExampleEC2_DescribeDhcpOptions() { svc := ec2.New(nil) - params := &ec2.DescribeDHCPOptionsInput{ - DHCPOptionsIDs: []*string{ + params := &ec2.DescribeDhcpOptionsInput{ + DhcpOptionsIds: []*string{ aws.String("String"), // Required // More values... }, @@ -2651,32 +2001,24 @@ func ExampleEC2_DescribeDHCPOptions() { // More values... }, } - resp, err := svc.DescribeDHCPOptions(params) + resp, err := svc.DescribeDhcpOptions(params) if err != nil { - if awsErr, ok := err.(awserr.Error); ok { - // Generic AWS error with Code, Message, and original error (if any) - fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) - if reqErr, ok := err.(awserr.RequestFailure); ok { - // A service error occurred - fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) - } - } else { - // This case should never be hit, the SDK should always return an - // error which satisfies the awserr.Error interface. - fmt.Println(err.Error()) - } + // Print the error, cast err to awserr.Error to get the Code and + // Message from an error. + fmt.Println(err.Error()) + return } // Pretty-print the response data. - fmt.Println(awsutil.Prettify(resp)) + fmt.Println(resp) } func ExampleEC2_DescribeExportTasks() { svc := ec2.New(nil) params := &ec2.DescribeExportTasksInput{ - ExportTaskIDs: []*string{ + ExportTaskIds: []*string{ aws.String("String"), // Required // More values... }, @@ -2684,22 +2026,14 @@ func ExampleEC2_DescribeExportTasks() { resp, err := svc.DescribeExportTasks(params) if err != nil { - if awsErr, ok := err.(awserr.Error); ok { - // Generic AWS error with Code, Message, and original error (if any) - fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) - if reqErr, ok := err.(awserr.RequestFailure); ok { - // A service error occurred - fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) - } - } else { - // This case should never be hit, the SDK should always return an - // error which satisfies the awserr.Error interface. - fmt.Println(err.Error()) - } + // Print the error, cast err to awserr.Error to get the Code and + // Message from an error. + fmt.Println(err.Error()) + return } // Pretty-print the response data. - fmt.Println(awsutil.Prettify(resp)) + fmt.Println(resp) } func ExampleEC2_DescribeFlowLogs() { @@ -2716,7 +2050,7 @@ func ExampleEC2_DescribeFlowLogs() { }, // More values... }, - FlowLogIDs: []*string{ + FlowLogIds: []*string{ aws.String("String"), // Required // More values... }, @@ -2726,22 +2060,14 @@ func ExampleEC2_DescribeFlowLogs() { resp, err := svc.DescribeFlowLogs(params) if err != nil { - if awsErr, ok := err.(awserr.Error); ok { - // Generic AWS error with Code, Message, and original error (if any) - fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) - if reqErr, ok := err.(awserr.RequestFailure); ok { - // A service error occurred - fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) - } - } else { - // This case should never be hit, the SDK should always return an - // error which satisfies the awserr.Error interface. - fmt.Println(err.Error()) - } + // Print the error, cast err to awserr.Error to get the Code and + // Message from an error. + fmt.Println(err.Error()) + return } // Pretty-print the response data. - fmt.Println(awsutil.Prettify(resp)) + fmt.Println(resp) } func ExampleEC2_DescribeImageAttribute() { @@ -2749,28 +2075,20 @@ func ExampleEC2_DescribeImageAttribute() { params := &ec2.DescribeImageAttributeInput{ Attribute: aws.String("ImageAttributeName"), // Required - ImageID: aws.String("String"), // Required + ImageId: aws.String("String"), // Required DryRun: aws.Bool(true), } resp, err := svc.DescribeImageAttribute(params) if err != nil { - if awsErr, ok := err.(awserr.Error); ok { - // Generic AWS error with Code, Message, and original error (if any) - fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) - if reqErr, ok := err.(awserr.RequestFailure); ok { - // A service error occurred - fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) - } - } else { - // This case should never be hit, the SDK should always return an - // error which satisfies the awserr.Error interface. - fmt.Println(err.Error()) - } + // Print the error, cast err to awserr.Error to get the Code and + // Message from an error. + fmt.Println(err.Error()) + return } // Pretty-print the response data. - fmt.Println(awsutil.Prettify(resp)) + fmt.Println(resp) } func ExampleEC2_DescribeImages() { @@ -2792,7 +2110,7 @@ func ExampleEC2_DescribeImages() { }, // More values... }, - ImageIDs: []*string{ + ImageIds: []*string{ aws.String("String"), // Required // More values... }, @@ -2804,22 +2122,14 @@ func ExampleEC2_DescribeImages() { resp, err := svc.DescribeImages(params) if err != nil { - if awsErr, ok := err.(awserr.Error); ok { - // Generic AWS error with Code, Message, and original error (if any) - fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) - if reqErr, ok := err.(awserr.RequestFailure); ok { - // A service error occurred - fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) - } - } else { - // This case should never be hit, the SDK should always return an - // error which satisfies the awserr.Error interface. - fmt.Println(err.Error()) - } + // Print the error, cast err to awserr.Error to get the Code and + // Message from an error. + fmt.Println(err.Error()) + return } // Pretty-print the response data. - fmt.Println(awsutil.Prettify(resp)) + fmt.Println(resp) } func ExampleEC2_DescribeImportImageTasks() { @@ -2837,7 +2147,7 @@ func ExampleEC2_DescribeImportImageTasks() { }, // More values... }, - ImportTaskIDs: []*string{ + ImportTaskIds: []*string{ aws.String("String"), // Required // More values... }, @@ -2847,22 +2157,14 @@ func ExampleEC2_DescribeImportImageTasks() { resp, err := svc.DescribeImportImageTasks(params) if err != nil { - if awsErr, ok := err.(awserr.Error); ok { - // Generic AWS error with Code, Message, and original error (if any) - fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) - if reqErr, ok := err.(awserr.RequestFailure); ok { - // A service error occurred - fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) - } - } else { - // This case should never be hit, the SDK should always return an - // error which satisfies the awserr.Error interface. - fmt.Println(err.Error()) - } + // Print the error, cast err to awserr.Error to get the Code and + // Message from an error. + fmt.Println(err.Error()) + return } // Pretty-print the response data. - fmt.Println(awsutil.Prettify(resp)) + fmt.Println(resp) } func ExampleEC2_DescribeImportSnapshotTasks() { @@ -2880,7 +2182,7 @@ func ExampleEC2_DescribeImportSnapshotTasks() { }, // More values... }, - ImportTaskIDs: []*string{ + ImportTaskIds: []*string{ aws.String("String"), // Required // More values... }, @@ -2890,22 +2192,14 @@ func ExampleEC2_DescribeImportSnapshotTasks() { resp, err := svc.DescribeImportSnapshotTasks(params) if err != nil { - if awsErr, ok := err.(awserr.Error); ok { - // Generic AWS error with Code, Message, and original error (if any) - fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) - if reqErr, ok := err.(awserr.RequestFailure); ok { - // A service error occurred - fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) - } - } else { - // This case should never be hit, the SDK should always return an - // error which satisfies the awserr.Error interface. - fmt.Println(err.Error()) - } + // Print the error, cast err to awserr.Error to get the Code and + // Message from an error. + fmt.Println(err.Error()) + return } // Pretty-print the response data. - fmt.Println(awsutil.Prettify(resp)) + fmt.Println(resp) } func ExampleEC2_DescribeInstanceAttribute() { @@ -2913,28 +2207,20 @@ func ExampleEC2_DescribeInstanceAttribute() { params := &ec2.DescribeInstanceAttributeInput{ Attribute: aws.String("InstanceAttributeName"), // Required - InstanceID: aws.String("String"), // Required + InstanceId: aws.String("String"), // Required DryRun: aws.Bool(true), } resp, err := svc.DescribeInstanceAttribute(params) if err != nil { - if awsErr, ok := err.(awserr.Error); ok { - // Generic AWS error with Code, Message, and original error (if any) - fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) - if reqErr, ok := err.(awserr.RequestFailure); ok { - // A service error occurred - fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) - } - } else { - // This case should never be hit, the SDK should always return an - // error which satisfies the awserr.Error interface. - fmt.Println(err.Error()) - } + // Print the error, cast err to awserr.Error to get the Code and + // Message from an error. + fmt.Println(err.Error()) + return } // Pretty-print the response data. - fmt.Println(awsutil.Prettify(resp)) + fmt.Println(resp) } func ExampleEC2_DescribeInstanceStatus() { @@ -2953,7 +2239,7 @@ func ExampleEC2_DescribeInstanceStatus() { // More values... }, IncludeAllInstances: aws.Bool(true), - InstanceIDs: []*string{ + InstanceIds: []*string{ aws.String("String"), // Required // More values... }, @@ -2963,22 +2249,14 @@ func ExampleEC2_DescribeInstanceStatus() { resp, err := svc.DescribeInstanceStatus(params) if err != nil { - if awsErr, ok := err.(awserr.Error); ok { - // Generic AWS error with Code, Message, and original error (if any) - fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) - if reqErr, ok := err.(awserr.RequestFailure); ok { - // A service error occurred - fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) - } - } else { - // This case should never be hit, the SDK should always return an - // error which satisfies the awserr.Error interface. - fmt.Println(err.Error()) - } + // Print the error, cast err to awserr.Error to get the Code and + // Message from an error. + fmt.Println(err.Error()) + return } // Pretty-print the response data. - fmt.Println(awsutil.Prettify(resp)) + fmt.Println(resp) } func ExampleEC2_DescribeInstances() { @@ -2996,7 +2274,7 @@ func ExampleEC2_DescribeInstances() { }, // More values... }, - InstanceIDs: []*string{ + InstanceIds: []*string{ aws.String("String"), // Required // More values... }, @@ -3006,22 +2284,14 @@ func ExampleEC2_DescribeInstances() { resp, err := svc.DescribeInstances(params) if err != nil { - if awsErr, ok := err.(awserr.Error); ok { - // Generic AWS error with Code, Message, and original error (if any) - fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) - if reqErr, ok := err.(awserr.RequestFailure); ok { - // A service error occurred - fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) - } - } else { - // This case should never be hit, the SDK should always return an - // error which satisfies the awserr.Error interface. - fmt.Println(err.Error()) - } + // Print the error, cast err to awserr.Error to get the Code and + // Message from an error. + fmt.Println(err.Error()) + return } // Pretty-print the response data. - fmt.Println(awsutil.Prettify(resp)) + fmt.Println(resp) } func ExampleEC2_DescribeInternetGateways() { @@ -3039,7 +2309,7 @@ func ExampleEC2_DescribeInternetGateways() { }, // More values... }, - InternetGatewayIDs: []*string{ + InternetGatewayIds: []*string{ aws.String("String"), // Required // More values... }, @@ -3047,22 +2317,14 @@ func ExampleEC2_DescribeInternetGateways() { resp, err := svc.DescribeInternetGateways(params) if err != nil { - if awsErr, ok := err.(awserr.Error); ok { - // Generic AWS error with Code, Message, and original error (if any) - fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) - if reqErr, ok := err.(awserr.RequestFailure); ok { - // A service error occurred - fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) - } - } else { - // This case should never be hit, the SDK should always return an - // error which satisfies the awserr.Error interface. - fmt.Println(err.Error()) - } + // Print the error, cast err to awserr.Error to get the Code and + // Message from an error. + fmt.Println(err.Error()) + return } // Pretty-print the response data. - fmt.Println(awsutil.Prettify(resp)) + fmt.Println(resp) } func ExampleEC2_DescribeKeyPairs() { @@ -3088,22 +2350,14 @@ func ExampleEC2_DescribeKeyPairs() { resp, err := svc.DescribeKeyPairs(params) if err != nil { - if awsErr, ok := err.(awserr.Error); ok { - // Generic AWS error with Code, Message, and original error (if any) - fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) - if reqErr, ok := err.(awserr.RequestFailure); ok { - // A service error occurred - fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) - } - } else { - // This case should never be hit, the SDK should always return an - // error which satisfies the awserr.Error interface. - fmt.Println(err.Error()) - } + // Print the error, cast err to awserr.Error to get the Code and + // Message from an error. + fmt.Println(err.Error()) + return } // Pretty-print the response data. - fmt.Println(awsutil.Prettify(resp)) + fmt.Println(resp) } func ExampleEC2_DescribeMovingAddresses() { @@ -3123,7 +2377,7 @@ func ExampleEC2_DescribeMovingAddresses() { }, MaxResults: aws.Int64(1), NextToken: aws.String("String"), - PublicIPs: []*string{ + PublicIps: []*string{ aws.String("String"), // Required // More values... }, @@ -3131,28 +2385,20 @@ func ExampleEC2_DescribeMovingAddresses() { resp, err := svc.DescribeMovingAddresses(params) if err != nil { - if awsErr, ok := err.(awserr.Error); ok { - // Generic AWS error with Code, Message, and original error (if any) - fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) - if reqErr, ok := err.(awserr.RequestFailure); ok { - // A service error occurred - fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) - } - } else { - // This case should never be hit, the SDK should always return an - // error which satisfies the awserr.Error interface. - fmt.Println(err.Error()) - } + // Print the error, cast err to awserr.Error to get the Code and + // Message from an error. + fmt.Println(err.Error()) + return } // Pretty-print the response data. - fmt.Println(awsutil.Prettify(resp)) + fmt.Println(resp) } -func ExampleEC2_DescribeNetworkACLs() { +func ExampleEC2_DescribeNetworkAcls() { svc := ec2.New(nil) - params := &ec2.DescribeNetworkACLsInput{ + params := &ec2.DescribeNetworkAclsInput{ DryRun: aws.Bool(true), Filters: []*ec2.Filter{ { // Required @@ -3164,59 +2410,43 @@ func ExampleEC2_DescribeNetworkACLs() { }, // More values... }, - NetworkACLIDs: []*string{ + NetworkAclIds: []*string{ aws.String("String"), // Required // More values... }, } - resp, err := svc.DescribeNetworkACLs(params) + resp, err := svc.DescribeNetworkAcls(params) if err != nil { - if awsErr, ok := err.(awserr.Error); ok { - // Generic AWS error with Code, Message, and original error (if any) - fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) - if reqErr, ok := err.(awserr.RequestFailure); ok { - // A service error occurred - fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) - } - } else { - // This case should never be hit, the SDK should always return an - // error which satisfies the awserr.Error interface. - fmt.Println(err.Error()) - } + // Print the error, cast err to awserr.Error to get the Code and + // Message from an error. + fmt.Println(err.Error()) + return } // Pretty-print the response data. - fmt.Println(awsutil.Prettify(resp)) + fmt.Println(resp) } func ExampleEC2_DescribeNetworkInterfaceAttribute() { svc := ec2.New(nil) params := &ec2.DescribeNetworkInterfaceAttributeInput{ - NetworkInterfaceID: aws.String("String"), // Required + NetworkInterfaceId: aws.String("String"), // Required Attribute: aws.String("NetworkInterfaceAttribute"), DryRun: aws.Bool(true), } resp, err := svc.DescribeNetworkInterfaceAttribute(params) if err != nil { - if awsErr, ok := err.(awserr.Error); ok { - // Generic AWS error with Code, Message, and original error (if any) - fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) - if reqErr, ok := err.(awserr.RequestFailure); ok { - // A service error occurred - fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) - } - } else { - // This case should never be hit, the SDK should always return an - // error which satisfies the awserr.Error interface. - fmt.Println(err.Error()) - } + // Print the error, cast err to awserr.Error to get the Code and + // Message from an error. + fmt.Println(err.Error()) + return } // Pretty-print the response data. - fmt.Println(awsutil.Prettify(resp)) + fmt.Println(resp) } func ExampleEC2_DescribeNetworkInterfaces() { @@ -3234,7 +2464,7 @@ func ExampleEC2_DescribeNetworkInterfaces() { }, // More values... }, - NetworkInterfaceIDs: []*string{ + NetworkInterfaceIds: []*string{ aws.String("String"), // Required // More values... }, @@ -3242,22 +2472,14 @@ func ExampleEC2_DescribeNetworkInterfaces() { resp, err := svc.DescribeNetworkInterfaces(params) if err != nil { - if awsErr, ok := err.(awserr.Error); ok { - // Generic AWS error with Code, Message, and original error (if any) - fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) - if reqErr, ok := err.(awserr.RequestFailure); ok { - // A service error occurred - fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) - } - } else { - // This case should never be hit, the SDK should always return an - // error which satisfies the awserr.Error interface. - fmt.Println(err.Error()) - } + // Print the error, cast err to awserr.Error to get the Code and + // Message from an error. + fmt.Println(err.Error()) + return } // Pretty-print the response data. - fmt.Println(awsutil.Prettify(resp)) + fmt.Println(resp) } func ExampleEC2_DescribePlacementGroups() { @@ -3283,22 +2505,14 @@ func ExampleEC2_DescribePlacementGroups() { resp, err := svc.DescribePlacementGroups(params) if err != nil { - if awsErr, ok := err.(awserr.Error); ok { - // Generic AWS error with Code, Message, and original error (if any) - fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) - if reqErr, ok := err.(awserr.RequestFailure); ok { - // A service error occurred - fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) - } - } else { - // This case should never be hit, the SDK should always return an - // error which satisfies the awserr.Error interface. - fmt.Println(err.Error()) - } + // Print the error, cast err to awserr.Error to get the Code and + // Message from an error. + fmt.Println(err.Error()) + return } // Pretty-print the response data. - fmt.Println(awsutil.Prettify(resp)) + fmt.Println(resp) } func ExampleEC2_DescribePrefixLists() { @@ -3318,7 +2532,7 @@ func ExampleEC2_DescribePrefixLists() { }, MaxResults: aws.Int64(1), NextToken: aws.String("String"), - PrefixListIDs: []*string{ + PrefixListIds: []*string{ aws.String("String"), // Required // More values... }, @@ -3326,22 +2540,14 @@ func ExampleEC2_DescribePrefixLists() { resp, err := svc.DescribePrefixLists(params) if err != nil { - if awsErr, ok := err.(awserr.Error); ok { - // Generic AWS error with Code, Message, and original error (if any) - fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) - if reqErr, ok := err.(awserr.RequestFailure); ok { - // A service error occurred - fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) - } - } else { - // This case should never be hit, the SDK should always return an - // error which satisfies the awserr.Error interface. - fmt.Println(err.Error()) - } + // Print the error, cast err to awserr.Error to get the Code and + // Message from an error. + fmt.Println(err.Error()) + return } // Pretty-print the response data. - fmt.Println(awsutil.Prettify(resp)) + fmt.Println(resp) } func ExampleEC2_DescribeRegions() { @@ -3367,22 +2573,14 @@ func ExampleEC2_DescribeRegions() { resp, err := svc.DescribeRegions(params) if err != nil { - if awsErr, ok := err.(awserr.Error); ok { - // Generic AWS error with Code, Message, and original error (if any) - fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) - if reqErr, ok := err.(awserr.RequestFailure); ok { - // A service error occurred - fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) - } - } else { - // This case should never be hit, the SDK should always return an - // error which satisfies the awserr.Error interface. - fmt.Println(err.Error()) - } + // Print the error, cast err to awserr.Error to get the Code and + // Message from an error. + fmt.Println(err.Error()) + return } // Pretty-print the response data. - fmt.Println(awsutil.Prettify(resp)) + fmt.Println(resp) } func ExampleEC2_DescribeReservedInstances() { @@ -3401,7 +2599,7 @@ func ExampleEC2_DescribeReservedInstances() { // More values... }, OfferingType: aws.String("OfferingTypeValues"), - ReservedInstancesIDs: []*string{ + ReservedInstancesIds: []*string{ aws.String("String"), // Required // More values... }, @@ -3409,22 +2607,14 @@ func ExampleEC2_DescribeReservedInstances() { resp, err := svc.DescribeReservedInstances(params) if err != nil { - if awsErr, ok := err.(awserr.Error); ok { - // Generic AWS error with Code, Message, and original error (if any) - fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) - if reqErr, ok := err.(awserr.RequestFailure); ok { - // A service error occurred - fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) - } - } else { - // This case should never be hit, the SDK should always return an - // error which satisfies the awserr.Error interface. - fmt.Println(err.Error()) - } + // Print the error, cast err to awserr.Error to get the Code and + // Message from an error. + fmt.Println(err.Error()) + return } // Pretty-print the response data. - fmt.Println(awsutil.Prettify(resp)) + fmt.Println(resp) } func ExampleEC2_DescribeReservedInstancesListings() { @@ -3441,28 +2631,20 @@ func ExampleEC2_DescribeReservedInstancesListings() { }, // More values... }, - ReservedInstancesID: aws.String("String"), - ReservedInstancesListingID: aws.String("String"), + ReservedInstancesId: aws.String("String"), + ReservedInstancesListingId: aws.String("String"), } resp, err := svc.DescribeReservedInstancesListings(params) if err != nil { - if awsErr, ok := err.(awserr.Error); ok { - // Generic AWS error with Code, Message, and original error (if any) - fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) - if reqErr, ok := err.(awserr.RequestFailure); ok { - // A service error occurred - fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) - } - } else { - // This case should never be hit, the SDK should always return an - // error which satisfies the awserr.Error interface. - fmt.Println(err.Error()) - } + // Print the error, cast err to awserr.Error to get the Code and + // Message from an error. + fmt.Println(err.Error()) + return } // Pretty-print the response data. - fmt.Println(awsutil.Prettify(resp)) + fmt.Println(resp) } func ExampleEC2_DescribeReservedInstancesModifications() { @@ -3480,7 +2662,7 @@ func ExampleEC2_DescribeReservedInstancesModifications() { // More values... }, NextToken: aws.String("String"), - ReservedInstancesModificationIDs: []*string{ + ReservedInstancesModificationIds: []*string{ aws.String("String"), // Required // More values... }, @@ -3488,22 +2670,14 @@ func ExampleEC2_DescribeReservedInstancesModifications() { resp, err := svc.DescribeReservedInstancesModifications(params) if err != nil { - if awsErr, ok := err.(awserr.Error); ok { - // Generic AWS error with Code, Message, and original error (if any) - fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) - if reqErr, ok := err.(awserr.RequestFailure); ok { - // A service error occurred - fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) - } - } else { - // This case should never be hit, the SDK should always return an - // error which satisfies the awserr.Error interface. - fmt.Println(err.Error()) - } + // Print the error, cast err to awserr.Error to get the Code and + // Message from an error. + fmt.Println(err.Error()) + return } // Pretty-print the response data. - fmt.Println(awsutil.Prettify(resp)) + fmt.Println(resp) } func ExampleEC2_DescribeReservedInstancesOfferings() { @@ -3532,7 +2706,7 @@ func ExampleEC2_DescribeReservedInstancesOfferings() { NextToken: aws.String("String"), OfferingType: aws.String("OfferingTypeValues"), ProductDescription: aws.String("RIProductDescription"), - ReservedInstancesOfferingIDs: []*string{ + ReservedInstancesOfferingIds: []*string{ aws.String("String"), // Required // More values... }, @@ -3540,22 +2714,14 @@ func ExampleEC2_DescribeReservedInstancesOfferings() { resp, err := svc.DescribeReservedInstancesOfferings(params) if err != nil { - if awsErr, ok := err.(awserr.Error); ok { - // Generic AWS error with Code, Message, and original error (if any) - fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) - if reqErr, ok := err.(awserr.RequestFailure); ok { - // A service error occurred - fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) - } - } else { - // This case should never be hit, the SDK should always return an - // error which satisfies the awserr.Error interface. - fmt.Println(err.Error()) - } + // Print the error, cast err to awserr.Error to get the Code and + // Message from an error. + fmt.Println(err.Error()) + return } // Pretty-print the response data. - fmt.Println(awsutil.Prettify(resp)) + fmt.Println(resp) } func ExampleEC2_DescribeRouteTables() { @@ -3573,7 +2739,7 @@ func ExampleEC2_DescribeRouteTables() { }, // More values... }, - RouteTableIDs: []*string{ + RouteTableIds: []*string{ aws.String("String"), // Required // More values... }, @@ -3581,22 +2747,14 @@ func ExampleEC2_DescribeRouteTables() { resp, err := svc.DescribeRouteTables(params) if err != nil { - if awsErr, ok := err.(awserr.Error); ok { - // Generic AWS error with Code, Message, and original error (if any) - fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) - if reqErr, ok := err.(awserr.RequestFailure); ok { - // A service error occurred - fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) - } - } else { - // This case should never be hit, the SDK should always return an - // error which satisfies the awserr.Error interface. - fmt.Println(err.Error()) - } + // Print the error, cast err to awserr.Error to get the Code and + // Message from an error. + fmt.Println(err.Error()) + return } // Pretty-print the response data. - fmt.Println(awsutil.Prettify(resp)) + fmt.Println(resp) } func ExampleEC2_DescribeSecurityGroups() { @@ -3614,7 +2772,7 @@ func ExampleEC2_DescribeSecurityGroups() { }, // More values... }, - GroupIDs: []*string{ + GroupIds: []*string{ aws.String("String"), // Required // More values... }, @@ -3626,22 +2784,14 @@ func ExampleEC2_DescribeSecurityGroups() { resp, err := svc.DescribeSecurityGroups(params) if err != nil { - if awsErr, ok := err.(awserr.Error); ok { - // Generic AWS error with Code, Message, and original error (if any) - fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) - if reqErr, ok := err.(awserr.RequestFailure); ok { - // A service error occurred - fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) - } - } else { - // This case should never be hit, the SDK should always return an - // error which satisfies the awserr.Error interface. - fmt.Println(err.Error()) - } + // Print the error, cast err to awserr.Error to get the Code and + // Message from an error. + fmt.Println(err.Error()) + return } // Pretty-print the response data. - fmt.Println(awsutil.Prettify(resp)) + fmt.Println(resp) } func ExampleEC2_DescribeSnapshotAttribute() { @@ -3649,28 +2799,20 @@ func ExampleEC2_DescribeSnapshotAttribute() { params := &ec2.DescribeSnapshotAttributeInput{ Attribute: aws.String("SnapshotAttributeName"), // Required - SnapshotID: aws.String("String"), // Required + SnapshotId: aws.String("String"), // Required DryRun: aws.Bool(true), } resp, err := svc.DescribeSnapshotAttribute(params) if err != nil { - if awsErr, ok := err.(awserr.Error); ok { - // Generic AWS error with Code, Message, and original error (if any) - fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) - if reqErr, ok := err.(awserr.RequestFailure); ok { - // A service error occurred - fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) - } - } else { - // This case should never be hit, the SDK should always return an - // error which satisfies the awserr.Error interface. - fmt.Println(err.Error()) - } + // Print the error, cast err to awserr.Error to get the Code and + // Message from an error. + fmt.Println(err.Error()) + return } // Pretty-print the response data. - fmt.Println(awsutil.Prettify(resp)) + fmt.Println(resp) } func ExampleEC2_DescribeSnapshots() { @@ -3690,15 +2832,15 @@ func ExampleEC2_DescribeSnapshots() { }, MaxResults: aws.Int64(1), NextToken: aws.String("String"), - OwnerIDs: []*string{ + OwnerIds: []*string{ aws.String("String"), // Required // More values... }, - RestorableByUserIDs: []*string{ + RestorableByUserIds: []*string{ aws.String("String"), // Required // More values... }, - SnapshotIDs: []*string{ + SnapshotIds: []*string{ aws.String("String"), // Required // More values... }, @@ -3706,22 +2848,14 @@ func ExampleEC2_DescribeSnapshots() { resp, err := svc.DescribeSnapshots(params) if err != nil { - if awsErr, ok := err.(awserr.Error); ok { - // Generic AWS error with Code, Message, and original error (if any) - fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) - if reqErr, ok := err.(awserr.RequestFailure); ok { - // A service error occurred - fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) - } - } else { - // This case should never be hit, the SDK should always return an - // error which satisfies the awserr.Error interface. - fmt.Println(err.Error()) - } + // Print the error, cast err to awserr.Error to get the Code and + // Message from an error. + fmt.Println(err.Error()) + return } // Pretty-print the response data. - fmt.Println(awsutil.Prettify(resp)) + fmt.Println(resp) } func ExampleEC2_DescribeSpotDatafeedSubscription() { @@ -3733,29 +2867,21 @@ func ExampleEC2_DescribeSpotDatafeedSubscription() { resp, err := svc.DescribeSpotDatafeedSubscription(params) if err != nil { - if awsErr, ok := err.(awserr.Error); ok { - // Generic AWS error with Code, Message, and original error (if any) - fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) - if reqErr, ok := err.(awserr.RequestFailure); ok { - // A service error occurred - fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) - } - } else { - // This case should never be hit, the SDK should always return an - // error which satisfies the awserr.Error interface. - fmt.Println(err.Error()) - } + // Print the error, cast err to awserr.Error to get the Code and + // Message from an error. + fmt.Println(err.Error()) + return } // Pretty-print the response data. - fmt.Println(awsutil.Prettify(resp)) + fmt.Println(resp) } func ExampleEC2_DescribeSpotFleetInstances() { svc := ec2.New(nil) params := &ec2.DescribeSpotFleetInstancesInput{ - SpotFleetRequestID: aws.String("String"), // Required + SpotFleetRequestId: aws.String("String"), // Required DryRun: aws.Bool(true), MaxResults: aws.Int64(1), NextToken: aws.String("String"), @@ -3763,29 +2889,21 @@ func ExampleEC2_DescribeSpotFleetInstances() { resp, err := svc.DescribeSpotFleetInstances(params) if err != nil { - if awsErr, ok := err.(awserr.Error); ok { - // Generic AWS error with Code, Message, and original error (if any) - fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) - if reqErr, ok := err.(awserr.RequestFailure); ok { - // A service error occurred - fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) - } - } else { - // This case should never be hit, the SDK should always return an - // error which satisfies the awserr.Error interface. - fmt.Println(err.Error()) - } + // Print the error, cast err to awserr.Error to get the Code and + // Message from an error. + fmt.Println(err.Error()) + return } // Pretty-print the response data. - fmt.Println(awsutil.Prettify(resp)) + fmt.Println(resp) } func ExampleEC2_DescribeSpotFleetRequestHistory() { svc := ec2.New(nil) params := &ec2.DescribeSpotFleetRequestHistoryInput{ - SpotFleetRequestID: aws.String("String"), // Required + SpotFleetRequestId: aws.String("String"), // Required StartTime: aws.Time(time.Now()), // Required DryRun: aws.Bool(true), EventType: aws.String("EventType"), @@ -3795,22 +2913,14 @@ func ExampleEC2_DescribeSpotFleetRequestHistory() { resp, err := svc.DescribeSpotFleetRequestHistory(params) if err != nil { - if awsErr, ok := err.(awserr.Error); ok { - // Generic AWS error with Code, Message, and original error (if any) - fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) - if reqErr, ok := err.(awserr.RequestFailure); ok { - // A service error occurred - fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) - } - } else { - // This case should never be hit, the SDK should always return an - // error which satisfies the awserr.Error interface. - fmt.Println(err.Error()) - } + // Print the error, cast err to awserr.Error to get the Code and + // Message from an error. + fmt.Println(err.Error()) + return } // Pretty-print the response data. - fmt.Println(awsutil.Prettify(resp)) + fmt.Println(resp) } func ExampleEC2_DescribeSpotFleetRequests() { @@ -3820,7 +2930,7 @@ func ExampleEC2_DescribeSpotFleetRequests() { DryRun: aws.Bool(true), MaxResults: aws.Int64(1), NextToken: aws.String("String"), - SpotFleetRequestIDs: []*string{ + SpotFleetRequestIds: []*string{ aws.String("String"), // Required // More values... }, @@ -3828,22 +2938,14 @@ func ExampleEC2_DescribeSpotFleetRequests() { resp, err := svc.DescribeSpotFleetRequests(params) if err != nil { - if awsErr, ok := err.(awserr.Error); ok { - // Generic AWS error with Code, Message, and original error (if any) - fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) - if reqErr, ok := err.(awserr.RequestFailure); ok { - // A service error occurred - fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) - } - } else { - // This case should never be hit, the SDK should always return an - // error which satisfies the awserr.Error interface. - fmt.Println(err.Error()) - } + // Print the error, cast err to awserr.Error to get the Code and + // Message from an error. + fmt.Println(err.Error()) + return } // Pretty-print the response data. - fmt.Println(awsutil.Prettify(resp)) + fmt.Println(resp) } func ExampleEC2_DescribeSpotInstanceRequests() { @@ -3861,7 +2963,7 @@ func ExampleEC2_DescribeSpotInstanceRequests() { }, // More values... }, - SpotInstanceRequestIDs: []*string{ + SpotInstanceRequestIds: []*string{ aws.String("String"), // Required // More values... }, @@ -3869,22 +2971,14 @@ func ExampleEC2_DescribeSpotInstanceRequests() { resp, err := svc.DescribeSpotInstanceRequests(params) if err != nil { - if awsErr, ok := err.(awserr.Error); ok { - // Generic AWS error with Code, Message, and original error (if any) - fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) - if reqErr, ok := err.(awserr.RequestFailure); ok { - // A service error occurred - fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) - } - } else { - // This case should never be hit, the SDK should always return an - // error which satisfies the awserr.Error interface. - fmt.Println(err.Error()) - } + // Print the error, cast err to awserr.Error to get the Code and + // Message from an error. + fmt.Println(err.Error()) + return } // Pretty-print the response data. - fmt.Println(awsutil.Prettify(resp)) + fmt.Println(resp) } func ExampleEC2_DescribeSpotPriceHistory() { @@ -3919,22 +3013,14 @@ func ExampleEC2_DescribeSpotPriceHistory() { resp, err := svc.DescribeSpotPriceHistory(params) if err != nil { - if awsErr, ok := err.(awserr.Error); ok { - // Generic AWS error with Code, Message, and original error (if any) - fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) - if reqErr, ok := err.(awserr.RequestFailure); ok { - // A service error occurred - fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) - } - } else { - // This case should never be hit, the SDK should always return an - // error which satisfies the awserr.Error interface. - fmt.Println(err.Error()) - } + // Print the error, cast err to awserr.Error to get the Code and + // Message from an error. + fmt.Println(err.Error()) + return } // Pretty-print the response data. - fmt.Println(awsutil.Prettify(resp)) + fmt.Println(resp) } func ExampleEC2_DescribeSubnets() { @@ -3952,7 +3038,7 @@ func ExampleEC2_DescribeSubnets() { }, // More values... }, - SubnetIDs: []*string{ + SubnetIds: []*string{ aws.String("String"), // Required // More values... }, @@ -3960,22 +3046,14 @@ func ExampleEC2_DescribeSubnets() { resp, err := svc.DescribeSubnets(params) if err != nil { - if awsErr, ok := err.(awserr.Error); ok { - // Generic AWS error with Code, Message, and original error (if any) - fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) - if reqErr, ok := err.(awserr.RequestFailure); ok { - // A service error occurred - fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) - } - } else { - // This case should never be hit, the SDK should always return an - // error which satisfies the awserr.Error interface. - fmt.Println(err.Error()) - } + // Print the error, cast err to awserr.Error to get the Code and + // Message from an error. + fmt.Println(err.Error()) + return } // Pretty-print the response data. - fmt.Println(awsutil.Prettify(resp)) + fmt.Println(resp) } func ExampleEC2_DescribeTags() { @@ -3999,357 +3077,35 @@ func ExampleEC2_DescribeTags() { resp, err := svc.DescribeTags(params) if err != nil { - if awsErr, ok := err.(awserr.Error); ok { - // Generic AWS error with Code, Message, and original error (if any) - fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) - if reqErr, ok := err.(awserr.RequestFailure); ok { - // A service error occurred - fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) - } - } else { - // This case should never be hit, the SDK should always return an - // error which satisfies the awserr.Error interface. - fmt.Println(err.Error()) - } + // Print the error, cast err to awserr.Error to get the Code and + // Message from an error. + fmt.Println(err.Error()) + return } // Pretty-print the response data. - fmt.Println(awsutil.Prettify(resp)) -} - -func ExampleEC2_DescribeVPCAttribute() { - svc := ec2.New(nil) - - params := &ec2.DescribeVPCAttributeInput{ - VPCID: aws.String("String"), // Required - Attribute: aws.String("VpcAttributeName"), - DryRun: aws.Bool(true), - } - resp, err := svc.DescribeVPCAttribute(params) - - if err != nil { - if awsErr, ok := err.(awserr.Error); ok { - // Generic AWS error with Code, Message, and original error (if any) - fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) - if reqErr, ok := err.(awserr.RequestFailure); ok { - // A service error occurred - fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) - } - } else { - // This case should never be hit, the SDK should always return an - // error which satisfies the awserr.Error interface. - fmt.Println(err.Error()) - } - } - - // Pretty-print the response data. - fmt.Println(awsutil.Prettify(resp)) -} - -func ExampleEC2_DescribeVPCClassicLink() { - svc := ec2.New(nil) - - params := &ec2.DescribeVPCClassicLinkInput{ - DryRun: aws.Bool(true), - Filters: []*ec2.Filter{ - { // Required - Name: aws.String("String"), - Values: []*string{ - aws.String("String"), // Required - // More values... - }, - }, - // More values... - }, - VPCIDs: []*string{ - aws.String("String"), // Required - // More values... - }, - } - resp, err := svc.DescribeVPCClassicLink(params) - - if err != nil { - if awsErr, ok := err.(awserr.Error); ok { - // Generic AWS error with Code, Message, and original error (if any) - fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) - if reqErr, ok := err.(awserr.RequestFailure); ok { - // A service error occurred - fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) - } - } else { - // This case should never be hit, the SDK should always return an - // error which satisfies the awserr.Error interface. - fmt.Println(err.Error()) - } - } - - // Pretty-print the response data. - fmt.Println(awsutil.Prettify(resp)) -} - -func ExampleEC2_DescribeVPCEndpointServices() { - svc := ec2.New(nil) - - params := &ec2.DescribeVPCEndpointServicesInput{ - DryRun: aws.Bool(true), - MaxResults: aws.Int64(1), - NextToken: aws.String("String"), - } - resp, err := svc.DescribeVPCEndpointServices(params) - - if err != nil { - if awsErr, ok := err.(awserr.Error); ok { - // Generic AWS error with Code, Message, and original error (if any) - fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) - if reqErr, ok := err.(awserr.RequestFailure); ok { - // A service error occurred - fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) - } - } else { - // This case should never be hit, the SDK should always return an - // error which satisfies the awserr.Error interface. - fmt.Println(err.Error()) - } - } - - // Pretty-print the response data. - fmt.Println(awsutil.Prettify(resp)) -} - -func ExampleEC2_DescribeVPCEndpoints() { - svc := ec2.New(nil) - - params := &ec2.DescribeVPCEndpointsInput{ - DryRun: aws.Bool(true), - Filters: []*ec2.Filter{ - { // Required - Name: aws.String("String"), - Values: []*string{ - aws.String("String"), // Required - // More values... - }, - }, - // More values... - }, - MaxResults: aws.Int64(1), - NextToken: aws.String("String"), - VPCEndpointIDs: []*string{ - aws.String("String"), // Required - // More values... - }, - } - resp, err := svc.DescribeVPCEndpoints(params) - - if err != nil { - if awsErr, ok := err.(awserr.Error); ok { - // Generic AWS error with Code, Message, and original error (if any) - fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) - if reqErr, ok := err.(awserr.RequestFailure); ok { - // A service error occurred - fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) - } - } else { - // This case should never be hit, the SDK should always return an - // error which satisfies the awserr.Error interface. - fmt.Println(err.Error()) - } - } - - // Pretty-print the response data. - fmt.Println(awsutil.Prettify(resp)) -} - -func ExampleEC2_DescribeVPCPeeringConnections() { - svc := ec2.New(nil) - - params := &ec2.DescribeVPCPeeringConnectionsInput{ - DryRun: aws.Bool(true), - Filters: []*ec2.Filter{ - { // Required - Name: aws.String("String"), - Values: []*string{ - aws.String("String"), // Required - // More values... - }, - }, - // More values... - }, - VPCPeeringConnectionIDs: []*string{ - aws.String("String"), // Required - // More values... - }, - } - resp, err := svc.DescribeVPCPeeringConnections(params) - - if err != nil { - if awsErr, ok := err.(awserr.Error); ok { - // Generic AWS error with Code, Message, and original error (if any) - fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) - if reqErr, ok := err.(awserr.RequestFailure); ok { - // A service error occurred - fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) - } - } else { - // This case should never be hit, the SDK should always return an - // error which satisfies the awserr.Error interface. - fmt.Println(err.Error()) - } - } - - // Pretty-print the response data. - fmt.Println(awsutil.Prettify(resp)) -} - -func ExampleEC2_DescribeVPCs() { - svc := ec2.New(nil) - - params := &ec2.DescribeVPCsInput{ - DryRun: aws.Bool(true), - Filters: []*ec2.Filter{ - { // Required - Name: aws.String("String"), - Values: []*string{ - aws.String("String"), // Required - // More values... - }, - }, - // More values... - }, - VPCIDs: []*string{ - aws.String("String"), // Required - // More values... - }, - } - resp, err := svc.DescribeVPCs(params) - - if err != nil { - if awsErr, ok := err.(awserr.Error); ok { - // Generic AWS error with Code, Message, and original error (if any) - fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) - if reqErr, ok := err.(awserr.RequestFailure); ok { - // A service error occurred - fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) - } - } else { - // This case should never be hit, the SDK should always return an - // error which satisfies the awserr.Error interface. - fmt.Println(err.Error()) - } - } - - // Pretty-print the response data. - fmt.Println(awsutil.Prettify(resp)) -} - -func ExampleEC2_DescribeVPNConnections() { - svc := ec2.New(nil) - - params := &ec2.DescribeVPNConnectionsInput{ - DryRun: aws.Bool(true), - Filters: []*ec2.Filter{ - { // Required - Name: aws.String("String"), - Values: []*string{ - aws.String("String"), // Required - // More values... - }, - }, - // More values... - }, - VPNConnectionIDs: []*string{ - aws.String("String"), // Required - // More values... - }, - } - resp, err := svc.DescribeVPNConnections(params) - - if err != nil { - if awsErr, ok := err.(awserr.Error); ok { - // Generic AWS error with Code, Message, and original error (if any) - fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) - if reqErr, ok := err.(awserr.RequestFailure); ok { - // A service error occurred - fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) - } - } else { - // This case should never be hit, the SDK should always return an - // error which satisfies the awserr.Error interface. - fmt.Println(err.Error()) - } - } - - // Pretty-print the response data. - fmt.Println(awsutil.Prettify(resp)) -} - -func ExampleEC2_DescribeVPNGateways() { - svc := ec2.New(nil) - - params := &ec2.DescribeVPNGatewaysInput{ - DryRun: aws.Bool(true), - Filters: []*ec2.Filter{ - { // Required - Name: aws.String("String"), - Values: []*string{ - aws.String("String"), // Required - // More values... - }, - }, - // More values... - }, - VPNGatewayIDs: []*string{ - aws.String("String"), // Required - // More values... - }, - } - resp, err := svc.DescribeVPNGateways(params) - - if err != nil { - if awsErr, ok := err.(awserr.Error); ok { - // Generic AWS error with Code, Message, and original error (if any) - fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) - if reqErr, ok := err.(awserr.RequestFailure); ok { - // A service error occurred - fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) - } - } else { - // This case should never be hit, the SDK should always return an - // error which satisfies the awserr.Error interface. - fmt.Println(err.Error()) - } - } - - // Pretty-print the response data. - fmt.Println(awsutil.Prettify(resp)) + fmt.Println(resp) } func ExampleEC2_DescribeVolumeAttribute() { svc := ec2.New(nil) params := &ec2.DescribeVolumeAttributeInput{ - VolumeID: aws.String("String"), // Required + VolumeId: aws.String("String"), // Required Attribute: aws.String("VolumeAttributeName"), DryRun: aws.Bool(true), } resp, err := svc.DescribeVolumeAttribute(params) if err != nil { - if awsErr, ok := err.(awserr.Error); ok { - // Generic AWS error with Code, Message, and original error (if any) - fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) - if reqErr, ok := err.(awserr.RequestFailure); ok { - // A service error occurred - fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) - } - } else { - // This case should never be hit, the SDK should always return an - // error which satisfies the awserr.Error interface. - fmt.Println(err.Error()) - } + // Print the error, cast err to awserr.Error to get the Code and + // Message from an error. + fmt.Println(err.Error()) + return } // Pretty-print the response data. - fmt.Println(awsutil.Prettify(resp)) + fmt.Println(resp) } func ExampleEC2_DescribeVolumeStatus() { @@ -4369,7 +3125,7 @@ func ExampleEC2_DescribeVolumeStatus() { }, MaxResults: aws.Int64(1), NextToken: aws.String("String"), - VolumeIDs: []*string{ + VolumeIds: []*string{ aws.String("String"), // Required // More values... }, @@ -4377,22 +3133,14 @@ func ExampleEC2_DescribeVolumeStatus() { resp, err := svc.DescribeVolumeStatus(params) if err != nil { - if awsErr, ok := err.(awserr.Error); ok { - // Generic AWS error with Code, Message, and original error (if any) - fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) - if reqErr, ok := err.(awserr.RequestFailure); ok { - // A service error occurred - fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) - } - } else { - // This case should never be hit, the SDK should always return an - // error which satisfies the awserr.Error interface. - fmt.Println(err.Error()) - } + // Print the error, cast err to awserr.Error to get the Code and + // Message from an error. + fmt.Println(err.Error()) + return } // Pretty-print the response data. - fmt.Println(awsutil.Prettify(resp)) + fmt.Println(resp) } func ExampleEC2_DescribeVolumes() { @@ -4412,7 +3160,7 @@ func ExampleEC2_DescribeVolumes() { }, MaxResults: aws.Int64(1), NextToken: aws.String("String"), - VolumeIDs: []*string{ + VolumeIds: []*string{ aws.String("String"), // Required // More values... }, @@ -4420,422 +3168,544 @@ func ExampleEC2_DescribeVolumes() { resp, err := svc.DescribeVolumes(params) if err != nil { - if awsErr, ok := err.(awserr.Error); ok { - // Generic AWS error with Code, Message, and original error (if any) - fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) - if reqErr, ok := err.(awserr.RequestFailure); ok { - // A service error occurred - fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) - } - } else { - // This case should never be hit, the SDK should always return an - // error which satisfies the awserr.Error interface. - fmt.Println(err.Error()) - } + // Print the error, cast err to awserr.Error to get the Code and + // Message from an error. + fmt.Println(err.Error()) + return } // Pretty-print the response data. - fmt.Println(awsutil.Prettify(resp)) + fmt.Println(resp) } -func ExampleEC2_DetachClassicLinkVPC() { +func ExampleEC2_DescribeVpcAttribute() { svc := ec2.New(nil) - params := &ec2.DetachClassicLinkVPCInput{ - InstanceID: aws.String("String"), // Required - VPCID: aws.String("String"), // Required - DryRun: aws.Bool(true), + params := &ec2.DescribeVpcAttributeInput{ + VpcId: aws.String("String"), // Required + Attribute: aws.String("VpcAttributeName"), + DryRun: aws.Bool(true), } - resp, err := svc.DetachClassicLinkVPC(params) + resp, err := svc.DescribeVpcAttribute(params) if err != nil { - if awsErr, ok := err.(awserr.Error); ok { - // Generic AWS error with Code, Message, and original error (if any) - fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) - if reqErr, ok := err.(awserr.RequestFailure); ok { - // A service error occurred - fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) - } - } else { - // This case should never be hit, the SDK should always return an - // error which satisfies the awserr.Error interface. - fmt.Println(err.Error()) - } + // Print the error, cast err to awserr.Error to get the Code and + // Message from an error. + fmt.Println(err.Error()) + return } // Pretty-print the response data. - fmt.Println(awsutil.Prettify(resp)) + fmt.Println(resp) +} + +func ExampleEC2_DescribeVpcClassicLink() { + svc := ec2.New(nil) + + params := &ec2.DescribeVpcClassicLinkInput{ + DryRun: aws.Bool(true), + Filters: []*ec2.Filter{ + { // Required + Name: aws.String("String"), + Values: []*string{ + aws.String("String"), // Required + // More values... + }, + }, + // More values... + }, + VpcIds: []*string{ + aws.String("String"), // Required + // More values... + }, + } + resp, err := svc.DescribeVpcClassicLink(params) + + if err != nil { + // Print the error, cast err to awserr.Error to get the Code and + // Message from an error. + fmt.Println(err.Error()) + return + } + + // Pretty-print the response data. + fmt.Println(resp) +} + +func ExampleEC2_DescribeVpcEndpointServices() { + svc := ec2.New(nil) + + params := &ec2.DescribeVpcEndpointServicesInput{ + DryRun: aws.Bool(true), + MaxResults: aws.Int64(1), + NextToken: aws.String("String"), + } + resp, err := svc.DescribeVpcEndpointServices(params) + + if err != nil { + // Print the error, cast err to awserr.Error to get the Code and + // Message from an error. + fmt.Println(err.Error()) + return + } + + // Pretty-print the response data. + fmt.Println(resp) +} + +func ExampleEC2_DescribeVpcEndpoints() { + svc := ec2.New(nil) + + params := &ec2.DescribeVpcEndpointsInput{ + DryRun: aws.Bool(true), + Filters: []*ec2.Filter{ + { // Required + Name: aws.String("String"), + Values: []*string{ + aws.String("String"), // Required + // More values... + }, + }, + // More values... + }, + MaxResults: aws.Int64(1), + NextToken: aws.String("String"), + VpcEndpointIds: []*string{ + aws.String("String"), // Required + // More values... + }, + } + resp, err := svc.DescribeVpcEndpoints(params) + + if err != nil { + // Print the error, cast err to awserr.Error to get the Code and + // Message from an error. + fmt.Println(err.Error()) + return + } + + // Pretty-print the response data. + fmt.Println(resp) +} + +func ExampleEC2_DescribeVpcPeeringConnections() { + svc := ec2.New(nil) + + params := &ec2.DescribeVpcPeeringConnectionsInput{ + DryRun: aws.Bool(true), + Filters: []*ec2.Filter{ + { // Required + Name: aws.String("String"), + Values: []*string{ + aws.String("String"), // Required + // More values... + }, + }, + // More values... + }, + VpcPeeringConnectionIds: []*string{ + aws.String("String"), // Required + // More values... + }, + } + resp, err := svc.DescribeVpcPeeringConnections(params) + + if err != nil { + // Print the error, cast err to awserr.Error to get the Code and + // Message from an error. + fmt.Println(err.Error()) + return + } + + // Pretty-print the response data. + fmt.Println(resp) +} + +func ExampleEC2_DescribeVpcs() { + svc := ec2.New(nil) + + params := &ec2.DescribeVpcsInput{ + DryRun: aws.Bool(true), + Filters: []*ec2.Filter{ + { // Required + Name: aws.String("String"), + Values: []*string{ + aws.String("String"), // Required + // More values... + }, + }, + // More values... + }, + VpcIds: []*string{ + aws.String("String"), // Required + // More values... + }, + } + resp, err := svc.DescribeVpcs(params) + + if err != nil { + // Print the error, cast err to awserr.Error to get the Code and + // Message from an error. + fmt.Println(err.Error()) + return + } + + // Pretty-print the response data. + fmt.Println(resp) +} + +func ExampleEC2_DescribeVpnConnections() { + svc := ec2.New(nil) + + params := &ec2.DescribeVpnConnectionsInput{ + DryRun: aws.Bool(true), + Filters: []*ec2.Filter{ + { // Required + Name: aws.String("String"), + Values: []*string{ + aws.String("String"), // Required + // More values... + }, + }, + // More values... + }, + VpnConnectionIds: []*string{ + aws.String("String"), // Required + // More values... + }, + } + resp, err := svc.DescribeVpnConnections(params) + + if err != nil { + // Print the error, cast err to awserr.Error to get the Code and + // Message from an error. + fmt.Println(err.Error()) + return + } + + // Pretty-print the response data. + fmt.Println(resp) +} + +func ExampleEC2_DescribeVpnGateways() { + svc := ec2.New(nil) + + params := &ec2.DescribeVpnGatewaysInput{ + DryRun: aws.Bool(true), + Filters: []*ec2.Filter{ + { // Required + Name: aws.String("String"), + Values: []*string{ + aws.String("String"), // Required + // More values... + }, + }, + // More values... + }, + VpnGatewayIds: []*string{ + aws.String("String"), // Required + // More values... + }, + } + resp, err := svc.DescribeVpnGateways(params) + + if err != nil { + // Print the error, cast err to awserr.Error to get the Code and + // Message from an error. + fmt.Println(err.Error()) + return + } + + // Pretty-print the response data. + fmt.Println(resp) +} + +func ExampleEC2_DetachClassicLinkVpc() { + svc := ec2.New(nil) + + params := &ec2.DetachClassicLinkVpcInput{ + InstanceId: aws.String("String"), // Required + VpcId: aws.String("String"), // Required + DryRun: aws.Bool(true), + } + resp, err := svc.DetachClassicLinkVpc(params) + + if err != nil { + // Print the error, cast err to awserr.Error to get the Code and + // Message from an error. + fmt.Println(err.Error()) + return + } + + // Pretty-print the response data. + fmt.Println(resp) } func ExampleEC2_DetachInternetGateway() { svc := ec2.New(nil) params := &ec2.DetachInternetGatewayInput{ - InternetGatewayID: aws.String("String"), // Required - VPCID: aws.String("String"), // Required + InternetGatewayId: aws.String("String"), // Required + VpcId: aws.String("String"), // Required DryRun: aws.Bool(true), } resp, err := svc.DetachInternetGateway(params) if err != nil { - if awsErr, ok := err.(awserr.Error); ok { - // Generic AWS error with Code, Message, and original error (if any) - fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) - if reqErr, ok := err.(awserr.RequestFailure); ok { - // A service error occurred - fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) - } - } else { - // This case should never be hit, the SDK should always return an - // error which satisfies the awserr.Error interface. - fmt.Println(err.Error()) - } + // Print the error, cast err to awserr.Error to get the Code and + // Message from an error. + fmt.Println(err.Error()) + return } // Pretty-print the response data. - fmt.Println(awsutil.Prettify(resp)) + fmt.Println(resp) } func ExampleEC2_DetachNetworkInterface() { svc := ec2.New(nil) params := &ec2.DetachNetworkInterfaceInput{ - AttachmentID: aws.String("String"), // Required + AttachmentId: aws.String("String"), // Required DryRun: aws.Bool(true), Force: aws.Bool(true), } resp, err := svc.DetachNetworkInterface(params) if err != nil { - if awsErr, ok := err.(awserr.Error); ok { - // Generic AWS error with Code, Message, and original error (if any) - fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) - if reqErr, ok := err.(awserr.RequestFailure); ok { - // A service error occurred - fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) - } - } else { - // This case should never be hit, the SDK should always return an - // error which satisfies the awserr.Error interface. - fmt.Println(err.Error()) - } + // Print the error, cast err to awserr.Error to get the Code and + // Message from an error. + fmt.Println(err.Error()) + return } // Pretty-print the response data. - fmt.Println(awsutil.Prettify(resp)) -} - -func ExampleEC2_DetachVPNGateway() { - svc := ec2.New(nil) - - params := &ec2.DetachVPNGatewayInput{ - VPCID: aws.String("String"), // Required - VPNGatewayID: aws.String("String"), // Required - DryRun: aws.Bool(true), - } - resp, err := svc.DetachVPNGateway(params) - - if err != nil { - if awsErr, ok := err.(awserr.Error); ok { - // Generic AWS error with Code, Message, and original error (if any) - fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) - if reqErr, ok := err.(awserr.RequestFailure); ok { - // A service error occurred - fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) - } - } else { - // This case should never be hit, the SDK should always return an - // error which satisfies the awserr.Error interface. - fmt.Println(err.Error()) - } - } - - // Pretty-print the response data. - fmt.Println(awsutil.Prettify(resp)) + fmt.Println(resp) } func ExampleEC2_DetachVolume() { svc := ec2.New(nil) params := &ec2.DetachVolumeInput{ - VolumeID: aws.String("String"), // Required + VolumeId: aws.String("String"), // Required Device: aws.String("String"), DryRun: aws.Bool(true), Force: aws.Bool(true), - InstanceID: aws.String("String"), + InstanceId: aws.String("String"), } resp, err := svc.DetachVolume(params) if err != nil { - if awsErr, ok := err.(awserr.Error); ok { - // Generic AWS error with Code, Message, and original error (if any) - fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) - if reqErr, ok := err.(awserr.RequestFailure); ok { - // A service error occurred - fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) - } - } else { - // This case should never be hit, the SDK should always return an - // error which satisfies the awserr.Error interface. - fmt.Println(err.Error()) - } + // Print the error, cast err to awserr.Error to get the Code and + // Message from an error. + fmt.Println(err.Error()) + return } // Pretty-print the response data. - fmt.Println(awsutil.Prettify(resp)) + fmt.Println(resp) } -func ExampleEC2_DisableVGWRoutePropagation() { +func ExampleEC2_DetachVpnGateway() { svc := ec2.New(nil) - params := &ec2.DisableVGWRoutePropagationInput{ - GatewayID: aws.String("String"), // Required - RouteTableID: aws.String("String"), // Required + params := &ec2.DetachVpnGatewayInput{ + VpcId: aws.String("String"), // Required + VpnGatewayId: aws.String("String"), // Required + DryRun: aws.Bool(true), } - resp, err := svc.DisableVGWRoutePropagation(params) + resp, err := svc.DetachVpnGateway(params) if err != nil { - if awsErr, ok := err.(awserr.Error); ok { - // Generic AWS error with Code, Message, and original error (if any) - fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) - if reqErr, ok := err.(awserr.RequestFailure); ok { - // A service error occurred - fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) - } - } else { - // This case should never be hit, the SDK should always return an - // error which satisfies the awserr.Error interface. - fmt.Println(err.Error()) - } + // Print the error, cast err to awserr.Error to get the Code and + // Message from an error. + fmt.Println(err.Error()) + return } // Pretty-print the response data. - fmt.Println(awsutil.Prettify(resp)) + fmt.Println(resp) } -func ExampleEC2_DisableVPCClassicLink() { +func ExampleEC2_DisableVgwRoutePropagation() { svc := ec2.New(nil) - params := &ec2.DisableVPCClassicLinkInput{ - VPCID: aws.String("String"), // Required + params := &ec2.DisableVgwRoutePropagationInput{ + GatewayId: aws.String("String"), // Required + RouteTableId: aws.String("String"), // Required + } + resp, err := svc.DisableVgwRoutePropagation(params) + + if err != nil { + // Print the error, cast err to awserr.Error to get the Code and + // Message from an error. + fmt.Println(err.Error()) + return + } + + // Pretty-print the response data. + fmt.Println(resp) +} + +func ExampleEC2_DisableVpcClassicLink() { + svc := ec2.New(nil) + + params := &ec2.DisableVpcClassicLinkInput{ + VpcId: aws.String("String"), // Required DryRun: aws.Bool(true), } - resp, err := svc.DisableVPCClassicLink(params) + resp, err := svc.DisableVpcClassicLink(params) if err != nil { - if awsErr, ok := err.(awserr.Error); ok { - // Generic AWS error with Code, Message, and original error (if any) - fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) - if reqErr, ok := err.(awserr.RequestFailure); ok { - // A service error occurred - fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) - } - } else { - // This case should never be hit, the SDK should always return an - // error which satisfies the awserr.Error interface. - fmt.Println(err.Error()) - } + // Print the error, cast err to awserr.Error to get the Code and + // Message from an error. + fmt.Println(err.Error()) + return } // Pretty-print the response data. - fmt.Println(awsutil.Prettify(resp)) + fmt.Println(resp) } func ExampleEC2_DisassociateAddress() { svc := ec2.New(nil) params := &ec2.DisassociateAddressInput{ - AssociationID: aws.String("String"), + AssociationId: aws.String("String"), DryRun: aws.Bool(true), - PublicIP: aws.String("String"), + PublicIp: aws.String("String"), } resp, err := svc.DisassociateAddress(params) if err != nil { - if awsErr, ok := err.(awserr.Error); ok { - // Generic AWS error with Code, Message, and original error (if any) - fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) - if reqErr, ok := err.(awserr.RequestFailure); ok { - // A service error occurred - fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) - } - } else { - // This case should never be hit, the SDK should always return an - // error which satisfies the awserr.Error interface. - fmt.Println(err.Error()) - } + // Print the error, cast err to awserr.Error to get the Code and + // Message from an error. + fmt.Println(err.Error()) + return } // Pretty-print the response data. - fmt.Println(awsutil.Prettify(resp)) + fmt.Println(resp) } func ExampleEC2_DisassociateRouteTable() { svc := ec2.New(nil) params := &ec2.DisassociateRouteTableInput{ - AssociationID: aws.String("String"), // Required + AssociationId: aws.String("String"), // Required DryRun: aws.Bool(true), } resp, err := svc.DisassociateRouteTable(params) if err != nil { - if awsErr, ok := err.(awserr.Error); ok { - // Generic AWS error with Code, Message, and original error (if any) - fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) - if reqErr, ok := err.(awserr.RequestFailure); ok { - // A service error occurred - fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) - } - } else { - // This case should never be hit, the SDK should always return an - // error which satisfies the awserr.Error interface. - fmt.Println(err.Error()) - } + // Print the error, cast err to awserr.Error to get the Code and + // Message from an error. + fmt.Println(err.Error()) + return } // Pretty-print the response data. - fmt.Println(awsutil.Prettify(resp)) + fmt.Println(resp) } -func ExampleEC2_EnableVGWRoutePropagation() { +func ExampleEC2_EnableVgwRoutePropagation() { svc := ec2.New(nil) - params := &ec2.EnableVGWRoutePropagationInput{ - GatewayID: aws.String("String"), // Required - RouteTableID: aws.String("String"), // Required + params := &ec2.EnableVgwRoutePropagationInput{ + GatewayId: aws.String("String"), // Required + RouteTableId: aws.String("String"), // Required } - resp, err := svc.EnableVGWRoutePropagation(params) + resp, err := svc.EnableVgwRoutePropagation(params) if err != nil { - if awsErr, ok := err.(awserr.Error); ok { - // Generic AWS error with Code, Message, and original error (if any) - fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) - if reqErr, ok := err.(awserr.RequestFailure); ok { - // A service error occurred - fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) - } - } else { - // This case should never be hit, the SDK should always return an - // error which satisfies the awserr.Error interface. - fmt.Println(err.Error()) - } + // Print the error, cast err to awserr.Error to get the Code and + // Message from an error. + fmt.Println(err.Error()) + return } // Pretty-print the response data. - fmt.Println(awsutil.Prettify(resp)) -} - -func ExampleEC2_EnableVPCClassicLink() { - svc := ec2.New(nil) - - params := &ec2.EnableVPCClassicLinkInput{ - VPCID: aws.String("String"), // Required - DryRun: aws.Bool(true), - } - resp, err := svc.EnableVPCClassicLink(params) - - if err != nil { - if awsErr, ok := err.(awserr.Error); ok { - // Generic AWS error with Code, Message, and original error (if any) - fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) - if reqErr, ok := err.(awserr.RequestFailure); ok { - // A service error occurred - fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) - } - } else { - // This case should never be hit, the SDK should always return an - // error which satisfies the awserr.Error interface. - fmt.Println(err.Error()) - } - } - - // Pretty-print the response data. - fmt.Println(awsutil.Prettify(resp)) + fmt.Println(resp) } func ExampleEC2_EnableVolumeIO() { svc := ec2.New(nil) params := &ec2.EnableVolumeIOInput{ - VolumeID: aws.String("String"), // Required + VolumeId: aws.String("String"), // Required DryRun: aws.Bool(true), } resp, err := svc.EnableVolumeIO(params) if err != nil { - if awsErr, ok := err.(awserr.Error); ok { - // Generic AWS error with Code, Message, and original error (if any) - fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) - if reqErr, ok := err.(awserr.RequestFailure); ok { - // A service error occurred - fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) - } - } else { - // This case should never be hit, the SDK should always return an - // error which satisfies the awserr.Error interface. - fmt.Println(err.Error()) - } + // Print the error, cast err to awserr.Error to get the Code and + // Message from an error. + fmt.Println(err.Error()) + return } // Pretty-print the response data. - fmt.Println(awsutil.Prettify(resp)) + fmt.Println(resp) +} + +func ExampleEC2_EnableVpcClassicLink() { + svc := ec2.New(nil) + + params := &ec2.EnableVpcClassicLinkInput{ + VpcId: aws.String("String"), // Required + DryRun: aws.Bool(true), + } + resp, err := svc.EnableVpcClassicLink(params) + + if err != nil { + // Print the error, cast err to awserr.Error to get the Code and + // Message from an error. + fmt.Println(err.Error()) + return + } + + // Pretty-print the response data. + fmt.Println(resp) } func ExampleEC2_GetConsoleOutput() { svc := ec2.New(nil) params := &ec2.GetConsoleOutputInput{ - InstanceID: aws.String("String"), // Required + InstanceId: aws.String("String"), // Required DryRun: aws.Bool(true), } resp, err := svc.GetConsoleOutput(params) if err != nil { - if awsErr, ok := err.(awserr.Error); ok { - // Generic AWS error with Code, Message, and original error (if any) - fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) - if reqErr, ok := err.(awserr.RequestFailure); ok { - // A service error occurred - fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) - } - } else { - // This case should never be hit, the SDK should always return an - // error which satisfies the awserr.Error interface. - fmt.Println(err.Error()) - } + // Print the error, cast err to awserr.Error to get the Code and + // Message from an error. + fmt.Println(err.Error()) + return } // Pretty-print the response data. - fmt.Println(awsutil.Prettify(resp)) + fmt.Println(resp) } func ExampleEC2_GetPasswordData() { svc := ec2.New(nil) params := &ec2.GetPasswordDataInput{ - InstanceID: aws.String("String"), // Required + InstanceId: aws.String("String"), // Required DryRun: aws.Bool(true), } resp, err := svc.GetPasswordData(params) if err != nil { - if awsErr, ok := err.(awserr.Error); ok { - // Generic AWS error with Code, Message, and original error (if any) - fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) - if reqErr, ok := err.(awserr.RequestFailure); ok { - // A service error occurred - fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) - } - } else { - // This case should never be hit, the SDK should always return an - // error which satisfies the awserr.Error interface. - fmt.Println(err.Error()) - } + // Print the error, cast err to awserr.Error to get the Code and + // Message from an error. + fmt.Println(err.Error()) + return } // Pretty-print the response data. - fmt.Println(awsutil.Prettify(resp)) + fmt.Println(resp) } func ExampleEC2_ImportImage() { @@ -4856,8 +3726,8 @@ func ExampleEC2_ImportImage() { Description: aws.String("String"), DeviceName: aws.String("String"), Format: aws.String("String"), - SnapshotID: aws.String("String"), - URL: aws.String("String"), + SnapshotId: aws.String("String"), + Url: aws.String("String"), UserBucket: &ec2.UserBucket{ S3Bucket: aws.String("String"), S3Key: aws.String("String"), @@ -4874,22 +3744,14 @@ func ExampleEC2_ImportImage() { resp, err := svc.ImportImage(params) if err != nil { - if awsErr, ok := err.(awserr.Error); ok { - // Generic AWS error with Code, Message, and original error (if any) - fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) - if reqErr, ok := err.(awserr.RequestFailure); ok { - // A service error occurred - fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) - } - } else { - // This case should never be hit, the SDK should always return an - // error which satisfies the awserr.Error interface. - fmt.Println(err.Error()) - } + // Print the error, cast err to awserr.Error to get the Code and + // Message from an error. + fmt.Println(err.Error()) + return } // Pretty-print the response data. - fmt.Println(awsutil.Prettify(resp)) + fmt.Println(resp) } func ExampleEC2_ImportInstance() { @@ -4904,7 +3766,7 @@ func ExampleEC2_ImportInstance() { Image: &ec2.DiskImageDetail{ Bytes: aws.Int64(1), // Required Format: aws.String("DiskImageFormat"), // Required - ImportManifestURL: aws.String("String"), // Required + ImportManifestUrl: aws.String("String"), // Required }, Volume: &ec2.VolumeDetail{ Size: aws.Int64(1), // Required @@ -4916,7 +3778,7 @@ func ExampleEC2_ImportInstance() { LaunchSpecification: &ec2.ImportInstanceLaunchSpecification{ AdditionalInfo: aws.String("String"), Architecture: aws.String("ArchitectureValues"), - GroupIDs: []*string{ + GroupIds: []*string{ aws.String("String"), // Required // More values... }, @@ -4932,8 +3794,8 @@ func ExampleEC2_ImportInstance() { GroupName: aws.String("String"), Tenancy: aws.String("Tenancy"), }, - PrivateIPAddress: aws.String("String"), - SubnetID: aws.String("String"), + PrivateIpAddress: aws.String("String"), + SubnetId: aws.String("String"), UserData: &ec2.UserData{ Data: aws.String("String"), }, @@ -4942,22 +3804,14 @@ func ExampleEC2_ImportInstance() { resp, err := svc.ImportInstance(params) if err != nil { - if awsErr, ok := err.(awserr.Error); ok { - // Generic AWS error with Code, Message, and original error (if any) - fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) - if reqErr, ok := err.(awserr.RequestFailure); ok { - // A service error occurred - fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) - } - } else { - // This case should never be hit, the SDK should always return an - // error which satisfies the awserr.Error interface. - fmt.Println(err.Error()) - } + // Print the error, cast err to awserr.Error to get the Code and + // Message from an error. + fmt.Println(err.Error()) + return } // Pretty-print the response data. - fmt.Println(awsutil.Prettify(resp)) + fmt.Println(resp) } func ExampleEC2_ImportKeyPair() { @@ -4971,22 +3825,14 @@ func ExampleEC2_ImportKeyPair() { resp, err := svc.ImportKeyPair(params) if err != nil { - if awsErr, ok := err.(awserr.Error); ok { - // Generic AWS error with Code, Message, and original error (if any) - fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) - if reqErr, ok := err.(awserr.RequestFailure); ok { - // A service error occurred - fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) - } - } else { - // This case should never be hit, the SDK should always return an - // error which satisfies the awserr.Error interface. - fmt.Println(err.Error()) - } + // Print the error, cast err to awserr.Error to get the Code and + // Message from an error. + fmt.Println(err.Error()) + return } // Pretty-print the response data. - fmt.Println(awsutil.Prettify(resp)) + fmt.Println(resp) } func ExampleEC2_ImportSnapshot() { @@ -5004,7 +3850,7 @@ func ExampleEC2_ImportSnapshot() { DiskContainer: &ec2.SnapshotDiskContainer{ Description: aws.String("String"), Format: aws.String("String"), - URL: aws.String("String"), + Url: aws.String("String"), UserBucket: &ec2.UserBucket{ S3Bucket: aws.String("String"), S3Key: aws.String("String"), @@ -5016,22 +3862,14 @@ func ExampleEC2_ImportSnapshot() { resp, err := svc.ImportSnapshot(params) if err != nil { - if awsErr, ok := err.(awserr.Error); ok { - // Generic AWS error with Code, Message, and original error (if any) - fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) - if reqErr, ok := err.(awserr.RequestFailure); ok { - // A service error occurred - fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) - } - } else { - // This case should never be hit, the SDK should always return an - // error which satisfies the awserr.Error interface. - fmt.Println(err.Error()) - } + // Print the error, cast err to awserr.Error to get the Code and + // Message from an error. + fmt.Println(err.Error()) + return } // Pretty-print the response data. - fmt.Println(awsutil.Prettify(resp)) + fmt.Println(resp) } func ExampleEC2_ImportVolume() { @@ -5042,7 +3880,7 @@ func ExampleEC2_ImportVolume() { Image: &ec2.DiskImageDetail{ // Required Bytes: aws.Int64(1), // Required Format: aws.String("DiskImageFormat"), // Required - ImportManifestURL: aws.String("String"), // Required + ImportManifestUrl: aws.String("String"), // Required }, Volume: &ec2.VolumeDetail{ // Required Size: aws.Int64(1), // Required @@ -5053,29 +3891,21 @@ func ExampleEC2_ImportVolume() { resp, err := svc.ImportVolume(params) if err != nil { - if awsErr, ok := err.(awserr.Error); ok { - // Generic AWS error with Code, Message, and original error (if any) - fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) - if reqErr, ok := err.(awserr.RequestFailure); ok { - // A service error occurred - fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) - } - } else { - // This case should never be hit, the SDK should always return an - // error which satisfies the awserr.Error interface. - fmt.Println(err.Error()) - } + // Print the error, cast err to awserr.Error to get the Code and + // Message from an error. + fmt.Println(err.Error()) + return } // Pretty-print the response data. - fmt.Println(awsutil.Prettify(resp)) + fmt.Println(resp) } func ExampleEC2_ModifyImageAttribute() { svc := ec2.New(nil) params := &ec2.ModifyImageAttributeInput{ - ImageID: aws.String("String"), // Required + ImageId: aws.String("String"), // Required Attribute: aws.String("String"), Description: &ec2.AttributeValue{ Value: aws.String("String"), @@ -5085,19 +3915,19 @@ func ExampleEC2_ModifyImageAttribute() { Add: []*ec2.LaunchPermission{ { // Required Group: aws.String("PermissionGroup"), - UserID: aws.String("String"), + UserId: aws.String("String"), }, // More values... }, Remove: []*ec2.LaunchPermission{ { // Required Group: aws.String("PermissionGroup"), - UserID: aws.String("String"), + UserId: aws.String("String"), }, // More values... }, }, - OperationType: aws.String("String"), + OperationType: aws.String("OperationType"), ProductCodes: []*string{ aws.String("String"), // Required // More values... @@ -5106,7 +3936,7 @@ func ExampleEC2_ModifyImageAttribute() { aws.String("String"), // Required // More values... }, - UserIDs: []*string{ + UserIds: []*string{ aws.String("String"), // Required // More values... }, @@ -5115,47 +3945,39 @@ func ExampleEC2_ModifyImageAttribute() { resp, err := svc.ModifyImageAttribute(params) if err != nil { - if awsErr, ok := err.(awserr.Error); ok { - // Generic AWS error with Code, Message, and original error (if any) - fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) - if reqErr, ok := err.(awserr.RequestFailure); ok { - // A service error occurred - fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) - } - } else { - // This case should never be hit, the SDK should always return an - // error which satisfies the awserr.Error interface. - fmt.Println(err.Error()) - } + // Print the error, cast err to awserr.Error to get the Code and + // Message from an error. + fmt.Println(err.Error()) + return } // Pretty-print the response data. - fmt.Println(awsutil.Prettify(resp)) + fmt.Println(resp) } func ExampleEC2_ModifyInstanceAttribute() { svc := ec2.New(nil) params := &ec2.ModifyInstanceAttributeInput{ - InstanceID: aws.String("String"), // Required + InstanceId: aws.String("String"), // Required Attribute: aws.String("InstanceAttributeName"), BlockDeviceMappings: []*ec2.InstanceBlockDeviceMappingSpecification{ { // Required DeviceName: aws.String("String"), - EBS: &ec2.EBSInstanceBlockDeviceSpecification{ + Ebs: &ec2.EbsInstanceBlockDeviceSpecification{ DeleteOnTermination: aws.Bool(true), - VolumeID: aws.String("String"), + VolumeId: aws.String("String"), }, NoDevice: aws.String("String"), VirtualName: aws.String("String"), }, // More values... }, - DisableAPITermination: &ec2.AttributeBooleanValue{ + DisableApiTermination: &ec2.AttributeBooleanValue{ Value: aws.Bool(true), }, DryRun: aws.Bool(true), - EBSOptimized: &ec2.AttributeBooleanValue{ + EbsOptimized: &ec2.AttributeBooleanValue{ Value: aws.Bool(true), }, Groups: []*string{ @@ -5171,15 +3993,15 @@ func ExampleEC2_ModifyInstanceAttribute() { Kernel: &ec2.AttributeValue{ Value: aws.String("String"), }, - RAMDisk: &ec2.AttributeValue{ - Value: aws.String("String"), - }, - SRIOVNetSupport: &ec2.AttributeValue{ + Ramdisk: &ec2.AttributeValue{ Value: aws.String("String"), }, SourceDestCheck: &ec2.AttributeBooleanValue{ Value: aws.Bool(true), }, + SriovNetSupport: &ec2.AttributeValue{ + Value: aws.String("String"), + }, UserData: &ec2.BlobAttributeValue{ Value: []byte("PAYLOAD"), }, @@ -5188,31 +4010,23 @@ func ExampleEC2_ModifyInstanceAttribute() { resp, err := svc.ModifyInstanceAttribute(params) if err != nil { - if awsErr, ok := err.(awserr.Error); ok { - // Generic AWS error with Code, Message, and original error (if any) - fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) - if reqErr, ok := err.(awserr.RequestFailure); ok { - // A service error occurred - fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) - } - } else { - // This case should never be hit, the SDK should always return an - // error which satisfies the awserr.Error interface. - fmt.Println(err.Error()) - } + // Print the error, cast err to awserr.Error to get the Code and + // Message from an error. + fmt.Println(err.Error()) + return } // Pretty-print the response data. - fmt.Println(awsutil.Prettify(resp)) + fmt.Println(resp) } func ExampleEC2_ModifyNetworkInterfaceAttribute() { svc := ec2.New(nil) params := &ec2.ModifyNetworkInterfaceAttributeInput{ - NetworkInterfaceID: aws.String("String"), // Required + NetworkInterfaceId: aws.String("String"), // Required Attachment: &ec2.NetworkInterfaceAttachmentChanges{ - AttachmentID: aws.String("String"), + AttachmentId: aws.String("String"), DeleteOnTermination: aws.Bool(true), }, Description: &ec2.AttributeValue{ @@ -5230,29 +4044,21 @@ func ExampleEC2_ModifyNetworkInterfaceAttribute() { resp, err := svc.ModifyNetworkInterfaceAttribute(params) if err != nil { - if awsErr, ok := err.(awserr.Error); ok { - // Generic AWS error with Code, Message, and original error (if any) - fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) - if reqErr, ok := err.(awserr.RequestFailure); ok { - // A service error occurred - fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) - } - } else { - // This case should never be hit, the SDK should always return an - // error which satisfies the awserr.Error interface. - fmt.Println(err.Error()) - } + // Print the error, cast err to awserr.Error to get the Code and + // Message from an error. + fmt.Println(err.Error()) + return } // Pretty-print the response data. - fmt.Println(awsutil.Prettify(resp)) + fmt.Println(resp) } func ExampleEC2_ModifyReservedInstances() { svc := ec2.New(nil) params := &ec2.ModifyReservedInstancesInput{ - ReservedInstancesIDs: []*string{ // Required + ReservedInstancesIds: []*string{ // Required aws.String("String"), // Required // More values... }, @@ -5270,42 +4076,34 @@ func ExampleEC2_ModifyReservedInstances() { resp, err := svc.ModifyReservedInstances(params) if err != nil { - if awsErr, ok := err.(awserr.Error); ok { - // Generic AWS error with Code, Message, and original error (if any) - fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) - if reqErr, ok := err.(awserr.RequestFailure); ok { - // A service error occurred - fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) - } - } else { - // This case should never be hit, the SDK should always return an - // error which satisfies the awserr.Error interface. - fmt.Println(err.Error()) - } + // Print the error, cast err to awserr.Error to get the Code and + // Message from an error. + fmt.Println(err.Error()) + return } // Pretty-print the response data. - fmt.Println(awsutil.Prettify(resp)) + fmt.Println(resp) } func ExampleEC2_ModifySnapshotAttribute() { svc := ec2.New(nil) params := &ec2.ModifySnapshotAttributeInput{ - SnapshotID: aws.String("String"), // Required + SnapshotId: aws.String("String"), // Required Attribute: aws.String("SnapshotAttributeName"), CreateVolumePermission: &ec2.CreateVolumePermissionModifications{ Add: []*ec2.CreateVolumePermission{ { // Required Group: aws.String("PermissionGroup"), - UserID: aws.String("String"), + UserId: aws.String("String"), }, // More values... }, Remove: []*ec2.CreateVolumePermission{ { // Required Group: aws.String("PermissionGroup"), - UserID: aws.String("String"), + UserId: aws.String("String"), }, // More values... }, @@ -5315,8 +4113,8 @@ func ExampleEC2_ModifySnapshotAttribute() { aws.String("String"), // Required // More values... }, - OperationType: aws.String("String"), - UserIDs: []*string{ + OperationType: aws.String("OperationType"), + UserIds: []*string{ aws.String("String"), // Required // More values... }, @@ -5324,130 +4122,64 @@ func ExampleEC2_ModifySnapshotAttribute() { resp, err := svc.ModifySnapshotAttribute(params) if err != nil { - if awsErr, ok := err.(awserr.Error); ok { - // Generic AWS error with Code, Message, and original error (if any) - fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) - if reqErr, ok := err.(awserr.RequestFailure); ok { - // A service error occurred - fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) - } - } else { - // This case should never be hit, the SDK should always return an - // error which satisfies the awserr.Error interface. - fmt.Println(err.Error()) - } + // Print the error, cast err to awserr.Error to get the Code and + // Message from an error. + fmt.Println(err.Error()) + return } // Pretty-print the response data. - fmt.Println(awsutil.Prettify(resp)) + fmt.Println(resp) +} + +func ExampleEC2_ModifySpotFleetRequest() { + svc := ec2.New(nil) + + params := &ec2.ModifySpotFleetRequestInput{ + SpotFleetRequestId: aws.String("String"), // Required + ExcessCapacityTerminationPolicy: aws.String("ExcessCapacityTerminationPolicy"), + TargetCapacity: aws.Int64(1), + } + resp, err := svc.ModifySpotFleetRequest(params) + + if err != nil { + // Print the error, cast err to awserr.Error to get the Code and + // Message from an error. + fmt.Println(err.Error()) + return + } + + // Pretty-print the response data. + fmt.Println(resp) } func ExampleEC2_ModifySubnetAttribute() { svc := ec2.New(nil) params := &ec2.ModifySubnetAttributeInput{ - SubnetID: aws.String("String"), // Required - MapPublicIPOnLaunch: &ec2.AttributeBooleanValue{ + SubnetId: aws.String("String"), // Required + MapPublicIpOnLaunch: &ec2.AttributeBooleanValue{ Value: aws.Bool(true), }, } resp, err := svc.ModifySubnetAttribute(params) if err != nil { - if awsErr, ok := err.(awserr.Error); ok { - // Generic AWS error with Code, Message, and original error (if any) - fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) - if reqErr, ok := err.(awserr.RequestFailure); ok { - // A service error occurred - fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) - } - } else { - // This case should never be hit, the SDK should always return an - // error which satisfies the awserr.Error interface. - fmt.Println(err.Error()) - } + // Print the error, cast err to awserr.Error to get the Code and + // Message from an error. + fmt.Println(err.Error()) + return } // Pretty-print the response data. - fmt.Println(awsutil.Prettify(resp)) -} - -func ExampleEC2_ModifyVPCAttribute() { - svc := ec2.New(nil) - - params := &ec2.ModifyVPCAttributeInput{ - VPCID: aws.String("String"), // Required - EnableDNSHostnames: &ec2.AttributeBooleanValue{ - Value: aws.Bool(true), - }, - EnableDNSSupport: &ec2.AttributeBooleanValue{ - Value: aws.Bool(true), - }, - } - resp, err := svc.ModifyVPCAttribute(params) - - if err != nil { - if awsErr, ok := err.(awserr.Error); ok { - // Generic AWS error with Code, Message, and original error (if any) - fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) - if reqErr, ok := err.(awserr.RequestFailure); ok { - // A service error occurred - fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) - } - } else { - // This case should never be hit, the SDK should always return an - // error which satisfies the awserr.Error interface. - fmt.Println(err.Error()) - } - } - - // Pretty-print the response data. - fmt.Println(awsutil.Prettify(resp)) -} - -func ExampleEC2_ModifyVPCEndpoint() { - svc := ec2.New(nil) - - params := &ec2.ModifyVPCEndpointInput{ - VPCEndpointID: aws.String("String"), // Required - AddRouteTableIDs: []*string{ - aws.String("String"), // Required - // More values... - }, - DryRun: aws.Bool(true), - PolicyDocument: aws.String("String"), - RemoveRouteTableIDs: []*string{ - aws.String("String"), // Required - // More values... - }, - ResetPolicy: aws.Bool(true), - } - resp, err := svc.ModifyVPCEndpoint(params) - - if err != nil { - if awsErr, ok := err.(awserr.Error); ok { - // Generic AWS error with Code, Message, and original error (if any) - fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) - if reqErr, ok := err.(awserr.RequestFailure); ok { - // A service error occurred - fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) - } - } else { - // This case should never be hit, the SDK should always return an - // error which satisfies the awserr.Error interface. - fmt.Println(err.Error()) - } - } - - // Pretty-print the response data. - fmt.Println(awsutil.Prettify(resp)) + fmt.Println(resp) } func ExampleEC2_ModifyVolumeAttribute() { svc := ec2.New(nil) params := &ec2.ModifyVolumeAttributeInput{ - VolumeID: aws.String("String"), // Required + VolumeId: aws.String("String"), // Required AutoEnableIO: &ec2.AttributeBooleanValue{ Value: aws.Bool(true), }, @@ -5456,29 +4188,76 @@ func ExampleEC2_ModifyVolumeAttribute() { resp, err := svc.ModifyVolumeAttribute(params) if err != nil { - if awsErr, ok := err.(awserr.Error); ok { - // Generic AWS error with Code, Message, and original error (if any) - fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) - if reqErr, ok := err.(awserr.RequestFailure); ok { - // A service error occurred - fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) - } - } else { - // This case should never be hit, the SDK should always return an - // error which satisfies the awserr.Error interface. - fmt.Println(err.Error()) - } + // Print the error, cast err to awserr.Error to get the Code and + // Message from an error. + fmt.Println(err.Error()) + return } // Pretty-print the response data. - fmt.Println(awsutil.Prettify(resp)) + fmt.Println(resp) +} + +func ExampleEC2_ModifyVpcAttribute() { + svc := ec2.New(nil) + + params := &ec2.ModifyVpcAttributeInput{ + VpcId: aws.String("String"), // Required + EnableDnsHostnames: &ec2.AttributeBooleanValue{ + Value: aws.Bool(true), + }, + EnableDnsSupport: &ec2.AttributeBooleanValue{ + Value: aws.Bool(true), + }, + } + resp, err := svc.ModifyVpcAttribute(params) + + if err != nil { + // Print the error, cast err to awserr.Error to get the Code and + // Message from an error. + fmt.Println(err.Error()) + return + } + + // Pretty-print the response data. + fmt.Println(resp) +} + +func ExampleEC2_ModifyVpcEndpoint() { + svc := ec2.New(nil) + + params := &ec2.ModifyVpcEndpointInput{ + VpcEndpointId: aws.String("String"), // Required + AddRouteTableIds: []*string{ + aws.String("String"), // Required + // More values... + }, + DryRun: aws.Bool(true), + PolicyDocument: aws.String("String"), + RemoveRouteTableIds: []*string{ + aws.String("String"), // Required + // More values... + }, + ResetPolicy: aws.Bool(true), + } + resp, err := svc.ModifyVpcEndpoint(params) + + if err != nil { + // Print the error, cast err to awserr.Error to get the Code and + // Message from an error. + fmt.Println(err.Error()) + return + } + + // Pretty-print the response data. + fmt.Println(resp) } func ExampleEC2_MonitorInstances() { svc := ec2.New(nil) params := &ec2.MonitorInstancesInput{ - InstanceIDs: []*string{ // Required + InstanceIds: []*string{ // Required aws.String("String"), // Required // More values... }, @@ -5487,50 +4266,34 @@ func ExampleEC2_MonitorInstances() { resp, err := svc.MonitorInstances(params) if err != nil { - if awsErr, ok := err.(awserr.Error); ok { - // Generic AWS error with Code, Message, and original error (if any) - fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) - if reqErr, ok := err.(awserr.RequestFailure); ok { - // A service error occurred - fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) - } - } else { - // This case should never be hit, the SDK should always return an - // error which satisfies the awserr.Error interface. - fmt.Println(err.Error()) - } + // Print the error, cast err to awserr.Error to get the Code and + // Message from an error. + fmt.Println(err.Error()) + return } // Pretty-print the response data. - fmt.Println(awsutil.Prettify(resp)) + fmt.Println(resp) } -func ExampleEC2_MoveAddressToVPC() { +func ExampleEC2_MoveAddressToVpc() { svc := ec2.New(nil) - params := &ec2.MoveAddressToVPCInput{ - PublicIP: aws.String("String"), // Required + params := &ec2.MoveAddressToVpcInput{ + PublicIp: aws.String("String"), // Required DryRun: aws.Bool(true), } - resp, err := svc.MoveAddressToVPC(params) + resp, err := svc.MoveAddressToVpc(params) if err != nil { - if awsErr, ok := err.(awserr.Error); ok { - // Generic AWS error with Code, Message, and original error (if any) - fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) - if reqErr, ok := err.(awserr.RequestFailure); ok { - // A service error occurred - fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) - } - } else { - // This case should never be hit, the SDK should always return an - // error which satisfies the awserr.Error interface. - fmt.Println(err.Error()) - } + // Print the error, cast err to awserr.Error to get the Code and + // Message from an error. + fmt.Println(err.Error()) + return } // Pretty-print the response data. - fmt.Println(awsutil.Prettify(resp)) + fmt.Println(resp) } func ExampleEC2_PurchaseReservedInstancesOffering() { @@ -5538,7 +4301,7 @@ func ExampleEC2_PurchaseReservedInstancesOffering() { params := &ec2.PurchaseReservedInstancesOfferingInput{ InstanceCount: aws.Int64(1), // Required - ReservedInstancesOfferingID: aws.String("String"), // Required + ReservedInstancesOfferingId: aws.String("String"), // Required DryRun: aws.Bool(true), LimitPrice: &ec2.ReservedInstanceLimitPrice{ Amount: aws.Float64(1.0), @@ -5548,29 +4311,21 @@ func ExampleEC2_PurchaseReservedInstancesOffering() { resp, err := svc.PurchaseReservedInstancesOffering(params) if err != nil { - if awsErr, ok := err.(awserr.Error); ok { - // Generic AWS error with Code, Message, and original error (if any) - fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) - if reqErr, ok := err.(awserr.RequestFailure); ok { - // A service error occurred - fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) - } - } else { - // This case should never be hit, the SDK should always return an - // error which satisfies the awserr.Error interface. - fmt.Println(err.Error()) - } + // Print the error, cast err to awserr.Error to get the Code and + // Message from an error. + fmt.Println(err.Error()) + return } // Pretty-print the response data. - fmt.Println(awsutil.Prettify(resp)) + fmt.Println(resp) } func ExampleEC2_RebootInstances() { svc := ec2.New(nil) params := &ec2.RebootInstancesInput{ - InstanceIDs: []*string{ // Required + InstanceIds: []*string{ // Required aws.String("String"), // Required // More values... }, @@ -5579,22 +4334,14 @@ func ExampleEC2_RebootInstances() { resp, err := svc.RebootInstances(params) if err != nil { - if awsErr, ok := err.(awserr.Error); ok { - // Generic AWS error with Code, Message, and original error (if any) - fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) - if reqErr, ok := err.(awserr.RequestFailure); ok { - // A service error occurred - fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) - } - } else { - // This case should never be hit, the SDK should always return an - // error which satisfies the awserr.Error interface. - fmt.Println(err.Error()) - } + // Print the error, cast err to awserr.Error to get the Code and + // Message from an error. + fmt.Println(err.Error()) + return } // Pretty-print the response data. - fmt.Println(awsutil.Prettify(resp)) + fmt.Println(resp) } func ExampleEC2_RegisterImage() { @@ -5606,11 +4353,11 @@ func ExampleEC2_RegisterImage() { BlockDeviceMappings: []*ec2.BlockDeviceMapping{ { // Required DeviceName: aws.String("String"), - EBS: &ec2.EBSBlockDevice{ + Ebs: &ec2.EbsBlockDevice{ DeleteOnTermination: aws.Bool(true), Encrypted: aws.Bool(true), - IOPS: aws.Int64(1), - SnapshotID: aws.String("String"), + Iops: aws.Int64(1), + SnapshotId: aws.String("String"), VolumeSize: aws.Int64(1), VolumeType: aws.String("VolumeType"), }, @@ -5622,131 +4369,99 @@ func ExampleEC2_RegisterImage() { Description: aws.String("String"), DryRun: aws.Bool(true), ImageLocation: aws.String("String"), - KernelID: aws.String("String"), - RAMDiskID: aws.String("String"), + KernelId: aws.String("String"), + RamdiskId: aws.String("String"), RootDeviceName: aws.String("String"), - SRIOVNetSupport: aws.String("String"), + SriovNetSupport: aws.String("String"), VirtualizationType: aws.String("String"), } resp, err := svc.RegisterImage(params) if err != nil { - if awsErr, ok := err.(awserr.Error); ok { - // Generic AWS error with Code, Message, and original error (if any) - fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) - if reqErr, ok := err.(awserr.RequestFailure); ok { - // A service error occurred - fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) - } - } else { - // This case should never be hit, the SDK should always return an - // error which satisfies the awserr.Error interface. - fmt.Println(err.Error()) - } + // Print the error, cast err to awserr.Error to get the Code and + // Message from an error. + fmt.Println(err.Error()) + return } // Pretty-print the response data. - fmt.Println(awsutil.Prettify(resp)) + fmt.Println(resp) } -func ExampleEC2_RejectVPCPeeringConnection() { +func ExampleEC2_RejectVpcPeeringConnection() { svc := ec2.New(nil) - params := &ec2.RejectVPCPeeringConnectionInput{ - VPCPeeringConnectionID: aws.String("String"), // Required + params := &ec2.RejectVpcPeeringConnectionInput{ + VpcPeeringConnectionId: aws.String("String"), // Required DryRun: aws.Bool(true), } - resp, err := svc.RejectVPCPeeringConnection(params) + resp, err := svc.RejectVpcPeeringConnection(params) if err != nil { - if awsErr, ok := err.(awserr.Error); ok { - // Generic AWS error with Code, Message, and original error (if any) - fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) - if reqErr, ok := err.(awserr.RequestFailure); ok { - // A service error occurred - fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) - } - } else { - // This case should never be hit, the SDK should always return an - // error which satisfies the awserr.Error interface. - fmt.Println(err.Error()) - } + // Print the error, cast err to awserr.Error to get the Code and + // Message from an error. + fmt.Println(err.Error()) + return } // Pretty-print the response data. - fmt.Println(awsutil.Prettify(resp)) + fmt.Println(resp) } func ExampleEC2_ReleaseAddress() { svc := ec2.New(nil) params := &ec2.ReleaseAddressInput{ - AllocationID: aws.String("String"), + AllocationId: aws.String("String"), DryRun: aws.Bool(true), - PublicIP: aws.String("String"), + PublicIp: aws.String("String"), } resp, err := svc.ReleaseAddress(params) if err != nil { - if awsErr, ok := err.(awserr.Error); ok { - // Generic AWS error with Code, Message, and original error (if any) - fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) - if reqErr, ok := err.(awserr.RequestFailure); ok { - // A service error occurred - fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) - } - } else { - // This case should never be hit, the SDK should always return an - // error which satisfies the awserr.Error interface. - fmt.Println(err.Error()) - } + // Print the error, cast err to awserr.Error to get the Code and + // Message from an error. + fmt.Println(err.Error()) + return } // Pretty-print the response data. - fmt.Println(awsutil.Prettify(resp)) + fmt.Println(resp) } -func ExampleEC2_ReplaceNetworkACLAssociation() { +func ExampleEC2_ReplaceNetworkAclAssociation() { svc := ec2.New(nil) - params := &ec2.ReplaceNetworkACLAssociationInput{ - AssociationID: aws.String("String"), // Required - NetworkACLID: aws.String("String"), // Required + params := &ec2.ReplaceNetworkAclAssociationInput{ + AssociationId: aws.String("String"), // Required + NetworkAclId: aws.String("String"), // Required DryRun: aws.Bool(true), } - resp, err := svc.ReplaceNetworkACLAssociation(params) + resp, err := svc.ReplaceNetworkAclAssociation(params) if err != nil { - if awsErr, ok := err.(awserr.Error); ok { - // Generic AWS error with Code, Message, and original error (if any) - fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) - if reqErr, ok := err.(awserr.RequestFailure); ok { - // A service error occurred - fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) - } - } else { - // This case should never be hit, the SDK should always return an - // error which satisfies the awserr.Error interface. - fmt.Println(err.Error()) - } + // Print the error, cast err to awserr.Error to get the Code and + // Message from an error. + fmt.Println(err.Error()) + return } // Pretty-print the response data. - fmt.Println(awsutil.Prettify(resp)) + fmt.Println(resp) } -func ExampleEC2_ReplaceNetworkACLEntry() { +func ExampleEC2_ReplaceNetworkAclEntry() { svc := ec2.New(nil) - params := &ec2.ReplaceNetworkACLEntryInput{ - CIDRBlock: aws.String("String"), // Required + params := &ec2.ReplaceNetworkAclEntryInput{ + CidrBlock: aws.String("String"), // Required Egress: aws.Bool(true), // Required - NetworkACLID: aws.String("String"), // Required + NetworkAclId: aws.String("String"), // Required Protocol: aws.String("String"), // Required RuleAction: aws.String("RuleAction"), // Required RuleNumber: aws.Int64(1), // Required DryRun: aws.Bool(true), - ICMPTypeCode: &ec2.ICMPTypeCode{ + IcmpTypeCode: &ec2.IcmpTypeCode{ Code: aws.Int64(1), Type: aws.Int64(1), }, @@ -5755,87 +4470,63 @@ func ExampleEC2_ReplaceNetworkACLEntry() { To: aws.Int64(1), }, } - resp, err := svc.ReplaceNetworkACLEntry(params) + resp, err := svc.ReplaceNetworkAclEntry(params) if err != nil { - if awsErr, ok := err.(awserr.Error); ok { - // Generic AWS error with Code, Message, and original error (if any) - fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) - if reqErr, ok := err.(awserr.RequestFailure); ok { - // A service error occurred - fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) - } - } else { - // This case should never be hit, the SDK should always return an - // error which satisfies the awserr.Error interface. - fmt.Println(err.Error()) - } + // Print the error, cast err to awserr.Error to get the Code and + // Message from an error. + fmt.Println(err.Error()) + return } // Pretty-print the response data. - fmt.Println(awsutil.Prettify(resp)) + fmt.Println(resp) } func ExampleEC2_ReplaceRoute() { svc := ec2.New(nil) params := &ec2.ReplaceRouteInput{ - DestinationCIDRBlock: aws.String("String"), // Required - RouteTableID: aws.String("String"), // Required + DestinationCidrBlock: aws.String("String"), // Required + RouteTableId: aws.String("String"), // Required DryRun: aws.Bool(true), - GatewayID: aws.String("String"), - InstanceID: aws.String("String"), - NetworkInterfaceID: aws.String("String"), - VPCPeeringConnectionID: aws.String("String"), + GatewayId: aws.String("String"), + InstanceId: aws.String("String"), + NetworkInterfaceId: aws.String("String"), + VpcPeeringConnectionId: aws.String("String"), } resp, err := svc.ReplaceRoute(params) if err != nil { - if awsErr, ok := err.(awserr.Error); ok { - // Generic AWS error with Code, Message, and original error (if any) - fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) - if reqErr, ok := err.(awserr.RequestFailure); ok { - // A service error occurred - fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) - } - } else { - // This case should never be hit, the SDK should always return an - // error which satisfies the awserr.Error interface. - fmt.Println(err.Error()) - } + // Print the error, cast err to awserr.Error to get the Code and + // Message from an error. + fmt.Println(err.Error()) + return } // Pretty-print the response data. - fmt.Println(awsutil.Prettify(resp)) + fmt.Println(resp) } func ExampleEC2_ReplaceRouteTableAssociation() { svc := ec2.New(nil) params := &ec2.ReplaceRouteTableAssociationInput{ - AssociationID: aws.String("String"), // Required - RouteTableID: aws.String("String"), // Required + AssociationId: aws.String("String"), // Required + RouteTableId: aws.String("String"), // Required DryRun: aws.Bool(true), } resp, err := svc.ReplaceRouteTableAssociation(params) if err != nil { - if awsErr, ok := err.(awserr.Error); ok { - // Generic AWS error with Code, Message, and original error (if any) - fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) - if reqErr, ok := err.(awserr.RequestFailure); ok { - // A service error occurred - fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) - } - } else { - // This case should never be hit, the SDK should always return an - // error which satisfies the awserr.Error interface. - fmt.Println(err.Error()) - } + // Print the error, cast err to awserr.Error to get the Code and + // Message from an error. + fmt.Println(err.Error()) + return } // Pretty-print the response data. - fmt.Println(awsutil.Prettify(resp)) + fmt.Println(resp) } func ExampleEC2_ReportInstanceStatus() { @@ -5859,22 +4550,14 @@ func ExampleEC2_ReportInstanceStatus() { resp, err := svc.ReportInstanceStatus(params) if err != nil { - if awsErr, ok := err.(awserr.Error); ok { - // Generic AWS error with Code, Message, and original error (if any) - fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) - if reqErr, ok := err.(awserr.RequestFailure); ok { - // A service error occurred - fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) - } - } else { - // This case should never be hit, the SDK should always return an - // error which satisfies the awserr.Error interface. - fmt.Println(err.Error()) - } + // Print the error, cast err to awserr.Error to get the Code and + // Message from an error. + fmt.Println(err.Error()) + return } // Pretty-print the response data. - fmt.Println(awsutil.Prettify(resp)) + fmt.Println(resp) } func ExampleEC2_RequestSpotFleet() { @@ -5882,18 +4565,18 @@ func ExampleEC2_RequestSpotFleet() { params := &ec2.RequestSpotFleetInput{ SpotFleetRequestConfig: &ec2.SpotFleetRequestConfigData{ // Required - IAMFleetRole: aws.String("String"), // Required + IamFleetRole: aws.String("String"), // Required LaunchSpecifications: []*ec2.SpotFleetLaunchSpecification{ // Required { // Required AddressingType: aws.String("String"), BlockDeviceMappings: []*ec2.BlockDeviceMapping{ { // Required DeviceName: aws.String("String"), - EBS: &ec2.EBSBlockDevice{ + Ebs: &ec2.EbsBlockDevice{ DeleteOnTermination: aws.Bool(true), Encrypted: aws.Bool(true), - IOPS: aws.Int64(1), - SnapshotID: aws.String("String"), + Iops: aws.Int64(1), + SnapshotId: aws.String("String"), VolumeSize: aws.Int64(1), VolumeType: aws.String("VolumeType"), }, @@ -5902,21 +4585,21 @@ func ExampleEC2_RequestSpotFleet() { }, // More values... }, - EBSOptimized: aws.Bool(true), - IAMInstanceProfile: &ec2.IAMInstanceProfileSpecification{ - ARN: aws.String("String"), + EbsOptimized: aws.Bool(true), + IamInstanceProfile: &ec2.IamInstanceProfileSpecification{ + Arn: aws.String("String"), Name: aws.String("String"), }, - ImageID: aws.String("String"), + ImageId: aws.String("String"), InstanceType: aws.String("InstanceType"), - KernelID: aws.String("String"), + KernelId: aws.String("String"), KeyName: aws.String("String"), Monitoring: &ec2.SpotFleetMonitoring{ Enabled: aws.Bool(true), }, NetworkInterfaces: []*ec2.InstanceNetworkInterfaceSpecification{ { // Required - AssociatePublicIPAddress: aws.Bool(true), + AssociatePublicIpAddress: aws.Bool(true), DeleteOnTermination: aws.Bool(true), Description: aws.String("String"), DeviceIndex: aws.Int64(1), @@ -5924,17 +4607,17 @@ func ExampleEC2_RequestSpotFleet() { aws.String("String"), // Required // More values... }, - NetworkInterfaceID: aws.String("String"), - PrivateIPAddress: aws.String("String"), - PrivateIPAddresses: []*ec2.PrivateIPAddressSpecification{ + NetworkInterfaceId: aws.String("String"), + PrivateIpAddress: aws.String("String"), + PrivateIpAddresses: []*ec2.PrivateIpAddressSpecification{ { // Required - PrivateIPAddress: aws.String("String"), // Required + PrivateIpAddress: aws.String("String"), // Required Primary: aws.Bool(true), }, // More values... }, - SecondaryPrivateIPAddressCount: aws.Int64(1), - SubnetID: aws.String("String"), + SecondaryPrivateIpAddressCount: aws.Int64(1), + SubnetId: aws.String("String"), }, // More values... }, @@ -5942,22 +4625,26 @@ func ExampleEC2_RequestSpotFleet() { AvailabilityZone: aws.String("String"), GroupName: aws.String("String"), }, - RAMDiskID: aws.String("String"), + RamdiskId: aws.String("String"), SecurityGroups: []*ec2.GroupIdentifier{ { // Required - GroupID: aws.String("String"), + GroupId: aws.String("String"), GroupName: aws.String("String"), }, // More values... }, - SubnetID: aws.String("String"), - UserData: aws.String("String"), + SpotPrice: aws.String("String"), + SubnetId: aws.String("String"), + UserData: aws.String("String"), + WeightedCapacity: aws.Float64(1.0), }, // More values... }, SpotPrice: aws.String("String"), // Required TargetCapacity: aws.Int64(1), // Required + AllocationStrategy: aws.String("AllocationStrategy"), ClientToken: aws.String("String"), + ExcessCapacityTerminationPolicy: aws.String("ExcessCapacityTerminationPolicy"), TerminateInstancesWithExpiration: aws.Bool(true), ValidFrom: aws.Time(time.Now()), ValidUntil: aws.Time(time.Now()), @@ -5967,22 +4654,14 @@ func ExampleEC2_RequestSpotFleet() { resp, err := svc.RequestSpotFleet(params) if err != nil { - if awsErr, ok := err.(awserr.Error); ok { - // Generic AWS error with Code, Message, and original error (if any) - fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) - if reqErr, ok := err.(awserr.RequestFailure); ok { - // A service error occurred - fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) - } - } else { - // This case should never be hit, the SDK should always return an - // error which satisfies the awserr.Error interface. - fmt.Println(err.Error()) - } + // Print the error, cast err to awserr.Error to get the Code and + // Message from an error. + fmt.Println(err.Error()) + return } // Pretty-print the response data. - fmt.Println(awsutil.Prettify(resp)) + fmt.Println(resp) } func ExampleEC2_RequestSpotInstances() { @@ -5991,6 +4670,7 @@ func ExampleEC2_RequestSpotInstances() { params := &ec2.RequestSpotInstancesInput{ SpotPrice: aws.String("String"), // Required AvailabilityZoneGroup: aws.String("String"), + BlockDurationMinutes: aws.Int64(1), ClientToken: aws.String("String"), DryRun: aws.Bool(true), InstanceCount: aws.Int64(1), @@ -6000,11 +4680,11 @@ func ExampleEC2_RequestSpotInstances() { BlockDeviceMappings: []*ec2.BlockDeviceMapping{ { // Required DeviceName: aws.String("String"), - EBS: &ec2.EBSBlockDevice{ + Ebs: &ec2.EbsBlockDevice{ DeleteOnTermination: aws.Bool(true), Encrypted: aws.Bool(true), - IOPS: aws.Int64(1), - SnapshotID: aws.String("String"), + Iops: aws.Int64(1), + SnapshotId: aws.String("String"), VolumeSize: aws.Int64(1), VolumeType: aws.String("VolumeType"), }, @@ -6013,21 +4693,21 @@ func ExampleEC2_RequestSpotInstances() { }, // More values... }, - EBSOptimized: aws.Bool(true), - IAMInstanceProfile: &ec2.IAMInstanceProfileSpecification{ - ARN: aws.String("String"), + EbsOptimized: aws.Bool(true), + IamInstanceProfile: &ec2.IamInstanceProfileSpecification{ + Arn: aws.String("String"), Name: aws.String("String"), }, - ImageID: aws.String("String"), + ImageId: aws.String("String"), InstanceType: aws.String("InstanceType"), - KernelID: aws.String("String"), + KernelId: aws.String("String"), KeyName: aws.String("String"), Monitoring: &ec2.RunInstancesMonitoringEnabled{ Enabled: aws.Bool(true), // Required }, NetworkInterfaces: []*ec2.InstanceNetworkInterfaceSpecification{ { // Required - AssociatePublicIPAddress: aws.Bool(true), + AssociatePublicIpAddress: aws.Bool(true), DeleteOnTermination: aws.Bool(true), Description: aws.String("String"), DeviceIndex: aws.Int64(1), @@ -6035,17 +4715,17 @@ func ExampleEC2_RequestSpotInstances() { aws.String("String"), // Required // More values... }, - NetworkInterfaceID: aws.String("String"), - PrivateIPAddress: aws.String("String"), - PrivateIPAddresses: []*ec2.PrivateIPAddressSpecification{ + NetworkInterfaceId: aws.String("String"), + PrivateIpAddress: aws.String("String"), + PrivateIpAddresses: []*ec2.PrivateIpAddressSpecification{ { // Required - PrivateIPAddress: aws.String("String"), // Required + PrivateIpAddress: aws.String("String"), // Required Primary: aws.Bool(true), }, // More values... }, - SecondaryPrivateIPAddressCount: aws.Int64(1), - SubnetID: aws.String("String"), + SecondaryPrivateIpAddressCount: aws.Int64(1), + SubnetId: aws.String("String"), }, // More values... }, @@ -6053,8 +4733,8 @@ func ExampleEC2_RequestSpotInstances() { AvailabilityZone: aws.String("String"), GroupName: aws.String("String"), }, - RAMDiskID: aws.String("String"), - SecurityGroupIDs: []*string{ + RamdiskId: aws.String("String"), + SecurityGroupIds: []*string{ aws.String("String"), // Required // More values... }, @@ -6062,7 +4742,7 @@ func ExampleEC2_RequestSpotInstances() { aws.String("String"), // Required // More values... }, - SubnetID: aws.String("String"), + SubnetId: aws.String("String"), UserData: aws.String("String"), }, Type: aws.String("SpotInstanceType"), @@ -6072,22 +4752,14 @@ func ExampleEC2_RequestSpotInstances() { resp, err := svc.RequestSpotInstances(params) if err != nil { - if awsErr, ok := err.(awserr.Error); ok { - // Generic AWS error with Code, Message, and original error (if any) - fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) - if reqErr, ok := err.(awserr.RequestFailure); ok { - // A service error occurred - fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) - } - } else { - // This case should never be hit, the SDK should always return an - // error which satisfies the awserr.Error interface. - fmt.Println(err.Error()) - } + // Print the error, cast err to awserr.Error to get the Code and + // Message from an error. + fmt.Println(err.Error()) + return } // Pretty-print the response data. - fmt.Println(awsutil.Prettify(resp)) + fmt.Println(resp) } func ExampleEC2_ResetImageAttribute() { @@ -6095,28 +4767,20 @@ func ExampleEC2_ResetImageAttribute() { params := &ec2.ResetImageAttributeInput{ Attribute: aws.String("ResetImageAttributeName"), // Required - ImageID: aws.String("String"), // Required + ImageId: aws.String("String"), // Required DryRun: aws.Bool(true), } resp, err := svc.ResetImageAttribute(params) if err != nil { - if awsErr, ok := err.(awserr.Error); ok { - // Generic AWS error with Code, Message, and original error (if any) - fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) - if reqErr, ok := err.(awserr.RequestFailure); ok { - // A service error occurred - fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) - } - } else { - // This case should never be hit, the SDK should always return an - // error which satisfies the awserr.Error interface. - fmt.Println(err.Error()) - } + // Print the error, cast err to awserr.Error to get the Code and + // Message from an error. + fmt.Println(err.Error()) + return } // Pretty-print the response data. - fmt.Println(awsutil.Prettify(resp)) + fmt.Println(resp) } func ExampleEC2_ResetInstanceAttribute() { @@ -6124,57 +4788,41 @@ func ExampleEC2_ResetInstanceAttribute() { params := &ec2.ResetInstanceAttributeInput{ Attribute: aws.String("InstanceAttributeName"), // Required - InstanceID: aws.String("String"), // Required + InstanceId: aws.String("String"), // Required DryRun: aws.Bool(true), } resp, err := svc.ResetInstanceAttribute(params) if err != nil { - if awsErr, ok := err.(awserr.Error); ok { - // Generic AWS error with Code, Message, and original error (if any) - fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) - if reqErr, ok := err.(awserr.RequestFailure); ok { - // A service error occurred - fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) - } - } else { - // This case should never be hit, the SDK should always return an - // error which satisfies the awserr.Error interface. - fmt.Println(err.Error()) - } + // Print the error, cast err to awserr.Error to get the Code and + // Message from an error. + fmt.Println(err.Error()) + return } // Pretty-print the response data. - fmt.Println(awsutil.Prettify(resp)) + fmt.Println(resp) } func ExampleEC2_ResetNetworkInterfaceAttribute() { svc := ec2.New(nil) params := &ec2.ResetNetworkInterfaceAttributeInput{ - NetworkInterfaceID: aws.String("String"), // Required + NetworkInterfaceId: aws.String("String"), // Required DryRun: aws.Bool(true), SourceDestCheck: aws.String("String"), } resp, err := svc.ResetNetworkInterfaceAttribute(params) if err != nil { - if awsErr, ok := err.(awserr.Error); ok { - // Generic AWS error with Code, Message, and original error (if any) - fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) - if reqErr, ok := err.(awserr.RequestFailure); ok { - // A service error occurred - fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) - } - } else { - // This case should never be hit, the SDK should always return an - // error which satisfies the awserr.Error interface. - fmt.Println(err.Error()) - } + // Print the error, cast err to awserr.Error to get the Code and + // Message from an error. + fmt.Println(err.Error()) + return } // Pretty-print the response data. - fmt.Println(awsutil.Prettify(resp)) + fmt.Println(resp) } func ExampleEC2_ResetSnapshotAttribute() { @@ -6182,199 +4830,167 @@ func ExampleEC2_ResetSnapshotAttribute() { params := &ec2.ResetSnapshotAttributeInput{ Attribute: aws.String("SnapshotAttributeName"), // Required - SnapshotID: aws.String("String"), // Required + SnapshotId: aws.String("String"), // Required DryRun: aws.Bool(true), } resp, err := svc.ResetSnapshotAttribute(params) if err != nil { - if awsErr, ok := err.(awserr.Error); ok { - // Generic AWS error with Code, Message, and original error (if any) - fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) - if reqErr, ok := err.(awserr.RequestFailure); ok { - // A service error occurred - fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) - } - } else { - // This case should never be hit, the SDK should always return an - // error which satisfies the awserr.Error interface. - fmt.Println(err.Error()) - } + // Print the error, cast err to awserr.Error to get the Code and + // Message from an error. + fmt.Println(err.Error()) + return } // Pretty-print the response data. - fmt.Println(awsutil.Prettify(resp)) + fmt.Println(resp) } func ExampleEC2_RestoreAddressToClassic() { svc := ec2.New(nil) params := &ec2.RestoreAddressToClassicInput{ - PublicIP: aws.String("String"), // Required + PublicIp: aws.String("String"), // Required DryRun: aws.Bool(true), } resp, err := svc.RestoreAddressToClassic(params) if err != nil { - if awsErr, ok := err.(awserr.Error); ok { - // Generic AWS error with Code, Message, and original error (if any) - fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) - if reqErr, ok := err.(awserr.RequestFailure); ok { - // A service error occurred - fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) - } - } else { - // This case should never be hit, the SDK should always return an - // error which satisfies the awserr.Error interface. - fmt.Println(err.Error()) - } + // Print the error, cast err to awserr.Error to get the Code and + // Message from an error. + fmt.Println(err.Error()) + return } // Pretty-print the response data. - fmt.Println(awsutil.Prettify(resp)) + fmt.Println(resp) } func ExampleEC2_RevokeSecurityGroupEgress() { svc := ec2.New(nil) params := &ec2.RevokeSecurityGroupEgressInput{ - GroupID: aws.String("String"), // Required - CIDRIP: aws.String("String"), + GroupId: aws.String("String"), // Required + CidrIp: aws.String("String"), DryRun: aws.Bool(true), FromPort: aws.Int64(1), - IPPermissions: []*ec2.IPPermission{ + IpPermissions: []*ec2.IpPermission{ { // Required FromPort: aws.Int64(1), - IPProtocol: aws.String("String"), - IPRanges: []*ec2.IPRange{ + IpProtocol: aws.String("String"), + IpRanges: []*ec2.IpRange{ { // Required - CIDRIP: aws.String("String"), + CidrIp: aws.String("String"), }, // More values... }, - PrefixListIDs: []*ec2.PrefixListID{ + PrefixListIds: []*ec2.PrefixListId{ { // Required - PrefixListID: aws.String("String"), + PrefixListId: aws.String("String"), }, // More values... }, ToPort: aws.Int64(1), - UserIDGroupPairs: []*ec2.UserIDGroupPair{ + UserIdGroupPairs: []*ec2.UserIdGroupPair{ { // Required - GroupID: aws.String("String"), + GroupId: aws.String("String"), GroupName: aws.String("String"), - UserID: aws.String("String"), + UserId: aws.String("String"), }, // More values... }, }, // More values... }, - IPProtocol: aws.String("String"), + IpProtocol: aws.String("String"), SourceSecurityGroupName: aws.String("String"), - SourceSecurityGroupOwnerID: aws.String("String"), + SourceSecurityGroupOwnerId: aws.String("String"), ToPort: aws.Int64(1), } resp, err := svc.RevokeSecurityGroupEgress(params) if err != nil { - if awsErr, ok := err.(awserr.Error); ok { - // Generic AWS error with Code, Message, and original error (if any) - fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) - if reqErr, ok := err.(awserr.RequestFailure); ok { - // A service error occurred - fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) - } - } else { - // This case should never be hit, the SDK should always return an - // error which satisfies the awserr.Error interface. - fmt.Println(err.Error()) - } + // Print the error, cast err to awserr.Error to get the Code and + // Message from an error. + fmt.Println(err.Error()) + return } // Pretty-print the response data. - fmt.Println(awsutil.Prettify(resp)) + fmt.Println(resp) } func ExampleEC2_RevokeSecurityGroupIngress() { svc := ec2.New(nil) params := &ec2.RevokeSecurityGroupIngressInput{ - CIDRIP: aws.String("String"), + CidrIp: aws.String("String"), DryRun: aws.Bool(true), FromPort: aws.Int64(1), - GroupID: aws.String("String"), + GroupId: aws.String("String"), GroupName: aws.String("String"), - IPPermissions: []*ec2.IPPermission{ + IpPermissions: []*ec2.IpPermission{ { // Required FromPort: aws.Int64(1), - IPProtocol: aws.String("String"), - IPRanges: []*ec2.IPRange{ + IpProtocol: aws.String("String"), + IpRanges: []*ec2.IpRange{ { // Required - CIDRIP: aws.String("String"), + CidrIp: aws.String("String"), }, // More values... }, - PrefixListIDs: []*ec2.PrefixListID{ + PrefixListIds: []*ec2.PrefixListId{ { // Required - PrefixListID: aws.String("String"), + PrefixListId: aws.String("String"), }, // More values... }, ToPort: aws.Int64(1), - UserIDGroupPairs: []*ec2.UserIDGroupPair{ + UserIdGroupPairs: []*ec2.UserIdGroupPair{ { // Required - GroupID: aws.String("String"), + GroupId: aws.String("String"), GroupName: aws.String("String"), - UserID: aws.String("String"), + UserId: aws.String("String"), }, // More values... }, }, // More values... }, - IPProtocol: aws.String("String"), + IpProtocol: aws.String("String"), SourceSecurityGroupName: aws.String("String"), - SourceSecurityGroupOwnerID: aws.String("String"), + SourceSecurityGroupOwnerId: aws.String("String"), ToPort: aws.Int64(1), } resp, err := svc.RevokeSecurityGroupIngress(params) if err != nil { - if awsErr, ok := err.(awserr.Error); ok { - // Generic AWS error with Code, Message, and original error (if any) - fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) - if reqErr, ok := err.(awserr.RequestFailure); ok { - // A service error occurred - fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) - } - } else { - // This case should never be hit, the SDK should always return an - // error which satisfies the awserr.Error interface. - fmt.Println(err.Error()) - } + // Print the error, cast err to awserr.Error to get the Code and + // Message from an error. + fmt.Println(err.Error()) + return } // Pretty-print the response data. - fmt.Println(awsutil.Prettify(resp)) + fmt.Println(resp) } func ExampleEC2_RunInstances() { svc := ec2.New(nil) params := &ec2.RunInstancesInput{ - ImageID: aws.String("String"), // Required + ImageId: aws.String("String"), // Required MaxCount: aws.Int64(1), // Required MinCount: aws.Int64(1), // Required AdditionalInfo: aws.String("String"), BlockDeviceMappings: []*ec2.BlockDeviceMapping{ { // Required DeviceName: aws.String("String"), - EBS: &ec2.EBSBlockDevice{ + Ebs: &ec2.EbsBlockDevice{ DeleteOnTermination: aws.Bool(true), Encrypted: aws.Bool(true), - IOPS: aws.Int64(1), - SnapshotID: aws.String("String"), + Iops: aws.Int64(1), + SnapshotId: aws.String("String"), VolumeSize: aws.Int64(1), VolumeType: aws.String("VolumeType"), }, @@ -6384,23 +5000,23 @@ func ExampleEC2_RunInstances() { // More values... }, ClientToken: aws.String("String"), - DisableAPITermination: aws.Bool(true), + DisableApiTermination: aws.Bool(true), DryRun: aws.Bool(true), - EBSOptimized: aws.Bool(true), - IAMInstanceProfile: &ec2.IAMInstanceProfileSpecification{ - ARN: aws.String("String"), + EbsOptimized: aws.Bool(true), + IamInstanceProfile: &ec2.IamInstanceProfileSpecification{ + Arn: aws.String("String"), Name: aws.String("String"), }, InstanceInitiatedShutdownBehavior: aws.String("ShutdownBehavior"), InstanceType: aws.String("InstanceType"), - KernelID: aws.String("String"), + KernelId: aws.String("String"), KeyName: aws.String("String"), Monitoring: &ec2.RunInstancesMonitoringEnabled{ Enabled: aws.Bool(true), // Required }, NetworkInterfaces: []*ec2.InstanceNetworkInterfaceSpecification{ { // Required - AssociatePublicIPAddress: aws.Bool(true), + AssociatePublicIpAddress: aws.Bool(true), DeleteOnTermination: aws.Bool(true), Description: aws.String("String"), DeviceIndex: aws.Int64(1), @@ -6408,17 +5024,17 @@ func ExampleEC2_RunInstances() { aws.String("String"), // Required // More values... }, - NetworkInterfaceID: aws.String("String"), - PrivateIPAddress: aws.String("String"), - PrivateIPAddresses: []*ec2.PrivateIPAddressSpecification{ + NetworkInterfaceId: aws.String("String"), + PrivateIpAddress: aws.String("String"), + PrivateIpAddresses: []*ec2.PrivateIpAddressSpecification{ { // Required - PrivateIPAddress: aws.String("String"), // Required + PrivateIpAddress: aws.String("String"), // Required Primary: aws.Bool(true), }, // More values... }, - SecondaryPrivateIPAddressCount: aws.Int64(1), - SubnetID: aws.String("String"), + SecondaryPrivateIpAddressCount: aws.Int64(1), + SubnetId: aws.String("String"), }, // More values... }, @@ -6427,9 +5043,9 @@ func ExampleEC2_RunInstances() { GroupName: aws.String("String"), Tenancy: aws.String("Tenancy"), }, - PrivateIPAddress: aws.String("String"), - RAMDiskID: aws.String("String"), - SecurityGroupIDs: []*string{ + PrivateIpAddress: aws.String("String"), + RamdiskId: aws.String("String"), + SecurityGroupIds: []*string{ aws.String("String"), // Required // More values... }, @@ -6437,35 +5053,27 @@ func ExampleEC2_RunInstances() { aws.String("String"), // Required // More values... }, - SubnetID: aws.String("String"), + SubnetId: aws.String("String"), UserData: aws.String("String"), } resp, err := svc.RunInstances(params) if err != nil { - if awsErr, ok := err.(awserr.Error); ok { - // Generic AWS error with Code, Message, and original error (if any) - fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) - if reqErr, ok := err.(awserr.RequestFailure); ok { - // A service error occurred - fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) - } - } else { - // This case should never be hit, the SDK should always return an - // error which satisfies the awserr.Error interface. - fmt.Println(err.Error()) - } + // Print the error, cast err to awserr.Error to get the Code and + // Message from an error. + fmt.Println(err.Error()) + return } // Pretty-print the response data. - fmt.Println(awsutil.Prettify(resp)) + fmt.Println(resp) } func ExampleEC2_StartInstances() { svc := ec2.New(nil) params := &ec2.StartInstancesInput{ - InstanceIDs: []*string{ // Required + InstanceIds: []*string{ // Required aws.String("String"), // Required // More values... }, @@ -6475,29 +5083,21 @@ func ExampleEC2_StartInstances() { resp, err := svc.StartInstances(params) if err != nil { - if awsErr, ok := err.(awserr.Error); ok { - // Generic AWS error with Code, Message, and original error (if any) - fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) - if reqErr, ok := err.(awserr.RequestFailure); ok { - // A service error occurred - fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) - } - } else { - // This case should never be hit, the SDK should always return an - // error which satisfies the awserr.Error interface. - fmt.Println(err.Error()) - } + // Print the error, cast err to awserr.Error to get the Code and + // Message from an error. + fmt.Println(err.Error()) + return } // Pretty-print the response data. - fmt.Println(awsutil.Prettify(resp)) + fmt.Println(resp) } func ExampleEC2_StopInstances() { svc := ec2.New(nil) params := &ec2.StopInstancesInput{ - InstanceIDs: []*string{ // Required + InstanceIds: []*string{ // Required aws.String("String"), // Required // More values... }, @@ -6507,29 +5107,21 @@ func ExampleEC2_StopInstances() { resp, err := svc.StopInstances(params) if err != nil { - if awsErr, ok := err.(awserr.Error); ok { - // Generic AWS error with Code, Message, and original error (if any) - fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) - if reqErr, ok := err.(awserr.RequestFailure); ok { - // A service error occurred - fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) - } - } else { - // This case should never be hit, the SDK should always return an - // error which satisfies the awserr.Error interface. - fmt.Println(err.Error()) - } + // Print the error, cast err to awserr.Error to get the Code and + // Message from an error. + fmt.Println(err.Error()) + return } // Pretty-print the response data. - fmt.Println(awsutil.Prettify(resp)) + fmt.Println(resp) } func ExampleEC2_TerminateInstances() { svc := ec2.New(nil) params := &ec2.TerminateInstancesInput{ - InstanceIDs: []*string{ // Required + InstanceIds: []*string{ // Required aws.String("String"), // Required // More values... }, @@ -6538,60 +5130,44 @@ func ExampleEC2_TerminateInstances() { resp, err := svc.TerminateInstances(params) if err != nil { - if awsErr, ok := err.(awserr.Error); ok { - // Generic AWS error with Code, Message, and original error (if any) - fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) - if reqErr, ok := err.(awserr.RequestFailure); ok { - // A service error occurred - fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) - } - } else { - // This case should never be hit, the SDK should always return an - // error which satisfies the awserr.Error interface. - fmt.Println(err.Error()) - } + // Print the error, cast err to awserr.Error to get the Code and + // Message from an error. + fmt.Println(err.Error()) + return } // Pretty-print the response data. - fmt.Println(awsutil.Prettify(resp)) + fmt.Println(resp) } -func ExampleEC2_UnassignPrivateIPAddresses() { +func ExampleEC2_UnassignPrivateIpAddresses() { svc := ec2.New(nil) - params := &ec2.UnassignPrivateIPAddressesInput{ - NetworkInterfaceID: aws.String("String"), // Required - PrivateIPAddresses: []*string{ // Required + params := &ec2.UnassignPrivateIpAddressesInput{ + NetworkInterfaceId: aws.String("String"), // Required + PrivateIpAddresses: []*string{ // Required aws.String("String"), // Required // More values... }, } - resp, err := svc.UnassignPrivateIPAddresses(params) + resp, err := svc.UnassignPrivateIpAddresses(params) if err != nil { - if awsErr, ok := err.(awserr.Error); ok { - // Generic AWS error with Code, Message, and original error (if any) - fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) - if reqErr, ok := err.(awserr.RequestFailure); ok { - // A service error occurred - fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) - } - } else { - // This case should never be hit, the SDK should always return an - // error which satisfies the awserr.Error interface. - fmt.Println(err.Error()) - } + // Print the error, cast err to awserr.Error to get the Code and + // Message from an error. + fmt.Println(err.Error()) + return } // Pretty-print the response data. - fmt.Println(awsutil.Prettify(resp)) + fmt.Println(resp) } func ExampleEC2_UnmonitorInstances() { svc := ec2.New(nil) params := &ec2.UnmonitorInstancesInput{ - InstanceIDs: []*string{ // Required + InstanceIds: []*string{ // Required aws.String("String"), // Required // More values... }, @@ -6600,20 +5176,12 @@ func ExampleEC2_UnmonitorInstances() { resp, err := svc.UnmonitorInstances(params) if err != nil { - if awsErr, ok := err.(awserr.Error); ok { - // Generic AWS error with Code, Message, and original error (if any) - fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) - if reqErr, ok := err.(awserr.RequestFailure); ok { - // A service error occurred - fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) - } - } else { - // This case should never be hit, the SDK should always return an - // error which satisfies the awserr.Error interface. - fmt.Println(err.Error()) - } + // Print the error, cast err to awserr.Error to get the Code and + // Message from an error. + fmt.Println(err.Error()) + return } // Pretty-print the response data. - fmt.Println(awsutil.Prettify(resp)) + fmt.Println(resp) } diff --git a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/service/ec2/service.go b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/service/ec2/service.go index b9767171118..fb20e805b9f 100644 --- a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/service/ec2/service.go +++ b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/service/ec2/service.go @@ -4,8 +4,12 @@ package ec2 import ( "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/internal/protocol/ec2query" - "github.com/aws/aws-sdk-go/internal/signer/v4" + "github.com/aws/aws-sdk-go/aws/defaults" + "github.com/aws/aws-sdk-go/aws/request" + "github.com/aws/aws-sdk-go/aws/service" + "github.com/aws/aws-sdk-go/aws/service/serviceinfo" + "github.com/aws/aws-sdk-go/private/protocol/ec2query" + "github.com/aws/aws-sdk-go/private/signer/v4" ) // Amazon Elastic Compute Cloud (Amazon EC2) provides resizable computing capacity @@ -13,21 +17,23 @@ import ( // need to invest in hardware up front, so you can develop and deploy applications // faster. type EC2 struct { - *aws.Service + *service.Service } // Used for custom service initialization logic -var initService func(*aws.Service) +var initService func(*service.Service) // Used for custom request initialization logic -var initRequest func(*aws.Request) +var initRequest func(*request.Request) // New returns a new EC2 client. func New(config *aws.Config) *EC2 { - service := &aws.Service{ - Config: aws.DefaultConfig.Merge(config), - ServiceName: "ec2", - APIVersion: "2015-04-15", + service := &service.Service{ + ServiceInfo: serviceinfo.ServiceInfo{ + Config: defaults.DefaultConfig.Merge(config), + ServiceName: "ec2", + APIVersion: "2015-10-01", + }, } service.Initialize() @@ -48,8 +54,8 @@ func New(config *aws.Config) *EC2 { // newRequest creates a new request for a EC2 operation and runs any // custom request initialization. -func (c *EC2) newRequest(op *aws.Operation, params, data interface{}) *aws.Request { - req := aws.NewRequest(c.Service, op, params, data) +func (c *EC2) newRequest(op *request.Operation, params, data interface{}) *request.Request { + req := c.NewRequest(op, params, data) // Run custom request initialization if present if initRequest != nil { diff --git a/build.go b/build.go index 7804d00890e..4a345c5fc73 100644 --- a/build.go +++ b/build.go @@ -328,9 +328,9 @@ func build(pkg string, tags []string) { func ldflags() string { var b bytes.Buffer b.WriteString("-w") - b.WriteString(fmt.Sprintf(" -X main.version '%s'", version)) - b.WriteString(fmt.Sprintf(" -X main.commit '%s'", getGitSha())) - b.WriteString(fmt.Sprintf(" -X main.buildstamp %d", buildStamp())) + b.WriteString(fmt.Sprintf(" -X main.version=%s", version)) + b.WriteString(fmt.Sprintf(" -X main.commit=%s", getGitSha())) + b.WriteString(fmt.Sprintf(" -X main.buildstamp=%d", buildStamp())) return b.String() } diff --git a/pkg/api/cloudwatch/cloudwatch.go b/pkg/api/cloudwatch/cloudwatch.go index 536a81ee3fe..6f2afdaa9e2 100644 --- a/pkg/api/cloudwatch/cloudwatch.go +++ b/pkg/api/cloudwatch/cloudwatch.go @@ -112,7 +112,7 @@ func handleDescribeInstances(req *cwRequest, c *middleware.Context) { params.Filters = reqParam.Parameters.Filters } if len(reqParam.Parameters.InstanceIds) > 0 { - params.InstanceIDs = reqParam.Parameters.InstanceIds + params.InstanceIds = reqParam.Parameters.InstanceIds } resp, err := svc.DescribeInstances(params) From a5c742cee5c070caf5d789cce9b21f93d1f5f2c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Mon, 26 Oct 2015 13:36:00 +0100 Subject: [PATCH 071/269] docs(elasticsearch): began work on elasticsearch docs #2862 --- docs/Makefile | 2 +- docs/VERSION | 2 +- docs/mkdocs.yml | 1 + docs/sources/datasources/elasticsearch.md | 55 +++++++++++++++++++++++ docs/sources/datasources/graphite.md | 6 +-- docs/sources/datasources/influxdb.md | 6 +-- docs/sources/versions.html_fragment | 1 + 7 files changed, 65 insertions(+), 8 deletions(-) create mode 100644 docs/sources/datasources/elasticsearch.md diff --git a/docs/Makefile b/docs/Makefile index fcb1708f916..9fd8cd6399f 100644 --- a/docs/Makefile +++ b/docs/Makefile @@ -44,7 +44,7 @@ docs-test: docs-build $(DOCKER_RUN_DOCS) "$(DOCKER_DOCS_IMAGE)" ./test.sh docs-build: - git fetch https://github.com/grafana/grafana.git docs-1.x && git diff --name-status FETCH_HEAD...HEAD -- . > changed-files + git fetch https://github.com/grafana/grafana.git docs-2.1 && git diff --name-status FETCH_HEAD...HEAD -- . > changed-files echo "$(GIT_BRANCH)" > GIT_BRANCH echo "$(GITCOMMIT)" > GITCOMMIT docker build -t "$(DOCKER_DOCS_IMAGE)" . diff --git a/docs/VERSION b/docs/VERSION index 7ec1d6db408..437459cd94c 100644 --- a/docs/VERSION +++ b/docs/VERSION @@ -1 +1 @@ -2.1.0 +2.5.0 diff --git a/docs/mkdocs.yml b/docs/mkdocs.yml index 6489bd5c426..c7b26d5eb0c 100644 --- a/docs/mkdocs.yml +++ b/docs/mkdocs.yml @@ -66,6 +66,7 @@ pages: - ['datasources/overview.md', 'Data Sources', 'Overview'] - ['datasources/graphite.md', 'Data Sources', 'Graphite'] +- ['datasources/elasticsearch.md', 'Data Sources', 'Elasticsearch'] - ['datasources/influxdb.md', 'Data Sources', 'InfluxDB'] - ['datasources/opentsdb.md', 'Data Sources', 'OpenTSDB'] - ['datasources/kairosdb.md', 'Data Sources', 'KairosDB'] diff --git a/docs/sources/datasources/elasticsearch.md b/docs/sources/datasources/elasticsearch.md new file mode 100644 index 00000000000..2e19b3a7bdd --- /dev/null +++ b/docs/sources/datasources/elasticsearch.md @@ -0,0 +1,55 @@ +---- +page_title: Elasticsearch +page_description: Elasticsearch grafana datasource documentation +page_keywords: Elasticsearch, grafana, kibana, documentation, datasource, docs +--- + +# Elasticsearch + +Grafana ships with advanced support for Elasticsearch. You can do many types of +simple or complex elasticsearch queries to visualize logs or metrics stored in elasticsearch. You can +also annotate your graphs with log events stored in elasticsearch. + +## Adding the data source +![](/img/v2/add_Graphite.jpg) + +1. Open the side menu by clicking the the Grafana icon in the top header. +2. In the side menu under the `Dashboards` link you should find a link named `Data Sources`. + + > NOTE: If this link is missing in the side menu it means that your current user does not have the `Admin` role for the current organization. + +3. Click the `Add new` link in the top header. +4. Select `Elasticsearch` from the dropdown. + +Name | Description +------------ | ------------- +Name | The data source name, important that this is the same as in Grafana v1.x if you plan to import old dashboards. +Default | Default data source means that it will be pre-selected for new panels. +Url | The http protocol, ip and port of you elasticsearch server. +Access | Proxy = access via Grafana backend, Direct = access directory from browser. + +Proxy access means that the Grafana backend will proxy all requests from the browser, and send them on to the Data Source. This is useful because it can eliminate CORS (Cross Origin Site Resource) issues, as well as eliminate the need to disseminate authentication details to the Data Source to the browser. + +Direct access is still supported because in some cases it may be useful to access a Data Source directly depending on the use case and topology of Grafana, the user, and the Data Source. + +### Direct access +If you select direct access you must update your Elasticsearch configuration to allow other domains to access +Elasticsearch from the browser. You do this by specifying these to options in your **elasticsearch.yml** config file. + + http.cors.enabled: true + http.cors.allow-origin: "*" + +### Index settings + +![](/img/elasticsearch/elasticsearch_ds_details.png) + + +## Metric editor + +### Navigate metric segments +Click the ``Select metric`` link to start navigating the metric space. One you start you can continue using the mouse +or keyboard arrow keys. You can select a wildcard and still continue. + +![](/img/animated_gifs/graphite_query1.gif) + + diff --git a/docs/sources/datasources/graphite.md b/docs/sources/datasources/graphite.md index 9640d21a81d..c4cae0b0c65 100644 --- a/docs/sources/datasources/graphite.md +++ b/docs/sources/datasources/graphite.md @@ -10,11 +10,11 @@ Grafana has an advanced Graphite query editor that lets you quickly navigate the change function parameters and much more. The editor can handle all types of graphite queries. It can even handle complex nested queries through the use of query references. -## Adding the data source to Grafana +## Adding the data source ![](/img/v2/add_Graphite.jpg) -1. Open the side menu by clicking the the Grafana icon in the top header. -2. In the side menu under the `Dashboards` link you should find a link named `Data Sources`. +1. Open the side menu by clicking the the Grafana icon in the top header. +2. In the side menu under the `Dashboards` link you should find a link named `Data Sources`. > NOTE: If this link is missing in the side menu it means that your current user does not have the `Admin` role for the current organization. diff --git a/docs/sources/datasources/influxdb.md b/docs/sources/datasources/influxdb.md index 8595548a1cb..e57d5a63fbc 100644 --- a/docs/sources/datasources/influxdb.md +++ b/docs/sources/datasources/influxdb.md @@ -12,11 +12,11 @@ them as different data sources. InfluxDB 0.9 is rapidly evolving and we continue to track its API. InfluxDB 0.8 is no longer maintained by InfluxDB Inc, but we provide support as a convenience to existing users. -## Adding the data source to Grafana +## Adding the data source ![](/img/v2/add_Influx.jpg) -1. Open the side menu by clicking the the Grafana icon in the top header. -2. In the side menu under the `Dashboards` link you should find a link named `Data Sources`. +1. Open the side menu by clicking the the Grafana icon in the top header. +2. In the side menu under the `Dashboards` link you should find a link named `Data Sources`. > NOTE: If this link is missing in the side menu it means that your current user does not have the `Admin` role for the current organization. diff --git a/docs/sources/versions.html_fragment b/docs/sources/versions.html_fragment index 55190af8b37..d9f6a4c655b 100644 --- a/docs/sources/versions.html_fragment +++ b/docs/sources/versions.html_fragment @@ -1,3 +1,4 @@ +
      • Version v2.5
      • Version v2.1
      • Version v2.0
      • Version v1.9
      • From 7477667df1be1c12d664269fd7f8b1415c88e53e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Mon, 26 Oct 2015 14:21:38 +0100 Subject: [PATCH 072/269] docs(elasticsearch): initial elasticsearch docs, closes #2862 --- docs/sources/datasources/cloudwatch.md | 32 +++++++++++++++++++++++ docs/sources/datasources/elasticsearch.md | 13 +++++---- docs/sources/datasources/overview.md | 2 ++ 3 files changed, 42 insertions(+), 5 deletions(-) create mode 100644 docs/sources/datasources/cloudwatch.md diff --git a/docs/sources/datasources/cloudwatch.md b/docs/sources/datasources/cloudwatch.md new file mode 100644 index 00000000000..b5e42b4b93a --- /dev/null +++ b/docs/sources/datasources/cloudwatch.md @@ -0,0 +1,32 @@ +---- +page_title: Cloudwatch +page_description: Cloudwatch grafana datasource documentation +page_keywords: Cloudwatch, grafana, documentation, datasource, docs +--- + +# Cloudwatch + +Grafana ships with support for Cloudwatch. + +## Adding the data source +![](/img/v2/add_Graphite.jpg) + +1. Open the side menu by clicking the the Grafana icon in the top header. +2. In the side menu under the `Dashboards` link you should find a link named `Data Sources`. + + > NOTE: If this link is missing in the side menu it means that your current user does not have the `Admin` role for the current organization. + +3. Click the `Add new` link in the top header. +4. Select `Elasticsearch` from the dropdown. + +Name | Description +------------ | ------------- +Name | The data source name, important that this is the same as in Grafana v1.x if you plan to import old dashboards. +Default | Default data source means that it will be pre-selected for new panels. +Url | The http protocol, ip and port of you elasticsearch server. +Access | Proxy = access via Grafana backend, Direct = access directory from browser. + +Proxy access means that the Grafana backend will proxy all requests from the browser, and send them on to the Data Source. This is useful because it can eliminate CORS (Cross Origin Site Resource) issues, as well as eliminate the need to disseminate authentication details to the Data Source to the browser. + +Direct access is still supported because in some cases it may be useful to access a Data Source directly depending on the use case and topology of Grafana, the user, and the Data Source. + diff --git a/docs/sources/datasources/elasticsearch.md b/docs/sources/datasources/elasticsearch.md index 2e19b3a7bdd..76b0040ecd3 100644 --- a/docs/sources/datasources/elasticsearch.md +++ b/docs/sources/datasources/elasticsearch.md @@ -43,13 +43,16 @@ Elasticsearch from the browser. You do this by specifying these to options in yo ![](/img/elasticsearch/elasticsearch_ds_details.png) +Here you can specify a default for the `time field` and specify the name of your elasticsearch index. You can use +a time pattern for the index name or a wildcard. -## Metric editor +## Metric Query editor -### Navigate metric segments -Click the ``Select metric`` link to start navigating the metric space. One you start you can continue using the mouse -or keyboard arrow keys. You can select a wildcard and still continue. +![](/img/elasticsearch/query_editor.png) -![](/img/animated_gifs/graphite_query1.gif) +The Elasticsearch query editor allows you to select multiple metrics and group by multiple terms or filters. Use the plus and minus icons to the right to add / remove +metrics or group bys. Some metrics and group by have options, click the option text to expand the the row to view and edit metric or group by options. +## Annotations +TODO diff --git a/docs/sources/datasources/overview.md b/docs/sources/datasources/overview.md index 4e1c08fe82b..a5b5307cd9f 100644 --- a/docs/sources/datasources/overview.md +++ b/docs/sources/datasources/overview.md @@ -15,6 +15,8 @@ The query language and capabilities of each Data Source are obviously very diffe The following datasources are officially supported: * [Graphite](/datasources/graphite/) +* [Elasticsearch](/datasources/elasticsearch/) +* [Cloudwatch](/datasources/cloudwatch/) * [InfluxDB](/datasources/influxdb/) * [OpenTSDB](/datasources/opentsdb/) * [KairosDB](/datasources/kairosdb) From 2e155bdedab561d1bfba723ba46dc6550ba91c7c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Mon, 26 Oct 2015 14:33:55 +0100 Subject: [PATCH 073/269] fix(dashboard): minor function name fixes, removed insert row above/below because it did not work, #2909 --- .../app/features/dashboard/dashboardCtrl.js | 12 ++--- public/app/features/dashboard/dashboardSrv.js | 2 +- public/app/features/dashboard/rowCtrl.js | 26 +++------- public/app/partials/dashboard.html | 49 ++++++++----------- public/test/specs/dashboardSrv-specs.js | 2 +- 5 files changed, 37 insertions(+), 54 deletions(-) diff --git a/public/app/features/dashboard/dashboardCtrl.js b/public/app/features/dashboard/dashboardCtrl.js index 30dda154e94..80b3a101f3f 100644 --- a/public/app/features/dashboard/dashboardCtrl.js +++ b/public/app/features/dashboard/dashboardCtrl.js @@ -29,7 +29,7 @@ function (angular, $, config) { var resizeEventTimeout; this.init = function(dashboard) { - $scope.reset_row(); + $scope.resetRow(); $scope.registerWindowResizeEvent(); $scope.onAppEvent('show-json-editor', $scope.showJsonEditor); $scope.setupDashboard(dashboard); @@ -88,17 +88,17 @@ function (angular, $, config) { $rootScope.$broadcast('refresh'); }; - $scope.add_row = function(dash, row) { + $scope.addRow = function(dash, row) { dash.rows.push(row); }; - $scope.add_row_default = function() { - $scope.reset_row(); + $scope.addRowDefault = function() { + $scope.resetRow(); $scope.row.title = 'New row'; - $scope.add_row($scope.dashboard, $scope.row); + $scope.addRow($scope.dashboard, $scope.row); }; - $scope.reset_row = function() { + $scope.resetRow = function() { $scope.row = { title: '', height: '250px', diff --git a/public/app/features/dashboard/dashboardSrv.js b/public/app/features/dashboard/dashboardSrv.js index 66372dea026..21318ac8370 100644 --- a/public/app/features/dashboard/dashboardSrv.js +++ b/public/app/features/dashboard/dashboardSrv.js @@ -118,7 +118,7 @@ function (angular, $, kbn, _, moment) { },0); }; - p.add_panel = function(panel, row) { + p.addPanel = function(panel, row) { var rowSpan = this.rowSpan(row); var panelCount = row.panels.length; var space = (12 - rowSpan) - panel.span; diff --git a/public/app/features/dashboard/rowCtrl.js b/public/app/features/dashboard/rowCtrl.js index 9b5de4c0a1b..5552981421e 100644 --- a/public/app/features/dashboard/rowCtrl.js +++ b/public/app/features/dashboard/rowCtrl.js @@ -28,7 +28,7 @@ function (angular, _, config) { $scope.panelMenuPos = posX; }; - $scope.toggle_row = function(row) { + $scope.toggleRow = function(row) { row.collapse = row.collapse ? false : true; if (!row.collapse) { $timeout(function() { @@ -37,11 +37,11 @@ function (angular, _, config) { } }; - $scope.add_panel = function(panel) { - $scope.dashboard.add_panel(panel, $scope.row); + $scope.addPanel = function(panel) { + $scope.dashboard.addPanel(panel, $scope.row); }; - $scope.delete_row = function() { + $scope.deleteRow = function() { $scope.appEvent('confirm-modal', { title: 'Are you sure you want to delete this row?', icon: 'fa-trash', @@ -52,7 +52,7 @@ function (angular, _, config) { }); }; - $scope.move_row = function(direction) { + $scope.moveRow = function(direction) { var rowsList = $scope.dashboard.rows; var rowIndex = _.indexOf(rowsList, $scope.row); var newIndex = rowIndex; @@ -82,17 +82,7 @@ function (angular, _, config) { } }; - $scope.insert_row = function(direction) { - var rowsList = $scope.dashboard.rows; - var currentRowIndex = _.indexOf(rowsList, $scope.row); - $scope.add_row_default(); - var newIndex = currentRowIndex + direction; - if (newIndex >= 0 && newIndex <= (rowsList.length - 1)) { - _.move(rowsList, rowsList.length - 1, newIndex); - } - }; - - $scope.add_panel_default = function(type) { + $scope.addPanelDefault = function(type) { var defaultSpan = 12; var _as = 12 - $scope.dashboard.rowSpan($scope.row); @@ -104,14 +94,14 @@ function (angular, _, config) { type: type }; - $scope.add_panel(panel); + $scope.addPanel(panel); $timeout(function() { $scope.$broadcast('render'); }); }; - $scope.set_height = function(height) { + $scope.setHeight = function(height) { $scope.row.height = height; $scope.$broadcast('render'); }; diff --git a/public/app/partials/dashboard.html b/public/app/partials/dashboard.html index efbc925e4b1..8a063820a53 100644 --- a/public/app/partials/dashboard.html +++ b/public/app/partials/dashboard.html @@ -18,11 +18,11 @@
        - +
        -
        +
        @@ -108,7 +101,7 @@
        - + ADD ROW
        diff --git a/public/test/specs/dashboardSrv-specs.js b/public/test/specs/dashboardSrv-specs.js index 276e28b32c8..8da659825b8 100644 --- a/public/test/specs/dashboardSrv-specs.js +++ b/public/test/specs/dashboardSrv-specs.js @@ -94,7 +94,7 @@ define([ it('adding default should split span in half', function() { dashboard.rows = [{ panels: [{ span: 12, id: 7 }] }]; - dashboard.add_panel({span: 4}, dashboard.rows[0]); + dashboard.addPanel({span: 4}, dashboard.rows[0]); expect(dashboard.rows[0].panels[0].span).to.be(6); expect(dashboard.rows[0].panels[1].span).to.be(6); From 1dbf0ad97623f05687b24506723ca1172fff008c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Mon, 26 Oct 2015 15:41:08 +0100 Subject: [PATCH 074/269] docs(cloudwatch): initial cloudwatch docs, closes #2900 --- docs/mkdocs.yml | 1 + docs/sources/datasources/cloudwatch.md | 48 +++++++++++++++---- docs/sources/datasources/overview.md | 2 +- .../cloudwatch/partials/config.html | 3 +- 4 files changed, 44 insertions(+), 10 deletions(-) diff --git a/docs/mkdocs.yml b/docs/mkdocs.yml index c7b26d5eb0c..7931ae81c3c 100644 --- a/docs/mkdocs.yml +++ b/docs/mkdocs.yml @@ -67,6 +67,7 @@ pages: - ['datasources/overview.md', 'Data Sources', 'Overview'] - ['datasources/graphite.md', 'Data Sources', 'Graphite'] - ['datasources/elasticsearch.md', 'Data Sources', 'Elasticsearch'] +- ['datasources/cloudwatch.md', 'Data Sources', 'CloudWatch'] - ['datasources/influxdb.md', 'Data Sources', 'InfluxDB'] - ['datasources/opentsdb.md', 'Data Sources', 'OpenTSDB'] - ['datasources/kairosdb.md', 'Data Sources', 'KairosDB'] diff --git a/docs/sources/datasources/cloudwatch.md b/docs/sources/datasources/cloudwatch.md index b5e42b4b93a..984068a94a6 100644 --- a/docs/sources/datasources/cloudwatch.md +++ b/docs/sources/datasources/cloudwatch.md @@ -4,12 +4,13 @@ page_description: Cloudwatch grafana datasource documentation page_keywords: Cloudwatch, grafana, documentation, datasource, docs --- -# Cloudwatch +# CloudWatch -Grafana ships with support for Cloudwatch. +Grafana ships with built in support for CloudWatch. You just have to add it as a data source and you will +be ready to build dashboards for you CloudWatch metrics. ## Adding the data source -![](/img/v2/add_Graphite.jpg) +![](/img/cloudwatch/cloudwatch_add.png) 1. Open the side menu by clicking the the Grafana icon in the top header. 2. In the side menu under the `Dashboards` link you should find a link named `Data Sources`. @@ -17,16 +18,47 @@ Grafana ships with support for Cloudwatch. > NOTE: If this link is missing in the side menu it means that your current user does not have the `Admin` role for the current organization. 3. Click the `Add new` link in the top header. -4. Select `Elasticsearch` from the dropdown. +4. Select `CloudWatch` from the dropdown. Name | Description ------------ | ------------- Name | The data source name, important that this is the same as in Grafana v1.x if you plan to import old dashboards. Default | Default data source means that it will be pre-selected for new panels. -Url | The http protocol, ip and port of you elasticsearch server. -Access | Proxy = access via Grafana backend, Direct = access directory from browser. +Default-Region | Used in query editor to set region (can be changed on per query basis) -Proxy access means that the Grafana backend will proxy all requests from the browser, and send them on to the Data Source. This is useful because it can eliminate CORS (Cross Origin Site Resource) issues, as well as eliminate the need to disseminate authentication details to the Data Source to the browser. +## Authentication + +### IAM Roles + +Currently all access to CloudWatch is done server side by the Grafana backend using the offical AWS SDK. If you grafana +server is running on AWS you can use IAM Roles and authentication will be handled automatically. + +Checkout AWS docs on [IAM Roles]](http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/iam-roles-for-amazon-ec2.html) + +### AWS credentials file + +Create a file at `~/.aws/credentials`. That is the `HOME` path for user running grafana-server. + +Example content: + + [default] + aws_access_key_id = asdsadasdasdasd + aws_secret_access_key = dasdasdsadasdasdasdsa + region = us-west-2 + + +### Metric Query Editor + +![](/img/cloudwatch/query_editor.png) + +You need to specify a namespace, metric, at least one stat, and at least one dimension. + + +### Cost + +It's worth to mention that Amazon will charge you for CloudWatch API usage. CloudWatch costs +$0.01 per 1,000 GetMetricStatistics or ListMetrics requests. For each query Grafana will +issue a GetMetricStatistics request and every time you pick a dimenion in the query editor +Grafana will issue a ListMetrics request. -Direct access is still supported because in some cases it may be useful to access a Data Source directly depending on the use case and topology of Grafana, the user, and the Data Source. diff --git a/docs/sources/datasources/overview.md b/docs/sources/datasources/overview.md index a5b5307cd9f..8fe6538dcd3 100644 --- a/docs/sources/datasources/overview.md +++ b/docs/sources/datasources/overview.md @@ -16,7 +16,7 @@ The following datasources are officially supported: * [Graphite](/datasources/graphite/) * [Elasticsearch](/datasources/elasticsearch/) -* [Cloudwatch](/datasources/cloudwatch/) +* [CloudWatch](/datasources/cloudwatch/) * [InfluxDB](/datasources/influxdb/) * [OpenTSDB](/datasources/opentsdb/) * [KairosDB](/datasources/kairosdb) diff --git a/public/app/plugins/datasource/cloudwatch/partials/config.html b/public/app/plugins/datasource/cloudwatch/partials/config.html index 3757dfba833..627b2829418 100644 --- a/public/app/plugins/datasource/cloudwatch/partials/config.html +++ b/public/app/plugins/datasource/cloudwatch/partials/config.html @@ -1,6 +1,7 @@ +
        CloudWatch details
        -
        +
        • Default Region From 59bd029e4670e6d27a0f8df9d1a4098cb6ac935d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Mon, 26 Oct 2015 15:51:34 +0100 Subject: [PATCH 075/269] docs(cloudwatch): minor cloudwatch fix --- docs/sources/datasources/cloudwatch.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/sources/datasources/cloudwatch.md b/docs/sources/datasources/cloudwatch.md index 984068a94a6..fa73824361e 100644 --- a/docs/sources/datasources/cloudwatch.md +++ b/docs/sources/datasources/cloudwatch.md @@ -47,14 +47,14 @@ Example content: region = us-west-2 -### Metric Query Editor +## Metric Query Editor ![](/img/cloudwatch/query_editor.png) You need to specify a namespace, metric, at least one stat, and at least one dimension. -### Cost +## Cost It's worth to mention that Amazon will charge you for CloudWatch API usage. CloudWatch costs $0.01 per 1,000 GetMetricStatistics or ListMetrics requests. For each query Grafana will From da3d5375b8b71d7aa57587a5e081c35db08f07ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Mon, 26 Oct 2015 16:21:03 +0100 Subject: [PATCH 076/269] feat(ldap): refactoring of PR #2928 updated docs --- conf/ldap.toml | 25 ++++-------- docs/sources/installation/ldap.md | 63 ++++++++++++++++++++++--------- pkg/login/ldap.go | 5 +++ 3 files changed, 57 insertions(+), 36 deletions(-) diff --git a/conf/ldap.toml b/conf/ldap.toml index bfe28d4e835..aa8a9679d68 100644 --- a/conf/ldap.toml +++ b/conf/ldap.toml @@ -18,30 +18,19 @@ bind_dn = "cn=admin,dc=grafana,dc=org" # Search user bind password bind_password = 'grafana' -# Schema's supporting memberOf - -# Search filter, for example "(cn=%s)" or "(sAMAccountName=%s)" +# User search filter, for example "(cn=%s)" or "(sAMAccountName=%s)" or "(uid=%s)" search_filter = "(cn=%s)" + # An array of base dns to search through search_base_dns = ["dc=grafana,dc=org"] -# Uncomment this section (and comment out the previous 2 entries) to use POSIX schema. -# In POSIX LDAP schemas, querying the people 'ou' gives you entries that do not have a -# memberOf attribute, so a secondary query must be made for groups. This is done by -# enabling group_search_filter below. You must also set -# member_of = "cn" +# In POSIX LDAP schemas, without memberOf attribute a secondary query must be made for groups. +# This is done by enabling group_search_filter below. You must also set member_of= "cn" # in [servers.attributes] below. -# -# Search filter, used to retrieve the user -# search_filter = "(uid=%s)" -# -# An array of the base DNs to search through for users. Typically uses ou=people. -# search_base_dns = ["ou=people,dc=grafana,dc=org"] -# -# Group search filter, to retrieve the groups of which the user is a member + +## Group search filter, to retrieve the groups of which the user is a member (only set if memberOf attribute is not available) # group_search_filter = "(&(objectClass=posixGroup)(memberUid=%s))" -# -# An array of the base DNs to search through for groups. Typically uses ou=groups +## An array of the base DNs to search through for groups. Typically uses ou=groups # group_search_base_dns = ["ou=groups,dc=grafana,dc=org"] # Specify names of the ldap attributes your ldap uses diff --git a/docs/sources/installation/ldap.md b/docs/sources/installation/ldap.md index 45552a8e2b0..82309ec0f19 100644 --- a/docs/sources/installation/ldap.md +++ b/docs/sources/installation/ldap.md @@ -21,26 +21,38 @@ specific configuration file (default: `/etc/grafana/ldap.toml`). verbose_logging = false [[servers]] -# LDAP server host +# Ldap server host (specify multiple hosts space separated) host = "127.0.0.1" -# Usual port is 389, or, if TLS is supported, 636 +# Default port is 389 or 636 if use_ssl = true port = 389 -# Set to true if LDAP server supports TLS +# Set to true if ldap server supports TLS use_ssl = false -# set to true if you want to skip SSL cert validation +# set to true if you want to skip ssl cert validation ssl_skip_verify = false +# set to the path to your root CA certificate or leave unset to use system defaults +# root_ca_cert = /path/to/certificate.crt # Search user bind dn bind_dn = "cn=admin,dc=grafana,dc=org" # Search user bind password -bind_password = "grafana" +bind_password = 'grafana' -# Search filter, for example "(cn=%s)" or "(sAMAccountName=%s)" +# User search filter, for example "(cn=%s)" or "(sAMAccountName=%s)" or "(uid=%s)" search_filter = "(cn=%s)" + # An array of base dns to search through search_base_dns = ["dc=grafana,dc=org"] -# Map LDAP user attributes to Grafana user attributes +# In POSIX LDAP schemas, without memberOf attribute a secondary query must be made for groups. +# This is done by enabling group_search_filter below. You must also set member_of= "cn" +# in [servers.attributes] below. + +## Group search filter, to retrieve the groups of which the user is a member (only set if memberOf attribute is not available) +# group_search_filter = "(&(objectClass=posixGroup)(memberUid=%s))" +## An array of the base DNs to search through for groups. Typically uses ou=groups +# group_search_base_dns = ["ou=groups,dc=grafana,dc=org"] + +# Specify names of the ldap attributes your ldap uses [servers.attributes] name = "givenName" surname = "sn" @@ -48,11 +60,11 @@ username = "cn" member_of = "memberOf" email = "email" -# Map LDAP groups to Grafana org roles +# Map ldap groups to grafana org roles [[servers.group_mappings]] group_dn = "cn=admins,dc=grafana,dc=org" org_role = "Admin" -# The Grafana organization database id, optional, if left out, the default org (id 1) will be used +# The Grafana organization database id, optional, if left out the default org (id 1) will be used # org_id = 1 [[servers.group_mappings]] @@ -60,9 +72,10 @@ group_dn = "cn=users,dc=grafana,dc=org" org_role = "Editor" [[servers.group_mappings]] -# If you want to match all (or no LDAP groups) then you can use wildcard +# If you want to match all (or no ldap groups) then you can use wildcard group_dn = "*" org_role = "Viewer" + ``` ## Bind & Bind Password @@ -87,17 +100,31 @@ bind_dn = "cn=%s,o=users,dc=grafana,dc=org" In this case you skip providing a `bind_password` and instead provide a `bind_dn` value with a `%s` somewhere. This will be replaced with the username entered in on the Grafana login page. The search filter and search bases settings are still needed to perform the LDAP search to retrieve the other LDAP information (like LDAP groups and email). +## POSIX schema (no memberOf attribute) +If your ldap server does not support the memberOf attribute add these options: + +```toml +## Group search filter, to retrieve the groups of which the user is a member (only set if memberOf attribute is not available) +group_search_filter = "(&(objectClass=posixGroup)(memberUid=%s))" +## An array of the base DNs to search through for groups. Typically uses ou=groups +group_search_base_dns = ["ou=groups,dc=grafana,dc=org"] +``` + +Also change set `member_of = "cn"` in the `[servers.attributes]` section. + + ## LDAP to Grafana Org Role Sync -## Group Mappings -In `[[servers.group_mappings]]` you can map an LDAP group to a Grafana organization and role. These will be synced every time the user logs in, with LDAP being the authoritative source. -So, if you change a user's role in the Grafana Org. Users page, this change will be reset the next time the user logs in. If you change the LDAP groups of a user, the change will take effect the next time the user logs in. +### Mappings +In `[[servers.group_mappings]]` you can map an LDAP group to a Grafana organization +and role. These will be synced every time the user logs in, with LDAP being +the authoritative source. So, if you change a user's role in the Grafana Org. +Users page, this change will be reset the next time the user logs in. If you +change the LDAP groups of a user, the change will take effect the next +time the user logs in. -### Priority between Multiple Mappings +### Priority The first group mapping that an LDAP user is matched to will be used for the sync. If you have LDAP users that fit multiple mappings, the topmost mapping in the TOML config will be used. -## Ldap to Grafana Org Role Sync -In the `[[servers.group_mappings]]` you can map a LDAP group to a grafana organization and role. These will be synced every time the user logs in. So -if you change a users role in the Grafana Org. Users page, this change will be reset the next time the user logs in. Similarly if you -can LDAP groups for a user in LDAP the change will take effect the next time the user logs in to Grafana. + diff --git a/pkg/login/ldap.go b/pkg/login/ldap.go index 6337f932256..355b4fd100a 100644 --- a/pkg/login/ldap.go +++ b/pkg/login/ldap.go @@ -319,6 +319,11 @@ func (a *ldapAuther) searchForUser(username string) (*ldapUserInfo, error) { var groupSearchResult *ldap.SearchResult for _, groupSearchBase := range a.server.GroupSearchBaseDNs { filter := strings.Replace(a.server.GroupSearchFilter, "%s", username, -1) + + if ldapCfg.VerboseLogging { + log.Info("LDAP: Searching for user's groups: %s", filter) + } + groupSearchReq := ldap.SearchRequest{ BaseDN: groupSearchBase, Scope: ldap.ScopeWholeSubtree, From 3b67a6a222cbcff6e7b9d85dfbeec13d9a74dab0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Mon, 26 Oct 2015 16:23:29 +0100 Subject: [PATCH 077/269] changelog: updated changelog with details of #2928 --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index bbe75e84210..e9fb3a21e4f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -29,6 +29,7 @@ it allows you to add queries of differnet data source types & instances to the s - [Issue #1575](https://github.com/grafana/grafana/issues/1575). Drilldown link: now you can click on the external link icon in the panel header to access drilldown links! - [Issue #1646](https://github.com/grafana/grafana/issues/1646). OpenTSDB: Fetch list of aggregators from OpenTSDB - [Issue #2955](https://github.com/grafana/grafana/issues/2955). Graph: More axis units (Length, Volume, Temperature, Pressure, etc), thanks @greglook +- [Issue #2928](https://github.com/grafana/grafana/issues/2928). LDAP: Support for searching for groups memberships, i.e. POSIX (no memberOf) schemas, also multiple ldap servers, and root ca cert, thanks @abligh **Fixes** - [Issue #2413](https://github.com/grafana/grafana/issues/2413). InfluxDB 0.9: Fix for handling empty series object in response from influxdb From 323e84375bae6c0032422e155814c40b6a42aee6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Mon, 26 Oct 2015 16:37:45 +0100 Subject: [PATCH 078/269] refactoring: minor refactoring and handling of known data source plugins --- pkg/metrics/report_usage.go | 2 +- pkg/models/datasource.go | 36 +++++++++++++++++++----------------- 2 files changed, 20 insertions(+), 18 deletions(-) diff --git a/pkg/metrics/report_usage.go b/pkg/metrics/report_usage.go index 065c83d3b8f..abda18d12b7 100644 --- a/pkg/metrics/report_usage.go +++ b/pkg/metrics/report_usage.go @@ -67,7 +67,7 @@ func sendUsageStats() { // as sending that name could be sensitive information dsOtherCount := 0 for _, dsStat := range dsStats.Result { - if m.IsStandardDataSource(dsStat.Type) { + if m.IsKnownDataSourcePlugin(dsStat.Type) { metrics["stats.ds."+dsStat.Type+".count"] = dsStat.Count } else { dsOtherCount += dsStat.Count diff --git a/pkg/models/datasource.go b/pkg/models/datasource.go index 35b623ce30a..38273598ab1 100644 --- a/pkg/models/datasource.go +++ b/pkg/models/datasource.go @@ -47,23 +47,25 @@ type DataSource struct { Updated time.Time } -func IsStandardDataSource(dsType string) bool { - switch dsType { - case DS_ES: - return true - case DS_INFLUXDB: - return true - case DS_OPENTSDB: - return true - case DS_CLOUDWATCH: - return true - case DS_PROMETHEUS: - return true - case DS_GRAPHITE: - return true - default: - return false - } +var knownDatasourcePlugins map[string]bool = map[string]bool{ + DS_ES: true, + DS_GRAPHITE: true, + DS_INFLUXDB: true, + DS_INFLUXDB_08: true, + DS_KAIROSDB: true, + DS_CLOUDWATCH: true, + DS_PROMETHEUS: true, + DS_OPENTSDB: true, + "opennms": true, + "druid": true, + "dalmatinerdb": true, + "gnocci": true, + "zabbix": true, +} + +func IsKnownDataSourcePlugin(dsType string) bool { + _, exists := knownDatasourcePlugins[dsType] + return exists } // ---------------------- From 09b3433e3201970f109a8b01e5e3ebe52513f0a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Mon, 26 Oct 2015 18:54:32 +0100 Subject: [PATCH 079/269] change(dashboards): made home dashboard and json file dashboards editable unless otherwise specified in json file, closes #2567 --- pkg/api/dashboard.go | 8 +++++++- public/app/core/routes/dashboard_loaders.js | 2 +- public/dashboards/home.json | 2 +- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/pkg/api/dashboard.go b/pkg/api/dashboard.go index d7f9f2cd740..8d7d3f6adfd 100644 --- a/pkg/api/dashboard.go +++ b/pkg/api/dashboard.go @@ -56,7 +56,7 @@ func GetDashboard(c *middleware.Context) { Type: m.DashTypeDB, CanStar: c.IsSignedIn, CanSave: c.OrgRole == m.ROLE_ADMIN || c.OrgRole == m.ROLE_EDITOR, - CanEdit: c.OrgRole == m.ROLE_ADMIN || c.OrgRole == m.ROLE_EDITOR || c.OrgRole == m.ROLE_READ_ONLY_EDITOR, + CanEdit: canEditDashboard(c.OrgRole), }, } @@ -122,6 +122,10 @@ func PostDashboard(c *middleware.Context, cmd m.SaveDashboardCommand) { c.JSON(200, util.DynMap{"status": "success", "slug": cmd.Result.Slug, "version": cmd.Result.Version}) } +func canEditDashboard(role m.RoleType) bool { + return role == m.ROLE_ADMIN || role == m.ROLE_EDITOR || role == m.ROLE_READ_ONLY_EDITOR +} + func GetHomeDashboard(c *middleware.Context) { filePath := path.Join(setting.StaticRootPath, "dashboards/home.json") file, err := os.Open(filePath) @@ -132,6 +136,7 @@ func GetHomeDashboard(c *middleware.Context) { dash := dtos.DashboardFullWithMeta{} dash.Meta.IsHome = true + dash.Meta.CanEdit = canEditDashboard(c.OrgRole) jsonParser := json.NewDecoder(file) if err := jsonParser.Decode(&dash.Dashboard); err != nil { c.JsonApiErr(500, "Failed to load home dashboard", err) @@ -152,6 +157,7 @@ func GetDashboardFromJsonFile(c *middleware.Context) { dash := dtos.DashboardFullWithMeta{Dashboard: dashboard.Data} dash.Meta.Type = m.DashTypeJson + dash.Meta.CanEdit = canEditDashboard(c.OrgRole) c.JSON(200, &dash) } diff --git a/public/app/core/routes/dashboard_loaders.js b/public/app/core/routes/dashboard_loaders.js index e8a9b80237f..bcc284e882c 100644 --- a/public/app/core/routes/dashboard_loaders.js +++ b/public/app/core/routes/dashboard_loaders.js @@ -9,7 +9,7 @@ function (coreModule) { if (!$routeParams.slug) { backendSrv.get('/api/dashboards/home').then(function(result) { var meta = result.meta; - meta.canSave = meta.canShare = meta.canEdit = meta.canStar = false; + meta.canSave = meta.canShare = meta.canStar = false; $scope.initDashboard(result, $scope); }); return; diff --git a/public/dashboards/home.json b/public/dashboards/home.json index 1cc28db24ae..6cd86b4090b 100644 --- a/public/dashboards/home.json +++ b/public/dashboards/home.json @@ -3,7 +3,7 @@ "tags": [], "style": "dark", "timezone": "browser", - "editable": false, + "editable": true, "hideControls": true, "rows": [ { From c97e3ec7aef9554de348d7d31e514a3b04eb4420 Mon Sep 17 00:00:00 2001 From: Matt Date: Mon, 26 Oct 2015 14:03:26 -0400 Subject: [PATCH 080/269] Updates to timepicker docs for 2.5 release Updated images to be in separate PR. --- docs/sources/reference/timerange.md | 47 +++++++++++++++++++++-------- 1 file changed, 34 insertions(+), 13 deletions(-) diff --git a/docs/sources/reference/timerange.md b/docs/sources/reference/timerange.md index c253e0cd64c..33658c66374 100644 --- a/docs/sources/reference/timerange.md +++ b/docs/sources/reference/timerange.md @@ -12,36 +12,57 @@ Grafana provides numerous ways to manage the time ranges of the data being visua In the top right, you have the master Dashboard time picker (it's in between the 'Zoom out' and the 'Refresh' links). -From this dropdown you can: +1. `Current time range & refresh interval`: This shows the current dashboard time and refresh interval. It also acts as the menu button to toggle the time range controls. +2. `Quick ranges`: Quick ranges are preset values to choose a relative time. At this time, quick ranges are not configurable, and will appear on every dashboard. +3. `Time range`: The time range section allows you to mix both explicit and relative ranges. The explicit time range format is `YYYY-MM-DD HH:MM:SS` +4. `Refreshing every:` When enabled, auto-refresh will reload the dashboard at the specified time range. Auto-refresh is most commonly used with relative time ranges ending in `now`, so new data will appear when the dashboard refreshes. -1. Specify an exact time range (eg. "October 13 12:01 to October 14 12:05) -2. Choose a relative time (eg. "Last 15 minutes","Last 1 week") -3. Configure auto-refresh options +These settings apply to all Panels in the Dashboard (except those with Panel Time Overrides enabled) -All of this applies to all Panels in the Dashboard (except those with Panel Time Overrides enabled) +## Time Units -## Customize relative time and auto auto-refresh options +The following time units are supported: `s (seconds)`, `m (minutes)`, `h (hours)`, `d (days)`, `w (weeks)`, `M (months)`, `y (years)`. The minus operator allows you to step back in time, relative to now. If you wish to display the full period of the unit (day, week, month, etc...), append `/$unit` to the end. -It's possible to customize the options displayed for relative time and the auto-refresh options. +Take a look at some examples to seen these concepts in practice: -From Dashboard settings, click the Timepicker tab. From here you can specify the relative and auto refresh intervals. The Timepicker tab settings are saved on a per Dashboard basis. Entries are comma separated and accept a number followed by one of the following units: `s (seconds)`, `m (minutes)`, `h (hours)`, `d (days)`, `w (weeks)`, `M (months)`, `y (years)`. +Example Relative Range | From: | To: +-------------- | ----- | --- +Last 5 minutes | `now-5m` | `now` +The day so far | `now/d` | `now` +This week | `now/w` | `now/w` +Week to date | `now/w` | `now` +Previous Month | `now-1M/M` | `now-1M/M` + + +## Dashboard-Level Time Picker Settings + +There are two settings available from the Dashboard Settings area, allowing customization of the auto-refresh intervals and the definition of `now`. +### Auto-Refresh Options + +It's possible to customize the options displayed for relative time and the auto-refresh options. + +From Dashboard settings, click the Timepicker tab. From here you can specify the relative and auto-refresh intervals. The Timepicker tab settings are saved on a per Dashboard basis. Entries are comma separated and accept any valid time unit. + +### Defining Now + +Users often ask, [when will then be now](https://www.youtube.com/watch?v=VeZ9HhHU86o)? Grafana offers the ability to override the `now` value on a per dashboard basis. Most commonly, this feature is used to accommodate known delays in data aggregation to avoid null values. ## Panel time overrides & timeshift -In Grafana v2.x you can now override the relative time range for individual panels, causing them to be different than what is selected in the Dashboard time picker in the upper right. You can also add a time shift to individual panels. This allows you to show metrics from different time periods or days at the same time. +You can override the relative time range for individual panels, causing them to be different than what is selected in the Dashboard time picker in the upper right. This allows you to show metrics from different time periods or days at the same time. -You control these overrides in panel editor mode and the new tab `Time Range`. +You control these overrides in panel editor mode and the tab `Time Range`. -When you zoom or change the Dashboard time to a custom absolute time range, all panel overrides will be disabled. The panel relative time override is only active when the dashboard time is also relative. The panel timeshift override however is always active, even when the dashboard time is absolute. +When you zoom or change the Dashboard time to a custom absolute time range, all panel overrides will be disabled. The panel relative time override is only active when the dashboard time is also relative. The panel timeshift override is always active, even when the dashboard time is absolute. -The `Hide time override info` option allows you to hide the the override info text that is by default shown in the +The `Hide time override info` option allows you to hide the override info text that is by default shown in the upper right of a panel when overridden time range options. -Currently you can only override the dashboard time with relative time ranges, not absolute time ranges. +Note: You can only override the dashboard time with relative time ranges. Absolute time ranges are not available. From da31fffb16319c988508ddd715d961d685c73da3 Mon Sep 17 00:00:00 2001 From: Matt Date: Mon, 26 Oct 2015 14:05:44 -0400 Subject: [PATCH 081/269] Update timerange.md --- docs/sources/reference/timerange.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/sources/reference/timerange.md b/docs/sources/reference/timerange.md index 33658c66374..2ab428622bc 100644 --- a/docs/sources/reference/timerange.md +++ b/docs/sources/reference/timerange.md @@ -8,7 +8,7 @@ page_keywords: grafana, time range, guide, documentation Grafana provides numerous ways to manage the time ranges of the data being visualized, both at the Dashboard-level and the Panel-level. - + In the top right, you have the master Dashboard time picker (it's in between the 'Zoom out' and the 'Refresh' links). From 6af86152e6eabc149f5131ec0234a18097ad1e35 Mon Sep 17 00:00:00 2001 From: ubhatnagar Date: Mon, 26 Oct 2015 21:02:04 -0700 Subject: [PATCH 082/269] Removed typos in cloudwatch docs --- docs/sources/datasources/cloudwatch.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/sources/datasources/cloudwatch.md b/docs/sources/datasources/cloudwatch.md index fa73824361e..0b8f49b70f5 100644 --- a/docs/sources/datasources/cloudwatch.md +++ b/docs/sources/datasources/cloudwatch.md @@ -30,7 +30,7 @@ Default-Region | Used in query editor to set region (can be changed on per query ### IAM Roles -Currently all access to CloudWatch is done server side by the Grafana backend using the offical AWS SDK. If you grafana +Currently all access to CloudWatch is done server side by the Grafana backend using the official AWS SDK. If you grafana server is running on AWS you can use IAM Roles and authentication will be handled automatically. Checkout AWS docs on [IAM Roles]](http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/iam-roles-for-amazon-ec2.html) @@ -58,7 +58,7 @@ You need to specify a namespace, metric, at least one stat, and at least one dim It's worth to mention that Amazon will charge you for CloudWatch API usage. CloudWatch costs $0.01 per 1,000 GetMetricStatistics or ListMetrics requests. For each query Grafana will -issue a GetMetricStatistics request and every time you pick a dimenion in the query editor +issue a GetMetricStatistics request and every time you pick a dimension in the query editor Grafana will issue a ListMetrics request. From a36711e6407e9107bb06679335dcda98cbeacb9b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Tue, 27 Oct 2015 10:26:44 +0100 Subject: [PATCH 083/269] fix(changelog): fixed link in changelog --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e9fb3a21e4f..b3072baf0f8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,7 +16,7 @@ it allows you to add queries of differnet data source types & instances to the s **User Onboarding** - Org admin can now send email invites (or invite links) to people who are not yet Grafana users - Sign up flow now supports email verification (if enabled) -- See [Issue #2353](https://github.com/grafana/grafana/issues/2354) for more info. +- See [Issue #2353](https://github.com/grafana/grafana/issues/2353) for more info. **Other new Features && Enhancements** - [Pull #2720](https://github.com/grafana/grafana/pull/2720). Admin: Initial basic quota support (per Org) From e7d5ea8a6c10fcb234487ce81666350d4ecdd503 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Tue, 27 Oct 2015 12:08:56 +0100 Subject: [PATCH 084/269] fix(build): revert some build script changes to make building on go 1.4 work again --- build.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/build.go b/build.go index 4a345c5fc73..3f9e53ee378 100644 --- a/build.go +++ b/build.go @@ -328,9 +328,9 @@ func build(pkg string, tags []string) { func ldflags() string { var b bytes.Buffer b.WriteString("-w") - b.WriteString(fmt.Sprintf(" -X main.version=%s", version)) - b.WriteString(fmt.Sprintf(" -X main.commit=%s", getGitSha())) - b.WriteString(fmt.Sprintf(" -X main.buildstamp=%d", buildStamp())) + b.WriteString(fmt.Sprintf(" -X main.version %s", version)) + b.WriteString(fmt.Sprintf(" -X main.commit %s", getGitSha())) + b.WriteString(fmt.Sprintf(" -X main.buildstamp %d", buildStamp())) return b.String() } From 358ba395ac0b9714b322a18f9bc140cd1f95cd10 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Tue, 27 Oct 2015 12:09:14 +0100 Subject: [PATCH 085/269] fix(invite): minor fix to invite partials markup --- public/app/features/org/partials/invite.html | 2 +- public/app/partials/signup_invited.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/public/app/features/org/partials/invite.html b/public/app/features/org/partials/invite.html index 808f722c081..ae5d3a7ea61 100644 --- a/public/app/features/org/partials/invite.html +++ b/public/app/features/org/partials/invite.html @@ -18,7 +18,7 @@
          -
          +
          • diff --git a/public/app/partials/signup_invited.html b/public/app/partials/signup_invited.html index 1ed43cd4cd7..ead9b9c0317 100644 --- a/public/app/partials/signup_invited.html +++ b/public/app/partials/signup_invited.html @@ -19,7 +19,7 @@
          -
          +
          • From 22a4ef42fcd012eedc1ee6d6fcfd423aaeaa82b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Tue, 27 Oct 2015 12:22:30 +0100 Subject: [PATCH 086/269] version change to 2.5-pre2 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 047f30f7ed0..63cec957978 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "company": "Coding Instinct AB" }, "name": "grafana", - "version": "2.5.0-pre1", + "version": "2.5.0-pre2", "repository": { "type": "git", "url": "http://github.com/torkelo/grafana.git" From 89ce1a5159db711771dc47eb98336576430b0de2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Tue, 27 Oct 2015 13:17:28 +0100 Subject: [PATCH 087/269] fix(dashlist): minor fix to dashlist panel, and some minor html markup fixes --- .../features/dashboard/partials/settings.html | 46 ++++++++++--------- .../features/panel/partials/panelTime.html | 2 +- public/app/panels/dashlist/editor.html | 6 +-- public/app/panels/dashlist/module.js | 2 + public/app/panels/singlestat/editor.html | 14 +++--- 5 files changed, 37 insertions(+), 33 deletions(-) diff --git a/public/app/features/dashboard/partials/settings.html b/public/app/features/dashboard/partials/settings.html index 543fad9de22..541ef45e9ab 100644 --- a/public/app/features/dashboard/partials/settings.html +++ b/public/app/features/dashboard/partials/settings.html @@ -77,28 +77,30 @@
            Rows settings
            -
            -
              -
            • - Title -
            • -
            • - -
            • -
            • - -
            • -
            • - -
            • -
            • - -
            • -
            • - -
            • -
            -
            +
            +
            +
              +
            • + Title +
            • +
            • + +
            • +
            • + +
            • +
            • + +
            • +
            • + +
            • +
            • + +
            • +
            +
            +
            diff --git a/public/app/features/panel/partials/panelTime.html b/public/app/features/panel/partials/panelTime.html index f5bfac1d8d9..04954108aca 100644 --- a/public/app/features/panel/partials/panelTime.html +++ b/public/app/features/panel/partials/panelTime.html @@ -1,5 +1,5 @@
            -
            +
            • diff --git a/public/app/panels/dashlist/editor.html b/public/app/panels/dashlist/editor.html index 7b176b74317..1a0ba518c01 100644 --- a/public/app/panels/dashlist/editor.html +++ b/public/app/panels/dashlist/editor.html @@ -1,7 +1,7 @@
              -
              +
              • Mode @@ -14,7 +14,7 @@
              -
              +
              • Search options @@ -41,7 +41,7 @@
                -
                +
                • Limit number to diff --git a/public/app/panels/dashlist/module.js b/public/app/panels/dashlist/module.js index 788e2968c48..1b20e9e5310 100644 --- a/public/app/panels/dashlist/module.js +++ b/public/app/panels/dashlist/module.js @@ -43,8 +43,10 @@ function (angular, app, _, config, PanelMeta) { $scope.init = function() { panelSrv.init($scope); + if ($scope.panel.tag) { $scope.panel.tags = [$scope.panel.tag]; + delete $scope.panel.tag; } if ($scope.isNewPanel()) { diff --git a/public/app/panels/singlestat/editor.html b/public/app/panels/singlestat/editor.html index 6b055e68bb4..f8df6d8adc9 100644 --- a/public/app/panels/singlestat/editor.html +++ b/public/app/panels/singlestat/editor.html @@ -1,5 +1,5 @@
                  -
                  +
                  • @@ -68,7 +68,7 @@ Decimals
                  • -
                  @@ -79,7 +79,7 @@
                  -
                  +
                  • Coloring @@ -121,7 +121,7 @@
                    -
                    +
                    • Spark lines @@ -147,7 +147,7 @@
                    • Fill Color
                    • -
                    • +
                    @@ -158,7 +158,7 @@
                    -
                    +
                    • Value to text mapping @@ -177,7 +177,7 @@
                    • - +
                    • From 23599814a3d194e8fdd815e8fa24ca3a21b94d5b Mon Sep 17 00:00:00 2001 From: Jari Sukanen Date: Tue, 27 Oct 2015 16:28:43 +0200 Subject: [PATCH 088/269] cloudwatch: add support for defining AWS profile for CloudWatch datasource Add support for defining AWS profile for CloudWatch datasource to support pulling information from multiple different AWS accounts to single dashboard. With this change, it is possible to define multiple AWS credentials in ~/.aws/credentials file and connect different data sources to different AWS accounts. --- pkg/api/cloudwatch/cloudwatch.go | 33 +++++++++++++++---- .../datasource/cloudwatch/datasource.js | 3 ++ .../cloudwatch/partials/config.html | 11 +++++++ 3 files changed, 41 insertions(+), 6 deletions(-) diff --git a/pkg/api/cloudwatch/cloudwatch.go b/pkg/api/cloudwatch/cloudwatch.go index 6f2afdaa9e2..d436d0a6452 100644 --- a/pkg/api/cloudwatch/cloudwatch.go +++ b/pkg/api/cloudwatch/cloudwatch.go @@ -7,6 +7,8 @@ import ( "time" "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/aws/credentials" + "github.com/aws/aws-sdk-go/aws/credentials/ec2rolecreds" "github.com/aws/aws-sdk-go/service/cloudwatch" "github.com/aws/aws-sdk-go/service/ec2" "github.com/grafana/grafana/pkg/middleware" @@ -17,9 +19,10 @@ type actionHandler func(*cwRequest, *middleware.Context) var actionHandlers map[string]actionHandler type cwRequest struct { - Region string `json:"region"` - Action string `json:"action"` - Body []byte `json:"-"` + Region string `json:"region"` + Profile string `json:"profile"` + Action string `json:"action"` + Body []byte `json:"-"` } func init() { @@ -35,7 +38,16 @@ func init() { } func handleGetMetricStatistics(req *cwRequest, c *middleware.Context) { - svc := cloudwatch.New(&aws.Config{Region: aws.String(req.Region)}) + creds := credentials.NewChainCredentials( + []credentials.Provider{ + &credentials.EnvProvider{}, + &credentials.SharedCredentialsProvider{Filename: "", Profile: req.Profile}, + &ec2rolecreds.EC2RoleProvider{ExpiryWindow: 5 * time.Minute}, + }) + svc := cloudwatch.New(&aws.Config{ + Region: aws.String(req.Region), + Credentials: creds, + }) reqParam := &struct { Parameters struct { @@ -70,7 +82,17 @@ func handleGetMetricStatistics(req *cwRequest, c *middleware.Context) { } func handleListMetrics(req *cwRequest, c *middleware.Context) { - svc := cloudwatch.New(&aws.Config{Region: aws.String(req.Region)}) + creds := credentials.NewChainCredentials( + []credentials.Provider{ + &credentials.EnvProvider{}, + &credentials.SharedCredentialsProvider{Filename: "", Profile: req.Profile}, + &ec2rolecreds.EC2RoleProvider{ExpiryWindow: 5 * time.Minute}, + }) + svc := cloudwatch.New(&aws.Config{ + Region: aws.String(req.Region), + Credentials: creds, + }) + reqParam := &struct { Parameters struct { Namespace string `json:"namespace"` @@ -78,7 +100,6 @@ func handleListMetrics(req *cwRequest, c *middleware.Context) { Dimensions []*cloudwatch.DimensionFilter `json:"dimensions"` } `json:"parameters"` }{} - json.Unmarshal(req.Body, reqParam) params := &cloudwatch.ListMetricsInput{ diff --git a/public/app/plugins/datasource/cloudwatch/datasource.js b/public/app/plugins/datasource/cloudwatch/datasource.js index 9a9876b53ae..2b5f8c76440 100644 --- a/public/app/plugins/datasource/cloudwatch/datasource.js +++ b/public/app/plugins/datasource/cloudwatch/datasource.js @@ -18,6 +18,7 @@ function (angular, _) { this.supportMetrics = true; this.proxyUrl = datasource.url; this.defaultRegion = datasource.jsonData.defaultRegion; + this.profile = datasource.jsonData.profile; } CloudWatchDatasource.prototype.query = function(options) { @@ -73,6 +74,7 @@ function (angular, _) { CloudWatchDatasource.prototype.performTimeSeriesQuery = function(query, start, end) { return this.awsRequest({ region: query.region, + profile: this.profile, action: 'GetMetricStatistics', parameters: { namespace: query.namespace, @@ -115,6 +117,7 @@ function (angular, _) { CloudWatchDatasource.prototype.getDimensionValues = function(region, namespace, metricName, dimensions) { var request = { region: templateSrv.replace(region), + profile: this.profile, action: 'ListMetrics', parameters: { namespace: templateSrv.replace(namespace), diff --git a/public/app/plugins/datasource/cloudwatch/partials/config.html b/public/app/plugins/datasource/cloudwatch/partials/config.html index 627b2829418..4be4debe072 100644 --- a/public/app/plugins/datasource/cloudwatch/partials/config.html +++ b/public/app/plugins/datasource/cloudwatch/partials/config.html @@ -12,6 +12,17 @@
                    +
                    +
                      +
                    • + AWS Profile +
                    • +
                    • + +
                    • +
                    +
                    +
                    From 6397b8c1ef60e96800e3e9c76ccabae4410bc088 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Wed, 28 Oct 2015 09:31:57 +0100 Subject: [PATCH 089/269] docs(): updated version to 2.5.0 --- docs/sources/guides/whats-new-in-v2-5.md | 9 +++++++++ package.json | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 docs/sources/guides/whats-new-in-v2-5.md diff --git a/docs/sources/guides/whats-new-in-v2-5.md b/docs/sources/guides/whats-new-in-v2-5.md new file mode 100644 index 00000000000..94b0b3cbbc9 --- /dev/null +++ b/docs/sources/guides/whats-new-in-v2-5.md @@ -0,0 +1,9 @@ +--- +page_title: What's New in Grafana v2.5 +page_description: What's new in Grafana v2.5 +page_keywords: grafana, new, changes, features, documentation +--- + +# What's new in Grafana v2.5 + + diff --git a/package.json b/package.json index 63cec957978..fde78ebd8bd 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "company": "Coding Instinct AB" }, "name": "grafana", - "version": "2.5.0-pre2", + "version": "2.5.0", "repository": { "type": "git", "url": "http://github.com/torkelo/grafana.git" From 287d8ca36707134fcaa8fb27a16e97f9c99fb554 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Wed, 28 Oct 2015 09:43:28 +0100 Subject: [PATCH 090/269] fix(changelog): minor spelling fix to changelog --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b3072baf0f8..75fd222c269 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,7 +11,7 @@ it allows you to add queries of differnet data source types & instances to the s **New Feature: New and much improved time picker** - Support for quick ranges like `Today`, `This day last week`, `This week`, `The day so far`, etc. -- Muck improved UI and improved support for UTC, [Issue #2761](https://github.com/grafana/grafana/issues/2761) for more info. +- Improved UI and improved support for UTC, [Issue #2761](https://github.com/grafana/grafana/issues/2761) for more info. **User Onboarding** - Org admin can now send email invites (or invite links) to people who are not yet Grafana users From 1685e7cea4397396a879806baac35746b823970e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Wed, 28 Oct 2015 11:07:05 +0100 Subject: [PATCH 091/269] docs(): update to install docs and whats new in 2.5 --- README.md | 2 +- docs/mkdocs.yml | 3 +- docs/sources/guides/whats-new-in-v2-5.md | 96 ++++++++++++++++++++++++ docs/sources/installation/debian.md | 6 +- docs/sources/installation/rpm.md | 8 +- docs/sources/installation/windows.md | 2 +- packaging/publish/publish.sh | 17 +++++ 7 files changed, 124 insertions(+), 10 deletions(-) create mode 100755 packaging/publish/publish.sh diff --git a/README.md b/README.md index a346acaaa8a..8cf9992927b 100644 --- a/README.md +++ b/README.md @@ -133,7 +133,7 @@ And if you have time clone this repo and submit a pull request and help me make the kickass metrics & devops dashboard we all dream about! Before creating a pull request be sure that "grunt test" runs without any style or unit test errors, also -please [sign the CLA](http://grafana.org/docs/contributing/cla.html) +please [sign the CLA](http://docs.grafana.org/project/cla/) ## License diff --git a/docs/mkdocs.yml b/docs/mkdocs.yml index 7931ae81c3c..f965e34c5bd 100644 --- a/docs/mkdocs.yml +++ b/docs/mkdocs.yml @@ -45,8 +45,9 @@ pages: - ['guides/basic_concepts.md', 'User Guides', 'Basic Concepts'] - ['guides/gettingstarted.md', 'User Guides', 'Getting Started'] -- ['guides/whats-new-in-v2.md', 'User Guides', "What's New in Grafana v2.0"] +- ['guides/whats-new-in-v2-5.md', 'User Guides', "What's New in Grafana v2.5"] - ['guides/whats-new-in-v2-1.md', 'User Guides', "What's New in Grafana v2.1"] +- ['guides/whats-new-in-v2.md', 'User Guides', "What's New in Grafana v2.0"] - ['guides/screencasts.md', 'User Guides', 'Screencasts'] - ['reference/graph.md', 'Reference', 'Graph Panel'] diff --git a/docs/sources/guides/whats-new-in-v2-5.md b/docs/sources/guides/whats-new-in-v2-5.md index 94b0b3cbbc9..1ad83bc2c8b 100644 --- a/docs/sources/guides/whats-new-in-v2-5.md +++ b/docs/sources/guides/whats-new-in-v2-5.md @@ -6,4 +6,100 @@ page_keywords: grafana, new, changes, features, documentation # What's new in Grafana v2.5 +## Release highlights +This is an exciting release, and we want to share some of the highlights. The release includes many +fixes and enhancements to all areas of Grafana, like new Data Sources, a new and improved timepicker, user invites, panel +resize handles and improved InfluxDB and OpenTSDB support. + +### New time range controls +New Time picker + +A new timepicker with room for more quick ranges as well as new types of relative ranges, like `Today`, +`The day so far` and `This day last week`. Also an improved time & calendar picker that now works +correctly in UTC mode. + +### Elasticsearch + +Elasticsearch example +
                    + +This release brings a fully featured query editor for Elasticsearch. You will now be able to visualize +logs or any kind of data stored in Elasticserarch. The query editor allows you to build both simple +and complex queries for logs or metrics. + +- Compute metrics from your documents, supported Elasticsearch aggregations: + - Count, Avg, Min, Max, Sum + - Percentiles, Std Dev, etc. +- Group by multiple terms or filters + - Specify group by options like Top 5 based on Avg @value +- Auto completion for field names +- Query only relevant indicies based on time pattern +- Alias patterns for short readable series names + +Try the new Elasticsearch query editor on the [play.grafana.org](http://play.grafana.org/dashboard/db/elasticsearch-metrics) site. + +### CloudWatch + +Cloudwatch editor + +Grafana 2.5 ships with a new CloudWatch datasource that will allow you to query and visualize CloudWatch +metrics directly from Grafana. + +- Rich editor with auto completion for metric names, namespaces and dimensions +- Templating queries for generic dashboards +- Alias patterns for short readable series names + +### Prometheus + +Prometheus editor + +Grafana 2.5 ships with a new Prometheus datasource that will allow you to query and visualize data +stored in Prometheus. + + +### Mix different data sources +Mix data sources in the same dashboard or in the same graph! + +In previous releases you have been able to mix different data sources on the same dashboard. In v2.5 you +will be able to mix then on the same graph! You can enable this by selecting the built in `-- Mixed --` data source. +When selected this will allow you to specify data source on a per query basis. This will, for example, allow you +to plot metrics from different Graphite servers on the same Graph or plot data from Elasticsearch alongside +data from Prometheus. Mixing different data sources on the same graph works for any data source, even custom ones. + +### Panel Resize handles + + +This release adds resize handles to the the bottom right corners of panels making is easy to resize both width and height. + +### User invites + + +This version also brings some new features for user management. + +- Organization admins can now invite new users (via email or manually via invite link) +- Users can signup using invite link and get automatically added to invited organization +- User signup workflow can (if enabled) contain an email verification step. +- Check out [#2353](https://github.com/grafana/grafana/issues/2353) for more info. + +### Miscellaneous improvements + +- InfluxDB query editor now supports math and AS expressions +- InfluxDB query editor now supports custom group by interval +- Panel drilldown link is easier to reach +- LDAP improvements (can now search for group membership if your LDAP server does not support memberOf attribute) +- More units for graph and singlestat panel (Length, Volume, Temperature, Pressure, Currency) +- Admin page for all organizations (remove / edit) + +### Breaking changes +There have been some changes to the data source plugin API. If you are using a custom plugin check that there is an update for it before you upgrade. Also +the new time picker does not currenty support custom quick ranges like the last one did. This will likey be added in a +future release. + +### Changelog +For a detailed list and link to github issues for everything included in the 2.5 release please +view the [CHANGELOG.md](https://github.com/grafana/grafana/blob/master/CHANGELOG.md) file. + +- - - + +### Download Grafana 2.5 now diff --git a/docs/sources/installation/debian.md b/docs/sources/installation/debian.md index 048474af3eb..b1fd4f4f9bc 100644 --- a/docs/sources/installation/debian.md +++ b/docs/sources/installation/debian.md @@ -10,13 +10,13 @@ page_keywords: grafana, installation, debian, ubuntu, guide Description | Download ------------ | ------------- -.deb for Debian-based Linux | [grafana_2.1.3_amd64.deb](https://grafanarel.s3.amazonaws.com/builds/grafana_2.1.3_amd64.deb) +.deb for Debian-based Linux | [grafana_2.5.0_amd64.deb](https://grafanarel.s3.amazonaws.com/builds/grafana_2.5.0_amd64.deb) ## Install - $ wget https://grafanarel.s3.amazonaws.com/builds/grafana_2.1.3_amd64.deb + $ wget https://grafanarel.s3.amazonaws.com/builds/grafana_2.5.0_amd64.deb $ sudo apt-get install -y adduser libfontconfig - $ sudo dpkg -i grafana_2.1.3_amd64.deb + $ sudo dpkg -i grafana_2.5.0_amd64.deb ## APT Repository diff --git a/docs/sources/installation/rpm.md b/docs/sources/installation/rpm.md index 67057384af0..464faa09b9d 100644 --- a/docs/sources/installation/rpm.md +++ b/docs/sources/installation/rpm.md @@ -10,24 +10,24 @@ page_keywords: grafana, installation, centos, fedora, opensuse, redhat, guide Description | Download ------------ | ------------- -.RPM for CentOS / Fedora / OpenSuse / Redhat Linux | [grafana-2.1.3-1.x86_64.rpm](https://grafanarel.s3.amazonaws.com/builds/grafana-2.1.3-1.x86_64.rpm) +.RPM for CentOS / Fedora / OpenSuse / Redhat Linux | [grafana-2.5.0-1.x86_64.rpm](https://grafanarel.s3.amazonaws.com/builds/grafana-2.5.0-1.x86_64.rpm) ## Install from package file You can install Grafana using Yum directly. - $ sudo yum install https://grafanarel.s3.amazonaws.com/builds/grafana-2.1.3-1.x86_64.rpm + $ sudo yum install https://grafanarel.s3.amazonaws.com/builds/grafana-2.5.0-1.x86_64.rpm Or install manually using `rpm`. #### On CentOS / Fedora / Redhat: $ sudo yum install initscripts fontconfig - $ sudo rpm -Uvh grafana-2.1.3-1.x86_64.rpm + $ sudo rpm -Uvh grafana-2.5.0-1.x86_64.rpm #### On OpenSuse: - $ sudo rpm -i --nodeps grafana-2.1.3-1.x86_64.rpm + $ sudo rpm -i --nodeps grafana-2.5.0-1.x86_64.rpm ## Install via YUM Repository diff --git a/docs/sources/installation/windows.md b/docs/sources/installation/windows.md index 1ef98ae4896..1bc2b5a2b92 100644 --- a/docs/sources/installation/windows.md +++ b/docs/sources/installation/windows.md @@ -10,7 +10,7 @@ page_keywords: grafana, installation, windows guide Description | Download ------------ | ------------- -Zip package for Windows | [grafana.2.1.3.windows-x64.zip](https://grafanarel.s3.amazonaws.com/winbuilds/dist/grafana-2.1.3.windows-x64.zip) +Zip package for Windows | [grafana.2.5.0.windows-x64.zip](https://grafanarel.s3.amazonaws.com/winbuilds/dist/grafana-2.5.0.windows-x64.zip) ## Configure diff --git a/packaging/publish/publish.sh b/packaging/publish/publish.sh new file mode 100755 index 00000000000..abccf74aa4b --- /dev/null +++ b/packaging/publish/publish.sh @@ -0,0 +1,17 @@ +#! /usr/bin/env bash + +version=2.5.0 + +wget https://grafanarel.s3.amazonaws.com/builds/grafana_${version}_amd64.deb + +package_cloud push grafana/stable/debian/jessie grafana_${version}_amd64.deb +package_cloud push grafana/stable/debian/wheezy grafana_${version}_amd64.deb +package_cloud push grafana/testing/debian/jessie grafana_${version}_amd64.deb +package_cloud push grafana/testing/debian/wheezy grafana_${version}_amd64.deb + +wget https://grafanarel.s3.amazonaws.com/builds/grafana-${version}-1.x86_64.rpm + +package_cloud push grafana/testing/el/6 grafana-${version}-1.x86_64.rpm +package_cloud push grafana/testing/el/7 grafana-${version}-1.x86_64.rpm +package_cloud push grafana/stable/el/7 grafana-${version}-1.x86_64.rpm +package_cloud push grafana/stable/el/6 grafana-${version}-1.x86_64.rpm From b82f1edd6393c1aac49dcb0dc3cd26f9acc8b41f Mon Sep 17 00:00:00 2001 From: Mitsuhiro Tanda Date: Wed, 28 Oct 2015 19:36:49 +0900 Subject: [PATCH 092/269] fix panel repeat for cloudwatch --- public/app/plugins/datasource/cloudwatch/datasource.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/public/app/plugins/datasource/cloudwatch/datasource.js b/public/app/plugins/datasource/cloudwatch/datasource.js index 9a9876b53ae..6a99724123b 100644 --- a/public/app/plugins/datasource/cloudwatch/datasource.js +++ b/public/app/plugins/datasource/cloudwatch/datasource.js @@ -34,7 +34,7 @@ function (angular, _) { query.region = templateSrv.replace(target.region, options.scopedVars); query.namespace = templateSrv.replace(target.namespace, options.scopedVars); query.metricName = templateSrv.replace(target.metricName, options.scopedVars); - query.dimensions = convertDimensionFormat(target.dimensions); + query.dimensions = convertDimensionFormat(target.dimensions, options.scopedVars); query.statistics = target.statistics; query.period = parseInt(target.period, 10); @@ -119,7 +119,7 @@ function (angular, _) { parameters: { namespace: templateSrv.replace(namespace), metricName: templateSrv.replace(metricName), - dimensions: convertDimensionFormat(dimensions), + dimensions: convertDimensionFormat(dimensions, {}), } }; @@ -276,11 +276,11 @@ function (angular, _) { return Math.round(date.valueOf() / 1000); } - function convertDimensionFormat(dimensions) { + function convertDimensionFormat(dimensions, scopedVars) { return _.map(dimensions, function(value, key) { return { - Name: templateSrv.replace(key), - Value: templateSrv.replace(value) + Name: templateSrv.replace(key, scopedVars), + Value: templateSrv.replace(value, scopedVars) }; }); } From 6ea2c08ecbec83530f399e467de14dc01c8127fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Wed, 28 Oct 2015 11:50:22 +0100 Subject: [PATCH 093/269] docs(): minor docs fix --- docs/sources/versions.html_fragment | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/sources/versions.html_fragment b/docs/sources/versions.html_fragment index d9f6a4c655b..3733641ac79 100644 --- a/docs/sources/versions.html_fragment +++ b/docs/sources/versions.html_fragment @@ -1,4 +1,4 @@ -
                  • Version v2.5
                  • +
                  • Version v2.5
                  • Version v2.1
                  • Version v2.0
                  • Version v1.9
                  • From 2f09ef2970ea3a8481d7d2c679a36321117fbc8c Mon Sep 17 00:00:00 2001 From: utkarshcmu Date: Wed, 28 Oct 2015 04:27:51 -0700 Subject: [PATCH 094/269] Fixed typos in 2.5v doc --- docs/sources/guides/whats-new-in-v2-5.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/sources/guides/whats-new-in-v2-5.md b/docs/sources/guides/whats-new-in-v2-5.md index 1ad83bc2c8b..f02d0d43fd0 100644 --- a/docs/sources/guides/whats-new-in-v2-5.md +++ b/docs/sources/guides/whats-new-in-v2-5.md @@ -33,7 +33,7 @@ and complex queries for logs or metrics. - Group by multiple terms or filters - Specify group by options like Top 5 based on Avg @value - Auto completion for field names -- Query only relevant indicies based on time pattern +- Query only relevant indices based on time pattern - Alias patterns for short readable series names Try the new Elasticsearch query editor on the [play.grafana.org](http://play.grafana.org/dashboard/db/elasticsearch-metrics) site. @@ -92,7 +92,7 @@ This version also brings some new features for user management. ### Breaking changes There have been some changes to the data source plugin API. If you are using a custom plugin check that there is an update for it before you upgrade. Also -the new time picker does not currenty support custom quick ranges like the last one did. This will likey be added in a +the new time picker does not currently support custom quick ranges like the last one did. This will likely be added in a future release. ### Changelog From e1393f978068c1e26ed86fa0db6a4aa776910c05 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Wed, 28 Oct 2015 14:46:47 +0100 Subject: [PATCH 095/269] changelog: updated and marked 2.5 as released --- CHANGELOG.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 75fd222c269..6486eedc18b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,6 @@ -# 2.5 (unreleased) +# 2.5.1 (unreleased) + +# 2.5 (2015-10-28) **New Feature: Mix data sources** - A built in data source is now available named `-- Mixed --`, When picked in the metrics tab, From 4729bea1a26489e2e9579e032ab3b92a206fef93 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Wed, 28 Oct 2015 15:04:25 +0100 Subject: [PATCH 096/269] fix(dashboard): fix for collapse row by clicking on row title, fixes #3065 --- CHANGELOG.md | 3 +++ package.json | 2 +- public/app/partials/dashboard.html | 2 +- public/app/partials/roweditor.html | 4 ++-- 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6486eedc18b..79c42499def 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,8 @@ # 2.5.1 (unreleased) +### Bug Fixes +* **dashboard**: fix for collapse row by clicking on row title, fixes [#3065](https://github.com/grafana/grafana/issues/3065) + # 2.5 (2015-10-28) **New Feature: Mix data sources** diff --git a/package.json b/package.json index fde78ebd8bd..543b6362d76 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "company": "Coding Instinct AB" }, "name": "grafana", - "version": "2.5.0", + "version": "2.5.1-pre1", "repository": { "type": "git", "url": "http://github.com/torkelo/grafana.git" diff --git a/public/app/partials/dashboard.html b/public/app/partials/dashboard.html index 8a063820a53..09c80fd3341 100644 --- a/public/app/partials/dashboard.html +++ b/public/app/partials/dashboard.html @@ -78,7 +78,7 @@
                  -
                  +
                  Row details
                  -
                  +
                  • Title @@ -45,7 +45,7 @@
                  Templating options
                  -
                  +
                  • Repeat Row From d3ee81bb5a4cb9fe052d826584bf93935049b666 Mon Sep 17 00:00:00 2001 From: utkarshcmu Date: Wed, 28 Oct 2015 10:18:44 -0700 Subject: [PATCH 097/269] Added tooltip for cloudwatch datasource --- public/app/plugins/datasource/cloudwatch/partials/config.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/app/plugins/datasource/cloudwatch/partials/config.html b/public/app/plugins/datasource/cloudwatch/partials/config.html index 627b2829418..2535eca944b 100644 --- a/public/app/plugins/datasource/cloudwatch/partials/config.html +++ b/public/app/plugins/datasource/cloudwatch/partials/config.html @@ -4,7 +4,7 @@
                    • - Default Region + Default RegionSpecify the region, such as for US West (Oregon) use ` us-west-2 ` as the region.
                    • From 5d64568f3e2488abd66d1295fa80232a6dfd231e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Thu, 29 Oct 2015 11:44:34 +0100 Subject: [PATCH 098/269] refactoring: some minor refactoring and changes to AWS profile PR #3053 --- pkg/api/cloudwatch/cloudwatch.go | 16 ++-- pkg/api/dataproxy.go | 2 +- .../datasource/cloudwatch/datasource.js | 3 - .../cloudwatch/partials/config.html | 94 +++++-------------- 4 files changed, 35 insertions(+), 80 deletions(-) diff --git a/pkg/api/cloudwatch/cloudwatch.go b/pkg/api/cloudwatch/cloudwatch.go index d436d0a6452..763eb3d489a 100644 --- a/pkg/api/cloudwatch/cloudwatch.go +++ b/pkg/api/cloudwatch/cloudwatch.go @@ -12,6 +12,7 @@ import ( "github.com/aws/aws-sdk-go/service/cloudwatch" "github.com/aws/aws-sdk-go/service/ec2" "github.com/grafana/grafana/pkg/middleware" + m "github.com/grafana/grafana/pkg/models" ) type actionHandler func(*cwRequest, *middleware.Context) @@ -19,10 +20,10 @@ type actionHandler func(*cwRequest, *middleware.Context) var actionHandlers map[string]actionHandler type cwRequest struct { - Region string `json:"region"` - Profile string `json:"profile"` - Action string `json:"action"` - Body []byte `json:"-"` + Region string `json:"region"` + Action string `json:"action"` + Body []byte `json:"-"` + DataSource *m.DataSource } func init() { @@ -41,7 +42,7 @@ func handleGetMetricStatistics(req *cwRequest, c *middleware.Context) { creds := credentials.NewChainCredentials( []credentials.Provider{ &credentials.EnvProvider{}, - &credentials.SharedCredentialsProvider{Filename: "", Profile: req.Profile}, + &credentials.SharedCredentialsProvider{Filename: "", Profile: req.DataSource.Database}, &ec2rolecreds.EC2RoleProvider{ExpiryWindow: 5 * time.Minute}, }) svc := cloudwatch.New(&aws.Config{ @@ -85,7 +86,7 @@ func handleListMetrics(req *cwRequest, c *middleware.Context) { creds := credentials.NewChainCredentials( []credentials.Provider{ &credentials.EnvProvider{}, - &credentials.SharedCredentialsProvider{Filename: "", Profile: req.Profile}, + &credentials.SharedCredentialsProvider{Filename: "", Profile: req.DataSource.Database}, &ec2rolecreds.EC2RoleProvider{ExpiryWindow: 5 * time.Minute}, }) svc := cloudwatch.New(&aws.Config{ @@ -145,9 +146,10 @@ func handleDescribeInstances(req *cwRequest, c *middleware.Context) { c.JSON(200, resp) } -func HandleRequest(c *middleware.Context) { +func HandleRequest(c *middleware.Context, ds *m.DataSource) { var req cwRequest req.Body, _ = ioutil.ReadAll(c.Req.Request.Body) + req.DataSource = ds json.Unmarshal(req.Body, &req) if handler, found := actionHandlers[req.Action]; !found { diff --git a/pkg/api/dataproxy.go b/pkg/api/dataproxy.go index 3aa215eac15..7193198155f 100644 --- a/pkg/api/dataproxy.go +++ b/pkg/api/dataproxy.go @@ -97,7 +97,7 @@ func ProxyDataSourceRequest(c *middleware.Context) { } if ds.Type == m.DS_CLOUDWATCH { - cloudwatch.HandleRequest(c) + cloudwatch.HandleRequest(c, ds) } else { proxyPath := c.Params("*") proxy := NewReverseProxy(ds, proxyPath, targetUrl) diff --git a/public/app/plugins/datasource/cloudwatch/datasource.js b/public/app/plugins/datasource/cloudwatch/datasource.js index 2b5f8c76440..9a9876b53ae 100644 --- a/public/app/plugins/datasource/cloudwatch/datasource.js +++ b/public/app/plugins/datasource/cloudwatch/datasource.js @@ -18,7 +18,6 @@ function (angular, _) { this.supportMetrics = true; this.proxyUrl = datasource.url; this.defaultRegion = datasource.jsonData.defaultRegion; - this.profile = datasource.jsonData.profile; } CloudWatchDatasource.prototype.query = function(options) { @@ -74,7 +73,6 @@ function (angular, _) { CloudWatchDatasource.prototype.performTimeSeriesQuery = function(query, start, end) { return this.awsRequest({ region: query.region, - profile: this.profile, action: 'GetMetricStatistics', parameters: { namespace: query.namespace, @@ -117,7 +115,6 @@ function (angular, _) { CloudWatchDatasource.prototype.getDimensionValues = function(region, namespace, metricName, dimensions) { var request = { region: templateSrv.replace(region), - profile: this.profile, action: 'ListMetrics', parameters: { namespace: templateSrv.replace(namespace), diff --git a/public/app/plugins/datasource/cloudwatch/partials/config.html b/public/app/plugins/datasource/cloudwatch/partials/config.html index 8bd17a954c1..6f79f47f945 100644 --- a/public/app/plugins/datasource/cloudwatch/partials/config.html +++ b/public/app/plugins/datasource/cloudwatch/partials/config.html @@ -1,73 +1,29 @@
                      CloudWatch details
                      -
                      -
                        -
                      • - Default RegionSpecify the region, such as for US West (Oregon) use ` us-west-2 ` as the region. -
                      • -
                      • - -
                      • -
                      -
                      +
                      +
                      +
                      +
                        +
                      • + Credentials profile nameCredentials profile name, as specified in ~/.aws/credentials, leave blank for default +
                      • +
                      • + +
                      • +
                      +
                      +
                      +
                      +
                        +
                      • + Default RegionSpecify the region, such as for US West (Oregon) use ` us-west-2 ` as the region. +
                      • +
                      • + +
                      • +
                      +
                      +
                      +
                      -
                      -
                        -
                      • - AWS Profile -
                      • -
                      • - -
                      • -
                      -
                      -
                      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - From f8a1c7c8a1909955971421a7a71986a8c0e68388 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Thu, 29 Oct 2015 12:22:01 +0100 Subject: [PATCH 099/269] docs(cloudwatch): updated docs with info about #3080 --- CHANGELOG.md | 3 +++ docs/sources/datasources/cloudwatch.md | 3 ++- public/app/plugins/datasource/cloudwatch/partials/config.html | 4 ++-- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 79c42499def..8ff1f10a8b4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,8 @@ # 2.5.1 (unreleased) +### Enhancements +* **cloudwatch**: Support for multiple AWS Credentials, closes [#3053](https://github.com/grafana/grafana/issues/3053), [#3080](https://github.com/grafana/grafana/issues/3080) + ### Bug Fixes * **dashboard**: fix for collapse row by clicking on row title, fixes [#3065](https://github.com/grafana/grafana/issues/3065) diff --git a/docs/sources/datasources/cloudwatch.md b/docs/sources/datasources/cloudwatch.md index 0b8f49b70f5..c0ec51d6356 100644 --- a/docs/sources/datasources/cloudwatch.md +++ b/docs/sources/datasources/cloudwatch.md @@ -24,7 +24,8 @@ Name | Description ------------ | ------------- Name | The data source name, important that this is the same as in Grafana v1.x if you plan to import old dashboards. Default | Default data source means that it will be pre-selected for new panels. -Default-Region | Used in query editor to set region (can be changed on per query basis) +Credentials profile name | Specify the name of the profile to use (if you use `~/aws/credentials` file), leave blank for default. This option was introduced in Grafana 2.5.1 +Default Region | Used in query editor to set region (can be changed on per query basis) ## Authentication diff --git a/public/app/plugins/datasource/cloudwatch/partials/config.html b/public/app/plugins/datasource/cloudwatch/partials/config.html index 6f79f47f945..60c645c33f9 100644 --- a/public/app/plugins/datasource/cloudwatch/partials/config.html +++ b/public/app/plugins/datasource/cloudwatch/partials/config.html @@ -9,7 +9,7 @@ Credentials profile nameCredentials profile name, as specified in ~/.aws/credentials, leave blank for default
                    • - +
                    @@ -20,7 +20,7 @@ Default RegionSpecify the region, such as for US West (Oregon) use ` us-west-2 ` as the region.
                  • - +
                  From cdcffcd31eaea408e4a0cff63a7f82d95141680c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Thu, 29 Oct 2015 12:32:32 +0100 Subject: [PATCH 100/269] fix(css): restored tooltip background to dark for white theme #3079 --- public/less/variables.light.less | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/public/less/variables.light.less b/public/less/variables.light.less index 27dcf8575f4..f9063c4cd74 100644 --- a/public/less/variables.light.less +++ b/public/less/variables.light.less @@ -278,8 +278,8 @@ // Tooltips and popovers // ------------------------- -@tooltipColor: @grayDark; -@tooltipBackground: darken(@white,3%); +@tooltipColor: @white; +@tooltipBackground: @grayDark; @tooltipArrowWidth: 5px; @tooltipArrowColor: @tooltipBackground; @tooltipLinkColor: darken(@white,11%); From 3de4707c983aa379249f07318b5c01725f78d2f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Thu, 29 Oct 2015 14:05:05 +0100 Subject: [PATCH 101/269] feat(elasticsearch): Annotation queries now use the daily index patterns defined in data source options, for old annotations that have an index property that will be used, so will not break existing dashboard/annotation configs, closes #3061 --- CHANGELOG.md | 3 ++- .../features/annotations/annotationsSrv.js | 12 ++++++---- public/app/panels/graph/module.js | 2 +- public/app/plugins/PLUGIN_CHANGES.md | 6 +++++ .../datasource/elasticsearch/datasource.js | 24 ++++++++++++++----- .../partials/annotations.editor.html | 2 +- .../plugins/datasource/graphite/datasource.js | 16 ++++++------- .../plugins/datasource/influxdb/datasource.js | 8 +++---- .../datasource/influxdb_08/datasource.js | 8 +++---- .../influxdb_08/specs/datasource-specs.ts | 2 +- 10 files changed, 53 insertions(+), 30 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8ff1f10a8b4..c5729e24f96 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,8 @@ # 2.5.1 (unreleased) ### Enhancements -* **cloudwatch**: Support for multiple AWS Credentials, closes [#3053](https://github.com/grafana/grafana/issues/3053), [#3080](https://github.com/grafana/grafana/issues/3080) +* **CloudWatch**: Support for multiple AWS Credentials, closes [#3053](https://github.com/grafana/grafana/issues/3053), [#3080](https://github.com/grafana/grafana/issues/3080) +* **Elasticsearch**: Support for dynamic daily indices for annotations, closes [#3061](https://github.com/grafana/grafana/issues/3061) ### Bug Fixes * **dashboard**: fix for collapse row by clicking on row title, fixes [#3065](https://github.com/grafana/grafana/issues/3065) diff --git a/public/app/features/annotations/annotationsSrv.js b/public/app/features/annotations/annotationsSrv.js index 89c9b72ec1f..f131ad28393 100644 --- a/public/app/features/annotations/annotationsSrv.js +++ b/public/app/features/annotations/annotationsSrv.js @@ -7,14 +7,14 @@ define([ var module = angular.module('grafana.services'); - module.service('annotationsSrv', function(datasourceSrv, $q, alertSrv, $rootScope) { + module.service('annotationsSrv', function($rootScope, $q, datasourceSrv, alertSrv, timeSrv) { var promiseCached; var list = []; var self = this; this.init = function() { $rootScope.onAppEvent('refresh', this.clearCache, $rootScope); - $rootScope.onAppEvent('setup-dashboard', this.clearCache, $rootScope); + $rootScope.onAppEvent('dashboard-loaded', this.clearCache, $rootScope); }; this.clearCache = function() { @@ -22,7 +22,7 @@ define([ list = []; }; - this.getAnnotations = function(rangeUnparsed, dashboard) { + this.getAnnotations = function(dashboard) { if (dashboard.annotations.list.length === 0) { return $q.when(null); } @@ -34,9 +34,13 @@ define([ self.dashboard = dashboard; var annotations = _.where(dashboard.annotations.list, {enable: true}); + var range = timeSrv.timeRange(); + var rangeRaw = timeSrv.timeRange(false); + var promises = _.map(annotations, function(annotation) { return datasourceSrv.get(annotation.datasource).then(function(datasource) { - return datasource.annotationQuery(annotation, rangeUnparsed) + var query = {range: range, rangeRaw: rangeRaw, annotation: annotation}; + return datasource.annotationQuery(query) .then(self.receiveAnnotationResults) .then(null, errorHandler); }, this); diff --git a/public/app/panels/graph/module.js b/public/app/panels/graph/module.js index 5cdeab799de..1cbd59f8a18 100644 --- a/public/app/panels/graph/module.js +++ b/public/app/panels/graph/module.js @@ -129,7 +129,7 @@ function (angular, $, _, kbn, moment, TimeSeries, PanelMeta) { $scope.refreshData = function(datasource) { panelHelper.updateTimeRange($scope); - $scope.annotationsPromise = annotationsSrv.getAnnotations($scope.rangeRaw, $scope.dashboard); + $scope.annotationsPromise = annotationsSrv.getAnnotations($scope.dashboard); return panelHelper.issueMetricQuery($scope, datasource) .then($scope.dataHandler, function(err) { diff --git a/public/app/plugins/PLUGIN_CHANGES.md b/public/app/plugins/PLUGIN_CHANGES.md index 5627af4a706..b79a0b65948 100644 --- a/public/app/plugins/PLUGIN_CHANGES.md +++ b/public/app/plugins/PLUGIN_CHANGES.md @@ -2,6 +2,12 @@ ## Changelog +2.5.1 +datasource annotationQuery changed. now single options parameter with: +- range +- rangeRaw +- annotation + 2.5 changed the `range` parameter in the `datasource.query` function's options parameter. This parameter now holds a parsed range with `moment` dates `form` and `to`. To get millisecond epoc from a `moment` you the function `valueOf`. The raw date range as represented diff --git a/public/app/plugins/datasource/elasticsearch/datasource.js b/public/app/plugins/datasource/elasticsearch/datasource.js index 374fc9da90d..6c216713368 100644 --- a/public/app/plugins/datasource/elasticsearch/datasource.js +++ b/public/app/plugins/datasource/elasticsearch/datasource.js @@ -60,17 +60,18 @@ function (angular, _, moment, kbn, ElasticQueryBuilder, IndexPattern, ElasticRes }); }; - ElasticDatasource.prototype.annotationQuery = function(annotation, rangeUnparsed) { - var range = {}; + ElasticDatasource.prototype.annotationQuery = function(options) { + var annotation = options.annotation; var timeField = annotation.timeField || '@timestamp'; var queryString = annotation.query || '*'; var tagsField = annotation.tagsField || 'tags'; var titleField = annotation.titleField || 'desc'; var textField = annotation.textField || null; + var range = {}; range[timeField]= { - from: rangeUnparsed.from, - to: rangeUnparsed.to, + from: options.range.from.valueOf(), + to: options.range.to.valueOf(), }; var queryInterpolated = templateSrv.replace(queryString); @@ -82,9 +83,20 @@ function (angular, _, moment, kbn, ElasticQueryBuilder, IndexPattern, ElasticRes "size": 10000 }; - return this._request('POST', annotation.index + '/_search', data).then(function(results) { + var header = {search_type: "query_then_fetch", "ignore_unavailable": true}; + + // old elastic annotations had index specified on them + if (annotation.index) { + header.index = annotation.index; + } else { + header.index = this.indexPattern.getIndexList(options.range.from, options.range.to); + } + + var payload = angular.toJson(header) + '\n' + angular.toJson(data) + '\n'; + + return this._post('/_msearch', payload).then(function(res) { var list = []; - var hits = results.data.hits.hits; + var hits = res.responses[0].hits.hits; var getFieldFromSource = function(source, fieldName) { if (!fieldName) { return; } diff --git a/public/app/plugins/datasource/elasticsearch/partials/annotations.editor.html b/public/app/plugins/datasource/elasticsearch/partials/annotations.editor.html index dae7d2bdeba..637ae78ada7 100644 --- a/public/app/plugins/datasource/elasticsearch/partials/annotations.editor.html +++ b/public/app/plugins/datasource/elasticsearch/partials/annotations.editor.html @@ -1,5 +1,5 @@
                  -
                  +
                  Index name
                  diff --git a/public/app/plugins/datasource/graphite/datasource.js b/public/app/plugins/datasource/graphite/datasource.js index f9e747fb984..8362412fd55 100644 --- a/public/app/plugins/datasource/graphite/datasource.js +++ b/public/app/plugins/datasource/graphite/datasource.js @@ -70,12 +70,12 @@ function (angular, _, $, config, dateMath) { return result; }; - GraphiteDatasource.prototype.annotationQuery = function(annotation, rangeUnparsed) { + GraphiteDatasource.prototype.annotationQuery = function(options) { // Graphite metric as annotation - if (annotation.target) { - var target = templateSrv.replace(annotation.target); + if (options.annotation.target) { + var target = templateSrv.replace(options.annotation.target); var graphiteQuery = { - rangeRaw: rangeUnparsed, + rangeRaw: options.rangeRaw, targets: [{ target: target }], format: 'json', maxDataPoints: 100 @@ -93,7 +93,7 @@ function (angular, _, $, config, dateMath) { if (!datapoint[0]) { continue; } list.push({ - annotation: annotation, + annotation: options.annotation, time: datapoint[1], title: target.target }); @@ -105,15 +105,15 @@ function (angular, _, $, config, dateMath) { } // Graphite event as annotation else { - var tags = templateSrv.replace(annotation.tags); - return this.events({ range: rangeUnparsed, tags: tags }) + var tags = templateSrv.replace(options.annotation.tags); + return this.events({range: options.rangeRaw, tags: tags}) .then(function(results) { var list = []; for (var i = 0; i < results.data.length; i++) { var e = results.data[i]; list.push({ - annotation: annotation, + annotation: options.annotation, time: e.when * 1000, title: e.what, tags: e.tags, diff --git a/public/app/plugins/datasource/influxdb/datasource.js b/public/app/plugins/datasource/influxdb/datasource.js index b8ee9b15d49..8460a0c1d0d 100644 --- a/public/app/plugins/datasource/influxdb/datasource.js +++ b/public/app/plugins/datasource/influxdb/datasource.js @@ -77,16 +77,16 @@ function (angular, _, dateMath, InfluxSeries, InfluxQueryBuilder) { }); }; - InfluxDatasource.prototype.annotationQuery = function(annotation, rangeUnparsed) { - var timeFilter = getTimeFilter({ rangeRaw: rangeUnparsed }); - var query = annotation.query.replace('$timeFilter', timeFilter); + InfluxDatasource.prototype.annotationQuery = function(options) { + var timeFilter = getTimeFilter({rangeRaw: options.rangeRaw}); + var query = options.annotation.query.replace('$timeFilter', timeFilter); query = templateSrv.replace(query); return this._seriesQuery(query).then(function(data) { if (!data || !data.results || !data.results[0]) { throw { message: 'No results in response from InfluxDB' }; } - return new InfluxSeries({ series: data.results[0].series, annotation: annotation }).getAnnotations(); + return new InfluxSeries({series: data.results[0].series, annotation: options.annotation}).getAnnotations(); }); }; diff --git a/public/app/plugins/datasource/influxdb_08/datasource.js b/public/app/plugins/datasource/influxdb_08/datasource.js index a5058db3eb6..3ed12ac2d08 100644 --- a/public/app/plugins/datasource/influxdb_08/datasource.js +++ b/public/app/plugins/datasource/influxdb_08/datasource.js @@ -57,13 +57,13 @@ function (angular, _, dateMath, InfluxSeries, InfluxQueryBuilder) { }); }; - InfluxDatasource.prototype.annotationQuery = function(annotation, rangeUnparsed) { - var timeFilter = getTimeFilter({ rangeRaw: rangeUnparsed }); - var query = annotation.query.replace('$timeFilter', timeFilter); + InfluxDatasource.prototype.annotationQuery = function(options) { + var timeFilter = getTimeFilter({rangeRaw: options.rangeRaw}); + var query = options.annotation.query.replace('$timeFilter', timeFilter); query = templateSrv.replace(query); return this._seriesQuery(query).then(function(results) { - return new InfluxSeries({ seriesList: results, annotation: annotation }).getAnnotations(); + return new InfluxSeries({seriesList: results, annotation: options.annotation}).getAnnotations(); }); }; diff --git a/public/app/plugins/datasource/influxdb_08/specs/datasource-specs.ts b/public/app/plugins/datasource/influxdb_08/specs/datasource-specs.ts index c4ea81759e8..46459939828 100644 --- a/public/app/plugins/datasource/influxdb_08/specs/datasource-specs.ts +++ b/public/app/plugins/datasource/influxdb_08/specs/datasource-specs.ts @@ -84,7 +84,7 @@ describe('InfluxDatasource', function() { return str.replace('$server', 'backend_01'); }; ctx.$httpBackend.expect('GET', urlExpected).respond(response); - ctx.ds.annotationQuery(annotation, range).then(function(data) { results = data; }); + ctx.ds.annotationQuery({annotation: annotation, rangeRaw: range}).then(function(data) { results = data; }); ctx.$httpBackend.flush(); }); From 963f9fdf40fc3326739cf8988f5490ccac238133 Mon Sep 17 00:00:00 2001 From: Dan Cleinmark Date: Thu, 29 Oct 2015 07:24:42 -0700 Subject: [PATCH 102/269] Ensure Promtheus step interval is always < 11000 Using a 2 week window (1209600 seconds) and a 60s step, Math.floor() recalculates a step of 109 and results in 11097 data points in the Prometheus query (> the 11000 max set by Prometheus). Math.ceil() returns a step of 110 and 10996 data points. --- public/app/plugins/datasource/prometheus/datasource.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/public/app/plugins/datasource/prometheus/datasource.js b/public/app/plugins/datasource/prometheus/datasource.js index 4770a0c0aea..c86fa2806d3 100644 --- a/public/app/plugins/datasource/prometheus/datasource.js +++ b/public/app/plugins/datasource/prometheus/datasource.js @@ -99,11 +99,11 @@ function (angular, _, moment, dateMath) { var url = '/api/v1/query_range?query=' + encodeURIComponent(query.expr) + '&start=' + start + '&end=' + end; var step = query.step; - var range = Math.floor(end - start); + var range = Math.ceil(end - start); // Prometheus drop query if range/step > 11000 // calibrate step if it is too big if (step !== 0 && range / step > 11000) { - step = Math.floor(range / 11000); + step = Math.ceil(range / 11000); } url += '&step=' + step; @@ -212,7 +212,7 @@ function (angular, _, moment, dateMath) { sec = 1; } - return Math.floor(sec * intervalFactor) + 's'; + return Math.ceil(sec * intervalFactor) + 's'; }; function transformMetricData(md, options) { From 8a252774ce945589f362a55bd213fc3d3c6f22d1 Mon Sep 17 00:00:00 2001 From: Mitsuhiro Tanda Date: Thu, 29 Oct 2015 23:46:10 +0900 Subject: [PATCH 103/269] Update cloudwatch.md, add explanation about templating --- docs/sources/datasources/cloudwatch.md | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/docs/sources/datasources/cloudwatch.md b/docs/sources/datasources/cloudwatch.md index c0ec51d6356..012da9d843a 100644 --- a/docs/sources/datasources/cloudwatch.md +++ b/docs/sources/datasources/cloudwatch.md @@ -54,6 +54,25 @@ Example content: You need to specify a namespace, metric, at least one stat, and at least one dimension. +## Templated queries +CloudWatch Datasource Plugin provides the following functions in `Variables values query` field in Templating Editor to query `region`, `namespaces`, `metric names` and `dimension keys/values` on the CloudWatch. + +Name | Description +------- | -------- +`regions()` | Returns a list of regions AWS provides their service. +`namespaces()` | Returns a list of namespaces CloudWatch support. +`metrics(namespace)` | Returns a list of metrics in the namespace. +`dimension_keys(namespace)` | Returns a list of dimension keys in the namespace. +`dimension_values(region, namespace, metric)` | Returns a list of dimension values matching the specified `region`, `namespace` and `metric`. + +For details about the metrics CloudWatch provides, please refer to the [CloudWatch documentation](https://docs.aws.amazon.com/AmazonCloudWatch/latest/DeveloperGuide/CW_Support_For_AWS.html). + +If you want to filter dimension values by other dimension key/value pair, you can specify optional parameter like this. +```sql +dimension_values(region, namespace, metric, dim_key1=dim_val1,dim_key2=dim_val2,...) +``` + +![](/img/v2/cloudwatch_templating.png) ## Cost From 13760b1bddce4c4a6895ef5174f9af25c34d9261 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Thu, 29 Oct 2015 15:53:15 +0100 Subject: [PATCH 104/269] fix(influxdb): fixed handling of relative time ranges like last x years, or last x months, fixes #3067 --- CHANGELOG.md | 1 + public/app/plugins/datasource/influxdb/datasource.js | 8 ++++++-- public/app/plugins/datasource/influxdb_08/datasource.js | 9 +++++++-- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c5729e24f96..8e67f9b0052 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ ### Bug Fixes * **dashboard**: fix for collapse row by clicking on row title, fixes [#3065](https://github.com/grafana/grafana/issues/3065) +* **influxdb**: fix for relative time ranges `last x months` and `last x years`, fixes [#3067](https://github.com/grafana/grafana/issues/3067) # 2.5 (2015-10-28) diff --git a/public/app/plugins/datasource/influxdb/datasource.js b/public/app/plugins/datasource/influxdb/datasource.js index 8460a0c1d0d..ded31d76c63 100644 --- a/public/app/plugins/datasource/influxdb/datasource.js +++ b/public/app/plugins/datasource/influxdb/datasource.js @@ -192,8 +192,12 @@ function (angular, _, dateMath, InfluxSeries, InfluxQueryBuilder) { if (date === 'now') { return 'now()'; } - if (date.indexOf('now-') >= 0 && date.indexOf('/') === -1) { - return date.replace('now', 'now()').replace('-', ' - '); + + var parts = /^now-(\d+)([d|h|m|s])$/.exec(date); + if (parts) { + var amount = parseInt(parts[1]); + var unit = parts[2]; + return 'now() - ' + amount + unit; } date = dateMath.parse(date, roundUp); } diff --git a/public/app/plugins/datasource/influxdb_08/datasource.js b/public/app/plugins/datasource/influxdb_08/datasource.js index 3ed12ac2d08..cba2e27b0cf 100644 --- a/public/app/plugins/datasource/influxdb_08/datasource.js +++ b/public/app/plugins/datasource/influxdb_08/datasource.js @@ -270,9 +270,14 @@ function (angular, _, dateMath, InfluxSeries, InfluxQueryBuilder) { if (date === 'now') { return 'now()'; } - if (date.indexOf('now-') >= 0 && date.indexOf('/') === -1) { - return date.replace('now', 'now()'); + + var parts = /^now-(\d+)([d|h|m|s])$/.exec(date); + if (parts) { + var amount = parseInt(parts[1]); + var unit = parts[2]; + return 'now()-' + amount + unit; } + date = dateMath.parse(date, roundUp); } return (date.valueOf() / 1000).toFixed(0) + 's'; From 34e3683ded03beaa3e6c6bc6eb7fae4c18591d9e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Thu, 29 Oct 2015 16:46:58 +0100 Subject: [PATCH 105/269] fix(cloudwatch): fixed limiting of cloudwatch period so it works for long time ranges in all cases, fixes #3086 --- CHANGELOG.md | 1 + public/app/plugins/datasource/cloudwatch/datasource.js | 6 +++--- .../datasource/cloudwatch/partials/query.editor.html | 3 ++- public/app/plugins/datasource/cloudwatch/query_ctrl.js | 2 +- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8e67f9b0052..85b9a1121c8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ * **Elasticsearch**: Support for dynamic daily indices for annotations, closes [#3061](https://github.com/grafana/grafana/issues/3061) ### Bug Fixes +* **cloudwatch**: fix for handling of period for long time ranges, fixes [#3086](https://github.com/grafana/grafana/issues/3086) * **dashboard**: fix for collapse row by clicking on row title, fixes [#3065](https://github.com/grafana/grafana/issues/3065) * **influxdb**: fix for relative time ranges `last x months` and `last x years`, fixes [#3067](https://github.com/grafana/grafana/issues/3067) diff --git a/public/app/plugins/datasource/cloudwatch/datasource.js b/public/app/plugins/datasource/cloudwatch/datasource.js index 6a99724123b..576fb9ffcdd 100644 --- a/public/app/plugins/datasource/cloudwatch/datasource.js +++ b/public/app/plugins/datasource/cloudwatch/datasource.js @@ -36,12 +36,12 @@ function (angular, _) { query.metricName = templateSrv.replace(target.metricName, options.scopedVars); query.dimensions = convertDimensionFormat(target.dimensions, options.scopedVars); query.statistics = target.statistics; - query.period = parseInt(target.period, 10); var range = end - start; - // CloudWatch limit datapoints up to 1440 + query.period = parseInt(target.period, 10) || 60; + if (range / query.period >= 1440) { - query.period = Math.floor(range / 1440 / 60) * 60; + query.period = Math.ceil(range / 1440 / 60) * 60; } queries.push(query); diff --git a/public/app/plugins/datasource/cloudwatch/partials/query.editor.html b/public/app/plugins/datasource/cloudwatch/partials/query.editor.html index 80491a284f6..d05ffd8547f 100644 --- a/public/app/plugins/datasource/cloudwatch/partials/query.editor.html +++ b/public/app/plugins/datasource/cloudwatch/partials/query.editor.html @@ -80,9 +80,10 @@
                • Period + Interval between points in seconds
                • - +
                diff --git a/public/app/plugins/datasource/cloudwatch/query_ctrl.js b/public/app/plugins/datasource/cloudwatch/query_ctrl.js index ccbc36f0912..3869a5ec715 100644 --- a/public/app/plugins/datasource/cloudwatch/query_ctrl.js +++ b/public/app/plugins/datasource/cloudwatch/query_ctrl.js @@ -15,7 +15,7 @@ function (angular, _) { target.metricName = target.metricName || ''; target.statistics = target.statistics || ['Average']; target.dimensions = target.dimensions || {}; - target.period = target.period || 60; + target.period = target.period || ''; target.region = target.region || $scope.datasource.getDefaultRegion(); $scope.aliasSyntax = '{{metric}} {{stat}} {{namespace}} {{region}} {{}}'; From 2a8904f844f2b11972ab0976c8ebba49ec7aadf4 Mon Sep 17 00:00:00 2001 From: utkarshcmu Date: Thu, 29 Oct 2015 11:13:38 -0700 Subject: [PATCH 106/269] Fixed queryCtrl to use suggest API --- public/app/plugins/datasource/opentsdb/queryCtrl.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/public/app/plugins/datasource/opentsdb/queryCtrl.js b/public/app/plugins/datasource/opentsdb/queryCtrl.js index d5aa3db58ae..afbced89403 100644 --- a/public/app/plugins/datasource/opentsdb/queryCtrl.js +++ b/public/app/plugins/datasource/opentsdb/queryCtrl.js @@ -48,13 +48,13 @@ function (angular, _, kbn) { }; $scope.suggestTagKeys = function(query, callback) { - $scope.datasource.metricFindQuery('tag_names(' + $scope.target.metric + ')') + $scope.datasource.metricFindQuery('suggest_tagk(' + query + ')') .then($scope.getTextValues) .then(callback); }; $scope.suggestTagValues = function(query, callback) { - $scope.datasource.metricFindQuery('tag_values(' + $scope.target.metric + ',' + $scope.target.currentTagKey + ')') + $scope.datasource.metricFindQuery('suggest_tagv(' + query + ')') .then($scope.getTextValues) .then(callback); }; From a27186e34f1649c40dae796effd9854d7c8d052c Mon Sep 17 00:00:00 2001 From: utkarshcmu Date: Thu, 29 Oct 2015 11:28:38 -0700 Subject: [PATCH 107/269] Cleaned the codebase :D --- public/app/plugins/datasource/opentsdb/datasource.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/app/plugins/datasource/opentsdb/datasource.js b/public/app/plugins/datasource/opentsdb/datasource.js index c46b451a64c..b7d4bd2d37b 100644 --- a/public/app/plugins/datasource/opentsdb/datasource.js +++ b/public/app/plugins/datasource/opentsdb/datasource.js @@ -178,7 +178,7 @@ function (angular, _, dateMath) { return this._performSuggestQuery(tag_values_suggest_query[1], 'tagv').then(responseTransform); } - return $q.when([{text: "wtf"}]); + return $q.when([]); }; OpenTSDBDatasource.prototype.testDatasource = function() { From f1847d45011754ee4e30535e92be7b5dac34dbc8 Mon Sep 17 00:00:00 2001 From: King'ori Maina Date: Fri, 30 Oct 2015 09:52:33 +0200 Subject: [PATCH 108/269] Correct object key typo MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Should be ‘message’ not ‘messsage’. --- public/app/plugins/datasource/influxdb/datasource.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/app/plugins/datasource/influxdb/datasource.js b/public/app/plugins/datasource/influxdb/datasource.js index ded31d76c63..87696c17a2a 100644 --- a/public/app/plugins/datasource/influxdb/datasource.js +++ b/public/app/plugins/datasource/influxdb/datasource.js @@ -169,7 +169,7 @@ function (angular, _, dateMath, InfluxSeries, InfluxQueryBuilder) { throw { message: 'InfluxDB Error Response: ' + err.data.error, data: err.data, config: err.config }; } else { - throw { messsage: 'InfluxDB Error: ' + err.message, data: err.data, config: err.config }; + throw { message: 'InfluxDB Error: ' + err.message, data: err.data, config: err.config }; } } }); From 4dcd2ceb0124f2667ef2bcb053a320398d6c24d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Fri, 30 Oct 2015 09:30:48 +0100 Subject: [PATCH 109/269] fix(graph): fixed for color picker layout issue when right side legend was used, fixes #3093 --- CHANGELOG.md | 1 + public/app/panels/graph/legend.js | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 85b9a1121c8..4cc80e2d533 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ * **cloudwatch**: fix for handling of period for long time ranges, fixes [#3086](https://github.com/grafana/grafana/issues/3086) * **dashboard**: fix for collapse row by clicking on row title, fixes [#3065](https://github.com/grafana/grafana/issues/3065) * **influxdb**: fix for relative time ranges `last x months` and `last x years`, fixes [#3067](https://github.com/grafana/grafana/issues/3067) +* **graph**: layout fix for color picker when right side legend was enabled, fixes [#3093](https://github.com/grafana/grafana/issues/3093) # 2.5 (2015-10-28) diff --git a/public/app/panels/graph/legend.js b/public/app/panels/graph/legend.js index 8f64f6b4395..c659447a704 100644 --- a/public/app/panels/graph/legend.js +++ b/public/app/panels/graph/legend.js @@ -34,7 +34,12 @@ function (angular, _, kbn, $) { } function openColorSelector(e) { - var el = $(e.currentTarget); + // if we clicked inside poup container ignore click + if ($(e.target).parents('.popover').length) { + return; + } + + var el = $(e.currentTarget).find('.fa-minus'); var index = getSeriesIndexForElement(el); var seriesInfo = seriesList[index]; var popoverScope = scope.$new(); From 8b9d13491f2e7efa88dd2f6fdbd6bfe7ee6926d4 Mon Sep 17 00:00:00 2001 From: utkarshcmu Date: Fri, 30 Oct 2015 02:07:08 -0700 Subject: [PATCH 110/269] Fixed some more typos in docs --- README.md | 2 +- docker/production/README.md | 4 ++-- docs/sources/tutorials/stack_guide_graphite.md | 10 +++++----- public/app/plugins/PLUGIN_CHANGES.md | 2 +- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 8cf9992927b..8c48a4f7366 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,7 @@ a standalone frontend only web application. Grafana 2.0 comes with a backend. - Click and drag to zoom - Multiple Y-axis, logarithmic scales - Bars, Lines, Points -- Smart Y-axis formating +- Smart Y-axis formatting - Series toggles & color selector - Legend values, and formatting options - Grid thresholds, axis labels diff --git a/docker/production/README.md b/docker/production/README.md index f6da10e62f6..9b0e23baf75 100644 --- a/docker/production/README.md +++ b/docker/production/README.md @@ -2,7 +2,7 @@ # Grafana docker image This container currently only contains the in development alpha of Grafana 2.0 (ie non production use). The -`#develop` tag is constantly updated as we make progress torwards a beta release. +`#develop` tag is constantly updated as we make progress towards a beta release. ## Running your Grafana image @@ -17,7 +17,7 @@ Try it out, default admin user is admin/admin. ## Configuring your Grafana container -All options defined in conf/grafana.ini can be overriden using environment variables, for example: +All options defined in conf/grafana.ini can be overridden using environment variables, for example: ``` diff --git a/docs/sources/tutorials/stack_guide_graphite.md b/docs/sources/tutorials/stack_guide_graphite.md index a9025cf9a71..1145cab2249 100644 --- a/docs/sources/tutorials/stack_guide_graphite.md +++ b/docs/sources/tutorials/stack_guide_graphite.md @@ -27,7 +27,7 @@ that is not really the case, or, at least, that it is a lot better than you expe To begin with we are going to install the 3 main components that define our metric stack. Later in the guide we will install StatsD, but that is optional. -- Carbon is the graphite ingestion deamon responsible for +- Carbon is the graphite ingestion daemon responsible for receiving metrics and storing them. - Graphite-api is light weight version of graphite-web with only the HTTP api and is responsible for executing metric queries. @@ -90,7 +90,7 @@ pattern = .* retentions = 10s:1d,1m:7d,10m:1y ``` -This config specifies the resolution of metrics and the retention periods. For example for all metrics begining with the word `carbon` receive metrics every minute and store for 30 days, then +This config specifies the resolution of metrics and the retention periods. For example for all metrics beginning with the word `carbon` receive metrics every minute and store for 30 days, then roll them up into 10 minute buckets and store those for 1 year, then roll those up into 1 hour buckets and store those for 5 years. For all other metrics the default rule will be applied with other retention periods. @@ -206,7 +206,7 @@ Reload supervisor supervisorctl reload -A carbon-cache deamon and graphite-api should now be running. Type `supervisorctl status` to verify that they are running. You can +A carbon-cache daemon and graphite-api should now be running. Type `supervisorctl status` to verify that they are running. You can also open `http://your_server_ip:8888/metrics/find?query?*` in your browser. You should see a json snippet. @@ -243,12 +243,12 @@ Open http://your_server_ip:3000 in your browser and login with the default user - Select `Add Panel` > `Graph` from the row menu - An empty graph panel should appear with title `no title (click here)`. Click on this title and then `Edit` - This will open the graph in edit mode and take you to the metrics tab. -- There is one query already added (asigned letter A) but it is empty. +- There is one query already added (assigned letter A) but it is empty. - Click on `select metric` to pick the first graphite metric node. A new `select metric` link will appear until you reached a leaf node. - Try picking the metric paths for `carbon.agents..cpuUsage`, you should now see a line appear in the graph! ## Writing metrics to Graphite -Graphite has the simples metric write protocol imaginable. Something that has surely contributed to its wide adoption by metric +Graphite has the simplest metric write protocol imaginable. Something that has surely contributed to its wide adoption by metric frameworks and numerous integrations. prod.server1.requests.count 10 1398969187 diff --git a/public/app/plugins/PLUGIN_CHANGES.md b/public/app/plugins/PLUGIN_CHANGES.md index b79a0b65948..138dab09931 100644 --- a/public/app/plugins/PLUGIN_CHANGES.md +++ b/public/app/plugins/PLUGIN_CHANGES.md @@ -10,6 +10,6 @@ datasource annotationQuery changed. now single options parameter with: 2.5 changed the `range` parameter in the `datasource.query` function's options parameter. This parameter now holds a parsed range with `moment` dates `form` and `to`. To get -millisecond epoc from a `moment` you the function `valueOf`. The raw date range as represented +millisecond epoch from a `moment` you the function `valueOf`. The raw date range as represented internally in grafana (which may be relative expressions like `now-5h`) is included in the new property `rangeRaw` (on the options object). From 39bc3cb532ff1bc7b26edf84bc39d79589947999 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Fri, 30 Oct 2015 14:04:25 +0100 Subject: [PATCH 111/269] refactoring: moving stuff around --- .../{components/timeSeries.js => core/time_series.js} | 0 public/app/features/panel/all.js | 10 +++++----- .../panel/{panelDirective.js => panel_directive.js} | 0 .../features/panel/{panelHelper.js => panel_helper.js} | 0 .../app/features/panel/{panelMenu.js => panel_menu.js} | 0 .../panelmeta.ts => features/panel/panel_meta.ts} | 0 .../app/features/panel/{panelSrv.js => panel_srv.js} | 0 .../panel/{soloPanelCtrl.js => solo_panel_ctrl.js} | 0 public/app/panels/dashlist/module.js | 2 +- public/app/panels/graph/module.js | 4 ++-- public/app/panels/singlestat/module.js | 4 ++-- public/app/panels/text/module.js | 2 +- .../{timeSeries-specs.js => core/time_series_specs.js} | 2 +- public/test/specs/graph-ctrl-specs.js | 4 ++-- public/test/specs/graph-specs.js | 2 +- public/test/specs/panelSrv-specs.js | 2 +- public/test/specs/singlestat-specs.js | 4 ++-- 17 files changed, 18 insertions(+), 18 deletions(-) rename public/app/{components/timeSeries.js => core/time_series.js} (100%) rename public/app/features/panel/{panelDirective.js => panel_directive.js} (100%) rename public/app/features/panel/{panelHelper.js => panel_helper.js} (100%) rename public/app/features/panel/{panelMenu.js => panel_menu.js} (100%) rename public/app/{components/panelmeta.ts => features/panel/panel_meta.ts} (100%) rename public/app/features/panel/{panelSrv.js => panel_srv.js} (100%) rename public/app/features/panel/{soloPanelCtrl.js => solo_panel_ctrl.js} (100%) rename public/test/specs/{timeSeries-specs.js => core/time_series_specs.js} (99%) diff --git a/public/app/components/timeSeries.js b/public/app/core/time_series.js similarity index 100% rename from public/app/components/timeSeries.js rename to public/app/core/time_series.js diff --git a/public/app/features/panel/all.js b/public/app/features/panel/all.js index 97051970fc6..bb687b035b5 100644 --- a/public/app/features/panel/all.js +++ b/public/app/features/panel/all.js @@ -1,7 +1,7 @@ define([ - './panelMenu', - './panelDirective', - './panelSrv', - './panelHelper', - './soloPanelCtrl', + './panel_menu', + './panel_directive', + './panel_srv', + './panel_helper', + './solo_panel_ctrl', ], function () {}); diff --git a/public/app/features/panel/panelDirective.js b/public/app/features/panel/panel_directive.js similarity index 100% rename from public/app/features/panel/panelDirective.js rename to public/app/features/panel/panel_directive.js diff --git a/public/app/features/panel/panelHelper.js b/public/app/features/panel/panel_helper.js similarity index 100% rename from public/app/features/panel/panelHelper.js rename to public/app/features/panel/panel_helper.js diff --git a/public/app/features/panel/panelMenu.js b/public/app/features/panel/panel_menu.js similarity index 100% rename from public/app/features/panel/panelMenu.js rename to public/app/features/panel/panel_menu.js diff --git a/public/app/components/panelmeta.ts b/public/app/features/panel/panel_meta.ts similarity index 100% rename from public/app/components/panelmeta.ts rename to public/app/features/panel/panel_meta.ts diff --git a/public/app/features/panel/panelSrv.js b/public/app/features/panel/panel_srv.js similarity index 100% rename from public/app/features/panel/panelSrv.js rename to public/app/features/panel/panel_srv.js diff --git a/public/app/features/panel/soloPanelCtrl.js b/public/app/features/panel/solo_panel_ctrl.js similarity index 100% rename from public/app/features/panel/soloPanelCtrl.js rename to public/app/features/panel/solo_panel_ctrl.js diff --git a/public/app/panels/dashlist/module.js b/public/app/panels/dashlist/module.js index 1b20e9e5310..d41fee29738 100644 --- a/public/app/panels/dashlist/module.js +++ b/public/app/panels/dashlist/module.js @@ -3,7 +3,7 @@ define([ 'app/app', 'lodash', 'config', - 'app/components/panelmeta', + 'app/features/panel/panel_meta', ], function (angular, app, _, config, PanelMeta) { 'use strict'; diff --git a/public/app/panels/graph/module.js b/public/app/panels/graph/module.js index 1cbd59f8a18..1bf45c7c1b8 100644 --- a/public/app/panels/graph/module.js +++ b/public/app/panels/graph/module.js @@ -4,8 +4,8 @@ define([ 'lodash', 'kbn', 'moment', - 'app/components/timeSeries', - 'app/components/panelmeta', + 'app/core/time_series', + 'app/features/panel/panel_meta', './seriesOverridesCtrl', './graph', './legend', diff --git a/public/app/panels/singlestat/module.js b/public/app/panels/singlestat/module.js index f065d2cb653..6c7d88edba8 100644 --- a/public/app/panels/singlestat/module.js +++ b/public/app/panels/singlestat/module.js @@ -3,8 +3,8 @@ define([ 'app/app', 'lodash', 'kbn', - 'app/components/timeSeries', - 'app/components/panelmeta', + 'app/core/time_series', + 'app/features/panel/panel_meta', './singleStatPanel', ], function (angular, app, _, kbn, TimeSeries, PanelMeta) { diff --git a/public/app/panels/text/module.js b/public/app/panels/text/module.js index c72d38953f7..c301690d2eb 100644 --- a/public/app/panels/text/module.js +++ b/public/app/panels/text/module.js @@ -3,7 +3,7 @@ define([ 'app/app', 'lodash', 'require', - 'app/components/panelmeta', + 'app/features/panel/panel_meta', ], function (angular, app, _, require, PanelMeta) { 'use strict'; diff --git a/public/test/specs/timeSeries-specs.js b/public/test/specs/core/time_series_specs.js similarity index 99% rename from public/test/specs/timeSeries-specs.js rename to public/test/specs/core/time_series_specs.js index 760df7c35c8..22d85775a05 100644 --- a/public/test/specs/timeSeries-specs.js +++ b/public/test/specs/core/time_series_specs.js @@ -1,5 +1,5 @@ define([ - 'app/components/timeSeries' + 'app/core/time_series' ], function(TimeSeries) { 'use strict'; diff --git a/public/test/specs/graph-ctrl-specs.js b/public/test/specs/graph-ctrl-specs.js index e9cab83a21a..a1f5809dee4 100644 --- a/public/test/specs/graph-ctrl-specs.js +++ b/public/test/specs/graph-ctrl-specs.js @@ -1,7 +1,7 @@ define([ './helpers', - 'app/features/panel/panelSrv', - 'app/features/panel/panelHelper', + 'app/features/panel/panel_srv', + 'app/features/panel/panel_helper', 'app/panels/graph/module' ], function(helpers) { 'use strict'; diff --git a/public/test/specs/graph-specs.js b/public/test/specs/graph-specs.js index 16bab4162ec..3a596ce4369 100644 --- a/public/test/specs/graph-specs.js +++ b/public/test/specs/graph-specs.js @@ -2,7 +2,7 @@ define([ './helpers', 'angular', 'jquery', - 'app/components/timeSeries', + 'app/core/time_series', 'app/panels/graph/graph' ], function(helpers, angular, $, TimeSeries) { 'use strict'; diff --git a/public/test/specs/panelSrv-specs.js b/public/test/specs/panelSrv-specs.js index 9557f2239a2..a0267cba420 100644 --- a/public/test/specs/panelSrv-specs.js +++ b/public/test/specs/panelSrv-specs.js @@ -1,6 +1,6 @@ define([ './helpers', - 'app/features/panel/panelSrv', + 'app/features/panel/panel_srv', ], function() { 'use strict'; diff --git a/public/test/specs/singlestat-specs.js b/public/test/specs/singlestat-specs.js index 4fa68a20c54..aff33396687 100644 --- a/public/test/specs/singlestat-specs.js +++ b/public/test/specs/singlestat-specs.js @@ -1,7 +1,7 @@ define([ './helpers', - 'app/features/panel/panelSrv', - 'app/features/panel/panelHelper', + 'app/features/panel/panel_srv', + 'app/features/panel/panel_helper', 'app/panels/singlestat/module' ], function(helpers) { 'use strict'; From 1113081aab236ad085efd1c456086ddf73492a3e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Fri, 30 Oct 2015 14:19:02 +0100 Subject: [PATCH 112/269] refactoring: moving components -> core --- public/app/app.js | 1 - public/app/components/require.config.js | 4 +- public/app/controllers/console-ctrl.js | 108 ------------------ public/app/controllers/grafanaCtrl.js | 6 +- public/app/controllers/invitedCtrl.js | 2 +- public/app/controllers/loginCtrl.js | 2 +- public/app/controllers/metricKeys.js | 2 +- public/app/controllers/search.js | 2 +- public/app/controllers/sidemenuCtrl.js | 2 +- public/app/controllers/signupCtrl.ts | 2 +- public/app/{components => core}/config.js | 0 public/app/{components => core}/store.js | 0 .../app/features/dashboard/dashboardCtrl.js | 3 +- .../features/dashboard/dashboardNavCtrl.js | 4 +- public/app/features/dashboard/playlistCtrl.js | 2 +- public/app/features/dashboard/playlistSrv.js | 2 +- public/app/features/dashboard/rowCtrl.js | 2 +- .../app/features/dashboard/shareModalCtrl.js | 2 +- public/app/features/dashboard/timeSrv.js | 4 +- public/app/features/org/datasourceEditCtrl.js | 4 +- public/app/features/org/newOrgCtrl.js | 2 +- public/app/features/panel/panel_directive.js | 2 +- public/app/features/panel/panel_srv.js | 2 +- .../features/profile/changePasswordCtrl.js | 2 +- public/app/features/profile/profileCtrl.js | 2 +- public/app/features/profile/selectOrgCtrl.js | 2 +- public/app/headers/common.d.ts | 2 +- public/app/panels/dashlist/module.js | 2 +- .../plugins/datasource/graphite/datasource.js | 2 +- .../plugins/datasource/graphite/query_ctrl.js | 2 +- public/app/services/backendSrv.js | 2 +- public/app/services/contextSrv.js | 4 +- public/app/services/datasourceSrv.js | 2 +- public/test/test-main.js | 4 +- 34 files changed, 35 insertions(+), 151 deletions(-) delete mode 100644 public/app/controllers/console-ctrl.js rename public/app/{components => core}/config.js (100%) rename public/app/{components => core}/store.js (100%) diff --git a/public/app/app.js b/public/app/app.js index 1e7acf2e56f..9c572e80fc2 100644 --- a/public/app/app.js +++ b/public/app/app.js @@ -3,7 +3,6 @@ define([ 'jquery', 'lodash', 'require', - 'config', 'bootstrap', 'angular-route', 'angular-sanitize', diff --git a/public/app/components/require.config.js b/public/app/components/require.config.js index 084bfbe7e77..cfb90b00696 100644 --- a/public/app/components/require.config.js +++ b/public/app/components/require.config.js @@ -3,10 +3,8 @@ require.config({ baseUrl: 'public', paths: { - config: 'app/components/config', settings: 'app/components/settings', kbn: 'app/components/kbn', - store: 'app/components/store', 'extend-jquery': 'app/components/extend-jquery', lodash: 'app/components/lodash.extended', @@ -61,7 +59,7 @@ require.config({ }, angular: { - deps: ['jquery','config'], + deps: ['jquery'], exports: 'angular' }, diff --git a/public/app/controllers/console-ctrl.js b/public/app/controllers/console-ctrl.js deleted file mode 100644 index 8a673d99476..00000000000 --- a/public/app/controllers/console-ctrl.js +++ /dev/null @@ -1,108 +0,0 @@ -define([ - 'angular', - 'lodash', - 'moment', - 'store' -], -function (angular, _, moment, store) { - 'use strict'; - - var module = angular.module('grafana.controllers'); - var consoleEnabled = store.getBool('grafanaConsole'); - - if (!consoleEnabled) { - return; - } - - var events = []; - - function ConsoleEvent(type, title, data) { - this.type = type; - this.title = title; - this.data = data; - this.time = moment().format('hh:mm:ss'); - - if (data.config) { - this.method = data.config.method; - this.elapsed = (new Date().getTime() - data.config.$grafana_timestamp) + ' ms'; - if (data.config.params && data.config.params.q) { - this.field2 = data.config.params.q; - } - if (_.isString(data.config.data)) { - this.field2 = data.config.data; - } - if (data.status !== 200) { - this.error = true; - this.field3 = data.data; - } - - if (_.isArray(data.data)) { - this.extractTimeseriesInfo(data.data); - } - } - } - - ConsoleEvent.prototype.extractTimeseriesInfo = function(series) { - if (series.length === 0) { - return; - } - - var points = 0; - var ok = false; - - if (series[0].datapoints) { - points = _.reduce(series, function(memo, val) { - return memo + val.datapoints.length; - }, 0); - ok = true; - } - if (series[0].columns) { - points = _.reduce(series, function(memo, val) { - return memo + val.points.length; - }, 0); - ok = true; - } - - if (ok) { - this.field1 = '(' + series.length + ' series'; - this.field1 += ', ' + points + ' points)'; - } - }; - - module.config(function($provide, $httpProvider) { - $provide.factory('mupp', function($q) { - return { - 'request': function(config) { - if (config.inspect) { - config.$grafana_timestamp = new Date().getTime(); - } - return config; - }, - 'response': function(response) { - if (response.config.inspect) { - events.push(new ConsoleEvent(response.config.inspect.type, response.config.url, response)); - } - return response; - }, - 'requestError': function(rejection) { - console.log('requestError', rejection); - return $q.reject(rejection); - }, - 'responseError': function (rejection) { - var inspect = rejection.config.inspect || { type: 'error' }; - events.push(new ConsoleEvent(inspect.type, rejection.config.url, rejection)); - return $q.reject(rejection); - } - }; - }); - - $httpProvider.interceptors.push('mupp'); - }); - - module.controller('ConsoleCtrl', function($scope) { - - $scope.events = events; - - }); - -}); diff --git a/public/app/controllers/grafanaCtrl.js b/public/app/controllers/grafanaCtrl.js index 77c4d5f70c5..42a67064e29 100644 --- a/public/app/controllers/grafanaCtrl.js +++ b/public/app/controllers/grafanaCtrl.js @@ -1,11 +1,11 @@ define([ 'angular', - 'config', 'lodash', 'jquery', - 'store', + 'app/core/config', + 'app/core/store', ], -function (angular, config, _, $, store) { +function (angular, _, $, config, store) { "use strict"; var module = angular.module('grafana.controllers'); diff --git a/public/app/controllers/invitedCtrl.js b/public/app/controllers/invitedCtrl.js index 0b4a096fb1b..42443c4370f 100644 --- a/public/app/controllers/invitedCtrl.js +++ b/public/app/controllers/invitedCtrl.js @@ -1,6 +1,6 @@ define([ 'angular', - 'config', + 'app/core/config', ], function (angular, config) { 'use strict'; diff --git a/public/app/controllers/loginCtrl.js b/public/app/controllers/loginCtrl.js index 0ee370fb979..7ec2c4353fd 100644 --- a/public/app/controllers/loginCtrl.js +++ b/public/app/controllers/loginCtrl.js @@ -1,6 +1,6 @@ define([ 'angular', - 'config', + 'app/core/config', ], function (angular, config) { 'use strict'; diff --git a/public/app/controllers/metricKeys.js b/public/app/controllers/metricKeys.js index be743112cf8..ac8dffdcdf7 100644 --- a/public/app/controllers/metricKeys.js +++ b/public/app/controllers/metricKeys.js @@ -1,7 +1,7 @@ define([ 'angular', 'lodash', - 'config' + 'app/core/config' ], function (angular, _, config) { 'use strict'; diff --git a/public/app/controllers/search.js b/public/app/controllers/search.js index 279b3a1d793..cbae6366244 100644 --- a/public/app/controllers/search.js +++ b/public/app/controllers/search.js @@ -1,7 +1,7 @@ define([ 'angular', 'lodash', - 'config', + 'app/core/config', ], function (angular, _, config) { 'use strict'; diff --git a/public/app/controllers/sidemenuCtrl.js b/public/app/controllers/sidemenuCtrl.js index b7ba32f0d35..7fe8a5036b4 100644 --- a/public/app/controllers/sidemenuCtrl.js +++ b/public/app/controllers/sidemenuCtrl.js @@ -2,7 +2,7 @@ define([ 'angular', 'lodash', 'jquery', - 'config', + 'app/core/config', ], function (angular, _, $, config) { 'use strict'; diff --git a/public/app/controllers/signupCtrl.ts b/public/app/controllers/signupCtrl.ts index d59f1f0eb68..bda332f664d 100644 --- a/public/app/controllers/signupCtrl.ts +++ b/public/app/controllers/signupCtrl.ts @@ -1,7 +1,7 @@ /// import angular = require('angular'); -import config = require('config'); +import config = require('app/core/config'); var module = angular.module('grafana.controllers'); diff --git a/public/app/components/config.js b/public/app/core/config.js similarity index 100% rename from public/app/components/config.js rename to public/app/core/config.js diff --git a/public/app/components/store.js b/public/app/core/store.js similarity index 100% rename from public/app/components/store.js rename to public/app/core/store.js diff --git a/public/app/features/dashboard/dashboardCtrl.js b/public/app/features/dashboard/dashboardCtrl.js index 80b3a101f3f..cf071565515 100644 --- a/public/app/features/dashboard/dashboardCtrl.js +++ b/public/app/features/dashboard/dashboardCtrl.js @@ -1,8 +1,7 @@ define([ 'angular', 'jquery', - 'config', - 'lodash', + 'app/core/config', ], function (angular, $, config) { "use strict"; diff --git a/public/app/features/dashboard/dashboardNavCtrl.js b/public/app/features/dashboard/dashboardNavCtrl.js index eef2a8595a7..cb6258bb92a 100644 --- a/public/app/features/dashboard/dashboardNavCtrl.js +++ b/public/app/features/dashboard/dashboardNavCtrl.js @@ -1,9 +1,7 @@ define([ 'angular', 'lodash', - 'config', - 'store', - 'filesaver' + 'app/core/config', ], function (angular, _) { 'use strict'; diff --git a/public/app/features/dashboard/playlistCtrl.js b/public/app/features/dashboard/playlistCtrl.js index b5d04374e9a..9242905405a 100644 --- a/public/app/features/dashboard/playlistCtrl.js +++ b/public/app/features/dashboard/playlistCtrl.js @@ -1,7 +1,7 @@ define([ 'angular', 'lodash', - 'config' + 'app/core/config' ], function (angular, _, config) { 'use strict'; diff --git a/public/app/features/dashboard/playlistSrv.js b/public/app/features/dashboard/playlistSrv.js index 9997581fbc3..aee00837562 100644 --- a/public/app/features/dashboard/playlistSrv.js +++ b/public/app/features/dashboard/playlistSrv.js @@ -2,7 +2,7 @@ define([ 'angular', 'lodash', 'kbn', - 'store' + 'app/core/store' ], function (angular, _, kbn) { 'use strict'; diff --git a/public/app/features/dashboard/rowCtrl.js b/public/app/features/dashboard/rowCtrl.js index 5552981421e..0d8ee5d9473 100644 --- a/public/app/features/dashboard/rowCtrl.js +++ b/public/app/features/dashboard/rowCtrl.js @@ -1,7 +1,7 @@ define([ 'angular', 'lodash', - 'config' + 'app/core/config' ], function (angular, _, config) { 'use strict'; diff --git a/public/app/features/dashboard/shareModalCtrl.js b/public/app/features/dashboard/shareModalCtrl.js index 9c0d14ee601..3ea0068b600 100644 --- a/public/app/features/dashboard/shareModalCtrl.js +++ b/public/app/features/dashboard/shareModalCtrl.js @@ -2,7 +2,7 @@ define([ 'angular', 'lodash', 'require', - 'config', + 'app/core/config', ], function (angular, _, require, config) { 'use strict'; diff --git a/public/app/features/dashboard/timeSrv.js b/public/app/features/dashboard/timeSrv.js index be05a1f8a70..b0e5d37b90d 100644 --- a/public/app/features/dashboard/timeSrv.js +++ b/public/app/features/dashboard/timeSrv.js @@ -1,11 +1,11 @@ define([ 'angular', 'lodash', - 'config', 'kbn', 'moment', + 'app/core/config', 'app/core/utils/datemath' -], function (angular, _, config, kbn, moment, dateMath) { +], function (angular, _, kbn, moment, config, dateMath) { 'use strict'; var module = angular.module('grafana.services'); diff --git a/public/app/features/org/datasourceEditCtrl.js b/public/app/features/org/datasourceEditCtrl.js index 09dd8606092..e2d5cc3d75d 100644 --- a/public/app/features/org/datasourceEditCtrl.js +++ b/public/app/features/org/datasourceEditCtrl.js @@ -1,9 +1,9 @@ define([ 'angular', - 'config', 'lodash', + 'app/core/config', ], -function (angular, config, _) { +function (angular, _, config) { 'use strict'; var module = angular.module('grafana.controllers'); diff --git a/public/app/features/org/newOrgCtrl.js b/public/app/features/org/newOrgCtrl.js index 220192a46ac..0e2eaaf7a8e 100644 --- a/public/app/features/org/newOrgCtrl.js +++ b/public/app/features/org/newOrgCtrl.js @@ -1,6 +1,6 @@ define([ 'angular', - 'config', + 'app/core/config', ], function (angular, config) { 'use strict'; diff --git a/public/app/features/panel/panel_directive.js b/public/app/features/panel/panel_directive.js index d4f510995c1..8dd9d367922 100644 --- a/public/app/features/panel/panel_directive.js +++ b/public/app/features/panel/panel_directive.js @@ -1,7 +1,7 @@ define([ 'angular', 'jquery', - 'config', + 'app/core/config', ], function (angular, $, config) { 'use strict'; diff --git a/public/app/features/panel/panel_srv.js b/public/app/features/panel/panel_srv.js index d93a4575615..3fdb8d38974 100644 --- a/public/app/features/panel/panel_srv.js +++ b/public/app/features/panel/panel_srv.js @@ -1,7 +1,7 @@ define([ 'angular', 'lodash', - 'config', + 'app/core/config', ], function (angular, _, config) { 'use strict'; diff --git a/public/app/features/profile/changePasswordCtrl.js b/public/app/features/profile/changePasswordCtrl.js index b2bb90ea6cf..69db0bfe06f 100644 --- a/public/app/features/profile/changePasswordCtrl.js +++ b/public/app/features/profile/changePasswordCtrl.js @@ -1,6 +1,6 @@ define([ 'angular', - 'config', + 'app/core/config', ], function (angular) { 'use strict'; diff --git a/public/app/features/profile/profileCtrl.js b/public/app/features/profile/profileCtrl.js index fd7af74834d..bae85a3d0c4 100644 --- a/public/app/features/profile/profileCtrl.js +++ b/public/app/features/profile/profileCtrl.js @@ -1,6 +1,6 @@ define([ 'angular', - 'config', + 'app/core/config', ], function (angular, config) { 'use strict'; diff --git a/public/app/features/profile/selectOrgCtrl.js b/public/app/features/profile/selectOrgCtrl.js index 9a588151432..f0bdc611d5a 100644 --- a/public/app/features/profile/selectOrgCtrl.js +++ b/public/app/features/profile/selectOrgCtrl.js @@ -1,6 +1,6 @@ define([ 'angular', - 'config', + 'app/core/config', ], function (angular, config) { 'use strict'; diff --git a/public/app/headers/common.d.ts b/public/app/headers/common.d.ts index e9f5b80c50c..1e5ff821255 100644 --- a/public/app/headers/common.d.ts +++ b/public/app/headers/common.d.ts @@ -4,7 +4,7 @@ /// // dummy modules -declare module 'config' { +declare module 'app/core/config' { var config : any; export = config; } diff --git a/public/app/panels/dashlist/module.js b/public/app/panels/dashlist/module.js index d41fee29738..d76664eb5c3 100644 --- a/public/app/panels/dashlist/module.js +++ b/public/app/panels/dashlist/module.js @@ -2,7 +2,7 @@ define([ 'angular', 'app/app', 'lodash', - 'config', + 'app/core/config', 'app/features/panel/panel_meta', ], function (angular, app, _, config, PanelMeta) { diff --git a/public/app/plugins/datasource/graphite/datasource.js b/public/app/plugins/datasource/graphite/datasource.js index 8362412fd55..968f7373a73 100644 --- a/public/app/plugins/datasource/graphite/datasource.js +++ b/public/app/plugins/datasource/graphite/datasource.js @@ -2,7 +2,7 @@ define([ 'angular', 'lodash', 'jquery', - 'config', + 'app/core/config', 'app/core/utils/datemath', './directives', './query_ctrl', diff --git a/public/app/plugins/datasource/graphite/query_ctrl.js b/public/app/plugins/datasource/graphite/query_ctrl.js index 0880dc23dc9..f9941d67564 100644 --- a/public/app/plugins/datasource/graphite/query_ctrl.js +++ b/public/app/plugins/datasource/graphite/query_ctrl.js @@ -1,7 +1,7 @@ define([ 'angular', 'lodash', - 'config', + 'app/core/config', './gfunc', './parser' ], diff --git a/public/app/services/backendSrv.js b/public/app/services/backendSrv.js index 819ce9d938e..4043e66a44b 100644 --- a/public/app/services/backendSrv.js +++ b/public/app/services/backendSrv.js @@ -1,7 +1,7 @@ define([ 'angular', 'lodash', - 'config', + 'app/core/config', ], function (angular, _, config) { 'use strict'; diff --git a/public/app/services/contextSrv.js b/public/app/services/contextSrv.js index b3f8a1ed164..8bef719e198 100644 --- a/public/app/services/contextSrv.js +++ b/public/app/services/contextSrv.js @@ -1,8 +1,8 @@ define([ 'angular', 'lodash', - 'store', - 'config', + 'app/core/store', + 'app/core/config', ], function (angular, _, store, config) { 'use strict'; diff --git a/public/app/services/datasourceSrv.js b/public/app/services/datasourceSrv.js index 644e84e8801..e4dd08e3c81 100644 --- a/public/app/services/datasourceSrv.js +++ b/public/app/services/datasourceSrv.js @@ -1,7 +1,7 @@ define([ 'angular', 'lodash', - 'config', + 'app/core/config', ], function (angular, _, config) { 'use strict'; diff --git a/public/test/test-main.js b/public/test/test-main.js index 5a7f1eeb437..4d6eee4048e 100644 --- a/public/test/test-main.js +++ b/public/test/test-main.js @@ -2,9 +2,7 @@ require.config({ baseUrl: 'http://localhost:9876/base/', paths: { - config: 'app/components/config', kbn: 'app/components/kbn', - store: 'app/components/store', settings: 'app/components/settings', lodash: 'app/components/lodash.extended', @@ -58,7 +56,7 @@ require.config({ }, angular: { - deps: ['jquery', 'config'], + deps: ['jquery'], exports: 'angular' }, From 1665cb4282e3bc871b602ee0d2c8570429853816 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Fri, 30 Oct 2015 14:24:04 +0100 Subject: [PATCH 113/269] refactoring: moving components -> core --- public/app/components/require.config.js | 1 - public/app/components/settings.js | 57 ------------------------- public/app/core/config.js | 2 +- public/app/core/settings.js | 27 ++++++++++++ 4 files changed, 28 insertions(+), 59 deletions(-) delete mode 100644 public/app/components/settings.js create mode 100644 public/app/core/settings.js diff --git a/public/app/components/require.config.js b/public/app/components/require.config.js index cfb90b00696..141b7ccaf85 100644 --- a/public/app/components/require.config.js +++ b/public/app/components/require.config.js @@ -3,7 +3,6 @@ require.config({ baseUrl: 'public', paths: { - settings: 'app/components/settings', kbn: 'app/components/kbn', 'extend-jquery': 'app/components/extend-jquery', lodash: 'app/components/lodash.extended', diff --git a/public/app/components/settings.js b/public/app/components/settings.js deleted file mode 100644 index a9e1d382dd5..00000000000 --- a/public/app/components/settings.js +++ /dev/null @@ -1,57 +0,0 @@ -define([ - 'lodash', -], -function (_) { - "use strict"; - - return function Settings (options) { - /** - * To add a setting, you MUST define a default. Also, - * THESE ARE ONLY DEFAULTS. - * They are overridden by config.js in the root directory - * @type {Object} - */ - var defaults = { - datasources : {}, - window_title_prefix : 'Grafana - ', - panels : { - 'graph': { path: 'app/panels/graph', name: 'Graph' }, - 'singlestat': { path: 'app/panels/singlestat', name: 'Single stat' }, - 'text': { path: 'app/panels/text', name: 'Text' }, - 'dashlist': { path: 'app/panels/dashlist', name: 'Dashboard list' }, - }, - new_panel_title: 'no title (click here)', - plugins: {}, - default_route: '/dashboard/file/default.json', - playlist_timespan: "1m", - unsaved_changes_warning: true, - search: { max_results: 100 }, - appSubUrl: "" - }; - - var settings = _.extend({}, defaults, options); - - // var parseBasicAuth = function(datasource) { - // var passwordEnd = datasource.url.indexOf('@'); - // if (passwordEnd > 0) { - // var userStart = datasource.url.indexOf('//') + 2; - // var userAndPassword = datasource.url.substring(userStart, passwordEnd); - // var bytes = crypto.charenc.Binary.stringToBytes(userAndPassword); - // datasource.basicAuth = crypto.util.bytesToBase64(bytes); - // - // var urlHead = datasource.url.substring(0, userStart); - // datasource.url = urlHead + datasource.url.substring(passwordEnd + 1); - // } - // - // return datasource; - // }; - // - // _.each(settings.datasources, function(datasource, key) { - // datasource.name = key; - // if (datasource.url) { parseBasicAuth(datasource); } - // if (datasource.type === 'influxdb') { parseMultipleHosts(datasource); } - // }); - - return settings; - }; -}); diff --git a/public/app/core/config.js b/public/app/core/config.js index e26a55e097b..f8e7bb228a2 100644 --- a/public/app/core/config.js +++ b/public/app/core/config.js @@ -1,5 +1,5 @@ define([ - 'settings', + 'app/core/settings', ], function (Settings) { "use strict"; diff --git a/public/app/core/settings.js b/public/app/core/settings.js new file mode 100644 index 00000000000..b7fb6e53c14 --- /dev/null +++ b/public/app/core/settings.js @@ -0,0 +1,27 @@ +define([ + 'lodash', +], +function (_) { + "use strict"; + + return function Settings (options) { + var defaults = { + datasources : {}, + window_title_prefix : 'Grafana - ', + panels : { + 'graph': { path: 'app/panels/graph', name: 'Graph' }, + 'singlestat': { path: 'app/panels/singlestat', name: 'Single stat' }, + 'text': { path: 'app/panels/text', name: 'Text' }, + 'dashlist': { path: 'app/panels/dashlist', name: 'Dashboard list' }, + }, + new_panel_title: 'no title (click here)', + plugins: {}, + playlist_timespan: "1m", + unsaved_changes_warning: true, + appSubUrl: "" + }; + + var settings = _.extend({}, defaults, options); + return settings; + }; +}); From 6cf46b16351480452be3dc4a78e9a3a478eacfbb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Fri, 30 Oct 2015 14:44:40 +0100 Subject: [PATCH 114/269] refactoring: more moving stuff around --- public/app/components/require.config.js | 1 - public/app/core/directives/dash_upload.js | 4 ++-- public/app/core/directives/misc.js | 4 ++-- public/app/core/directives/ng_model_on_blur.js | 6 +++--- public/app/core/time_series.js | 2 +- public/app/{components => core/utils}/kbn.js | 0 public/app/features/dashboard/dashboardLoaderSrv.js | 2 +- public/app/features/dashboard/dashboardSrv.js | 3 +-- public/app/features/dashboard/graphiteImportCtrl.js | 2 +- public/app/features/dashboard/playlistSrv.js | 3 +-- public/app/features/dashboard/timeSrv.js | 4 ++-- .../app/features/dashboard/timepicker/timepicker.ts | 2 +- public/app/features/panel/panel_helper.js | 8 ++++---- public/app/features/panellinks/linkSrv.js | 4 ++-- public/app/features/templating/templateValuesSrv.js | 2 +- public/app/headers/common.d.ts | 2 +- public/app/panels/graph/graph.js | 4 ++-- public/app/panels/graph/legend.js | 3 +-- public/app/panels/graph/module.js | 13 ++++++------- public/app/panels/singlestat/module.js | 2 +- .../plugins/datasource/elasticsearch/datasource.js | 2 +- .../app/plugins/datasource/kairosdb/datasource.js | 2 +- public/app/plugins/datasource/opentsdb/queryCtrl.js | 2 +- public/app/plugins/datasource/sql/datasource.js | 2 -- public/test/specs/helpers.js | 3 +-- public/test/specs/kbn-format-specs.js | 2 +- public/test/test-main.js | 3 --- 27 files changed, 38 insertions(+), 49 deletions(-) rename public/app/{components => core/utils}/kbn.js (100%) diff --git a/public/app/components/require.config.js b/public/app/components/require.config.js index 141b7ccaf85..1af01a91710 100644 --- a/public/app/components/require.config.js +++ b/public/app/components/require.config.js @@ -3,7 +3,6 @@ require.config({ baseUrl: 'public', paths: { - kbn: 'app/components/kbn', 'extend-jquery': 'app/components/extend-jquery', lodash: 'app/components/lodash.extended', diff --git a/public/app/core/directives/dash_upload.js b/public/app/core/directives/dash_upload.js index 4a42d38eea7..ed4253c71ca 100644 --- a/public/app/core/directives/dash_upload.js +++ b/public/app/core/directives/dash_upload.js @@ -1,8 +1,8 @@ define([ - 'kbn', '../core_module', + 'app/core/utils/kbn', ], -function (kbn, coreModule) { +function (coreModule, kbn) { 'use strict'; coreModule.directive('dashUpload', function(timer, alertSrv, $location) { diff --git a/public/app/core/directives/misc.js b/public/app/core/directives/misc.js index 5733774c3bd..0fe18f922f7 100644 --- a/public/app/core/directives/misc.js +++ b/public/app/core/directives/misc.js @@ -1,9 +1,9 @@ define([ 'angular', - 'kbn', '../core_module', + 'app/core/utils/kbn', ], -function (angular, kbn, coreModule) { +function (angular, coreModule, kbn) { 'use strict'; coreModule.directive('tip', function($compile) { diff --git a/public/app/core/directives/ng_model_on_blur.js b/public/app/core/directives/ng_model_on_blur.js index 5e32a28eb94..c4a645732c5 100644 --- a/public/app/core/directives/ng_model_on_blur.js +++ b/public/app/core/directives/ng_model_on_blur.js @@ -1,9 +1,9 @@ define([ - 'kbn', - 'app/core/core_module', + '../core_module', + 'app/core/utils/kbn', 'app/core/utils/rangeutil', ], -function (kbn, coreModule, rangeUtil) { +function (coreModule, kbn, rangeUtil) { 'use strict'; coreModule.directive('ngModelOnblur', function() { diff --git a/public/app/core/time_series.js b/public/app/core/time_series.js index 74194e68ff9..9465232c200 100644 --- a/public/app/core/time_series.js +++ b/public/app/core/time_series.js @@ -1,6 +1,6 @@ define([ 'lodash', - 'kbn' + 'app/core/utils/kbn' ], function (_, kbn) { 'use strict'; diff --git a/public/app/components/kbn.js b/public/app/core/utils/kbn.js similarity index 100% rename from public/app/components/kbn.js rename to public/app/core/utils/kbn.js diff --git a/public/app/features/dashboard/dashboardLoaderSrv.js b/public/app/features/dashboard/dashboardLoaderSrv.js index 85e6374e0a3..f578a9d1075 100644 --- a/public/app/features/dashboard/dashboardLoaderSrv.js +++ b/public/app/features/dashboard/dashboardLoaderSrv.js @@ -3,7 +3,7 @@ define([ 'moment', 'lodash', 'jquery', - 'kbn', + 'app/core/utils/kbn', 'app/core/utils/datemath', ], function (angular, moment, _, $, kbn, dateMath) { diff --git a/public/app/features/dashboard/dashboardSrv.js b/public/app/features/dashboard/dashboardSrv.js index 21318ac8370..ce7cbeb11d2 100644 --- a/public/app/features/dashboard/dashboardSrv.js +++ b/public/app/features/dashboard/dashboardSrv.js @@ -1,11 +1,10 @@ define([ 'angular', 'jquery', - 'kbn', 'lodash', 'moment', ], -function (angular, $, kbn, _, moment) { +function (angular, $, _, moment) { 'use strict'; var module = angular.module('grafana.services'); diff --git a/public/app/features/dashboard/graphiteImportCtrl.js b/public/app/features/dashboard/graphiteImportCtrl.js index 2b6660c2a22..53338883274 100644 --- a/public/app/features/dashboard/graphiteImportCtrl.js +++ b/public/app/features/dashboard/graphiteImportCtrl.js @@ -1,7 +1,7 @@ define([ 'angular', 'lodash', - 'kbn' + 'app/core/utils/kbn' ], function (angular, _, kbn) { 'use strict'; diff --git a/public/app/features/dashboard/playlistSrv.js b/public/app/features/dashboard/playlistSrv.js index aee00837562..bf4587f6c48 100644 --- a/public/app/features/dashboard/playlistSrv.js +++ b/public/app/features/dashboard/playlistSrv.js @@ -1,8 +1,7 @@ define([ 'angular', 'lodash', - 'kbn', - 'app/core/store' + 'app/core/utils/kbn', ], function (angular, _, kbn) { 'use strict'; diff --git a/public/app/features/dashboard/timeSrv.js b/public/app/features/dashboard/timeSrv.js index b0e5d37b90d..e0e0ed47dab 100644 --- a/public/app/features/dashboard/timeSrv.js +++ b/public/app/features/dashboard/timeSrv.js @@ -1,11 +1,11 @@ define([ 'angular', 'lodash', - 'kbn', 'moment', 'app/core/config', + 'app/core/utils/kbn', 'app/core/utils/datemath' -], function (angular, _, kbn, moment, config, dateMath) { +], function (angular, _, moment, config, kbn, dateMath) { 'use strict'; var module = angular.module('grafana.services'); diff --git a/public/app/features/dashboard/timepicker/timepicker.ts b/public/app/features/dashboard/timepicker/timepicker.ts index bda002d59cd..c6d2680ce02 100644 --- a/public/app/features/dashboard/timepicker/timepicker.ts +++ b/public/app/features/dashboard/timepicker/timepicker.ts @@ -4,7 +4,7 @@ import angular = require('angular'); import _ = require('lodash'); import moment = require('moment'); -import kbn = require('kbn'); +import kbn = require('app/core/utils/kbn'); import dateMath = require('app/core/utils/datemath'); import rangeUtil = require('app/core/utils/rangeutil'); diff --git a/public/app/features/panel/panel_helper.js b/public/app/features/panel/panel_helper.js index c7473692a43..c3ccbfe7e09 100644 --- a/public/app/features/panel/panel_helper.js +++ b/public/app/features/panel/panel_helper.js @@ -1,12 +1,12 @@ define([ 'angular', + 'lodash', + 'jquery', + 'app/core/utils/kbn', 'app/core/utils/datemath', 'app/core/utils/rangeutil', - 'lodash', - 'kbn', - 'jquery', ], -function (angular, dateMath, rangeUtil, _, kbn, $) { +function (angular, _, $, kbn, dateMath, rangeUtil) { 'use strict'; var module = angular.module('grafana.services'); diff --git a/public/app/features/panellinks/linkSrv.js b/public/app/features/panellinks/linkSrv.js index 2e1f3e16436..c3a99bed4cb 100644 --- a/public/app/features/panellinks/linkSrv.js +++ b/public/app/features/panellinks/linkSrv.js @@ -1,9 +1,9 @@ define([ 'angular', - 'kbn', 'lodash', + 'app/core/utils/kbn', ], -function (angular, kbn, _) { +function (angular, _, kbn) { 'use strict'; angular diff --git a/public/app/features/templating/templateValuesSrv.js b/public/app/features/templating/templateValuesSrv.js index 18216fabd0f..bd3e6eb2b52 100644 --- a/public/app/features/templating/templateValuesSrv.js +++ b/public/app/features/templating/templateValuesSrv.js @@ -1,7 +1,7 @@ define([ 'angular', 'lodash', - 'kbn', + 'app/core/utils/kbn', ], function (angular, _, kbn) { 'use strict'; diff --git a/public/app/headers/common.d.ts b/public/app/headers/common.d.ts index 1e5ff821255..5f97278274f 100644 --- a/public/app/headers/common.d.ts +++ b/public/app/headers/common.d.ts @@ -9,7 +9,7 @@ declare module 'app/core/config' { export = config; } -declare module 'kbn' { +declare module 'app/core/utils/kbn' { var kbn : any; export = kbn; } diff --git a/public/app/panels/graph/graph.js b/public/app/panels/graph/graph.js index dce30643205..6e1424ae906 100755 --- a/public/app/panels/graph/graph.js +++ b/public/app/panels/graph/graph.js @@ -1,9 +1,9 @@ define([ 'angular', 'jquery', - 'kbn', 'moment', 'lodash', + 'app/core/utils/kbn', './graph.tooltip', 'jquery.flot', 'jquery.flot.events', @@ -14,7 +14,7 @@ define([ 'jquery.flot.fillbelow', 'jquery.flot.crosshair' ], -function (angular, $, kbn, moment, _, GraphTooltip) { +function (angular, $, moment, _, kbn, GraphTooltip) { 'use strict'; var module = angular.module('grafana.directives'); diff --git a/public/app/panels/graph/legend.js b/public/app/panels/graph/legend.js index c659447a704..065e74fed30 100644 --- a/public/app/panels/graph/legend.js +++ b/public/app/panels/graph/legend.js @@ -1,12 +1,11 @@ define([ 'angular', 'lodash', - 'kbn', 'jquery', 'jquery.flot', 'jquery.flot.time', ], -function (angular, _, kbn, $) { +function (angular, _, $) { 'use strict'; var module = angular.module('grafana.panels.graph'); diff --git a/public/app/panels/graph/module.js b/public/app/panels/graph/module.js index 1bf45c7c1b8..ff9633d0576 100644 --- a/public/app/panels/graph/module.js +++ b/public/app/panels/graph/module.js @@ -1,16 +1,15 @@ define([ 'angular', - 'jquery', 'lodash', - 'kbn', 'moment', + 'app/core/utils/kbn', 'app/core/time_series', 'app/features/panel/panel_meta', './seriesOverridesCtrl', './graph', './legend', ], -function (angular, $, _, kbn, moment, TimeSeries, PanelMeta) { +function (angular, _, moment, kbn, TimeSeries, PanelMeta) { 'use strict'; var module = angular.module('grafana.panels.graph'); @@ -42,9 +41,9 @@ function (angular, $, _, kbn, moment, TimeSeries, PanelMeta) { var _d = { // datasource name, null = default datasource datasource: null, - // sets client side (flot) or native graphite png renderer (png) + // sets client side (flot) or native graphite png renderer (png) renderer: 'flot', - // Show/hide the x-axis + // Show/hide the x-axis 'x-axis' : true, // Show/hide y-axis 'y-axis' : true, @@ -179,8 +178,8 @@ function (angular, $, _, kbn, moment, TimeSeries, PanelMeta) { var series = new TimeSeries({ datapoints: datapoints, - alias: alias, - color: color, + alias: alias, + color: color, }); if (datapoints && datapoints.length > 0) { diff --git a/public/app/panels/singlestat/module.js b/public/app/panels/singlestat/module.js index 6c7d88edba8..18d02e166f1 100644 --- a/public/app/panels/singlestat/module.js +++ b/public/app/panels/singlestat/module.js @@ -2,7 +2,7 @@ define([ 'angular', 'app/app', 'lodash', - 'kbn', + 'app/core/utils/kbn', 'app/core/time_series', 'app/features/panel/panel_meta', './singleStatPanel', diff --git a/public/app/plugins/datasource/elasticsearch/datasource.js b/public/app/plugins/datasource/elasticsearch/datasource.js index 6c216713368..4e27da73850 100644 --- a/public/app/plugins/datasource/elasticsearch/datasource.js +++ b/public/app/plugins/datasource/elasticsearch/datasource.js @@ -2,7 +2,7 @@ define([ 'angular', 'lodash', 'moment', - 'kbn', + 'app/core/utils/kbn', './query_builder', './index_pattern', './elastic_response', diff --git a/public/app/plugins/datasource/kairosdb/datasource.js b/public/app/plugins/datasource/kairosdb/datasource.js index 5d20adfa5f0..287b5ce7292 100644 --- a/public/app/plugins/datasource/kairosdb/datasource.js +++ b/public/app/plugins/datasource/kairosdb/datasource.js @@ -2,7 +2,7 @@ define([ 'angular', 'lodash', 'app/core/utils/datemath', - 'kbn', + 'app/core/utils/kbn', './queryCtrl', './directives', ], diff --git a/public/app/plugins/datasource/opentsdb/queryCtrl.js b/public/app/plugins/datasource/opentsdb/queryCtrl.js index d5aa3db58ae..2d796674bd5 100644 --- a/public/app/plugins/datasource/opentsdb/queryCtrl.js +++ b/public/app/plugins/datasource/opentsdb/queryCtrl.js @@ -1,7 +1,7 @@ define([ 'angular', 'lodash', - 'kbn' + 'app/core/utils/kbn' ], function (angular, _, kbn) { 'use strict'; diff --git a/public/app/plugins/datasource/sql/datasource.js b/public/app/plugins/datasource/sql/datasource.js index 591dc5a5bb4..ae6e62286ba 100644 --- a/public/app/plugins/datasource/sql/datasource.js +++ b/public/app/plugins/datasource/sql/datasource.js @@ -1,7 +1,5 @@ define([ 'angular', - 'lodash', - 'kbn', ], function (angular) { 'use strict'; diff --git a/public/test/specs/helpers.js b/public/test/specs/helpers.js index 9fa5aeee209..ded17428d8f 100644 --- a/public/test/specs/helpers.js +++ b/public/test/specs/helpers.js @@ -1,8 +1,7 @@ define([ - 'kbn', 'lodash', 'app/core/utils/datemath', -], function(kbn, _, dateMath) { +], function(_, dateMath) { 'use strict'; function ControllerTestContext() { diff --git a/public/test/specs/kbn-format-specs.js b/public/test/specs/kbn-format-specs.js index f84544fff4f..0a51312e9b1 100644 --- a/public/test/specs/kbn-format-specs.js +++ b/public/test/specs/kbn-format-specs.js @@ -1,5 +1,5 @@ define([ - 'kbn', + 'app/core/utils/kbn', 'app/core/utils/datemath' ], function(kbn, dateMath) { 'use strict'; diff --git a/public/test/test-main.js b/public/test/test-main.js index 4d6eee4048e..82197d75a19 100644 --- a/public/test/test-main.js +++ b/public/test/test-main.js @@ -2,9 +2,6 @@ require.config({ baseUrl: 'http://localhost:9876/base/', paths: { - kbn: 'app/components/kbn', - - settings: 'app/components/settings', lodash: 'app/components/lodash.extended', 'lodash-src': 'vendor/lodash', From 97de8c1cc262c77fe84f4851ba10b4430f4d08ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Fri, 30 Oct 2015 15:04:27 +0100 Subject: [PATCH 115/269] refactoring: move moving stuff around --- public/app/app.js | 2 -- public/app/core/core.ts | 3 +++ .../extend-jquery.js => core/jquery_extended.js} | 0 .../lodash_extended.js} | 0 public/app/{components => core}/partials.js | 0 public/app/features/dashboard/dashboardNavCtrl.js | 2 +- public/app/features/dashboard/shareModalCtrl.js | 4 ++-- .../require.config.js => require_config.js} | 14 +++----------- public/test/test-main.js | 4 +--- .../{ZeroClipboard.js => zero_clipboard.js} | 0 .../{ZeroClipboard.swf => zero_clipboard.swf} | Bin public/views/index.html | 2 +- tasks/options/requirejs.js | 7 +------ 13 files changed, 12 insertions(+), 26 deletions(-) rename public/app/{components/extend-jquery.js => core/jquery_extended.js} (100%) rename public/app/{components/lodash.extended.js => core/lodash_extended.js} (100%) rename public/app/{components => core}/partials.js (100%) rename public/app/{components/require.config.js => require_config.js} (91%) rename public/vendor/{ZeroClipboard.js => zero_clipboard.js} (100%) rename public/vendor/{ZeroClipboard.swf => zero_clipboard.swf} (100%) diff --git a/public/app/app.js b/public/app/app.js index 9c572e80fc2..b15bb43ddf5 100644 --- a/public/app/app.js +++ b/public/app/app.js @@ -9,7 +9,6 @@ define([ 'angular-strap', 'angular-dragdrop', 'angular-ui', - 'extend-jquery', 'bindonce', 'app/core/core', ], @@ -73,7 +72,6 @@ function (angular, $, _, appLevelRequire) { 'app/services/all', 'app/features/all', 'app/controllers/all', - 'app/components/partials', ]; app.boot = function() { diff --git a/public/app/core/core.ts b/public/app/core/core.ts index 98f487b236f..6c9d0cea958 100644 --- a/public/app/core/core.ts +++ b/public/app/core/core.ts @@ -16,6 +16,9 @@ /// /// +/// +/// + export * from './directives/array_join' export * from './directives/give_focus' export * from './filters/filters' diff --git a/public/app/components/extend-jquery.js b/public/app/core/jquery_extended.js similarity index 100% rename from public/app/components/extend-jquery.js rename to public/app/core/jquery_extended.js diff --git a/public/app/components/lodash.extended.js b/public/app/core/lodash_extended.js similarity index 100% rename from public/app/components/lodash.extended.js rename to public/app/core/lodash_extended.js diff --git a/public/app/components/partials.js b/public/app/core/partials.js similarity index 100% rename from public/app/components/partials.js rename to public/app/core/partials.js diff --git a/public/app/features/dashboard/dashboardNavCtrl.js b/public/app/features/dashboard/dashboardNavCtrl.js index cb6258bb92a..56a64c4933f 100644 --- a/public/app/features/dashboard/dashboardNavCtrl.js +++ b/public/app/features/dashboard/dashboardNavCtrl.js @@ -1,7 +1,7 @@ define([ 'angular', 'lodash', - 'app/core/config', + 'vendor/filesaver' ], function (angular, _) { 'use strict'; diff --git a/public/app/features/dashboard/shareModalCtrl.js b/public/app/features/dashboard/shareModalCtrl.js index 3ea0068b600..b723660abe7 100644 --- a/public/app/features/dashboard/shareModalCtrl.js +++ b/public/app/features/dashboard/shareModalCtrl.js @@ -84,9 +84,9 @@ function (angular, _, require, config) { module.directive('clipboardButton',function() { return function(scope, elem) { - require(['ZeroClipboard'], function(ZeroClipboard) { + require(['vendor/zero_clipboard'], function(ZeroClipboard) { ZeroClipboard.config({ - swfPath: config.appSubUrl + '/public/vendor/ZeroClipboard.swf' + swfPath: config.appSubUrl + '/public/vendor/zero_clipboard.swf' }); new ZeroClipboard(elem[0]); }); diff --git a/public/app/components/require.config.js b/public/app/require_config.js similarity index 91% rename from public/app/components/require.config.js rename to public/app/require_config.js index 1af01a91710..d9f8e90cad9 100644 --- a/public/app/components/require.config.js +++ b/public/app/require_config.js @@ -3,13 +3,11 @@ require.config({ baseUrl: 'public', paths: { - 'extend-jquery': 'app/components/extend-jquery', - lodash: 'app/components/lodash.extended', + 'lodash-src': 'vendor/lodash', + lodash: 'app/core/lodash_extended', text: 'vendor/requirejs-text/text', moment: 'vendor/moment', - filesaver: 'vendor/filesaver', - ZeroClipboard: 'vendor/ZeroClipboard', angular: 'vendor/angular/angular', 'angular-route': 'vendor/angular-route/angular-route', 'angular-sanitize': 'vendor/angular-sanitize/angular-sanitize', @@ -21,10 +19,7 @@ require.config({ bindonce: 'vendor/angular-bindonce/bindonce', crypto: 'vendor/crypto.min', spectrum: 'vendor/spectrum', - - 'lodash-src': 'vendor/lodash', bootstrap: 'vendor/bootstrap/bootstrap', - jquery: 'vendor/jquery/dist/jquery', 'jquery.flot': 'vendor/flot/jquery.flot', @@ -42,6 +37,7 @@ require.config({ 'bootstrap-tagsinput': 'vendor/tagsinput/bootstrap-tagsinput', 'aws-sdk': 'vendor/aws-sdk/dist/aws-sdk.min', }, + shim: { spectrum: { @@ -52,10 +48,6 @@ require.config({ exports: 'Crypto' }, - ZeroClipboard: { - exports: 'ZeroClipboard' - }, - angular: { deps: ['jquery'], exports: 'angular' diff --git a/public/test/test-main.js b/public/test/test-main.js index 82197d75a19..119f1875475 100644 --- a/public/test/test-main.js +++ b/public/test/test-main.js @@ -2,7 +2,7 @@ require.config({ baseUrl: 'http://localhost:9876/base/', paths: { - lodash: 'app/components/lodash.extended', + lodash: 'app/core/lodash_extended', 'lodash-src': 'vendor/lodash', moment: 'vendor/moment', @@ -21,7 +21,6 @@ require.config({ bindonce: 'vendor/angular-bindonce/bindonce', crypto: 'vendor/crypto.min', spectrum: 'vendor/spectrum', - jquery: 'vendor/jquery/dist/jquery', bootstrap: 'vendor/bootstrap/bootstrap', @@ -40,7 +39,6 @@ require.config({ 'jquery.flot.fillbelow': 'vendor/flot/jquery.flot.fillbelow', modernizr: 'vendor/modernizr-2.6.1', - 'aws-sdk': 'vendor/aws-sdk/dist/aws-sdk.min', }, shim: { diff --git a/public/vendor/ZeroClipboard.js b/public/vendor/zero_clipboard.js similarity index 100% rename from public/vendor/ZeroClipboard.js rename to public/vendor/zero_clipboard.js diff --git a/public/vendor/ZeroClipboard.swf b/public/vendor/zero_clipboard.swf similarity index 100% rename from public/vendor/ZeroClipboard.swf rename to public/vendor/zero_clipboard.swf diff --git a/public/views/index.html b/public/views/index.html index d19e244fc99..5b4e2f5bd92 100644 --- a/public/views/index.html +++ b/public/views/index.html @@ -19,7 +19,7 @@ - + diff --git a/tasks/options/requirejs.js b/tasks/options/requirejs.js index a1636af98e5..d61aec067c2 100644 --- a/tasks/options/requirejs.js +++ b/tasks/options/requirejs.js @@ -6,7 +6,7 @@ module.exports = function(config,grunt) { var options = { appDir: '<%= genDir %>', dir: '<%= tempDir %>', - mainConfigFile: '<%= genDir %>/app/components/require.config.js', + mainConfigFile: '<%= genDir %>/app/require_config.js', baseUrl: './', waitSeconds: 0, @@ -41,16 +41,12 @@ module.exports = function(config,grunt) { // main/common module name: 'app/app', include: [ - 'kbn', 'text', 'jquery', - 'angular', - 'settings', 'bootstrap', 'modernizr', 'timepicker', 'datepicker', - 'lodash', 'jquery.flot', 'angular-strap', 'angular-dragdrop', @@ -58,7 +54,6 @@ module.exports = function(config,grunt) { 'app/services/all', 'app/features/all', 'app/controllers/all', - 'app/components/partials', // bundle the datasources 'app/plugins/datasource/grafana/datasource', 'app/plugins/datasource/graphite/datasource', From 152b484eb5e97a5f966c38cc36390f6a4c85b8dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Fri, 30 Oct 2015 15:16:05 +0100 Subject: [PATCH 116/269] refactoring: moved app/controllers -> app/core/controllers --- public/app/app.js | 1 - public/app/controllers/metricKeys.js | 186 ------------------ public/app/{ => core}/controllers/all.js | 0 .../app/{ => core}/controllers/errorCtrl.js | 8 +- .../app/{ => core}/controllers/grafanaCtrl.js | 7 +- .../app/{ => core}/controllers/inspectCtrl.js | 7 +- .../app/{ => core}/controllers/invitedCtrl.js | 9 +- .../{ => core}/controllers/jsonEditorCtrl.js | 8 +- .../app/{ => core}/controllers/loginCtrl.js | 7 +- .../controllers/resetPasswordCtrl.js | 8 +- public/app/{ => core}/controllers/search.js | 7 +- .../{ => core}/controllers/sidemenuCtrl.js | 7 +- .../app/{ => core}/controllers/signupCtrl.ts | 7 +- public/app/core/core.ts | 1 + 14 files changed, 31 insertions(+), 232 deletions(-) delete mode 100644 public/app/controllers/metricKeys.js rename public/app/{ => core}/controllers/all.js (100%) rename public/app/{ => core}/controllers/errorCtrl.js (60%) rename public/app/{ => core}/controllers/grafanaCtrl.js (95%) rename public/app/{ => core}/controllers/inspectCtrl.js (92%) rename public/app/{ => core}/controllers/invitedCtrl.js (82%) rename public/app/{ => core}/controllers/jsonEditorCtrl.js (68%) rename public/app/{ => core}/controllers/loginCtrl.js (92%) rename public/app/{ => core}/controllers/resetPasswordCtrl.js (84%) rename public/app/{ => core}/controllers/search.js (95%) rename public/app/{ => core}/controllers/sidemenuCtrl.js (94%) rename public/app/{ => core}/controllers/signupCtrl.ts (89%) diff --git a/public/app/app.js b/public/app/app.js index b15bb43ddf5..6ffc95cb4f0 100644 --- a/public/app/app.js +++ b/public/app/app.js @@ -71,7 +71,6 @@ function (angular, $, _, appLevelRequire) { var preBootRequires = [ 'app/services/all', 'app/features/all', - 'app/controllers/all', ]; app.boot = function() { diff --git a/public/app/controllers/metricKeys.js b/public/app/controllers/metricKeys.js deleted file mode 100644 index ac8dffdcdf7..00000000000 --- a/public/app/controllers/metricKeys.js +++ /dev/null @@ -1,186 +0,0 @@ -define([ - 'angular', - 'lodash', - 'app/core/config' -], -function (angular, _, config) { - 'use strict'; - - var module = angular.module('grafana.controllers'); - - module.controller('MetricKeysCtrl', function($scope, $http, $q) { - var elasticSearchUrlForMetricIndex = config.elasticsearch + '/' + config.grafana_metrics_index + '/'; - var httpOptions = {}; - if (config.elasticsearchBasicAuth) { - httpOptions.withCredentials = true; - httpOptions.headers = { - "Authorization": "Basic " + config.elasticsearchBasicAuth - }; - } - $scope.init = function () { - $scope.metricPath = "prod.apps.api.boobarella.*"; - $scope.metricCounter = 0; - }; - - $scope.createIndex = function () { - $scope.errorText = null; - $scope.infoText = null; - - deleteIndex() - .then(createIndex) - .then(function () { - $scope.infoText = "Index created!"; - }) - .then(null, function (err) { - $scope.errorText = angular.toJson(err); - }); - }; - - $scope.loadMetricsFromPath = function() { - $scope.errorText = null; - $scope.infoText = null; - $scope.metricCounter = 0; - - return loadMetricsRecursive($scope.metricPath) - .then(function() { - $scope.infoText = "Indexing completed!"; - }, function(err) { - $scope.errorText = "Error: " + err; - }); - }; - - $scope.loadAll = function() { - $scope.infoText = "Fetching all metrics from graphite..."; - - getFromEachGraphite('/metrics/index.json', saveMetricsArray) - .then(function() { - $scope.infoText = "Indexing complete!"; - }).then(null, function(err) { - $scope.errorText = err; - }); - }; - - function getFromEachGraphite(request, data_callback, error_callback) { - return $q.all(_.map(config.datasources, function(datasource) { - if (datasource.type = 'graphite') { - return $http.get(datasource.url + request) - .then(data_callback, error_callback); - } - })); - } - - function saveMetricsArray(data, currentIndex) { - if (!data && !data.data && data.data.length === 0) { - return $q.reject('No metrics from graphite'); - } - - if (data.data.length === currentIndex) { - return $q.when('done'); - } - - currentIndex = currentIndex || 0; - - return saveMetricKey(data.data[currentIndex]) - .then(function() { - return saveMetricsArray(data, currentIndex + 1); - }); - } - - function deleteIndex() - { - var deferred = $q.defer(); - $http.delete(elasticSearchUrlForMetricIndex, httpOptions) - .success(function() { - deferred.resolve('ok'); - }) - .error(function(data, status) { - if (status === 404) { - deferred.resolve('ok'); - } - else { - deferred.reject('elastic search returned unexpected error'); - } - }); - - return deferred.promise; - } - - function createIndex() - { - return $http.put(elasticSearchUrlForMetricIndex, { - settings: { - analysis: { - analyzer: { - metric_path_ngram : { tokenizer : "my_ngram_tokenizer" } - }, - tokenizer: { - my_ngram_tokenizer : { - type : "nGram", - min_gram : "3", - max_gram : "8", - token_chars: ["letter", "digit", "punctuation", "symbol"] - } - } - } - }, - mappings: { - metricKey: { - properties: { - metricPath: { - type: "multi_field", - fields: { - "metricPath": { type: "string", index: "analyzed", index_analyzer: "standard" }, - "metricPath_ng": { type: "string", index: "analyzed", index_analyzer: "metric_path_ngram" } - } - } - } - } - } - }, httpOptions); - } - - function receiveMetric(result) { - var data = result.data; - if (!data || data.length === 0) { - console.log('no data'); - return; - } - - var funcs = _.map(data, function(metric) { - if (metric.expandable) { - return loadMetricsRecursive(metric.id + ".*"); - } - if (metric.leaf) { - return saveMetricKey(metric.id); - } - }); - - return $q.all(funcs); - } - - function saveMetricKey(metricId) { - - // Create request with id as title. Rethink this. - var request = $scope.ejs.Document(config.grafana_metrics_index, 'metricKey', metricId).source({ - metricPath: metricId - }); - - return request.doIndex( - function() { - $scope.infoText = "Indexing " + metricId; - $scope.metricCounter = $scope.metricCounter + 1; - }, - function() { - $scope.errorText = "failed to save metric " + metricId; - } - ); - } - - function loadMetricsRecursive(metricPath) - { - return getFromEachGraphite('/metrics/find/?query=' + metricPath, receiveMetric); - } - - }); - -}); diff --git a/public/app/controllers/all.js b/public/app/core/controllers/all.js similarity index 100% rename from public/app/controllers/all.js rename to public/app/core/controllers/all.js diff --git a/public/app/controllers/errorCtrl.js b/public/app/core/controllers/errorCtrl.js similarity index 60% rename from public/app/controllers/errorCtrl.js rename to public/app/core/controllers/errorCtrl.js index 13b64584226..9816928fa6c 100644 --- a/public/app/controllers/errorCtrl.js +++ b/public/app/core/controllers/errorCtrl.js @@ -1,13 +1,11 @@ define([ 'angular', - 'lodash' + '../core_module', ], -function (angular) { +function (angular, coreModule) { 'use strict'; - var module = angular.module('grafana.controllers'); - - module.controller('ErrorCtrl', function($scope, contextSrv) { + coreModule.controller('ErrorCtrl', function($scope, contextSrv) { var showSideMenu = contextSrv.sidemenu; contextSrv.sidemenu = false; diff --git a/public/app/controllers/grafanaCtrl.js b/public/app/core/controllers/grafanaCtrl.js similarity index 95% rename from public/app/controllers/grafanaCtrl.js rename to public/app/core/controllers/grafanaCtrl.js index 42a67064e29..baafd15938e 100644 --- a/public/app/controllers/grafanaCtrl.js +++ b/public/app/core/controllers/grafanaCtrl.js @@ -2,15 +2,14 @@ define([ 'angular', 'lodash', 'jquery', + '../core_module', 'app/core/config', 'app/core/store', ], -function (angular, _, $, config, store) { +function (angular, _, $, coreModule, config, store) { "use strict"; - var module = angular.module('grafana.controllers'); - - module.controller('GrafanaCtrl', function($scope, alertSrv, utilSrv, $rootScope, $controller, contextSrv) { + coreModule.controller('GrafanaCtrl', function($scope, alertSrv, utilSrv, $rootScope, $controller, contextSrv) { $scope.init = function() { $scope.contextSrv = contextSrv; diff --git a/public/app/controllers/inspectCtrl.js b/public/app/core/controllers/inspectCtrl.js similarity index 92% rename from public/app/controllers/inspectCtrl.js rename to public/app/core/controllers/inspectCtrl.js index e70a88323e9..81cfaf64a85 100644 --- a/public/app/controllers/inspectCtrl.js +++ b/public/app/core/controllers/inspectCtrl.js @@ -2,13 +2,12 @@ define([ 'angular', 'lodash', 'jquery', + '../core_module', ], -function (angular, _, $) { +function (angular, _, $, coreModule) { 'use strict'; - var module = angular.module('grafana.controllers'); - - module.controller('InspectCtrl', function($scope) { + coreModule.controller('InspectCtrl', function($scope) { var model = $scope.inspector; function getParametersFromQueryString(queryString) { diff --git a/public/app/controllers/invitedCtrl.js b/public/app/core/controllers/invitedCtrl.js similarity index 82% rename from public/app/controllers/invitedCtrl.js rename to public/app/core/controllers/invitedCtrl.js index 42443c4370f..540cb01ca1c 100644 --- a/public/app/controllers/invitedCtrl.js +++ b/public/app/core/controllers/invitedCtrl.js @@ -1,16 +1,13 @@ define([ 'angular', + '../core_module', 'app/core/config', ], -function (angular, config) { +function (angular, coreModule, config) { 'use strict'; - var module = angular.module('grafana.controllers'); - - module.controller('InvitedCtrl', function($scope, $routeParams, contextSrv, backendSrv) { - + coreModule.controller('InvitedCtrl', function($scope, $routeParams, contextSrv, backendSrv) { contextSrv.sidemenu = false; - $scope.formModel = {}; $scope.init = function() { diff --git a/public/app/controllers/jsonEditorCtrl.js b/public/app/core/controllers/jsonEditorCtrl.js similarity index 68% rename from public/app/controllers/jsonEditorCtrl.js rename to public/app/core/controllers/jsonEditorCtrl.js index 60bda8514b7..0bfd5fcfb05 100644 --- a/public/app/controllers/jsonEditorCtrl.js +++ b/public/app/core/controllers/jsonEditorCtrl.js @@ -1,13 +1,11 @@ define([ 'angular', - 'lodash' + '../core_module', ], -function (angular) { +function (angular, coreModule) { 'use strict'; - var module = angular.module('grafana.controllers'); - - module.controller('JsonEditorCtrl', function($scope) { + coreModule.controller('JsonEditorCtrl', function($scope) { $scope.json = angular.toJson($scope.object, true); $scope.canUpdate = $scope.updateHandler !== void 0; diff --git a/public/app/controllers/loginCtrl.js b/public/app/core/controllers/loginCtrl.js similarity index 92% rename from public/app/controllers/loginCtrl.js rename to public/app/core/controllers/loginCtrl.js index 7ec2c4353fd..22cb2c6f04b 100644 --- a/public/app/controllers/loginCtrl.js +++ b/public/app/core/controllers/loginCtrl.js @@ -1,13 +1,12 @@ define([ 'angular', + '../core_module', 'app/core/config', ], -function (angular, config) { +function (angular, coreModule, config) { 'use strict'; - var module = angular.module('grafana.controllers'); - - module.controller('LoginCtrl', function($scope, backendSrv, contextSrv, $location) { + coreModule.controller('LoginCtrl', function($scope, backendSrv, contextSrv, $location) { $scope.formModel = { user: '', email: '', diff --git a/public/app/controllers/resetPasswordCtrl.js b/public/app/core/controllers/resetPasswordCtrl.js similarity index 84% rename from public/app/controllers/resetPasswordCtrl.js rename to public/app/core/controllers/resetPasswordCtrl.js index ed693f0d45a..d414b059458 100644 --- a/public/app/controllers/resetPasswordCtrl.js +++ b/public/app/core/controllers/resetPasswordCtrl.js @@ -1,13 +1,11 @@ define([ 'angular', + '../core_module', ], -function (angular) { +function (angular, coreModule) { 'use strict'; - var module = angular.module('grafana.controllers'); - - module.controller('ResetPasswordCtrl', function($scope, contextSrv, backendSrv, $location) { - + coreModule.controller('ResetPasswordCtrl', function($scope, contextSrv, backendSrv, $location) { contextSrv.sidemenu = false; $scope.formModel = {}; $scope.mode = 'send'; diff --git a/public/app/controllers/search.js b/public/app/core/controllers/search.js similarity index 95% rename from public/app/controllers/search.js rename to public/app/core/controllers/search.js index cbae6366244..bbf869b9f38 100644 --- a/public/app/controllers/search.js +++ b/public/app/core/controllers/search.js @@ -1,14 +1,13 @@ define([ 'angular', 'lodash', + '../core_module', 'app/core/config', ], -function (angular, _, config) { +function (angular, _, coreModule, config) { 'use strict'; - var module = angular.module('grafana.controllers'); - - module.controller('SearchCtrl', function($scope, $location, $timeout, backendSrv) { + coreModule.controller('SearchCtrl', function($scope, $location, $timeout, backendSrv) { $scope.init = function() { $scope.giveSearchFocus = 0; diff --git a/public/app/controllers/sidemenuCtrl.js b/public/app/core/controllers/sidemenuCtrl.js similarity index 94% rename from public/app/controllers/sidemenuCtrl.js rename to public/app/core/controllers/sidemenuCtrl.js index 7fe8a5036b4..c2ee868323f 100644 --- a/public/app/controllers/sidemenuCtrl.js +++ b/public/app/core/controllers/sidemenuCtrl.js @@ -2,14 +2,13 @@ define([ 'angular', 'lodash', 'jquery', + '../core_module', 'app/core/config', ], -function (angular, _, $, config) { +function (angular, _, $, coreModule, config) { 'use strict'; - var module = angular.module('grafana.controllers'); - - module.controller('SideMenuCtrl', function($scope, $location, contextSrv, backendSrv) { + coreModule.controller('SideMenuCtrl', function($scope, $location, contextSrv, backendSrv) { $scope.getUrl = function(url) { return config.appSubUrl + url; diff --git a/public/app/controllers/signupCtrl.ts b/public/app/core/controllers/signupCtrl.ts similarity index 89% rename from public/app/controllers/signupCtrl.ts rename to public/app/core/controllers/signupCtrl.ts index bda332f664d..9c18b121612 100644 --- a/public/app/controllers/signupCtrl.ts +++ b/public/app/core/controllers/signupCtrl.ts @@ -1,9 +1,8 @@ -/// +/// import angular = require('angular'); import config = require('app/core/config'); - -var module = angular.module('grafana.controllers'); +import coreModule = require('../core_module'); export class SignUpCtrl { @@ -48,5 +47,5 @@ export class SignUpCtrl { }; } -module.controller('SignUpCtrl', SignUpCtrl); +coreModule.controller('SignUpCtrl', SignUpCtrl); diff --git a/public/app/core/core.ts b/public/app/core/core.ts index 6c9d0cea958..1d4683b0ce7 100644 --- a/public/app/core/core.ts +++ b/public/app/core/core.ts @@ -16,6 +16,7 @@ /// /// +/// /// /// From 97697b93edd5cffe3c383bc7b6184132d856c4ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Fri, 30 Oct 2015 15:58:20 +0100 Subject: [PATCH 117/269] refactoring: moving and renaming things --- public/app/app.js | 1 - public/app/core/core.ts | 1 + public/app/{ => core}/services/alertSrv.js | 9 ++++----- public/app/{ => core}/services/all.js | 0 public/app/{ => core}/services/analytics.js | 7 +++---- public/app/{ => core}/services/backendSrv.js | 7 +++---- public/app/{ => core}/services/contextSrv.js | 7 +++---- public/app/{ => core}/services/datasourceSrv.js | 7 +++---- public/app/{ => core}/services/keyboardManager.js | 9 ++++----- public/app/{ => core}/services/popoverSrv.js | 7 +++---- public/app/{ => core}/services/timer.js | 11 +++++------ public/app/{ => core}/services/uiSegmentSrv.js | 7 +++---- public/app/{ => core}/services/utilSrv.js | 7 +++---- .../datasource/cloudwatch/specs/datasource_specs.ts | 3 +++ .../elasticsearch/specs/datasource_specs.ts | 1 + .../elasticsearch/specs/query_ctrl_specs.ts | 2 +- .../datasource/graphite/specs/datasource_specs.ts | 4 +++- .../datasource/graphite/specs/query_ctrl_specs.ts | 4 +++- .../datasource/influxdb/specs/query_ctrl_specs.ts | 3 ++- .../datasource/influxdb_08/specs/datasource-specs.ts | 5 +++-- .../datasource/prometheus/specs/datasource_specs.ts | 3 +++ public/test/{specs => }/core/time_series_specs.js | 0 public/test/{specs => }/core/utils/datemath_specs.ts | 0 public/test/{specs => }/core/utils/rangeutil_specs.ts | 0 public/test/specs/kairosdb-datasource-specs.js | 3 +++ public/test/specs/linkSrv-specs.js | 1 + public/test/specs/opentsdbDatasource-specs.js | 1 + .../specs/{timeSrv-specs.js => time_srv_specs.js} | 7 ++++--- tasks/options/requirejs.js | 2 -- 29 files changed, 63 insertions(+), 56 deletions(-) rename public/app/{ => core}/services/alertSrv.js (92%) rename public/app/{ => core}/services/all.js (100%) rename public/app/{ => core}/services/analytics.js (75%) rename public/app/{ => core}/services/backendSrv.js (95%) rename public/app/{ => core}/services/contextSrv.js (91%) rename public/app/{ => core}/services/datasourceSrv.js (92%) rename public/app/{ => core}/services/keyboardManager.js (97%) rename public/app/{ => core}/services/popoverSrv.js (88%) rename public/app/{ => core}/services/timer.js (80%) rename public/app/{ => core}/services/uiSegmentSrv.js (94%) rename public/app/{ => core}/services/utilSrv.js (78%) rename public/test/{specs => }/core/time_series_specs.js (100%) rename public/test/{specs => }/core/utils/datemath_specs.ts (100%) rename public/test/{specs => }/core/utils/rangeutil_specs.ts (100%) rename public/test/specs/{timeSrv-specs.js => time_srv_specs.js} (96%) diff --git a/public/app/app.js b/public/app/app.js index 6ffc95cb4f0..0637b3aeea7 100644 --- a/public/app/app.js +++ b/public/app/app.js @@ -69,7 +69,6 @@ function (angular, $, _, appLevelRequire) { }); var preBootRequires = [ - 'app/services/all', 'app/features/all', ]; diff --git a/public/app/core/core.ts b/public/app/core/core.ts index 1d4683b0ce7..9b726de271a 100644 --- a/public/app/core/core.ts +++ b/public/app/core/core.ts @@ -17,6 +17,7 @@ /// /// +/// /// /// diff --git a/public/app/services/alertSrv.js b/public/app/core/services/alertSrv.js similarity index 92% rename from public/app/services/alertSrv.js rename to public/app/core/services/alertSrv.js index 3d0f9e66ff2..f3b5329cd60 100644 --- a/public/app/services/alertSrv.js +++ b/public/app/core/services/alertSrv.js @@ -1,13 +1,12 @@ define([ 'angular', - 'lodash' + 'lodash', + '../core_module', ], -function (angular, _) { +function (angular, _, coreModule) { 'use strict'; - var module = angular.module('grafana.services'); - - module.service('alertSrv', function($timeout, $sce, $rootScope, $modal, $q) { + coreModule.service('alertSrv', function($timeout, $sce, $rootScope, $modal, $q) { var self = this; this.init = function() { diff --git a/public/app/services/all.js b/public/app/core/services/all.js similarity index 100% rename from public/app/services/all.js rename to public/app/core/services/all.js diff --git a/public/app/services/analytics.js b/public/app/core/services/analytics.js similarity index 75% rename from public/app/services/analytics.js rename to public/app/core/services/analytics.js index 4bb7f0c79db..e09ee6c9b77 100644 --- a/public/app/services/analytics.js +++ b/public/app/core/services/analytics.js @@ -1,12 +1,11 @@ define([ 'angular', + '../core_module', ], -function(angular) { +function(angular, coreModule) { 'use strict'; - var module = angular.module('grafana.services'); - module.service('googleAnalyticsSrv', function($rootScope, $location) { - + coreModule.service('googleAnalyticsSrv', function($rootScope, $location) { var first = true; this.init = function() { diff --git a/public/app/services/backendSrv.js b/public/app/core/services/backendSrv.js similarity index 95% rename from public/app/services/backendSrv.js rename to public/app/core/services/backendSrv.js index 4043e66a44b..43b5193e66e 100644 --- a/public/app/services/backendSrv.js +++ b/public/app/core/services/backendSrv.js @@ -1,14 +1,13 @@ define([ 'angular', 'lodash', + '../core_module', 'app/core/config', ], -function (angular, _, config) { +function (angular, _, coreModule, config) { 'use strict'; - var module = angular.module('grafana.services'); - - module.service('backendSrv', function($http, alertSrv, $timeout) { + coreModule.service('backendSrv', function($http, alertSrv, $timeout) { var self = this; this.get = function(url, params) { diff --git a/public/app/services/contextSrv.js b/public/app/core/services/contextSrv.js similarity index 91% rename from public/app/services/contextSrv.js rename to public/app/core/services/contextSrv.js index 8bef719e198..77f10fdf16a 100644 --- a/public/app/services/contextSrv.js +++ b/public/app/core/services/contextSrv.js @@ -1,15 +1,14 @@ define([ 'angular', 'lodash', + '../core_module', 'app/core/store', 'app/core/config', ], -function (angular, _, store, config) { +function (angular, _, coreModule, store, config) { 'use strict'; - var module = angular.module('grafana.services'); - - module.service('contextSrv', function($rootScope, $timeout) { + coreModule.service('contextSrv', function($rootScope, $timeout) { var self = this; function User() { diff --git a/public/app/services/datasourceSrv.js b/public/app/core/services/datasourceSrv.js similarity index 92% rename from public/app/services/datasourceSrv.js rename to public/app/core/services/datasourceSrv.js index e4dd08e3c81..9709bb88cdf 100644 --- a/public/app/services/datasourceSrv.js +++ b/public/app/core/services/datasourceSrv.js @@ -1,14 +1,13 @@ define([ 'angular', 'lodash', + '../core_module', 'app/core/config', ], -function (angular, _, config) { +function (angular, _, coreModule, config) { 'use strict'; - var module = angular.module('grafana.services'); - - module.service('datasourceSrv', function($q, $injector, $rootScope) { + coreModule.service('datasourceSrv', function($q, $injector, $rootScope) { var self = this; this.init = function() { diff --git a/public/app/services/keyboardManager.js b/public/app/core/services/keyboardManager.js similarity index 97% rename from public/app/services/keyboardManager.js rename to public/app/core/services/keyboardManager.js index f45ddad305b..14b65465281 100644 --- a/public/app/services/keyboardManager.js +++ b/public/app/core/services/keyboardManager.js @@ -1,15 +1,14 @@ define([ 'angular', - 'lodash' + 'lodash', + '../core_module', ], -function (angular, _) { +function (angular, _, coreModule) { 'use strict'; - var module = angular.module('grafana.services'); - // This service was based on OpenJS library available in BSD License // http://www.openjs.com/scripts/events/keyboard_shortcuts/index.php - module.factory('keyboardManager', ['$window', '$timeout', function ($window, $timeout) { + coreModule.factory('keyboardManager', ['$window', '$timeout', function ($window, $timeout) { var keyboardManagerService = {}; var defaultOpt = { diff --git a/public/app/services/popoverSrv.js b/public/app/core/services/popoverSrv.js similarity index 88% rename from public/app/services/popoverSrv.js rename to public/app/core/services/popoverSrv.js index cec294178c0..26a935bf283 100644 --- a/public/app/services/popoverSrv.js +++ b/public/app/core/services/popoverSrv.js @@ -2,13 +2,12 @@ define([ 'angular', 'lodash', 'jquery', + '../core_module', ], -function (angular, _, $) { +function (angular, _, $, coreModule) { 'use strict'; - var module = angular.module('grafana.services'); - - module.service('popoverSrv', function($templateCache, $timeout, $q, $http, $compile) { + coreModule.service('popoverSrv', function($templateCache, $timeout, $q, $http, $compile) { this.getTemplate = function(url) { return $q.when($templateCache.get(url) || $http.get(url, {cache: true})); diff --git a/public/app/services/timer.js b/public/app/core/services/timer.js similarity index 80% rename from public/app/services/timer.js rename to public/app/core/services/timer.js index 3939fe6b78f..668388a786e 100644 --- a/public/app/services/timer.js +++ b/public/app/core/services/timer.js @@ -1,13 +1,12 @@ define([ 'angular', - 'lodash' + 'lodash', + '../core_module', ], -function (angular, _) { +function (angular, _, coreModule) { 'use strict'; - var module = angular.module('grafana.services'); - - module.service('timer', function($timeout) { + coreModule.service('timer', function($timeout) { // This service really just tracks a list of $timeout promises to give us a // method for cancelling them all when we need to @@ -31,4 +30,4 @@ function (angular, _) { }; }); -}); \ No newline at end of file +}); diff --git a/public/app/services/uiSegmentSrv.js b/public/app/core/services/uiSegmentSrv.js similarity index 94% rename from public/app/services/uiSegmentSrv.js rename to public/app/core/services/uiSegmentSrv.js index 2973089b6ba..cb11512e12f 100644 --- a/public/app/services/uiSegmentSrv.js +++ b/public/app/core/services/uiSegmentSrv.js @@ -1,13 +1,12 @@ define([ 'angular', 'lodash', + '../core_module', ], -function (angular, _) { +function (angular, _, coreModule) { 'use strict'; - var module = angular.module('grafana.services'); - - module.service('uiSegmentSrv', function($sce, templateSrv) { + coreModule.service('uiSegmentSrv', function($sce, templateSrv) { function MetricSegment(options) { if (options === '*' || options.value === '*') { diff --git a/public/app/services/utilSrv.js b/public/app/core/services/utilSrv.js similarity index 78% rename from public/app/services/utilSrv.js rename to public/app/core/services/utilSrv.js index b9e703443e4..2418546e5da 100644 --- a/public/app/services/utilSrv.js +++ b/public/app/core/services/utilSrv.js @@ -1,12 +1,11 @@ define([ 'angular', + '../core_module', ], -function (angular) { +function (angular, coreModule) { 'use strict'; - var module = angular.module('grafana.services'); - - module.service('utilSrv', function($rootScope, $modal, $q) { + coreModule.service('utilSrv', function($rootScope, $modal, $q) { this.init = function() { $rootScope.onAppEvent('show-modal', this.showModal, $rootScope); diff --git a/public/app/plugins/datasource/cloudwatch/specs/datasource_specs.ts b/public/app/plugins/datasource/cloudwatch/specs/datasource_specs.ts index 4714a642d30..0a569275d05 100644 --- a/public/app/plugins/datasource/cloudwatch/specs/datasource_specs.ts +++ b/public/app/plugins/datasource/cloudwatch/specs/datasource_specs.ts @@ -8,10 +8,13 @@ declare var helpers: any; describe('CloudWatchDatasource', function() { var ctx = new helpers.ServiceTestContext(); + beforeEach(angularMocks.module('grafana.core')); beforeEach(angularMocks.module('grafana.services')); beforeEach(angularMocks.module('grafana.controllers')); + beforeEach(ctx.providePhase(['templateSrv', 'backendSrv'])); beforeEach(ctx.createService('CloudWatchDatasource')); + beforeEach(function() { ctx.ds = new ctx.service({ jsonData: { diff --git a/public/app/plugins/datasource/elasticsearch/specs/datasource_specs.ts b/public/app/plugins/datasource/elasticsearch/specs/datasource_specs.ts index 584f915a86d..f087f847a19 100644 --- a/public/app/plugins/datasource/elasticsearch/specs/datasource_specs.ts +++ b/public/app/plugins/datasource/elasticsearch/specs/datasource_specs.ts @@ -10,6 +10,7 @@ declare var helpers: any; describe('ElasticDatasource', function() { var ctx = new helpers.ServiceTestContext(); + beforeEach(angularMocks.module('grafana.core')); beforeEach(angularMocks.module('grafana.services')); beforeEach(ctx.providePhase(['templateSrv', 'backendSrv'])); beforeEach(ctx.createService('ElasticDatasource')); diff --git a/public/app/plugins/datasource/elasticsearch/specs/query_ctrl_specs.ts b/public/app/plugins/datasource/elasticsearch/specs/query_ctrl_specs.ts index d88e8446ead..bcf111827a6 100644 --- a/public/app/plugins/datasource/elasticsearch/specs/query_ctrl_specs.ts +++ b/public/app/plugins/datasource/elasticsearch/specs/query_ctrl_specs.ts @@ -1,5 +1,5 @@ /// -/// +/// /// import {describe, beforeEach, it, sinon, expect, angularMocks} from 'test/lib/common'; diff --git a/public/app/plugins/datasource/graphite/specs/datasource_specs.ts b/public/app/plugins/datasource/graphite/specs/datasource_specs.ts index 8ba7e35b773..0ab4899e6eb 100644 --- a/public/app/plugins/datasource/graphite/specs/datasource_specs.ts +++ b/public/app/plugins/datasource/graphite/specs/datasource_specs.ts @@ -7,10 +7,12 @@ declare var helpers: any; describe('graphiteDatasource', function() { var ctx = new helpers.ServiceTestContext(); + beforeEach(angularMocks.module('grafana.core')); beforeEach(angularMocks.module('grafana.services')); - beforeEach(ctx.providePhase(['backendSrv'])); + beforeEach(ctx.providePhase(['backendSrv'])); beforeEach(ctx.createService('GraphiteDatasource')); + beforeEach(function() { ctx.ds = new ctx.service({ url: [''] }); }); diff --git a/public/app/plugins/datasource/graphite/specs/query_ctrl_specs.ts b/public/app/plugins/datasource/graphite/specs/query_ctrl_specs.ts index 0b12ea051e0..03602973f25 100644 --- a/public/app/plugins/datasource/graphite/specs/query_ctrl_specs.ts +++ b/public/app/plugins/datasource/graphite/specs/query_ctrl_specs.ts @@ -1,6 +1,6 @@ /// /// -/// +/// /// import {describe, beforeEach, it, sinon, expect, angularMocks} from 'test/lib/common'; @@ -11,8 +11,10 @@ declare var helpers: any; describe('GraphiteQueryCtrl', function() { var ctx = new helpers.ControllerTestContext(); + beforeEach(angularMocks.module('grafana.core')); beforeEach(angularMocks.module('grafana.controllers')); beforeEach(angularMocks.module('grafana.services')); + beforeEach(ctx.providePhase()); beforeEach(ctx.createControllerPhase('GraphiteQueryCtrl')); diff --git a/public/app/plugins/datasource/influxdb/specs/query_ctrl_specs.ts b/public/app/plugins/datasource/influxdb/specs/query_ctrl_specs.ts index ee02338c3da..6da2c78535d 100644 --- a/public/app/plugins/datasource/influxdb/specs/query_ctrl_specs.ts +++ b/public/app/plugins/datasource/influxdb/specs/query_ctrl_specs.ts @@ -1,5 +1,5 @@ /// -/// +/// /// import {describe, beforeEach, it, sinon, expect, angularMocks} from 'test/lib/common'; @@ -9,6 +9,7 @@ declare var helpers: any; describe('InfluxDBQueryCtrl', function() { var ctx = new helpers.ControllerTestContext(); + beforeEach(angularMocks.module('grafana.core')); beforeEach(angularMocks.module('grafana.controllers')); beforeEach(angularMocks.module('grafana.services')); beforeEach(ctx.providePhase()); diff --git a/public/app/plugins/datasource/influxdb_08/specs/datasource-specs.ts b/public/app/plugins/datasource/influxdb_08/specs/datasource-specs.ts index 46459939828..4d3d2b3817f 100644 --- a/public/app/plugins/datasource/influxdb_08/specs/datasource-specs.ts +++ b/public/app/plugins/datasource/influxdb_08/specs/datasource-specs.ts @@ -1,6 +1,6 @@ /// -/// -/// +/// +/// /// import {describe, beforeEach, it, sinon, expect, angularMocks} from 'test/lib/common'; @@ -10,6 +10,7 @@ declare var helpers: any; describe('InfluxDatasource', function() { var ctx = new helpers.ServiceTestContext(); + beforeEach(angularMocks.module('grafana.core')); beforeEach(angularMocks.module('grafana.services')); beforeEach(ctx.providePhase(['templateSrv'])); beforeEach(ctx.createService('InfluxDatasource_08')); diff --git a/public/app/plugins/datasource/prometheus/specs/datasource_specs.ts b/public/app/plugins/datasource/prometheus/specs/datasource_specs.ts index a6b494ccbf8..2ac4992edef 100644 --- a/public/app/plugins/datasource/prometheus/specs/datasource_specs.ts +++ b/public/app/plugins/datasource/prometheus/specs/datasource_specs.ts @@ -6,12 +6,15 @@ import moment = require('moment'); declare var helpers: any; describe('PrometheusDatasource', function() { + var ctx = new helpers.ServiceTestContext(); + beforeEach(angularMocks.module('grafana.core')); beforeEach(angularMocks.module('grafana.services')); beforeEach(ctx.createService('PrometheusDatasource')); beforeEach(function() { ctx.ds = new ctx.service({ url: 'proxied', directUrl: 'direct', user: 'test', password: 'mupp' }); }); + describe('When querying prometheus with one target using query editor target spec', function() { var results; var urlExpected = 'proxied/api/v1/query_range?query=' + diff --git a/public/test/specs/core/time_series_specs.js b/public/test/core/time_series_specs.js similarity index 100% rename from public/test/specs/core/time_series_specs.js rename to public/test/core/time_series_specs.js diff --git a/public/test/specs/core/utils/datemath_specs.ts b/public/test/core/utils/datemath_specs.ts similarity index 100% rename from public/test/specs/core/utils/datemath_specs.ts rename to public/test/core/utils/datemath_specs.ts diff --git a/public/test/specs/core/utils/rangeutil_specs.ts b/public/test/core/utils/rangeutil_specs.ts similarity index 100% rename from public/test/specs/core/utils/rangeutil_specs.ts rename to public/test/core/utils/rangeutil_specs.ts diff --git a/public/test/specs/kairosdb-datasource-specs.js b/public/test/specs/kairosdb-datasource-specs.js index edee99752f7..47cb2d7bc46 100644 --- a/public/test/specs/kairosdb-datasource-specs.js +++ b/public/test/specs/kairosdb-datasource-specs.js @@ -7,9 +7,12 @@ define([ describe('KairosDBDatasource', function() { var ctx = new helpers.ServiceTestContext(); + beforeEach(module('grafana.core')); beforeEach(module('grafana.services')); + beforeEach(ctx.providePhase(['templateSrv'])); beforeEach(ctx.createService('KairosDBDatasource')); + beforeEach(function() { ctx.ds = new ctx.service({ url: ''}); }); diff --git a/public/test/specs/linkSrv-specs.js b/public/test/specs/linkSrv-specs.js index 8a978b650ff..9ecff29bc77 100644 --- a/public/test/specs/linkSrv-specs.js +++ b/public/test/specs/linkSrv-specs.js @@ -7,6 +7,7 @@ define([ describe('linkSrv', function() { var _linkSrv; + beforeEach(module('grafana.core')); beforeEach(module('grafana.services')); beforeEach(inject(function(linkSrv) { diff --git a/public/test/specs/opentsdbDatasource-specs.js b/public/test/specs/opentsdbDatasource-specs.js index 57818fdc4fa..88eacc832c6 100644 --- a/public/test/specs/opentsdbDatasource-specs.js +++ b/public/test/specs/opentsdbDatasource-specs.js @@ -7,6 +7,7 @@ define([ describe('opentsdb', function() { var ctx = new helpers.ServiceTestContext(); + beforeEach(module('grafana.core')); beforeEach(module('grafana.services')); beforeEach(ctx.providePhase(['backendSrv'])); diff --git a/public/test/specs/timeSrv-specs.js b/public/test/specs/time_srv_specs.js similarity index 96% rename from public/test/specs/timeSrv-specs.js rename to public/test/specs/time_srv_specs.js index d369456e457..4f065af6cf8 100644 --- a/public/test/specs/timeSrv-specs.js +++ b/public/test/specs/time_srv_specs.js @@ -1,9 +1,9 @@ define([ - '../mocks/dashboard-mock', - './helpers', + 'test/mocks/dashboard-mock', + 'test/specs/helpers', 'lodash', 'moment', - 'app/services/timer', + 'app/core/services/timer', 'app/features/dashboard/timeSrv' ], function(dashboardMock, helpers, _, moment) { 'use strict'; @@ -12,6 +12,7 @@ define([ var ctx = new helpers.ServiceTestContext(); var _dashboard; + beforeEach(module('grafana.core')); beforeEach(module('grafana.services')); beforeEach(ctx.providePhase(['$routeParams'])); beforeEach(ctx.createService('timeSrv')); diff --git a/tasks/options/requirejs.js b/tasks/options/requirejs.js index d61aec067c2..6780eb4bad4 100644 --- a/tasks/options/requirejs.js +++ b/tasks/options/requirejs.js @@ -51,9 +51,7 @@ module.exports = function(config,grunt) { 'angular-strap', 'angular-dragdrop', 'app/core/core', - 'app/services/all', 'app/features/all', - 'app/controllers/all', // bundle the datasources 'app/plugins/datasource/grafana/datasource', 'app/plugins/datasource/graphite/datasource', From d8f68eb11833c73b9509680de411535c8d2b56cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Fri, 30 Oct 2015 16:06:29 +0100 Subject: [PATCH 118/269] refactoring: moving and renaming things --- public/app/core/controllers/all.js | 20 +++++++++---------- .../{errorCtrl.js => error_ctrl.js} | 0 .../{grafanaCtrl.js => grafana_ctrl.js} | 0 .../{inspectCtrl.js => inspect_ctrl.js} | 0 .../{invitedCtrl.js => invited_ctrl.js} | 0 ...{jsonEditorCtrl.js => json_editor_ctrl.js} | 0 .../{loginCtrl.js => login_ctrl.js} | 0 ...PasswordCtrl.js => reset_password_ctrl.js} | 0 .../controllers/{search.js => search_ctrl.js} | 0 .../{sidemenuCtrl.js => sidemenu_ctrl.js} | 0 .../{signupCtrl.ts => signup_ctrl.ts} | 0 .../services/{alertSrv.js => alert_srv.js} | 0 public/app/core/services/all.js | 16 +++++++-------- .../{backendSrv.js => backend_srv.js} | 0 .../{contextSrv.js => context_srv.js} | 0 .../{datasourceSrv.js => datasource_srv.js} | 0 ...keyboardManager.js => keyboard_manager.js} | 0 .../{popoverSrv.js => popover_srv.js} | 0 .../{uiSegmentSrv.js => segment_srv.js} | 0 .../core/services/{utilSrv.js => util_srv.js} | 0 .../elasticsearch/specs/query_ctrl_specs.ts | 2 +- .../graphite/specs/query_ctrl_specs.ts | 2 +- .../influxdb/specs/query_ctrl_specs.ts | 2 +- .../influxdb_08/specs/datasource-specs.ts | 4 ++-- 24 files changed, 23 insertions(+), 23 deletions(-) rename public/app/core/controllers/{errorCtrl.js => error_ctrl.js} (100%) rename public/app/core/controllers/{grafanaCtrl.js => grafana_ctrl.js} (100%) rename public/app/core/controllers/{inspectCtrl.js => inspect_ctrl.js} (100%) rename public/app/core/controllers/{invitedCtrl.js => invited_ctrl.js} (100%) rename public/app/core/controllers/{jsonEditorCtrl.js => json_editor_ctrl.js} (100%) rename public/app/core/controllers/{loginCtrl.js => login_ctrl.js} (100%) rename public/app/core/controllers/{resetPasswordCtrl.js => reset_password_ctrl.js} (100%) rename public/app/core/controllers/{search.js => search_ctrl.js} (100%) rename public/app/core/controllers/{sidemenuCtrl.js => sidemenu_ctrl.js} (100%) rename public/app/core/controllers/{signupCtrl.ts => signup_ctrl.ts} (100%) rename public/app/core/services/{alertSrv.js => alert_srv.js} (100%) rename public/app/core/services/{backendSrv.js => backend_srv.js} (100%) rename public/app/core/services/{contextSrv.js => context_srv.js} (100%) rename public/app/core/services/{datasourceSrv.js => datasource_srv.js} (100%) rename public/app/core/services/{keyboardManager.js => keyboard_manager.js} (100%) rename public/app/core/services/{popoverSrv.js => popover_srv.js} (100%) rename public/app/core/services/{uiSegmentSrv.js => segment_srv.js} (100%) rename public/app/core/services/{utilSrv.js => util_srv.js} (100%) diff --git a/public/app/core/controllers/all.js b/public/app/core/controllers/all.js index 1a313e6b019..d22010cffdc 100644 --- a/public/app/core/controllers/all.js +++ b/public/app/core/controllers/all.js @@ -1,12 +1,12 @@ define([ - './grafanaCtrl', - './search', - './inspectCtrl', - './jsonEditorCtrl', - './loginCtrl', - './invitedCtrl', - './signupCtrl', - './resetPasswordCtrl', - './sidemenuCtrl', - './errorCtrl', + './grafana_ctrl', + './search_ctrl', + './inspect_ctrl', + './json_editor_ctrl', + './login_ctrl', + './invited_ctrl', + './signup_ctrl', + './reset_password_ctrl', + './sidemenu_ctrl', + './error_ctrl', ], function () {}); diff --git a/public/app/core/controllers/errorCtrl.js b/public/app/core/controllers/error_ctrl.js similarity index 100% rename from public/app/core/controllers/errorCtrl.js rename to public/app/core/controllers/error_ctrl.js diff --git a/public/app/core/controllers/grafanaCtrl.js b/public/app/core/controllers/grafana_ctrl.js similarity index 100% rename from public/app/core/controllers/grafanaCtrl.js rename to public/app/core/controllers/grafana_ctrl.js diff --git a/public/app/core/controllers/inspectCtrl.js b/public/app/core/controllers/inspect_ctrl.js similarity index 100% rename from public/app/core/controllers/inspectCtrl.js rename to public/app/core/controllers/inspect_ctrl.js diff --git a/public/app/core/controllers/invitedCtrl.js b/public/app/core/controllers/invited_ctrl.js similarity index 100% rename from public/app/core/controllers/invitedCtrl.js rename to public/app/core/controllers/invited_ctrl.js diff --git a/public/app/core/controllers/jsonEditorCtrl.js b/public/app/core/controllers/json_editor_ctrl.js similarity index 100% rename from public/app/core/controllers/jsonEditorCtrl.js rename to public/app/core/controllers/json_editor_ctrl.js diff --git a/public/app/core/controllers/loginCtrl.js b/public/app/core/controllers/login_ctrl.js similarity index 100% rename from public/app/core/controllers/loginCtrl.js rename to public/app/core/controllers/login_ctrl.js diff --git a/public/app/core/controllers/resetPasswordCtrl.js b/public/app/core/controllers/reset_password_ctrl.js similarity index 100% rename from public/app/core/controllers/resetPasswordCtrl.js rename to public/app/core/controllers/reset_password_ctrl.js diff --git a/public/app/core/controllers/search.js b/public/app/core/controllers/search_ctrl.js similarity index 100% rename from public/app/core/controllers/search.js rename to public/app/core/controllers/search_ctrl.js diff --git a/public/app/core/controllers/sidemenuCtrl.js b/public/app/core/controllers/sidemenu_ctrl.js similarity index 100% rename from public/app/core/controllers/sidemenuCtrl.js rename to public/app/core/controllers/sidemenu_ctrl.js diff --git a/public/app/core/controllers/signupCtrl.ts b/public/app/core/controllers/signup_ctrl.ts similarity index 100% rename from public/app/core/controllers/signupCtrl.ts rename to public/app/core/controllers/signup_ctrl.ts diff --git a/public/app/core/services/alertSrv.js b/public/app/core/services/alert_srv.js similarity index 100% rename from public/app/core/services/alertSrv.js rename to public/app/core/services/alert_srv.js diff --git a/public/app/core/services/all.js b/public/app/core/services/all.js index bbe0e5235d3..2d4415a8fa2 100644 --- a/public/app/core/services/all.js +++ b/public/app/core/services/all.js @@ -1,13 +1,13 @@ define([ - './alertSrv', - './utilSrv', - './datasourceSrv', - './contextSrv', + './alert_srv', + './util_srv', + './datasource_srv', + './context_srv', './timer', - './keyboardManager', + './keyboard_manager', './analytics', - './popoverSrv', - './uiSegmentSrv', - './backendSrv', + './popover_srv', + './segment_srv', + './backend_srv', ], function () {}); diff --git a/public/app/core/services/backendSrv.js b/public/app/core/services/backend_srv.js similarity index 100% rename from public/app/core/services/backendSrv.js rename to public/app/core/services/backend_srv.js diff --git a/public/app/core/services/contextSrv.js b/public/app/core/services/context_srv.js similarity index 100% rename from public/app/core/services/contextSrv.js rename to public/app/core/services/context_srv.js diff --git a/public/app/core/services/datasourceSrv.js b/public/app/core/services/datasource_srv.js similarity index 100% rename from public/app/core/services/datasourceSrv.js rename to public/app/core/services/datasource_srv.js diff --git a/public/app/core/services/keyboardManager.js b/public/app/core/services/keyboard_manager.js similarity index 100% rename from public/app/core/services/keyboardManager.js rename to public/app/core/services/keyboard_manager.js diff --git a/public/app/core/services/popoverSrv.js b/public/app/core/services/popover_srv.js similarity index 100% rename from public/app/core/services/popoverSrv.js rename to public/app/core/services/popover_srv.js diff --git a/public/app/core/services/uiSegmentSrv.js b/public/app/core/services/segment_srv.js similarity index 100% rename from public/app/core/services/uiSegmentSrv.js rename to public/app/core/services/segment_srv.js diff --git a/public/app/core/services/utilSrv.js b/public/app/core/services/util_srv.js similarity index 100% rename from public/app/core/services/utilSrv.js rename to public/app/core/services/util_srv.js diff --git a/public/app/plugins/datasource/elasticsearch/specs/query_ctrl_specs.ts b/public/app/plugins/datasource/elasticsearch/specs/query_ctrl_specs.ts index bcf111827a6..776b9064a95 100644 --- a/public/app/plugins/datasource/elasticsearch/specs/query_ctrl_specs.ts +++ b/public/app/plugins/datasource/elasticsearch/specs/query_ctrl_specs.ts @@ -1,5 +1,5 @@ /// -/// +/// /// import {describe, beforeEach, it, sinon, expect, angularMocks} from 'test/lib/common'; diff --git a/public/app/plugins/datasource/graphite/specs/query_ctrl_specs.ts b/public/app/plugins/datasource/graphite/specs/query_ctrl_specs.ts index 03602973f25..364a64f82aa 100644 --- a/public/app/plugins/datasource/graphite/specs/query_ctrl_specs.ts +++ b/public/app/plugins/datasource/graphite/specs/query_ctrl_specs.ts @@ -1,6 +1,6 @@ /// /// -/// +/// /// import {describe, beforeEach, it, sinon, expect, angularMocks} from 'test/lib/common'; diff --git a/public/app/plugins/datasource/influxdb/specs/query_ctrl_specs.ts b/public/app/plugins/datasource/influxdb/specs/query_ctrl_specs.ts index 6da2c78535d..8fb5bea4925 100644 --- a/public/app/plugins/datasource/influxdb/specs/query_ctrl_specs.ts +++ b/public/app/plugins/datasource/influxdb/specs/query_ctrl_specs.ts @@ -1,5 +1,5 @@ /// -/// +/// /// import {describe, beforeEach, it, sinon, expect, angularMocks} from 'test/lib/common'; diff --git a/public/app/plugins/datasource/influxdb_08/specs/datasource-specs.ts b/public/app/plugins/datasource/influxdb_08/specs/datasource-specs.ts index 4d3d2b3817f..a8111776465 100644 --- a/public/app/plugins/datasource/influxdb_08/specs/datasource-specs.ts +++ b/public/app/plugins/datasource/influxdb_08/specs/datasource-specs.ts @@ -1,6 +1,6 @@ /// -/// -/// +/// +/// /// import {describe, beforeEach, it, sinon, expect, angularMocks} from 'test/lib/common'; From 2ca6acc1e975ca82b93071f550062d682d8ec2b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Bu=CC=88nemann?= Date: Sat, 31 Oct 2015 05:36:35 +0100 Subject: [PATCH 119/269] Fix npm 3 build failure in phantomjs task npm v3.0+ by default dedupes node modules and stores them in a flat tree, which means the hardcoded path to the location.js will no longer be nested under the karma-phantomjs-launcher module. This fixes issue #2999. --- tasks/options/phantomjs.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tasks/options/phantomjs.js b/tasks/options/phantomjs.js index 7eac7cb36ac..300688f5ba2 100644 --- a/tasks/options/phantomjs.js +++ b/tasks/options/phantomjs.js @@ -6,6 +6,11 @@ module.exports = function(config,grunt) { var dest = './vendor/phantomjs/phantomjs'; var confDir = './node_modules/karma-phantomjs-launcher/node_modules/phantomjs/lib/' + if (!grunt.file.exists(confDir)) { + // npm 3 or npm 2 with dedupe + confDir = './node_modules/phantomjs/lib/'; + } + if (!grunt.file.exists(dest)){ var m=grunt.file.read(confDir+"location.js") From 03130e1217f09ea9bbff9caac52ebe20d853f9a8 Mon Sep 17 00:00:00 2001 From: Utkarsh Bhatnagar Date: Fri, 30 Oct 2015 22:11:17 -0700 Subject: [PATCH 120/269] Update opentsdb.md As we merged, changes with auto suggestions in the master branch. Update docs respectively. --- docs/sources/datasources/opentsdb.md | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/docs/sources/datasources/opentsdb.md b/docs/sources/datasources/opentsdb.md index bcaeed9056c..14aa67ef31c 100644 --- a/docs/sources/datasources/opentsdb.md +++ b/docs/sources/datasources/opentsdb.md @@ -30,10 +30,9 @@ Open a graph in edit mode by click the title. ![](/img/v2/opentsdb_query_editor.png) ### Auto complete suggestions -You should get auto complete suggestions for tags and tag values. If you do not you need to enable `tsd.core.meta.enable_realtime_ts` in -the OpenTSDB server settings. +As soon as you start typing metric names, tag names and tag values , you should see highlighted auto complete suggestions for them. - > Note: This is required for the OpenTSDB `lookup` api to work. + > Note: This is required for the OpenTSDB `suggest` api to work. ## Templating queries Grafana's OpenTSDB data source now supports template variable values queries. This means you can create template variables that fetch the values from OpenTSDB (for example metric names, tag names, or tag values). The query editor is also enhanced to limiting tags by metric. @@ -46,4 +45,8 @@ When using OpenTSDB with a template variable of `query` type you can use followi suggest_tagk(prefix) // return tag names (i.e. keys) for all metrics with specific prefix (can be empty) suggest_tagv(prefix) // return tag values for all metrics with specific prefix (can be empty) +If you do not see template variables being populated in `Preview of values` section, you need to enable `tsd.core.meta.enable_realtime_ts` in the OpenTSDB server settings. Also, to populate metadata of the existing time series data in OpenTSDB, you need to run `tsd uid metasync` on the OpenTSDB server. + +> Note: This is required for the OpenTSDB `lookup` api to work. + For details on opentsdb metric queries checkout the official [OpenTSDB documentation](http://opentsdb.net/docs/build/html/index.html) From c5435596ad089df6950fb020852502c42508a5f5 Mon Sep 17 00:00:00 2001 From: utkarshcmu Date: Fri, 30 Oct 2015 22:34:40 -0700 Subject: [PATCH 121/269] Added All Value support for custom type templating --- .../features/templating/partials/editor.html | 17 +++++++++++++++++ .../features/templating/templateValuesSrv.js | 5 +++++ 2 files changed, 22 insertions(+) diff --git a/public/app/features/templating/partials/editor.html b/public/app/features/templating/partials/editor.html index 63ecd00adcf..133886971bd 100644 --- a/public/app/features/templating/partials/editor.html +++ b/public/app/features/templating/partials/editor.html @@ -146,6 +146,23 @@
              +
              +
                +
              • + +
              • +
              • + +
              • +
              • + All format +
              • +
              • + +
              • +
              +
              +
              diff --git a/public/app/features/templating/templateValuesSrv.js b/public/app/features/templating/templateValuesSrv.js index 18216fabd0f..a82eca012e6 100644 --- a/public/app/features/templating/templateValuesSrv.js +++ b/public/app/features/templating/templateValuesSrv.js @@ -115,6 +115,11 @@ function (angular, _, kbn) { if (variable.type === 'interval') { self.updateAutoInterval(variable); } + + if (variable.type === 'custom' && variable.includeAll) { + self.addAllOption(variable); + } + }; this.updateOptions = function(variable) { From acb5340ffb24f75f35365ca04a8a8f77877774a2 Mon Sep 17 00:00:00 2001 From: Vitaliy Fuks Date: Sat, 31 Oct 2015 18:07:24 -0400 Subject: [PATCH 122/269] Fixed typo in OpenTSDB's "metasync" documentation --- docs/sources/datasources/opentsdb.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/sources/datasources/opentsdb.md b/docs/sources/datasources/opentsdb.md index 14aa67ef31c..43fcda643ee 100644 --- a/docs/sources/datasources/opentsdb.md +++ b/docs/sources/datasources/opentsdb.md @@ -45,7 +45,7 @@ When using OpenTSDB with a template variable of `query` type you can use followi suggest_tagk(prefix) // return tag names (i.e. keys) for all metrics with specific prefix (can be empty) suggest_tagv(prefix) // return tag values for all metrics with specific prefix (can be empty) -If you do not see template variables being populated in `Preview of values` section, you need to enable `tsd.core.meta.enable_realtime_ts` in the OpenTSDB server settings. Also, to populate metadata of the existing time series data in OpenTSDB, you need to run `tsd uid metasync` on the OpenTSDB server. +If you do not see template variables being populated in `Preview of values` section, you need to enable `tsd.core.meta.enable_realtime_ts` in the OpenTSDB server settings. Also, to populate metadata of the existing time series data in OpenTSDB, you need to run `tsdb uid metasync` on the OpenTSDB server. > Note: This is required for the OpenTSDB `lookup` api to work. From 8448e3970b80a8dc03c3587c6b7f64a50f418c35 Mon Sep 17 00:00:00 2001 From: utkarshcmu Date: Sun, 1 Nov 2015 09:48:27 -0800 Subject: [PATCH 123/269] Removed unnecessary components. --- .../angular-native-dragdrop/.bower.json | 36 -- .../angular-native-dragdrop/Gulpfile.js | 15 - public/vendor/angular-native-dragdrop/LICENSE | 10 - .../vendor/angular-native-dragdrop/bower.json | 27 -- .../demo/css/styles.css | 29 -- .../angular-native-dragdrop/demo/index.html | 129 ------- .../angular-native-dragdrop/demo/js/app.js | 46 --- .../docs/css/styles.css | 32 -- .../angular-native-dragdrop/docs/index.html | 323 ------------------ .../angular-native-dragdrop/package.json | 24 -- 10 files changed, 671 deletions(-) delete mode 100644 public/vendor/angular-native-dragdrop/.bower.json delete mode 100644 public/vendor/angular-native-dragdrop/Gulpfile.js delete mode 100644 public/vendor/angular-native-dragdrop/LICENSE delete mode 100644 public/vendor/angular-native-dragdrop/bower.json delete mode 100644 public/vendor/angular-native-dragdrop/demo/css/styles.css delete mode 100644 public/vendor/angular-native-dragdrop/demo/index.html delete mode 100644 public/vendor/angular-native-dragdrop/demo/js/app.js delete mode 100644 public/vendor/angular-native-dragdrop/docs/css/styles.css delete mode 100644 public/vendor/angular-native-dragdrop/docs/index.html delete mode 100644 public/vendor/angular-native-dragdrop/package.json diff --git a/public/vendor/angular-native-dragdrop/.bower.json b/public/vendor/angular-native-dragdrop/.bower.json deleted file mode 100644 index 6cef5b66f76..00000000000 --- a/public/vendor/angular-native-dragdrop/.bower.json +++ /dev/null @@ -1,36 +0,0 @@ -{ - "name": "angular-native-dragdrop", - "version": "1.1.1", - "homepage": "http://angular-dragdrop.github.io/angular-dragdrop", - "authors": [ - "ganarajpr" - ], - "description": "Angular HTML5 Drag and Drop directive written in pure with no dependency on JQuery.", - "main": "draganddrop.js", - "keywords": [ - "angular", - "drag", - "drop", - "html5" - ], - "dependencies": { - "angular": "^1.3" - }, - "license": "MIT", - "ignore": [ - "**/.*", - "node_modules", - "bower_components", - "test", - "tests" - ], - "_release": "1.1.1", - "_resolution": { - "type": "version", - "tag": "v1.1.1", - "commit": "4ff89cb0aa61070508e935729fb816fd46a58f60" - }, - "_source": "git://github.com/angular-dragdrop/angular-dragdrop.git", - "_target": "~1.1.1", - "_originalSource": "angular-native-dragdrop" -} \ No newline at end of file diff --git a/public/vendor/angular-native-dragdrop/Gulpfile.js b/public/vendor/angular-native-dragdrop/Gulpfile.js deleted file mode 100644 index 0aa3bdfff72..00000000000 --- a/public/vendor/angular-native-dragdrop/Gulpfile.js +++ /dev/null @@ -1,15 +0,0 @@ -/* jshint -W097 */ -'use strict'; - -/* global require */ -var jshint = require('gulp-jshint'); -var stylish = require('jshint-stylish'); -var gulp = require('gulp'); - -gulp.task('lint', function() { - return gulp.src('./draganddrop.js') - .pipe(jshint()) - .pipe(jshint.reporter(stylish)); -}); - -gulp.task('default', ['lint']); diff --git a/public/vendor/angular-native-dragdrop/LICENSE b/public/vendor/angular-native-dragdrop/LICENSE deleted file mode 100644 index d239cb9e0d3..00000000000 --- a/public/vendor/angular-native-dragdrop/LICENSE +++ /dev/null @@ -1,10 +0,0 @@ - -The MIT License - -Copyright (c) 2015 Ganaraj P R, [Nebithi](http://www.nebithi.com) - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/public/vendor/angular-native-dragdrop/bower.json b/public/vendor/angular-native-dragdrop/bower.json deleted file mode 100644 index 8ffcb8869a7..00000000000 --- a/public/vendor/angular-native-dragdrop/bower.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - "name": "angular-native-dragdrop", - "version": "1.1.1", - "homepage": "http://angular-dragdrop.github.io/angular-dragdrop", - "authors": [ - "ganarajpr" - ], - "description": "Angular HTML5 Drag and Drop directive written in pure with no dependency on JQuery.", - "main": "draganddrop.js", - "keywords": [ - "angular", - "drag", - "drop", - "html5" - ], - "dependencies": { - "angular": "^1.3" - }, - "license": "MIT", - "ignore": [ - "**/.*", - "node_modules", - "bower_components", - "test", - "tests" - ] -} diff --git a/public/vendor/angular-native-dragdrop/demo/css/styles.css b/public/vendor/angular-native-dragdrop/demo/css/styles.css deleted file mode 100644 index 4dd18383697..00000000000 --- a/public/vendor/angular-native-dragdrop/demo/css/styles.css +++ /dev/null @@ -1,29 +0,0 @@ -body { - background-color: #f8f7f8; -} - -.heading { - border-bottom: 1px solid #b7b7b7; - padding-bottom: 10px; - margin-bottom: 10px; -} - -.topRow { - margin-bottom: 30px; -} - -.on-drag-enter { - background-color : #677ba6; -} - -.on-drag-enter-custom { - background-color : #d78cc7; -} - -.on-drag-hover { - background-color : #3eb352; -} - -.on-drag-hover-custom { - background-color : #d7a931; -} \ No newline at end of file diff --git a/public/vendor/angular-native-dragdrop/demo/index.html b/public/vendor/angular-native-dragdrop/demo/index.html deleted file mode 100644 index 9693e8f8c95..00000000000 --- a/public/vendor/angular-native-dragdrop/demo/index.html +++ /dev/null @@ -1,129 +0,0 @@ - - - - - - Angular DragDrop (Demo) - - - - - - - - - - -
              -
              -

              - Drag and drop between the two lists. -

              -
              - -

              Beasts

              - -

              Left column of beasts is not draggable and accepts both beasts and priests

              - -
              - -
              -
              -
                -
              • - {{man}} -
              • -
              -
              -
              -
                -
              • - {{woman}} -
              • -
              -
              -
              - -
              - -

              Priests

              - -
              - -
              -
              -
                -
              • - {{man}} -
              • -
              -
              -
              -
                -
              • - {{woman}} -
              • -
              -
              -
              - -
              - -

              Terrorists

              - -

              Each terrorist list item accepts a new terrorist. Shows inserting into a particular - position in an array.

              - -
              - - -
              -
              -
                -
              • - {{man}} -
              • -
              -
              -
              -
                -
              • - {{woman}} -
              • -
              -
              -
              -
              - - - diff --git a/public/vendor/angular-native-dragdrop/demo/js/app.js b/public/vendor/angular-native-dragdrop/demo/js/app.js deleted file mode 100644 index 7fca20ac0ce..00000000000 --- a/public/vendor/angular-native-dragdrop/demo/js/app.js +++ /dev/null @@ -1,46 +0,0 @@ -angular.module('app', [ - 'hljs', - 'ang-drag-drop' -]).controller('MainCtrl', function($scope) { - $scope.men = [ - 'John', - 'Jack', - 'Mark', - 'Ernie', - 'Mike (Locked)' - ]; - - - $scope.women = [ - 'Jane', - 'Jill', - 'Betty', - 'Mary' - ]; - - $scope.addText = ''; - - $scope.dropValidateHandler = function($drop, $event, $data) { - if ($data === 'Mike (Locked)') { - return false; - } - if ($drop.element[0] === $event.srcElement.parentNode) { - // Don't allow moving to same container - return false; - } - return true; - }; - - $scope.dropSuccessHandler = function($event, index, array) { - array.splice(index, 1); - }; - - $scope.onDrop = function($event, $data, array, index) { - if (index !== undefined) { - array.splice(index, 0, $data); - } else { - array.push($data); - } - }; - -}); diff --git a/public/vendor/angular-native-dragdrop/docs/css/styles.css b/public/vendor/angular-native-dragdrop/docs/css/styles.css deleted file mode 100644 index d4480e8b536..00000000000 --- a/public/vendor/angular-native-dragdrop/docs/css/styles.css +++ /dev/null @@ -1,32 +0,0 @@ -.content { - margin : 50px auto; - font-size: 1.0em; - line-height: 1.5em; -} - -.content a{ - color: #677BA6; - cursor: pointer; -} - -body { - background-color: #f8f7f8; -} - -.jumbotron h1, -.jumbotron p{ - font-family: 'Open Sans'; -} - -.heading{ - border-bottom: 1px solid #b7b7b7; - padding-bottom: 10px; - margin-bottom: 10px; -} - -.ribbon{ - position: fixed; - top : 0; - right : 0; - z-index: 2000; -} \ No newline at end of file diff --git a/public/vendor/angular-native-dragdrop/docs/index.html b/public/vendor/angular-native-dragdrop/docs/index.html deleted file mode 100644 index 25603db4e34..00000000000 --- a/public/vendor/angular-native-dragdrop/docs/index.html +++ /dev/null @@ -1,323 +0,0 @@ - - - - Angular DragDrop - - - - - - - - - - -Fork me on GitHub -
              -
              -

              Angular Drag and Drop

              - -

              Angular-DragDrop is a AngularJS HTML5 Drag and Drop directive written in pure with no dependency on JQuery.

              - - -
              - - -
              -
              -

              Directives

              -
              - -

              ui-draggable

              - -

              - directive in module ngDragDrop -

              - -

              The ui-draggable attribute tells Angular that the element is draggable. ui-draggable - takes an expression as the attribute value. The expression should evaluate to either true or false. - You can toggle the draggability of an element using this expression. -

              - - -

              Additional Attributes

              - -

              drag

              - -

              The drag property is used to assign the data that needs to be passed along with the dragging - element.

              -
              -

              drag-handle-class

              - -

              The class used to mark child elements of draggable object to be used as drag handle. Default class name is - drag-handle.

              -
              - NOTE: If attribute is not present drag handle feature is not active. -
              -
              -

              on-drop-success

              - -

              The on-drop-success attribute takes a function. We can consider this to be an on-drop-success - handler function. - This can be useful if you need to do some post processing after the dragged element is dropped successfully on - the drop site. - -

              - NOTE: This callback function is only called when the drop succeeds. -
              - You can request the drag-end event ( very similiar to requesting the click event in - ng-click ) - by passing $event in the event handler. -

              - -
              -

              on-drop-failure

              - -

              The on-drop-failure attribute takes a function. We can consider this to be an on-drop-failure - handler function. - This can be useful if you need to do some post processing after the dragged element is dropped unsuccessfully on - any drop site. - -

              - NOTE: This callback function is only called when the drop fails. -
              - You can request the drag-end event ( very similiar to requesting the click event in - ng-click ) - by passing $event in the event handler. -

              - - -
              -

              Usage

              - -

              - -

              - ... - -
              -

              - -

              Details

              - -

              - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
              ParamTypeDetails
              ui-draggableExpression that should be - evaluated. The given expression should resolve to true or false. -
              dragTakes any JSON convertable $scope variable.
              drag-handle-classClass name used to mark child elements of draggable object to be used as drag handle.
              If attribute - is not present drag handle feature is not used.
              If attribute is present but have no value - drag-handle used as default.
              on-drop-successTakes any $scope function. Can also pass $event.
              on-drop-failureTakes any $scope function. Can also pass $event.
              drag-channelTakes a string that can be used as the channel name for the dragging operation. - Default channel is "defaultchannel" -
              -

              -
              - -

              Events

              - -

              On start of dragging an Angular Event ANGULAR_DRAG_START is dispatched from the - $rootScope. The event also carries - carries the information about the channel in which the dragging has started. -

              - -

              On end of dragging an Angular Event ANGULAR_DRAG_END is dispatched from the $rootScope. - The event also carries - carries the information about the channel in which the dragging has started. -

              - -

              When hovering a draggable element on top of a drop area an Angular Event ANGULAR_HOVER - is dispatched from the $rootScope. - The event also carries the information about the channel in which the dragging has started. -

              - -
              - -

              ui-on-drop

              - -

              - directive in module ngDragDrop -

              - -

              The ui-on-drop attribute tells Angular that the element is a drop site. ui-on-drop - takes a function as the attribute value. The function will be called when a valid dragged element is dropped in - that location. - A valid dragged element is one which has the same channel as the drop location. - -

              - NOTE : This callback function is only called when the drop succeeds. -
              - The ui-on-drop callback can request additional parameters. The data that is dragged is available to the - callback as $data and its channel as $channel. Apart from this the drop event is exposed as $event. -

              -

              Additional Attributes

              - -

              drop-channel

              - -

              The channel that the drop site accepts. The dragged element should have the same channel as this drop site for it - to be droppable at this location. It is possible to provide comma separated list of channels. - -

              - NOTE: Also special value of drag-channel attribute is available to accept - dragged element with any channel value — * -
              -

              - -
              - -

              drop-validate

              - -

              Extra validation that makes sure that the drop site accepts the dragged element beyond having the same channel. If - not defined, no extra validation is made. - -

              - NOTE: This callback function is called only if the channel condition is met, when the element - starts being dragged -
              -

              - -
              - -

              drag-enter-class

              - -

              The class that will be added to the the droppable element when a dragged element ( which is droppable ) - enters the drop location. The default value for this is on-drag-enter

              - -

              drag-hover-class

              - -

              The class that will be added to the drop area element when hovering with an element. - The default value for this is on-drag-hover

              - -
              -

              Usage

              - -

              - -

              - ... -
              -

              - -

              Details

              - -

              - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
              ParamTypeDetails
              ui-on-dropTakes any $scope function. Can also pass $event, $data and $channel. -
              drop-channelThe channel on which the drop has to listen for drag events.
              - Single value, comma separated list or special value * are possible
              drop-validateTakes any $scope function. Can also pass $data and $channel -
              drag-enter-classA class name that will be put on the droppable element when the dragged objects enters its boundaries. -
              Default class name is on-drag-enter.
              drag-hover-classA class name that will be put on the drop area when an element is dragged onto it.
              Default class - name is on-drag-hover.
              -

              -
              -

              Demo

              - - - -
              -
              - - - - - diff --git a/public/vendor/angular-native-dragdrop/package.json b/public/vendor/angular-native-dragdrop/package.json deleted file mode 100644 index 30aa4f51205..00000000000 --- a/public/vendor/angular-native-dragdrop/package.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "name": "angular-native-dragdrop", - "version": "1.1.1", - "description": "Angular HTML5 Drag and Drop directive written in pure with no dependency on JQuery.", - "main": "draganddrop.js", - "scripts": { - "test": "gulp" - }, - "repository": { - "type": "git", - "url": "https://github.com/angular-dragdrop/angular-dragdrop.git" - }, - "author": "ganarajpr", - "license": "MIT", - "bugs": { - "url": "https://github.com/angular-dragdrop/angular-dragdrop/issues" - }, - "homepage": "http://angular-dragdrop.github.io/angular-dragdrop", - "devDependencies": { - "gulp": "^3.8.11", - "gulp-jshint": "^1.9.2", - "jshint-stylish": "^1.0.1" - } -} From 51003396040f994d0a0f3375ef0079ac630d154b Mon Sep 17 00:00:00 2001 From: utkarshcmu Date: Sun, 1 Nov 2015 22:58:14 -0800 Subject: [PATCH 124/269] Initialized dashboard JSON doc. --- docs/sources/reference/dashboard.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 docs/sources/reference/dashboard.md diff --git a/docs/sources/reference/dashboard.md b/docs/sources/reference/dashboard.md new file mode 100644 index 00000000000..e69de29bb2d From 3a021a87a1df417b1e1478f39e4d209e1b22ae87 Mon Sep 17 00:00:00 2001 From: utkarshcmu Date: Sun, 1 Nov 2015 23:17:23 -0800 Subject: [PATCH 125/269] Added JSON of new dashboard --- docs/sources/reference/dashboard.md | 80 +++++++++++++++++++++++++++++ 1 file changed, 80 insertions(+) diff --git a/docs/sources/reference/dashboard.md b/docs/sources/reference/dashboard.md index e69de29bb2d..1a05ff596c8 100644 --- a/docs/sources/reference/dashboard.md +++ b/docs/sources/reference/dashboard.md @@ -0,0 +1,80 @@ +---- +page_title: Dashboard JSON +page_description: Dashboard JSON Reference +page_keywords: grafana, dashboard, json, documentation +--- + +# Dashboard JSON + +## Overview + +A dashboard in Grafana is represented by a JSON object, which stores dashboard metadata, rows of panels, panel queries, etc. + + + +> To view the JSON of a dashboard, you can click on "Manage dashboard" cog menu and select "View JSON" from it. + +## Basic fields + +A dashboard JSON object is initialized with the following fields when it is created. + +``` +{ + "id": null, + "title": "New dashboard", + "originalTitle": "New dashboard", + "tags": [], + "style": "dark", + "timezone": "browser", + "editable": true, + "hideControls": false, + "sharedCrosshair": false, + "rows": [ + { + "height": "250px", + "panels": [], + "title": "Row", + "collapse": false, + "editable": true + } + ], + "time": { + "from": "now-6h", + "to": "now" + }, + "timepicker": { + "time_options": [ + "5m", + "15m", + "1h", + "6h", + "12h", + "24h", + "2d", + "7d", + "30d" + ], + "refresh_intervals": [ + "5s", + "10s", + "30s", + "1m", + "5m", + "15m", + "30m", + "1h", + "2h", + "1d" + ] + }, + "templating": { + "list": [] + }, + "annotations": { + "list": [] + }, + "schemaVersion": 7, + "version": 0, + "links": [] +} +``` From ada641090f04284dc9ff2f6b05c37ec9d5dddf02 Mon Sep 17 00:00:00 2001 From: Utkarsh Bhatnagar Date: Sun, 1 Nov 2015 23:53:24 -0800 Subject: [PATCH 126/269] Explained basic JSON fields --- docs/sources/reference/dashboard.md | 35 ++++++++++++++++++++++++----- 1 file changed, 30 insertions(+), 5 deletions(-) diff --git a/docs/sources/reference/dashboard.md b/docs/sources/reference/dashboard.md index 1a05ff596c8..c5bea813802 100644 --- a/docs/sources/reference/dashboard.md +++ b/docs/sources/reference/dashboard.md @@ -8,15 +8,19 @@ page_keywords: grafana, dashboard, json, documentation ## Overview -A dashboard in Grafana is represented by a JSON object, which stores dashboard metadata, rows of panels, panel queries, etc. +A dashboard in Grafana is represented by a JSON object, which stores metadata of its dashboard. Dashboard metadata includes dashboard properties, metadata from rows, panels, template variables, panel queries, etc. - +To view the JSON of a dashboard, follow the steps mentioned below: -> To view the JSON of a dashboard, you can click on "Manage dashboard" cog menu and select "View JSON" from it. + 1. Go to a dashboard + 2. Click on `Manage dashboard` menu on the top navigation bar + 3. Select `View JSON` from the dropdown menu ## Basic fields -A dashboard JSON object is initialized with the following fields when it is created. +When a user creates a new dashboard, a new dashboard JSON object is initialized with the following fields: + +> Note: In the following JSON, id is shown as null which is the default value assigned to it until the dashboard is not saved. Once saved, an integer value is assigned to the `id` field. ``` { @@ -26,7 +30,7 @@ A dashboard JSON object is initialized with the following fields when it is crea "tags": [], "style": "dark", "timezone": "browser", - "editable": true, + "editable": true, "hideControls": false, "sharedCrosshair": false, "rows": [ @@ -78,3 +82,24 @@ A dashboard JSON object is initialized with the following fields when it is crea "links": [] } ``` +Each field in the dashboard JSON is explained below with its usage: + +| Name | Usage | +| ---- | ----- | +| **id** | unique dashboard id, an integer | +| **title** | current title of dashboard | +| **originalTitle** | title of dashboard when saved for the first time | +| **tags** | an array of strings storing tags associated with dashboard | +| **style** | theme of dashboard, i.e. dark or light | +| **timezone** | timezone of dashboard, i.e. utc or browser | +| **editable** | whether a dashboard is editable or not | +| **hideControls** | whether row controls on the left in green are hidden or not | +| **sharedCrosshair** | TODO | +| **rows** | row metadata, see rows section for details | +| **time** | time range of dashboard, i.e. last 6 hours, last 7 days, etc | +| **timepicker** | timepicker metadata, see timepicker section for details | +| **templating** | timeplating metadata, see templating section for details | +| **annotations** | annotations metadata, see annotations section for details | +| **schemaVersion** | TODO | +| **version** | TODO | +| **links** | TODO | From 4c1b6f3059111e74464f7410a20fdc4acc3480ab Mon Sep 17 00:00:00 2001 From: utkarshcmu Date: Sun, 1 Nov 2015 23:55:03 -0800 Subject: [PATCH 127/269] Fixed a typo --- docs/sources/reference/dashboard.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/sources/reference/dashboard.md b/docs/sources/reference/dashboard.md index c5bea813802..16481829f82 100644 --- a/docs/sources/reference/dashboard.md +++ b/docs/sources/reference/dashboard.md @@ -98,7 +98,7 @@ Each field in the dashboard JSON is explained below with its usage: | **rows** | row metadata, see rows section for details | | **time** | time range of dashboard, i.e. last 6 hours, last 7 days, etc | | **timepicker** | timepicker metadata, see timepicker section for details | -| **templating** | timeplating metadata, see templating section for details | +| **templating** | templating metadata, see templating section for details | | **annotations** | annotations metadata, see annotations section for details | | **schemaVersion** | TODO | | **version** | TODO | From f54615ed46a1741a5fd23928ff8874ce9f7819cd Mon Sep 17 00:00:00 2001 From: Utkarsh Bhatnagar Date: Mon, 2 Nov 2015 00:21:59 -0800 Subject: [PATCH 128/269] Included rows JSON and TODO headers --- docs/sources/reference/dashboard.md | 104 +++++++++++++++++----------- 1 file changed, 62 insertions(+), 42 deletions(-) diff --git a/docs/sources/reference/dashboard.md b/docs/sources/reference/dashboard.md index 16481829f82..cdef0c75119 100644 --- a/docs/sources/reference/dashboard.md +++ b/docs/sources/reference/dashboard.md @@ -16,11 +16,11 @@ To view the JSON of a dashboard, follow the steps mentioned below: 2. Click on `Manage dashboard` menu on the top navigation bar 3. Select `View JSON` from the dropdown menu -## Basic fields +## JSON fields When a user creates a new dashboard, a new dashboard JSON object is initialized with the following fields: -> Note: In the following JSON, id is shown as null which is the default value assigned to it until the dashboard is not saved. Once saved, an integer value is assigned to the `id` field. +> Note: In the following JSON, id is shown as null which is the default value assigned to it until a dashboard is saved. Once a dashboard is saved, an integer value is assigned to the `id` field. ``` { @@ -33,43 +33,14 @@ When a user creates a new dashboard, a new dashboard JSON object is initialized "editable": true, "hideControls": false, "sharedCrosshair": false, - "rows": [ - { - "height": "250px", - "panels": [], - "title": "Row", - "collapse": false, - "editable": true - } - ], + "rows": [], "time": { "from": "now-6h", "to": "now" }, "timepicker": { - "time_options": [ - "5m", - "15m", - "1h", - "6h", - "12h", - "24h", - "2d", - "7d", - "30d" - ], - "refresh_intervals": [ - "5s", - "10s", - "30s", - "1m", - "5m", - "15m", - "30m", - "1h", - "2h", - "1d" - ] + "time_options": [], + "refresh_intervals": [] }, "templating": { "list": [] @@ -89,17 +60,66 @@ Each field in the dashboard JSON is explained below with its usage: | **id** | unique dashboard id, an integer | | **title** | current title of dashboard | | **originalTitle** | title of dashboard when saved for the first time | -| **tags** | an array of strings storing tags associated with dashboard | -| **style** | theme of dashboard, i.e. dark or light | -| **timezone** | timezone of dashboard, i.e. utc or browser | +| **tags** | tags associated with dashboard, an array of strings | +| **style** | theme of dashboard, i.e. `dark` or `light` | +| **timezone** | timezone of dashboard, i.e. `utc` or `browser` | | **editable** | whether a dashboard is editable or not | | **hideControls** | whether row controls on the left in green are hidden or not | | **sharedCrosshair** | TODO | -| **rows** | row metadata, see rows section for details | -| **time** | time range of dashboard, i.e. last 6 hours, last 7 days, etc | -| **timepicker** | timepicker metadata, see timepicker section for details | -| **templating** | templating metadata, see templating section for details | -| **annotations** | annotations metadata, see annotations section for details | +| **rows** | row metadata, see [rows section](/dashboard/#rows) for details | +| **time** | time range for dashboard, i.e. last 6 hours, last 7 days, etc | +| **timepicker** | timepicker metadata, see [timepicker section](/dashboard/#timepicker) for details | +| **templating** | templating metadata, see [templating section](/dashboard/#templating) for details | +| **annotations** | annotations metadata, see [annotations section](/dashboard/#annotations) for details | | **schemaVersion** | TODO | | **version** | TODO | | **links** | TODO | + +### rows + +`rows` field represents an array of JSON object representing each row in a dashboard, such as shown below: + +``` + "rows": [ + { + "collapse": false, + "editable": true, + "height": "200px", + "panels": [], + "title": "New row" + }, + { + "collapse": true, + "editable": true, + "height": "300px", + "panels": [], + "title": "New row" + } + ] +``` + +Usage of the fields is explained below: + +| Name | Usage | +| ---- | ----- | +| **collapse** | whether row is collapsed or not | +| **editable** | whether a row is editable or not | +| **height** | height of the row in pixels | +| **panels** | panels metadata, see [panels section](/dashboard/#panels) for details | +| **title** | title of row | + +#### panels + +TODO + +### timepicker + +TODO + +### templating + +TODO + +### annotations + +TODO From e51d403420c75adc2f721724244b7d773d871968 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Mon, 2 Nov 2015 15:14:35 +0100 Subject: [PATCH 129/269] rename: moved test file --- .../test/{specs/kbn-format-specs.js => core/utils/kbn_specs.js} | 0 tasks/options/requirejs.js | 1 + 2 files changed, 1 insertion(+) rename public/test/{specs/kbn-format-specs.js => core/utils/kbn_specs.js} (100%) diff --git a/public/test/specs/kbn-format-specs.js b/public/test/core/utils/kbn_specs.js similarity index 100% rename from public/test/specs/kbn-format-specs.js rename to public/test/core/utils/kbn_specs.js diff --git a/tasks/options/requirejs.js b/tasks/options/requirejs.js index 6780eb4bad4..9d0522bd349 100644 --- a/tasks/options/requirejs.js +++ b/tasks/options/requirejs.js @@ -55,6 +55,7 @@ module.exports = function(config,grunt) { // bundle the datasources 'app/plugins/datasource/grafana/datasource', 'app/plugins/datasource/graphite/datasource', + 'app/plugins/datasource/elasticsearch/datasource', 'app/plugins/datasource/influxdb/datasource', ] }, From 36c4d01ef8de654b2846803bc0a5dccebd38a2c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Mon, 2 Nov 2015 17:00:47 +0100 Subject: [PATCH 130/269] feat(tablepanel) began work on new table panel --- public/app/core/settings.js | 1 + .../core/{time_series.js => time_series.ts} | 83 ++++++----- public/app/panels/graph/module.html | 4 - public/app/panels/table/module.html | 4 + public/app/panels/table/module.ts | 136 ++++++++++++++++++ 5 files changed, 192 insertions(+), 36 deletions(-) rename public/app/core/{time_series.js => time_series.ts} (77%) create mode 100644 public/app/panels/table/module.html create mode 100644 public/app/panels/table/module.ts diff --git a/public/app/core/settings.js b/public/app/core/settings.js index b7fb6e53c14..e452b59b904 100644 --- a/public/app/core/settings.js +++ b/public/app/core/settings.js @@ -10,6 +10,7 @@ function (_) { window_title_prefix : 'Grafana - ', panels : { 'graph': { path: 'app/panels/graph', name: 'Graph' }, + 'table': { path: 'app/panels/table', name: 'Table' }, 'singlestat': { path: 'app/panels/singlestat', name: 'Single stat' }, 'text': { path: 'app/panels/text', name: 'Text' }, 'dashlist': { path: 'app/panels/dashlist', name: 'Dashboard list' }, diff --git a/public/app/core/time_series.js b/public/app/core/time_series.ts similarity index 77% rename from public/app/core/time_series.js rename to public/app/core/time_series.ts index 9465232c200..30086be622a 100644 --- a/public/app/core/time_series.js +++ b/public/app/core/time_series.ts @@ -1,11 +1,46 @@ -define([ - 'lodash', - 'app/core/utils/kbn' -], -function (_, kbn) { - 'use strict'; +/// - function TimeSeries(opts) { +import _ = require('lodash'); +import kbn = require('app/core/utils/kbn'); + +function matchSeriesOverride(aliasOrRegex, seriesAlias) { + if (!aliasOrRegex) { return false; } + + if (aliasOrRegex[0] === '/') { + var regex = kbn.stringToJsRegex(aliasOrRegex); + return seriesAlias.match(regex) != null; + } + + return aliasOrRegex === seriesAlias; +} + +function translateFillOption(fill) { + return fill === 0 ? 0.001 : fill/10; +} + +class TimeSeries { + datapoints: any; + id: string; + label: string; + alias: string; + color: string; + valueFormater: any; + stats: any; + legend: boolean; + allIsNull: boolean; + decimals: number; + scaledDecimals: number; + + lines: any; + bars: any; + points: any; + yaxis: any; + zindex: any; + stack: any; + fillBelowTo: any; + transform: any; + + constructor(opts) { this.datapoints = opts.datapoints; this.label = opts.alias; this.id = opts.alias; @@ -16,22 +51,7 @@ function (_, kbn) { this.legend = true; } - function matchSeriesOverride(aliasOrRegex, seriesAlias) { - if (!aliasOrRegex) { return false; } - - if (aliasOrRegex[0] === '/') { - var regex = kbn.stringToJsRegex(aliasOrRegex); - return seriesAlias.match(regex) != null; - } - - return aliasOrRegex === seriesAlias; - } - - function translateFillOption(fill) { - return fill === 0 ? 0.001 : fill/10; - } - - TimeSeries.prototype.applySeriesOverrides = function(overrides) { + applySeriesOverrides(overrides) { this.lines = {}; this.points = {}; this.bars = {}; @@ -64,7 +84,7 @@ function (_, kbn) { } }; - TimeSeries.prototype.getFlotPairs = function (fillStyle) { + getFlotPairs(fillStyle) { var result = []; this.stats.total = 0; @@ -124,18 +144,17 @@ function (_, kbn) { } return result; - }; + } - TimeSeries.prototype.updateLegendValues = function(formater, decimals, scaledDecimals) { + updateLegendValues(formater, decimals, scaledDecimals) { this.valueFormater = formater; this.decimals = decimals; this.scaledDecimals = scaledDecimals; - }; + } - TimeSeries.prototype.formatValue = function(value) { + formatValue(value) { return this.valueFormater(value, this.decimals, this.scaledDecimals); - }; + } +} - return TimeSeries; - -}); +export = TimeSeries; diff --git a/public/app/panels/graph/module.html b/public/app/panels/graph/module.html index b0793780fa8..9c49c42741d 100644 --- a/public/app/panels/graph/module.html +++ b/public/app/panels/graph/module.html @@ -3,10 +3,6 @@
              - - - -
              No datapoints No datapoints returned from metric query diff --git a/public/app/panels/table/module.html b/public/app/panels/table/module.html new file mode 100644 index 00000000000..0463d751817 --- /dev/null +++ b/public/app/panels/table/module.html @@ -0,0 +1,4 @@ + +
              +
              +
              diff --git a/public/app/panels/table/module.ts b/public/app/panels/table/module.ts new file mode 100644 index 00000000000..e65278d44a8 --- /dev/null +++ b/public/app/panels/table/module.ts @@ -0,0 +1,136 @@ +/// + +import angular = require('angular'); +import $ = require('jquery'); +import _ = require('lodash'); +import moment = require('moment'); +import PanelMeta = require('app/features/panel/panel_meta'); +import TimeSeries = require('app/core/time_series'); + +var panelDefaults = { + targets: [{}], +}; + +export class TablePanelCtrl { + + constructor($scope, $rootScope, $q, panelSrv, panelHelper) { + $scope.ctrl = this; + + $scope.panelMeta = new PanelMeta({ + panelName: 'Table', + editIcon: "fa fa-table", + fullscreen: true, + metricsEditor: true, + }); + + $scope.panelMeta.addEditorTab('Options', 'app/panels/table/options.html'); + $scope.panelMeta.addEditorTab('Time range', 'app/features/panel/partials/panelTime.html'); + + _.defaults($scope.panel, panelDefaults); + + $scope.refreshData = function(datasource) { + var data = { + columns: [], + rows: [], + }; + + data.columns.push({text: 'Time'}); + data.columns.push({text: 'Value'}); + data.columns.push({text: 'Value2'}); + data.rows.push([ + moment().format('LLL'), 17.2, 15.12 + ]); + data.rows.push([ + moment().format('LLL'), 12.2, 122.3244 + ]); + data.rows.push([ + moment().format('LLL'), 111.2, 2312.22 + ]); + + panelHelper.broadcastRender($scope, data); + + // panelHelper.updateTimeRange($scope); + // + // return panelHelper.issueMetricQuery($scope, datasource) + // .then($scope.dataHandler, function(err) { + // $scope.seriesList = []; + // $scope.render([]); + // throw err; + // }); + }; + + $scope.dataHandler = function(results) { + $scope.seriesList = _.map(results.data, $scope.seriesHandler); + panelHelper.broadcastRender($scope, $scope.seriesList); + }; + + $scope.seriesHandler = function(seriesData, index) { + var datapoints = seriesData.datapoints; + var alias = seriesData.target; + var colorIndex = index % $rootScope.colors.length; + var color = $scope.panel.aliasColors[alias] || $rootScope.colors[colorIndex]; + + var series = new TimeSeries({ + datapoints: datapoints, + alias: alias, + color: color, + }); + + return series; + }; + + panelSrv.init($scope); + } +} + +export function tablePanelDirective() { + 'use strict'; + return { + restrict: 'E', + templateUrl: 'app/panels/table/module.html', + controller: TablePanelCtrl, + link: function(scope, elem) { + var data; + + function renderPanel() { + var rootDiv = elem.find('.table-panel-container'); + var tableDiv = $('
              '); + var i, y, rowElem, colElem, column, row; + + rowElem = $(''); + for (i = 0; i < data.columns.length; i++) { + column = data.columns[i]; + colElem = $('' + column.text + ''); + rowElem.append(colElem); + } + + tableDiv.append(rowElem); + + for (y = 0; y < data.rows.length; y++) { + row = data.rows[y]; + rowElem = $('') + for (i = 0; i < data.columns.length; i++) { + colElem = $('' + row[i] + ''); + rowElem.append(colElem); + } + tableDiv.append(rowElem); + } + + rootDiv.empty(); + rootDiv.append(tableDiv); + } + + scope.$on('render', function(event, renderData) { + data = renderData || data; + if (!data) { + scope.get_data(); + return; + } + renderPanel(); + }); + } + }; +} + +angular.module('grafana.directives').directive('grafanaPanelTable', tablePanelDirective); + From e8c9b0806abb0ea84e3223d6a87d53f1c9171352 Mon Sep 17 00:00:00 2001 From: Utkarsh Bhatnagar Date: Mon, 2 Nov 2015 10:15:40 -0800 Subject: [PATCH 131/269] Added templating, timepicker, panel docs --- docs/sources/reference/dashboard.md | 305 +++++++++++++++++++++++++++- 1 file changed, 301 insertions(+), 4 deletions(-) diff --git a/docs/sources/reference/dashboard.md b/docs/sources/reference/dashboard.md index cdef0c75119..1a289208e3a 100644 --- a/docs/sources/reference/dashboard.md +++ b/docs/sources/reference/dashboard.md @@ -77,7 +77,7 @@ Each field in the dashboard JSON is explained below with its usage: ### rows -`rows` field represents an array of JSON object representing each row in a dashboard, such as shown below: +`rows` field consists of an array of JSON object representing each row in a dashboard, such as shown below: ``` "rows": [ @@ -110,15 +110,312 @@ Usage of the fields is explained below: #### panels -TODO +Panels are the building blocks a dashboard. It consists of datasource queries, type of graphs, aliases, etc. Panel JSON consists of an array of JSON objects, each representing a different panel in a row. Most of the fields are common for all panels but some fields depends on the panel type. Following is an example of panel JSON representing a `graph` panel type: + +``` +"panels": [ + { + "aliasColors": {}, + "bars": false, + "datasource": null, + "editable": true, + "error": false, + "fill": 0, + "grid": { + "leftLogBase": 1, + "leftMax": null, + "leftMin": null, + "rightLogBase": 1, + "rightMax": null, + "rightMin": null, + "threshold1": null, + "threshold1Color": "rgba(216, 200, 27, 0.27)", + "threshold2": null, + "threshold2Color": "rgba(234, 112, 112, 0.22)" + }, + "id": 1, + "legend": { + "avg": false, + "current": false, + "max": false, + "min": false, + "show": true, + "total": false, + "values": false + }, + "lines": true, + "linewidth": 1, + "links": [], + "nullPointMode": "connected", + "percentage": false, + "pointradius": 5, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "span": 4, + "stack": false, + "steppedLine": false, + "targets": [ + { + "aggregator": "max", + "alias": "$tag_instance_id", + "currentTagKey": "", + "currentTagValue": "", + "downsampleAggregator": "avg", + "downsampleInterval": "", + "errors": {}, + "metric": "memory.percent-used", + "refId": "A", + "shouldComputeRate": false, + "tags": { + "app": "$app", + "env": "stage", + "instance_id": "*" + } + } + ], + "timeFrom": null, + "timeShift": null, + "title": "Memory Utilization", + "tooltip": { + "shared": true, + "value_type": "cumulative" + }, + "type": "graph", + "x-axis": true, + "y-axis": true, + "y_formats": [ + "percent", + "short" + ] + }, + { + "aliasColors": {}, + "bars": false, + "datasource": null, + "editable": true, + "error": false, + "fill": 0, + "grid": { + "leftLogBase": 1, + "leftMax": null, + "leftMin": null, + "rightLogBase": 1, + "rightMax": null, + "rightMin": null, + "threshold1": null, + "threshold1Color": "rgba(216, 200, 27, 0.27)", + "threshold2": null, + "threshold2Color": "rgba(234, 112, 112, 0.22)" + }, + "id": 2, + "legend": { + "avg": false, + "current": false, + "max": false, + "min": false, + "show": true, + "total": false, + "values": false + }, + "lines": true, + "linewidth": 1, + "links": [], + "nullPointMode": "connected", + "percentage": false, + "pointradius": 5, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "span": 4, + "stack": false, + "steppedLine": false, + "targets": [ + { + "aggregator": "avg", + "alias": "$tag_instance_id", + "currentTagKey": "", + "currentTagValue": "", + "downsampleAggregator": "avg", + "downsampleInterval": "", + "errors": {}, + "metric": "memory.percent-cached", + "refId": "A", + "shouldComputeRate": false, + "tags": { + "app": "$app", + "env": "prod", + "instance_id": "*" + } + } + ], + "timeFrom": null, + "timeShift": null, + "title": "Memory Cached", + "tooltip": { + "shared": true, + "value_type": "cumulative" + }, + "type": "graph", + "x-axis": true, + "y-axis": true, + "y_formats": [ + "short", + "short" + ] + }, +``` + +Usage of each field is explained below: + +| Name | Usage | +| ---- | ----- | +| TODO | TODO | ### timepicker -TODO +Description: TODO + +``` +"timepicker": { + "collapse": false, + "enable": true, + "notice": false, + "now": true, + "refresh_intervals": [ + "5s", + "10s", + "30s", + "1m", + "5m", + "15m", + "30m", + "1h", + "2h", + "1d" + ], + "status": "Stable", + "time_options": [ + "5m", + "15m", + "1h", + "3h", + "6h", + "12h", + "24h", + "2d", + "3d", + "4d", + "7d", + "30d" + ], + "type": "timepicker" + } +``` + +Usage of the fields is explained below: + +| Name | Usage | +| ---- | ----- | +| **collapse** | whether timepicker is collapsed or not | +| **enable** | whether timepicker is enabled or not | +| **notice** | TODO | +| **now** | TODO | +| **refresh_intervals** | TODO | +| **status** | TODO | +| **time_options** | TODO | +| **type** | TODO | ### templating -TODO +`templating` fields contains array of template variables with their saved values along with some other metadata, for example: + +``` + "templating": { + "enable": true, + "list": [ + { + "allFormat": "wildcard", + "current": { + "tags": [], + "text": "prod", + "value": "prod" + }, + "datasource": null, + "includeAll": true, + "name": "env", + "options": [ + { + "selected": false, + "text": "All", + "value": "*" + }, + { + "selected": false, + "text": "stage", + "value": "stage" + }, + { + "selected": false, + "text": "test", + "value": "test" + } + ], + "query": "tag_values(cpu.utilization.average,env)", + "refresh": false, + "refresh_on_load": false, + "type": "query" + }, + { + "allFormat": "wildcard", + "current": { + "text": "apache", + "value": "apache" + }, + "datasource": null, + "includeAll": false, + "multi": false, + "multiFormat": "glob", + "name": "app", + "options": [ + { + "selected": true, + "text": "tomcat", + "value": "tomcat" + }, + { + "selected": false, + "text": "cassandra", + "value": "cassandra" + } + ], + "query": "tag_values(cpu.utilization.average,app)", + "refresh_on_load": false, + "regex": "", + "type": "query" + } + ] + } +``` + +Usage of the above mentioned fields in the templating section is explained below: + +| Name | Usage | +| ---- | ----- | +| **enable** | whether templating is enabled or not | +| **list** | an array of objects representing, each representing one template variable | +| **allFormat** | format to use while fetching all values from datasource, eg: `wildcard`, `glob`, `regex`, `pipe`, etc. | +| **current** | shows current selected variable text/value on the dashboard | +| **datasource** | shows datasource for the variables | +| **includeAll** | whether all value option is available or not | +| **multi** | whether multiple values can be selected or not from variable value list | +| **multiFormat** | format to use while fetching timeseries from datasource | +| **name** | name of variable | +| **options** | array of variable text/value pairs available for selection on dashboard | +| **query** | datasource query used to fetch values for a variable | +| **refresh_on_load** | TODO | +| **regex** | TODO | +| **type** | type of variable, i.e. `custom`, `query` or `interval` | ### annotations From f14ef22bb6be96ed2cb1ccc0ec52a903c1e44a82 Mon Sep 17 00:00:00 2001 From: Utkarsh Bhatnagar Date: Mon, 2 Nov 2015 10:25:33 -0800 Subject: [PATCH 132/269] Fixed doc links --- docs/sources/reference/dashboard.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/sources/reference/dashboard.md b/docs/sources/reference/dashboard.md index 1a289208e3a..60064690fb2 100644 --- a/docs/sources/reference/dashboard.md +++ b/docs/sources/reference/dashboard.md @@ -66,11 +66,11 @@ Each field in the dashboard JSON is explained below with its usage: | **editable** | whether a dashboard is editable or not | | **hideControls** | whether row controls on the left in green are hidden or not | | **sharedCrosshair** | TODO | -| **rows** | row metadata, see [rows section](/dashboard/#rows) for details | +| **rows** | row metadata, see [rows section](/dashboard.md/#rows) for details | | **time** | time range for dashboard, i.e. last 6 hours, last 7 days, etc | -| **timepicker** | timepicker metadata, see [timepicker section](/dashboard/#timepicker) for details | -| **templating** | templating metadata, see [templating section](/dashboard/#templating) for details | -| **annotations** | annotations metadata, see [annotations section](/dashboard/#annotations) for details | +| **timepicker** | timepicker metadata, see [timepicker section](/dashboard.md/#timepicker) for details | +| **templating** | templating metadata, see [templating section](/dashboard.md/#templating) for details | +| **annotations** | annotations metadata, see [annotations section](/dashboard.md/#annotations) for details | | **schemaVersion** | TODO | | **version** | TODO | | **links** | TODO | @@ -105,7 +105,7 @@ Usage of the fields is explained below: | **collapse** | whether row is collapsed or not | | **editable** | whether a row is editable or not | | **height** | height of the row in pixels | -| **panels** | panels metadata, see [panels section](/dashboard/#panels) for details | +| **panels** | panels metadata, see [panels section](/dashboard.md/#panels) for details | | **title** | title of row | #### panels From 74b10a42ee66f3fa682ea139be8f560725b2f871 Mon Sep 17 00:00:00 2001 From: Utkarsh Bhatnagar Date: Mon, 2 Nov 2015 10:29:42 -0800 Subject: [PATCH 133/269] Fixed broken links in the doc page --- docs/sources/reference/dashboard.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/sources/reference/dashboard.md b/docs/sources/reference/dashboard.md index 60064690fb2..5b18b9e26ad 100644 --- a/docs/sources/reference/dashboard.md +++ b/docs/sources/reference/dashboard.md @@ -66,11 +66,11 @@ Each field in the dashboard JSON is explained below with its usage: | **editable** | whether a dashboard is editable or not | | **hideControls** | whether row controls on the left in green are hidden or not | | **sharedCrosshair** | TODO | -| **rows** | row metadata, see [rows section](/dashboard.md/#rows) for details | +| **rows** | row metadata, see [rows section](/docs/sources/reference/dashboard.md/#rows) for details | | **time** | time range for dashboard, i.e. last 6 hours, last 7 days, etc | -| **timepicker** | timepicker metadata, see [timepicker section](/dashboard.md/#timepicker) for details | -| **templating** | templating metadata, see [templating section](/dashboard.md/#templating) for details | -| **annotations** | annotations metadata, see [annotations section](/dashboard.md/#annotations) for details | +| **timepicker** | timepicker metadata, see [timepicker section](/docs/sources/reference/dashboard.md/#timepicker) for details | +| **templating** | templating metadata, see [templating section](/docs/sources/reference/dashboard.md/#templating) for details | +| **annotations** | annotations metadata, see [annotations section](/docs/sources/reference/dashboard.md/#annotations) for details | | **schemaVersion** | TODO | | **version** | TODO | | **links** | TODO | @@ -105,7 +105,7 @@ Usage of the fields is explained below: | **collapse** | whether row is collapsed or not | | **editable** | whether a row is editable or not | | **height** | height of the row in pixels | -| **panels** | panels metadata, see [panels section](/dashboard.md/#panels) for details | +| **panels** | panels metadata, see [panels section](/docs/sources/reference/dashboard.md/#panels) for details | | **title** | title of row | #### panels From 8171cd51c472d4cb5b82d9b03530ed2f66fa7c97 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Mon, 2 Nov 2015 20:51:49 +0100 Subject: [PATCH 134/269] feat(tablepanel): minor progress on table panel --- public/app/panels/table/module.html | 10 ++-- public/app/panels/table/module.ts | 60 ++++--------------- .../panels/table/specs/table_model_specs.ts | 28 +++++++++ public/app/panels/table/table_model.ts | 43 +++++++++++++ public/less/grafana.less | 7 ++- .../{dashlist.less => panel_dashlist.less} | 0 public/less/{graph.less => panel_graph.less} | 0 ...{singlestat.less => panel_singlestat.less} | 0 public/less/panel_table.less | 49 +++++++++++++++ 9 files changed, 143 insertions(+), 54 deletions(-) create mode 100644 public/app/panels/table/specs/table_model_specs.ts create mode 100644 public/app/panels/table/table_model.ts rename public/less/{dashlist.less => panel_dashlist.less} (100%) rename public/less/{graph.less => panel_graph.less} (100%) rename public/less/{singlestat.less => panel_singlestat.less} (100%) create mode 100644 public/less/panel_table.less diff --git a/public/app/panels/table/module.html b/public/app/panels/table/module.html index 0463d751817..c85252354dc 100644 --- a/public/app/panels/table/module.html +++ b/public/app/panels/table/module.html @@ -1,4 +1,6 @@ - -
              -
              -
              +
              + +
              +
              +
              +
              diff --git a/public/app/panels/table/module.ts b/public/app/panels/table/module.ts index e65278d44a8..36094dd90b2 100644 --- a/public/app/panels/table/module.ts +++ b/public/app/panels/table/module.ts @@ -6,6 +6,7 @@ import _ = require('lodash'); import moment = require('moment'); import PanelMeta = require('app/features/panel/panel_meta'); import TimeSeries = require('app/core/time_series'); +import {TableModel} from './table_model'; var panelDefaults = { targets: [{}], @@ -29,54 +30,19 @@ export class TablePanelCtrl { _.defaults($scope.panel, panelDefaults); $scope.refreshData = function(datasource) { - var data = { - columns: [], - rows: [], - }; + panelHelper.updateTimeRange($scope); - data.columns.push({text: 'Time'}); - data.columns.push({text: 'Value'}); - data.columns.push({text: 'Value2'}); - data.rows.push([ - moment().format('LLL'), 17.2, 15.12 - ]); - data.rows.push([ - moment().format('LLL'), 12.2, 122.3244 - ]); - data.rows.push([ - moment().format('LLL'), 111.2, 2312.22 - ]); - - panelHelper.broadcastRender($scope, data); - - // panelHelper.updateTimeRange($scope); - // - // return panelHelper.issueMetricQuery($scope, datasource) - // .then($scope.dataHandler, function(err) { - // $scope.seriesList = []; - // $scope.render([]); - // throw err; - // }); + return panelHelper.issueMetricQuery($scope, datasource) + .then($scope.dataHandler, function(err) { + $scope.seriesList = []; + $scope.render([]); + throw err; + }); }; $scope.dataHandler = function(results) { - $scope.seriesList = _.map(results.data, $scope.seriesHandler); - panelHelper.broadcastRender($scope, $scope.seriesList); - }; - - $scope.seriesHandler = function(seriesData, index) { - var datapoints = seriesData.datapoints; - var alias = seriesData.target; - var colorIndex = index % $rootScope.colors.length; - var color = $scope.panel.aliasColors[alias] || $rootScope.colors[colorIndex]; - - var series = new TimeSeries({ - datapoints: datapoints, - alias: alias, - color: color, - }); - - return series; + $scope.tableModel = TableModel.transform(results.data, $scope.panel); + panelHelper.broadcastRender($scope, $scope.tableModel); }; panelSrv.init($scope); @@ -94,13 +60,13 @@ export function tablePanelDirective() { function renderPanel() { var rootDiv = elem.find('.table-panel-container'); - var tableDiv = $('
              '); + var tableDiv = $('
              '); var i, y, rowElem, colElem, column, row; rowElem = $(''); for (i = 0; i < data.columns.length; i++) { column = data.columns[i]; - colElem = $('' + column.text + ''); + colElem = $('' + column.text + ''); rowElem.append(colElem); } @@ -108,7 +74,7 @@ export function tablePanelDirective() { for (y = 0; y < data.rows.length; y++) { row = data.rows[y]; - rowElem = $('') + rowElem = $(''); for (i = 0; i < data.columns.length; i++) { colElem = $('' + row[i] + ''); rowElem.append(colElem); diff --git a/public/app/panels/table/specs/table_model_specs.ts b/public/app/panels/table/specs/table_model_specs.ts new file mode 100644 index 00000000000..7cb9575eb86 --- /dev/null +++ b/public/app/panels/table/specs/table_model_specs.ts @@ -0,0 +1,28 @@ +import {describe, beforeEach, it, sinon, expect} from 'test/lib/common'; + +import {TableModel} from '../table_model'; + +describe('when getting tableData', () => { + + describe('simple time series', () => { + var panel = { + }; + + it ('should return 2 columns', () => { + var data = TableModel.transform([ + { + target: 'test', + datapoints: [[12.12, new Date().getTime()]], + } + ], panel); + + expect(data.columns.length).to.be(2); + expect(data.rows.length).to.be(1); + + expect(data.columns[0].text).to.be('Time'); + expect(data.columns[1].text).to.be('Value'); + }); + + }); + +}); diff --git a/public/app/panels/table/table_model.ts b/public/app/panels/table/table_model.ts new file mode 100644 index 00000000000..0351f30b33b --- /dev/null +++ b/public/app/panels/table/table_model.ts @@ -0,0 +1,43 @@ +/// + +import moment = require('moment'); +import _ = require('lodash'); + +export class TableModel { + columns: any[]; + rows: any[]; + + static transform(data, panel) { + var model = new TableModel(); + + if (!data || data.length === 0) { + return model; + } + + model.columns = [ + {text: 'Time'}, + {text: 'Value'}, + ]; + model.rows = []; + + for (var i = 0; i < data.length; i++) { + var series = data[i]; + for (var y = 0; y < series.datapoints.length; y++) { + var dp = series.datapoints[y]; + var time = moment(dp[1]).format('LLL'); + var value = dp[0]; + if (value === null) { + value = 'null'; + } else if (_.isNumber(value)) { + value = value.toFixed(2); + } + + model.rows.push([time, value]); + } + } + + return model; + } +} + + diff --git a/public/less/grafana.less b/public/less/grafana.less index 6e23faa214d..e82c3b93c01 100644 --- a/public/less/grafana.less +++ b/public/less/grafana.less @@ -1,18 +1,19 @@ @import "type.less"; @import "login.less"; @import "submenu.less"; -@import "graph.less"; +@import "panel_graph.less"; +@import "panel_dashlist.less"; +@import "panel_singlestat.less"; +@import "panel_table.less"; @import "bootstrap-tagsinput.less"; @import "tables_lists.less"; @import "search.less"; @import "panel.less"; @import "forms.less"; -@import "singlestat.less"; @import "tightform.less"; @import "sidemenu.less"; @import "navbar.less"; @import "gfbox.less"; -@import "dashlist.less"; @import "admin.less"; @import "validation.less"; @import "fonts.less"; diff --git a/public/less/dashlist.less b/public/less/panel_dashlist.less similarity index 100% rename from public/less/dashlist.less rename to public/less/panel_dashlist.less diff --git a/public/less/graph.less b/public/less/panel_graph.less similarity index 100% rename from public/less/graph.less rename to public/less/panel_graph.less diff --git a/public/less/singlestat.less b/public/less/panel_singlestat.less similarity index 100% rename from public/less/singlestat.less rename to public/less/panel_singlestat.less diff --git a/public/less/panel_table.less b/public/less/panel_table.less new file mode 100644 index 00000000000..a46fb7e65b9 --- /dev/null +++ b/public/less/panel_table.less @@ -0,0 +1,49 @@ +.table-panel-wrapper { + .panel-content { + padding: 0; + } + .panel-title-container { + padding-bottom: 4px; + } +} + +.gf-table-panel* { + box-sizing: border-box; +} + +.gf-table-panel { + width: 100%; + table-layout: fixed; + border-collapse: collapse; +} + +.gf-table-panel tr { + border-bottom: 2px solid @bodyBackground; +} + +.gf-table-panel th { + background: @grafanaTargetFuncBackground; + padding: 5px 0 5px 15px; + text-align: left; + border-top: 2px solid @bodyBackground; + + &:first-child { + padding-left: 15px; + } +} + +.gf-table-panel td { + padding: 15px 0 15px 15px; + + &:first-child { + padding-left: 15px; + } +} + +.gf-table-panel .ellipsis { + display: block; + width: 100%; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; +} From da9c792ca2edcf79d30569e266c4ea636f86a837 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Tue, 3 Nov 2015 08:18:35 +0100 Subject: [PATCH 135/269] feat(tablepanel): minor progress --- public/app/panels/table/module.ts | 20 ++++++++++++++++++-- public/less/panel_table.less | 4 ++++ 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/public/app/panels/table/module.ts b/public/app/panels/table/module.ts index 36094dd90b2..22b087bdfa4 100644 --- a/public/app/panels/table/module.ts +++ b/public/app/panels/table/module.ts @@ -58,6 +58,15 @@ export function tablePanelDirective() { link: function(scope, elem) { var data; + function getTableHeight() { + var panelHeight = scope.height || scope.panel.height || scope.row.height; + if (_.isString(panelHeight)) { + panelHeight = parseInt(panelHeight.replace('px', ''), 10); + } + + return (panelHeight - 40) + 'px'; + } + function renderPanel() { var rootDiv = elem.find('.table-panel-container'); var tableDiv = $('
              '); @@ -70,8 +79,10 @@ export function tablePanelDirective() { rowElem.append(colElem); } - tableDiv.append(rowElem); + var headElem = $(''); + headElem.append(rowElem); + var tbodyElem = $(''); for (y = 0; y < data.rows.length; y++) { row = data.rows[y]; rowElem = $(''); @@ -79,9 +90,14 @@ export function tablePanelDirective() { colElem = $('' + row[i] + ''); rowElem.append(colElem); } - tableDiv.append(rowElem); + tbodyElem.append(rowElem); } + tableDiv.append(headElem); + tableDiv.append(tbodyElem); + + rootDiv.css({'max-height': getTableHeight()}); + rootDiv.empty(); rootDiv.append(tableDiv); } diff --git a/public/less/panel_table.less b/public/less/panel_table.less index a46fb7e65b9..8cd62cbb76b 100644 --- a/public/less/panel_table.less +++ b/public/less/panel_table.less @@ -7,6 +7,10 @@ } } +.table-panel-container { + overflow: auto; +} + .gf-table-panel* { box-sizing: border-box; } From 867b838053d6a903fcad5d73201225cbb23217a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Tue, 3 Nov 2015 16:19:51 +0100 Subject: [PATCH 136/269] feat(tablepanel): work on table panel --- public/app/panels/graph/styleEditor.html | 2 +- public/app/panels/table/module.ts | 29 ++++--- public/app/panels/table/options.html | 58 +++++++++++++ .../panels/table/specs/table_model_specs.ts | 49 +++++++++-- public/app/panels/table/table_model.ts | 81 ++++++++++++++++--- public/less/panel_table.less | 1 - 6 files changed, 188 insertions(+), 32 deletions(-) create mode 100644 public/app/panels/table/options.html diff --git a/public/app/panels/graph/styleEditor.html b/public/app/panels/graph/styleEditor.html index 5d5f2fd7401..f692328a0fd 100644 --- a/public/app/panels/graph/styleEditor.html +++ b/public/app/panels/graph/styleEditor.html @@ -63,7 +63,7 @@
              Series specific overrides Regex match example: /server[0-3]/i
              -
              +
              • diff --git a/public/app/panels/table/module.ts b/public/app/panels/table/module.ts index 22b087bdfa4..8cb46d6cc46 100644 --- a/public/app/panels/table/module.ts +++ b/public/app/panels/table/module.ts @@ -6,16 +6,13 @@ import _ = require('lodash'); import moment = require('moment'); import PanelMeta = require('app/features/panel/panel_meta'); import TimeSeries = require('app/core/time_series'); -import {TableModel} from './table_model'; - -var panelDefaults = { - targets: [{}], -}; +import {TableModel, transformers} from './table_model'; export class TablePanelCtrl { constructor($scope, $rootScope, $q, panelSrv, panelHelper) { $scope.ctrl = this; + $scope.transformers = transformers; $scope.panelMeta = new PanelMeta({ panelName: 'Table', @@ -27,21 +24,31 @@ export class TablePanelCtrl { $scope.panelMeta.addEditorTab('Options', 'app/panels/table/options.html'); $scope.panelMeta.addEditorTab('Time range', 'app/features/panel/partials/panelTime.html'); + var panelDefaults = { + targets: [{}], + transform: 'timeseries_to_rows' + }; + _.defaults($scope.panel, panelDefaults); $scope.refreshData = function(datasource) { panelHelper.updateTimeRange($scope); return panelHelper.issueMetricQuery($scope, datasource) - .then($scope.dataHandler, function(err) { - $scope.seriesList = []; - $scope.render([]); - throw err; - }); + .then($scope.dataHandler, function(err) { + $scope.seriesList = []; + $scope.render([]); + throw err; + }); }; $scope.dataHandler = function(results) { - $scope.tableModel = TableModel.transform(results.data, $scope.panel); + $scope.dataRaw = results.data; + $scope.render(); + }; + + $scope.render = function() { + $scope.tableModel = TableModel.transform($scope.dataRaw, $scope.panel); panelHelper.broadcastRender($scope, $scope.tableModel); }; diff --git a/public/app/panels/table/options.html b/public/app/panels/table/options.html new file mode 100644 index 00000000000..7f1332b6e18 --- /dev/null +++ b/public/app/panels/table/options.html @@ -0,0 +1,58 @@ +
                +
                +
                Data Table
                +
                +
                  +
                • + Data to Table Transform +
                • +
                • + +
                • +
                +
                +
                +
                +
                + +
                +
                +
                Table Display
                +
                +
                + +
                +
                +
                Column Styles
                + +
                +
                +
                  +
                • + +
                • + +
                • + alias or regex +
                • + +
                • + +
                • + + +
                +
                +
                +
                + + +
                +
                + diff --git a/public/app/panels/table/specs/table_model_specs.ts b/public/app/panels/table/specs/table_model_specs.ts index 7cb9575eb86..04106100392 100644 --- a/public/app/panels/table/specs/table_model_specs.ts +++ b/public/app/panels/table/specs/table_model_specs.ts @@ -4,25 +4,62 @@ import {TableModel} from '../table_model'; describe('when getting tableData', () => { - describe('simple time series', () => { + describe('timeseries_to_rows', () => { var panel = { + transform: 'timeseries_to_rows' }; - it ('should return 2 columns', () => { + it ('should return 2 rows', () => { var data = TableModel.transform([ { - target: 'test', + target: 'series1', + datapoints: [[12.12, new Date().getTime()]], + }, + { + target: 'series2', datapoints: [[12.12, new Date().getTime()]], } ], panel); - expect(data.columns.length).to.be(2); + expect(data.columns.length).to.be(3); + expect(data.rows.length).to.be(2); + + expect(data.columns[0].text).to.be('Time'); + expect(data.columns[1].text).to.be('Series'); + expect(data.columns[2].text).to.be('Value'); + expect(data.rows[0][1]).to.be('series1'); + expect(data.rows[0][2]).to.be('12.12'); + + expect(data.rows[1][1]).to.be('series2'); + }); + }); + + describe('timeseries_to_rows', () => { + var panel = { + transform: 'timeseries_to_columns' + }; + + it ('should return 3 columns', () => { + var data = TableModel.transform([ + { + target: 'series1', + datapoints: [[12.12, new Date().getTime()]], + }, + { + target: 'series2', + datapoints: [[16.12, new Date().getTime()]], + } + ], panel); + + expect(data.columns.length).to.be(3); expect(data.rows.length).to.be(1); expect(data.columns[0].text).to.be('Time'); - expect(data.columns[1].text).to.be('Value'); + expect(data.columns[1].text).to.be('series1'); + expect(data.columns[2].text).to.be('series2'); + expect(data.rows[0][1]).to.be('12.12'); + expect(data.rows[0][2]).to.be('16.12'); }); - }); }); diff --git a/public/app/panels/table/table_model.ts b/public/app/panels/table/table_model.ts index 0351f30b33b..9410c36badf 100644 --- a/public/app/panels/table/table_model.ts +++ b/public/app/panels/table/table_model.ts @@ -3,21 +3,17 @@ import moment = require('moment'); import _ = require('lodash'); -export class TableModel { - columns: any[]; - rows: any[]; - - static transform(data, panel) { - var model = new TableModel(); - - if (!data || data.length === 0) { - return model; - } +var transformers = {}; +transformers['timeseries_to_rows'] = { + description: 'Time series to rows', + transform: function(data, panel, model) { model.columns = [ {text: 'Time'}, + {text: 'Series'}, {text: 'Value'}, ]; + model.rows = []; for (var i = 0; i < data.length; i++) { @@ -32,12 +28,71 @@ export class TableModel { value = value.toFixed(2); } - model.rows.push([time, value]); + model.rows.push([time, series.target, value]); + } + } + }, +}; + +transformers['timeseries_to_columns'] = { + description: 'Time series to columns', + transform: function(data, panel, model) { + model.columns = [{text: 'Time'}]; + model.rows = []; + + var points = {}; + + for (var i = 0; i < data.length; i++) { + var series = data[i]; + model.columns.push({text: series.target}); + + for (var y = 0; y < series.datapoints.length; y++) { + var dp = series.datapoints[y]; + var time = dp[1]; + if (!points[time]) { + points[time] = {}; + points[time][i] = [dp[0]]; + } + else { + points[time][i] = dp[0]; + } } } + for (var time in points) { + var point = points[time]; + var values = [time]; + + for (var i = 0; i < data.length; i++) { + if (point[i] !== undefined) { + values.push(point[i]); + } + } + + model.rows.push(values); + } + } +}; + +export {transformers} + +export class TableModel { + columns: any[]; + rows: any[]; + + static transform(data, panel) { + var model = new TableModel(); + + if (!data || data.length === 0) { + return model; + } + + var transformer = transformers[panel.transform]; + if (!transformer) { + throw {message: 'Transformer ' + panel.transformer + ' not found'}; + } + + transformer.transform(data, panel, model); return model; } } - - diff --git a/public/less/panel_table.less b/public/less/panel_table.less index 8cd62cbb76b..8f7dea39f9a 100644 --- a/public/less/panel_table.less +++ b/public/less/panel_table.less @@ -17,7 +17,6 @@ .gf-table-panel { width: 100%; - table-layout: fixed; border-collapse: collapse; } From 6062930f9a69374670ff671ad1961f7f7db08a01 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Wed, 4 Nov 2015 09:41:03 +0100 Subject: [PATCH 137/269] feat(tablepanel): added more unit tests for table transforms --- public/app/panels/table/module.ts | 8 +- public/app/panels/table/options.html | 11 ++- .../panels/table/specs/table_model_specs.ts | 65 -------------- .../panels/table/specs/transformers_specs.ts | 72 ++++++++++++++++ public/app/panels/table/table_model.ts | 78 +---------------- public/app/panels/table/transformers.ts | 84 +++++++++++++++++++ 6 files changed, 172 insertions(+), 146 deletions(-) delete mode 100644 public/app/panels/table/specs/table_model_specs.ts create mode 100644 public/app/panels/table/specs/transformers_specs.ts create mode 100644 public/app/panels/table/transformers.ts diff --git a/public/app/panels/table/module.ts b/public/app/panels/table/module.ts index 8cb46d6cc46..6103e11113b 100644 --- a/public/app/panels/table/module.ts +++ b/public/app/panels/table/module.ts @@ -6,7 +6,9 @@ import _ = require('lodash'); import moment = require('moment'); import PanelMeta = require('app/features/panel/panel_meta'); import TimeSeries = require('app/core/time_series'); -import {TableModel, transformers} from './table_model'; + +import {TableModel} from './table_model'; +import {transformers} from './transformers'; export class TablePanelCtrl { @@ -26,7 +28,9 @@ export class TablePanelCtrl { var panelDefaults = { targets: [{}], - transform: 'timeseries_to_rows' + transform: 'timeseries_to_rows', + pageSize: 50, + showHeader: true, }; _.defaults($scope.panel, panelDefaults); diff --git a/public/app/panels/table/options.html b/public/app/panels/table/options.html index 7f1332b6e18..717259df40f 100644 --- a/public/app/panels/table/options.html +++ b/public/app/panels/table/options.html @@ -1,10 +1,10 @@
                -
                Data Table
                +
                Data
                • - Data to Table Transform + To Table Transform
                • +
                diff --git a/public/app/panels/table/specs/table_model_specs.ts b/public/app/panels/table/specs/table_model_specs.ts deleted file mode 100644 index 04106100392..00000000000 --- a/public/app/panels/table/specs/table_model_specs.ts +++ /dev/null @@ -1,65 +0,0 @@ -import {describe, beforeEach, it, sinon, expect} from 'test/lib/common'; - -import {TableModel} from '../table_model'; - -describe('when getting tableData', () => { - - describe('timeseries_to_rows', () => { - var panel = { - transform: 'timeseries_to_rows' - }; - - it ('should return 2 rows', () => { - var data = TableModel.transform([ - { - target: 'series1', - datapoints: [[12.12, new Date().getTime()]], - }, - { - target: 'series2', - datapoints: [[12.12, new Date().getTime()]], - } - ], panel); - - expect(data.columns.length).to.be(3); - expect(data.rows.length).to.be(2); - - expect(data.columns[0].text).to.be('Time'); - expect(data.columns[1].text).to.be('Series'); - expect(data.columns[2].text).to.be('Value'); - expect(data.rows[0][1]).to.be('series1'); - expect(data.rows[0][2]).to.be('12.12'); - - expect(data.rows[1][1]).to.be('series2'); - }); - }); - - describe('timeseries_to_rows', () => { - var panel = { - transform: 'timeseries_to_columns' - }; - - it ('should return 3 columns', () => { - var data = TableModel.transform([ - { - target: 'series1', - datapoints: [[12.12, new Date().getTime()]], - }, - { - target: 'series2', - datapoints: [[16.12, new Date().getTime()]], - } - ], panel); - - expect(data.columns.length).to.be(3); - expect(data.rows.length).to.be(1); - - expect(data.columns[0].text).to.be('Time'); - expect(data.columns[1].text).to.be('series1'); - expect(data.columns[2].text).to.be('series2'); - expect(data.rows[0][1]).to.be('12.12'); - expect(data.rows[0][2]).to.be('16.12'); - }); - }); - -}); diff --git a/public/app/panels/table/specs/transformers_specs.ts b/public/app/panels/table/specs/transformers_specs.ts new file mode 100644 index 00000000000..cbe4fd6312b --- /dev/null +++ b/public/app/panels/table/specs/transformers_specs.ts @@ -0,0 +1,72 @@ +import {describe, beforeEach, it, sinon, expect} from 'test/lib/common'; + +import {TableModel} from '../table_model'; + +describe('when transforming time series table', () => { + var table; + + describe('given 2 time series', () => { + var time = new Date().getTime(); + var timeSeries = [ + { + target: 'series1', + datapoints: [[12.12, time], [14.44, time+1]], + }, + { + target: 'series2', + datapoints: [[16.12, time]], + } + ]; + + describe('timeseries_to_rows', () => { + var panel = {transform: 'timeseries_to_rows'}; + + beforeEach(() => { + table = TableModel.transform(timeSeries, panel); + }); + + it('should return 3 rows', () => { + expect(table.rows.length).to.be(3); + expect(table.rows[0][1]).to.be('series1'); + expect(table.rows[1][1]).to.be('series1'); + expect(table.rows[2][1]).to.be('series2'); + expect(table.rows[0][2]).to.be('12.12'); + }); + + it('should return 3 rows', () => { + expect(table.columns.length).to.be(3); + expect(table.columns[0].text).to.be('Time'); + expect(table.columns[1].text).to.be('Series'); + expect(table.columns[2].text).to.be('Value'); + }); + }); + + describe('timeseries_to_columns', () => { + var panel = { + transform: 'timeseries_to_columns' + }; + + beforeEach(() => { + table = TableModel.transform(timeSeries, panel); + }); + + it ('should return 3 columns', () => { + expect(table.columns.length).to.be(3); + expect(table.columns[0].text).to.be('Time'); + expect(table.columns[1].text).to.be('series1'); + expect(table.columns[2].text).to.be('series2'); + }); + + it ('should return 2 rows', () => { + expect(table.rows.length).to.be(2); + expect(table.rows[0][1]).to.be('12.12'); + expect(table.rows[0][2]).to.be('16.12'); + }); + + it ('should show - when no value for timestamp', () => { + expect(table.rows[1][2]).to.be('-'); + }); + }); + }); +}); + diff --git a/public/app/panels/table/table_model.ts b/public/app/panels/table/table_model.ts index 9410c36badf..528d250fb99 100644 --- a/public/app/panels/table/table_model.ts +++ b/public/app/panels/table/table_model.ts @@ -1,80 +1,4 @@ -/// - -import moment = require('moment'); -import _ = require('lodash'); - -var transformers = {}; - -transformers['timeseries_to_rows'] = { - description: 'Time series to rows', - transform: function(data, panel, model) { - model.columns = [ - {text: 'Time'}, - {text: 'Series'}, - {text: 'Value'}, - ]; - - model.rows = []; - - for (var i = 0; i < data.length; i++) { - var series = data[i]; - for (var y = 0; y < series.datapoints.length; y++) { - var dp = series.datapoints[y]; - var time = moment(dp[1]).format('LLL'); - var value = dp[0]; - if (value === null) { - value = 'null'; - } else if (_.isNumber(value)) { - value = value.toFixed(2); - } - - model.rows.push([time, series.target, value]); - } - } - }, -}; - -transformers['timeseries_to_columns'] = { - description: 'Time series to columns', - transform: function(data, panel, model) { - model.columns = [{text: 'Time'}]; - model.rows = []; - - var points = {}; - - for (var i = 0; i < data.length; i++) { - var series = data[i]; - model.columns.push({text: series.target}); - - for (var y = 0; y < series.datapoints.length; y++) { - var dp = series.datapoints[y]; - var time = dp[1]; - if (!points[time]) { - points[time] = {}; - points[time][i] = [dp[0]]; - } - else { - points[time][i] = dp[0]; - } - } - } - - for (var time in points) { - var point = points[time]; - var values = [time]; - - for (var i = 0; i < data.length; i++) { - if (point[i] !== undefined) { - values.push(point[i]); - } - } - - model.rows.push(values); - } - } -}; - -export {transformers} +import {transformers} from './transformers'; export class TableModel { columns: any[]; diff --git a/public/app/panels/table/transformers.ts b/public/app/panels/table/transformers.ts new file mode 100644 index 00000000000..7617f03c413 --- /dev/null +++ b/public/app/panels/table/transformers.ts @@ -0,0 +1,84 @@ +/// + +import moment = require('moment'); +import _ = require('lodash'); + +var transformers = {}; + +transformers['timeseries_to_rows'] = { + description: 'Time series to rows', + transform: function(data, panel, model) { + model.columns = [ + {text: 'Time'}, + {text: 'Series'}, + {text: 'Value'}, + ]; + + model.rows = []; + + for (var i = 0; i < data.length; i++) { + var series = data[i]; + for (var y = 0; y < series.datapoints.length; y++) { + var dp = series.datapoints[y]; + var time = moment(dp[1]).format('LLL'); + var value = dp[0]; + if (value === null) { + value = 'null'; + } else if (_.isNumber(value)) { + value = value.toFixed(2); + } + + model.rows.push([time, series.target, value]); + } + } + }, +}; + +transformers['timeseries_to_columns'] = { + description: 'Time series to columns', + transform: function(data, panel, model) { + model.columns = [{text: 'Time'}]; + model.rows = []; + + // group by time + var points = {}; + + for (var i = 0; i < data.length; i++) { + var series = data[i]; + model.columns.push({text: series.target}); + + for (var y = 0; y < series.datapoints.length; y++) { + var dp = series.datapoints[y]; + var timeKey = dp[1].toString(); + + if (!points[timeKey]) { + points[timeKey] = {time: dp[1]}; + points[timeKey][i] = dp[0]; + } + else { + points[timeKey][i] = dp[0]; + } + } + } + + for (var time in points) { + var point = points[time]; + var values = [moment(point.time).format('LLL')]; + + for (var i = 0; i < data.length; i++) { + var value = point[i]; + if (_.isNumber(value)) { + values.push(value.toFixed(2)); + } else { + values.push('-'); + } + } + + model.rows.push(values); + } + } +}; + +export {transformers} + + From fdeeb73587180417cd1524cbf8f1cb94c31fedd4 Mon Sep 17 00:00:00 2001 From: utkarshcmu Date: Wed, 4 Nov 2015 02:27:35 -0800 Subject: [PATCH 138/269] AWS Region as a mandatory field --- public/app/plugins/datasource/cloudwatch/partials/config.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/app/plugins/datasource/cloudwatch/partials/config.html b/public/app/plugins/datasource/cloudwatch/partials/config.html index 60c645c33f9..15d747ac937 100644 --- a/public/app/plugins/datasource/cloudwatch/partials/config.html +++ b/public/app/plugins/datasource/cloudwatch/partials/config.html @@ -20,7 +20,7 @@ Default RegionSpecify the region, such as for US West (Oregon) use ` us-west-2 ` as the region.
              • - +
              From 93b4f3fac8fdda0c48a0a69f35ab90a6e3019a38 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Wed, 4 Nov 2015 12:56:53 +0100 Subject: [PATCH 139/269] feat(tablepanel): minor progress on table panel --- public/app/panels/table/module.html | 2 + public/app/panels/table/module.ts | 69 +++++++++++----- public/app/panels/table/options.html | 19 +++-- public/less/grafana.less | 1 + public/less/pagination.less | 113 +++++++++++++++++++++++++++ public/less/panel_table.less | 12 ++- 6 files changed, 187 insertions(+), 29 deletions(-) create mode 100644 public/less/pagination.less diff --git a/public/app/panels/table/module.html b/public/app/panels/table/module.html index c85252354dc..75d428acf6a 100644 --- a/public/app/panels/table/module.html +++ b/public/app/panels/table/module.html @@ -2,5 +2,7 @@
              +
              diff --git a/public/app/panels/table/module.ts b/public/app/panels/table/module.ts index 6103e11113b..f4da7161f6f 100644 --- a/public/app/panels/table/module.ts +++ b/public/app/panels/table/module.ts @@ -15,6 +15,7 @@ export class TablePanelCtrl { constructor($scope, $rootScope, $q, panelSrv, panelHelper) { $scope.ctrl = this; $scope.transformers = transformers; + $scope.pageIndex = 0; $scope.panelMeta = new PanelMeta({ panelName: 'Table', @@ -68,6 +69,7 @@ export function tablePanelDirective() { controller: TablePanelCtrl, link: function(scope, elem) { var data; + var panel = scope.panel; function getTableHeight() { var panelHeight = scope.height || scope.panel.height || scope.row.height; @@ -78,39 +80,67 @@ export function tablePanelDirective() { return (panelHeight - 40) + 'px'; } - function renderPanel() { - var rootDiv = elem.find('.table-panel-container'); - var tableDiv = $('
              '); - var i, y, rowElem, colElem, column, row; - - rowElem = $(''); - for (i = 0; i < data.columns.length; i++) { - column = data.columns[i]; - colElem = $('' + column.text + ''); + function appendTableHeader(tableElem) { + var rowElem = $(''); + for (var i = 0; i < data.columns.length; i++) { + var column = data.columns[i]; + var colElem = $('' + column.text + ''); rowElem.append(colElem); } var headElem = $(''); headElem.append(rowElem); + headElem.appendTo(tableElem); + } + function appendTableRows(tableElem) { var tbodyElem = $(''); - for (y = 0; y < data.rows.length; y++) { - row = data.rows[y]; - rowElem = $(''); - for (i = 0; i < data.columns.length; i++) { - colElem = $('' + row[i] + ''); + var rowEnd = Math.min(panel.pageSize, data.rows.length); + var rowStart = 0; + + for (var y = rowStart; y < rowEnd; y++) { + var row = data.rows[y]; + var rowElem = $(''); + for (var i = 0; i < data.columns.length; i++) { + var colElem = $('' + row[i] + ''); rowElem.append(colElem); } tbodyElem.append(rowElem); } - tableDiv.append(headElem); - tableDiv.append(tbodyElem); + tableElem.append(tbodyElem); + } - rootDiv.css({'max-height': getTableHeight()}); + function appendPaginationControls(footerElem) { + var paginationElem = $('
            • ' + (i+1) + '
            • '); + paginationList.append(pageLinkElem); + } + + var nextLink = $('
            • »
            • '); + paginationList.append(nextLink); + paginationElem.append(paginationList); + + footerElem.empty(); + footerElem.append(paginationElem); + } + + function renderPanel() { + var rootElem = elem.find('.table-panel-container'); + var footerElem = elem.find('.table-panel-footer'); + var tableElem = $('
              '); + + appendTableHeader(tableElem); + appendTableRows(tableElem); + + rootElem.css({'max-height': getTableHeight()}); + rootElem.empty(); + rootElem.append(tableElem); + appendPaginationControls(footerElem); } scope.$on('render', function(event, renderData) { @@ -126,4 +156,3 @@ export function tablePanelDirective() { } angular.module('grafana.directives').directive('grafanaPanelTable', tablePanelDirective); - diff --git a/public/app/panels/table/options.html b/public/app/panels/table/options.html index 717259df40f..8c91cc1ecf9 100644 --- a/public/app/panels/table/options.html +++ b/public/app/panels/table/options.html @@ -21,14 +21,19 @@
              Table Display
              +
              +
                +
              • + Pagination (Page size) +
              • +
              • + +
              • +
              +
              +
              -
            • - Pagination (Page size) -
            • -
            • - -
            • diff --git a/public/less/grafana.less b/public/less/grafana.less index e82c3b93c01..041c0112481 100644 --- a/public/less/grafana.less +++ b/public/less/grafana.less @@ -15,6 +15,7 @@ @import "navbar.less"; @import "gfbox.less"; @import "admin.less"; +@import "pagination.less"; @import "validation.less"; @import "fonts.less"; @import "tabs.less"; diff --git a/public/less/pagination.less b/public/less/pagination.less new file mode 100644 index 00000000000..6e292e5ab37 --- /dev/null +++ b/public/less/pagination.less @@ -0,0 +1,113 @@ +.pagination { +} + +.pagination ul { + display: inline-block; + margin-left: 0; + margin-bottom: 0; + .border-radius(@baseBorderRadius); + .box-shadow(0 1px 2px rgba(0,0,0,.05)); +} +.pagination ul > li { + display: inline; // Remove list-style and block-level defaults +} +.pagination ul > li > a, +.pagination ul > li > span { + float: left; // Collapse white-space + padding: 4px 12px; + line-height: @baseLineHeight; + text-decoration: none; + background-color: @paginationBackground; + border: 1px solid @paginationBorder; + border-left-width: 0; +} +.pagination ul > li > a:hover, +.pagination ul > li > a:focus, +.pagination ul > .active > a, +.pagination ul > .active > span { + background-color: @paginationActiveBackground; +} +.pagination ul > .active > a, +.pagination ul > .active > span { + color: @grayLight; + cursor: default; +} +.pagination ul > .disabled > span, +.pagination ul > .disabled > a, +.pagination ul > .disabled > a:hover, +.pagination ul > .disabled > a:focus { + color: @grayLight; + background-color: transparent; + cursor: default; +} +.pagination ul > li:first-child > a, +.pagination ul > li:first-child > span { + border-left-width: 1px; + .border-left-radius(@baseBorderRadius); +} +.pagination ul > li:last-child > a, +.pagination ul > li:last-child > span { + .border-right-radius(@baseBorderRadius); +} + + +// Alignment +// -------------------------------------------------- + +.pagination-centered { + text-align: center; +} +.pagination-right { + text-align: right; +} + + +// Sizing +// -------------------------------------------------- + +// Large +.pagination-large { + ul > li > a, + ul > li > span { + padding: @paddingLarge; + font-size: @fontSizeLarge; + } + ul > li:first-child > a, + ul > li:first-child > span { + .border-left-radius(@borderRadiusLarge); + } + ul > li:last-child > a, + ul > li:last-child > span { + .border-right-radius(@borderRadiusLarge); + } +} + +// Small and mini +.pagination-mini, +.pagination-small { + ul > li:first-child > a, + ul > li:first-child > span { + .border-left-radius(@borderRadiusSmall); + } + ul > li:last-child > a, + ul > li:last-child > span { + .border-right-radius(@borderRadiusSmall); + } +} + +// Small +.pagination-small { + ul > li > a, + ul > li > span { + padding: @paddingSmall; + font-size: @fontSizeSmall; + } +} +// Mini +.pagination-mini { + ul > li > a, + ul > li > span { + padding: @paddingMini; + font-size: @fontSizeMini; + } +} diff --git a/public/less/panel_table.less b/public/less/panel_table.less index 8f7dea39f9a..272f5a5c3dc 100644 --- a/public/less/panel_table.less +++ b/public/less/panel_table.less @@ -11,6 +11,13 @@ overflow: auto; } +.table-panel-footer { + text-align: center; + .pagination { + display: inline-block; + } +} + .gf-table-panel* { box-sizing: border-box; } @@ -25,10 +32,11 @@ } .gf-table-panel th { - background: @grafanaTargetFuncBackground; + background: @grafanaListAccent; padding: 5px 0 5px 15px; text-align: left; border-top: 2px solid @bodyBackground; + color: @blue; &:first-child { padding-left: 15px; @@ -36,7 +44,7 @@ } .gf-table-panel td { - padding: 15px 0 15px 15px; + padding: 12px 0 12px 15px; &:first-child { padding-left: 15px; From 7387f2e490ac6b6eadd8bd2487f18d1154c65998 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Wed, 4 Nov 2015 17:23:16 +0100 Subject: [PATCH 140/269] feat(tablepanel): fixed header, and pagination styling --- public/app/panels/table/module.html | 16 +++++ public/app/panels/table/module.ts | 26 +++---- public/app/panels/table/transformers.ts | 10 ++- public/less/panel_table.less | 91 ++++++++++++++++--------- 4 files changed, 95 insertions(+), 48 deletions(-) diff --git a/public/app/panels/table/module.html b/public/app/panels/table/module.html index 75d428acf6a..1ceb7f52647 100644 --- a/public/app/panels/table/module.html +++ b/public/app/panels/table/module.html @@ -1,6 +1,22 @@
              +
              +
              + + + + + + + + +
              +
              + {{col.text}} +
              +
              +
              diff --git a/public/app/panels/table/module.ts b/public/app/panels/table/module.ts index f4da7161f6f..deae2aaed89 100644 --- a/public/app/panels/table/module.ts +++ b/public/app/panels/table/module.ts @@ -53,8 +53,8 @@ export class TablePanelCtrl { }; $scope.render = function() { - $scope.tableModel = TableModel.transform($scope.dataRaw, $scope.panel); - panelHelper.broadcastRender($scope, $scope.tableModel); + $scope.table = TableModel.transform($scope.dataRaw, $scope.panel); + panelHelper.broadcastRender($scope, $scope.table); }; panelSrv.init($scope); @@ -93,8 +93,8 @@ export function tablePanelDirective() { headElem.appendTo(tableElem); } - function appendTableRows(tableElem) { - var tbodyElem = $(''); + function appendTableRows(tbodyElem) { + var rowElements = $(document.createDocumentFragment()); var rowEnd = Math.min(panel.pageSize, data.rows.length); var rowStart = 0; @@ -105,14 +105,14 @@ export function tablePanelDirective() { var colElem = $('' + row[i] + ''); rowElem.append(colElem); } - tbodyElem.append(rowElem); + rowElements.append(rowElem); } - tableElem.append(tbodyElem); + tbodyElem.empty(); + tbodyElem.append(rowElements); } function appendPaginationControls(footerElem) { - var paginationElem = $('
            From 0a1af65a4cdaf63b049d2ffb92f62ae812dbea7b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Thu, 5 Nov 2015 07:43:06 +0100 Subject: [PATCH 143/269] feat(tablepanel): more column style rules --- public/app/panels/table/controller.ts | 44 ++++-- public/app/panels/table/module.ts | 7 +- public/app/panels/table/options.html | 132 +++++++++--------- .../panels/table/specs/transformers_specs.ts | 10 +- 4 files changed, 111 insertions(+), 82 deletions(-) diff --git a/public/app/panels/table/controller.ts b/public/app/panels/table/controller.ts index 281deec2852..4ae5a1807fa 100644 --- a/public/app/panels/table/controller.ts +++ b/public/app/panels/table/controller.ts @@ -37,15 +37,18 @@ export class TablePanelCtrl { transform: 'timeseries_to_rows', pageSize: 50, showHeader: true, - columns: [{ - pattern: '/.*/', - unit: 'short', - decimals: 2, - colors: ["rgba(245, 54, 54, 0.9)", "rgba(237, 129, 40, 0.89)", "rgba(50, 172, 45, 0.97)"], - }], + columns: [], }; - _.defaults($scope.panel, panelDefaults); + $scope.init = function() { + _.defaults($scope.panel, panelDefaults); + + if ($scope.panel.columns.length === 0) { + $scope.addColumnStyle(); + } + + panelSrv.init($scope); + }; $scope.setUnitFormat = function(column, subItem) { column.unit = subItem.value; @@ -73,7 +76,32 @@ export class TablePanelCtrl { panelHelper.broadcastRender($scope, $scope.table); }; - panelSrv.init($scope); + $scope.getColumnNames = function() { + if (!$scope.table) { + return []; + } + return _.map($scope.table.columns, function(col: any) { + return col.text; + }); + }; + + $scope.addColumnStyle = function() { + var columnStyleDefaults = { + unit: 'short', + decimals: 2, + colors: ["rgba(245, 54, 54, 0.9)", "rgba(237, 129, 40, 0.89)", "rgba(50, 172, 45, 0.97)"], + pattern: '/.*/', + colorMode: 'value', + }; + + $scope.panel.columns.push(angular.copy(columnStyleDefaults)); + }; + + $scope.removeColumnStyle = function(col) { + $scope.panel.columns = _.without($scope.panel.columns, col); + }; + + $scope.init(); } } diff --git a/public/app/panels/table/module.ts b/public/app/panels/table/module.ts index b804336efc4..39cd1056290 100644 --- a/public/app/panels/table/module.ts +++ b/public/app/panels/table/module.ts @@ -42,10 +42,10 @@ export function tablePanelDirective() { function createColumnFormater(style) { return function(v) { - if (v === null) { + if (v === null || v === void 0) { return '-'; } - if (_.isString(v)) { + if (_.isString(v) || style) { return v; } let valueFormater = kbn.valueFormats[style.unit]; @@ -79,7 +79,8 @@ export function tablePanelDirective() { let rowElements = $(document.createDocumentFragment()); let rowEnd = Math.min(panel.pageSize, data.rows.length); let rowStart = 0; - + // reset formater cache + formaters = []; for (var y = rowStart; y < rowEnd; y++) { let row = data.rows[y]; diff --git a/public/app/panels/table/options.html b/public/app/panels/table/options.html index f92241d53ec..c1d4ca658ac 100644 --- a/public/app/panels/table/options.html +++ b/public/app/panels/table/options.html @@ -41,76 +41,76 @@
            Column Styles
            -
            -
            -
              -
            • - -
            • - -
            • - Name or regex -
            • - -
            • - -
            • - -
            • - Unit -
            • - -
            • - Decimals -
            • -
            • - -
            • -
            -
            -
            -
            -
              -
            • - -
            • -
            • - Coloring -
            • -
            • - +
            • +
            • + Unit +
            • + +
            • + Decimals +
            • +
            • + +
            • +
            +
            +
            +
            +
              +
            • + +
            • +
            • + Coloring +
            • +
            • + -
            • -
            • - ThresholdsComma seperated values -
            • -
            • - -
            • -
            • - Colors -
            • -
            • - - - -
            • -
            • - invert order -
            • -
            -
            + ng-change="render()" + style="width: 150px" + > +
          • +
          • + ThresholdsComma seperated values +
          • +
          • + +
          • +
          • + Colors +
          • +
          • + + + +
          • +
          • + invert order +
          • +
          +
          +
          -
          -
          diff --git a/public/app/panels/table/specs/transformers_specs.ts b/public/app/panels/table/specs/transformers_specs.ts index cbe4fd6312b..ea3eb609976 100644 --- a/public/app/panels/table/specs/transformers_specs.ts +++ b/public/app/panels/table/specs/transformers_specs.ts @@ -30,7 +30,7 @@ describe('when transforming time series table', () => { expect(table.rows[0][1]).to.be('series1'); expect(table.rows[1][1]).to.be('series1'); expect(table.rows[2][1]).to.be('series2'); - expect(table.rows[0][2]).to.be('12.12'); + expect(table.rows[0][2]).to.be(12.12); }); it('should return 3 rows', () => { @@ -59,12 +59,12 @@ describe('when transforming time series table', () => { it ('should return 2 rows', () => { expect(table.rows.length).to.be(2); - expect(table.rows[0][1]).to.be('12.12'); - expect(table.rows[0][2]).to.be('16.12'); + expect(table.rows[0][1]).to.be(12.12); + expect(table.rows[0][2]).to.be(16.12); }); - it ('should show - when no value for timestamp', () => { - expect(table.rows[1][2]).to.be('-'); + it ('should be undefined when no value for timestamp', () => { + expect(table.rows[1][2]).to.be(undefined); }); }); }); From 7d3146ed8d45a8d67a1381821a39cd6e5d2a59ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Thu, 5 Nov 2015 08:36:51 +0100 Subject: [PATCH 144/269] feat(tablepanel): fixed header, and pagination styling --- public/app/panels/table/table_model.ts | 5 +++ .../datasource/elasticsearch/datasource.js | 5 +-- .../datasource/elasticsearch/metric_agg.js | 8 +++-- .../elasticsearch/partials/metricAgg.html | 2 +- .../datasource/elasticsearch/query_def.js | 17 +++++----- .../elasticsearch/specs/datasource_specs.ts | 32 +++++++++++++++++++ 6 files changed, 56 insertions(+), 13 deletions(-) diff --git a/public/app/panels/table/table_model.ts b/public/app/panels/table/table_model.ts index 528d250fb99..943234bcd89 100644 --- a/public/app/panels/table/table_model.ts +++ b/public/app/panels/table/table_model.ts @@ -4,6 +4,11 @@ export class TableModel { columns: any[]; rows: any[]; + constructor() { + this.columns = []; + this.rows = []; + } + static transform(data, panel) { var model = new TableModel(); diff --git a/public/app/plugins/datasource/elasticsearch/datasource.js b/public/app/plugins/datasource/elasticsearch/datasource.js index 4e27da73850..f8770064b8e 100644 --- a/public/app/plugins/datasource/elasticsearch/datasource.js +++ b/public/app/plugins/datasource/elasticsearch/datasource.js @@ -170,7 +170,8 @@ function (angular, _, moment, kbn, ElasticQueryBuilder, IndexPattern, ElasticRes target = options.targets[i]; if (target.hide) {return;} - var esQuery = angular.toJson(this.queryBuilder.build(target)); + var queryObj = this.queryBuilder.build(target); + var esQuery = angular.toJson(queryObj); var luceneQuery = angular.toJson(target.query || '*'); // remove inner quotes luceneQuery = luceneQuery.substr(1, luceneQuery.length - 2); @@ -185,7 +186,7 @@ function (angular, _, moment, kbn, ElasticQueryBuilder, IndexPattern, ElasticRes payload = payload.replace(/\$timeTo/g, options.range.to.valueOf()); payload = templateSrv.replace(payload, options.scopedVars); - return this._post('/_msearch?search_type=count', payload).then(function(res) { + return this._post('/_msearch', payload).then(function(res) { return new ElasticResponse(sentTargets, res).getTimeSeries(); }); }; diff --git a/public/app/plugins/datasource/elasticsearch/metric_agg.js b/public/app/plugins/datasource/elasticsearch/metric_agg.js index fd748a1f8b0..c4e04dad325 100644 --- a/public/app/plugins/datasource/elasticsearch/metric_agg.js +++ b/public/app/plugins/datasource/elasticsearch/metric_agg.js @@ -28,6 +28,7 @@ function (angular, _, queryDef) { $scope.isFirst = $scope.index === 0; $scope.isSingle = metricAggs.length === 1; $scope.settingsLinkText = ''; + $scope.aggDef = _.findWhere($scope.metricAggTypes, {value: $scope.agg.type}); if (!$scope.agg.field) { $scope.agg.field = 'select field'; @@ -53,6 +54,11 @@ function (angular, _, queryDef) { $scope.agg.meta.std_deviation_bounds_lower = true; $scope.agg.meta.std_deviation_bounds_upper = true; } + break; + } + case 'raw_document': { + $scope.target.metrics = [$scope.agg]; + $scope.target.bucketAggs = []; } } }; @@ -65,8 +71,6 @@ function (angular, _, queryDef) { $scope.agg.settings = {}; $scope.agg.meta = {}; $scope.showOptions = false; - - $scope.validateModel(); $scope.onChange(); }; diff --git a/public/app/plugins/datasource/elasticsearch/partials/metricAgg.html b/public/app/plugins/datasource/elasticsearch/partials/metricAgg.html index 7d58be38094..65030af5655 100644 --- a/public/app/plugins/datasource/elasticsearch/partials/metricAgg.html +++ b/public/app/plugins/datasource/elasticsearch/partials/metricAgg.html @@ -6,7 +6,7 @@
        • -
        • +
        • diff --git a/public/app/plugins/datasource/elasticsearch/query_def.js b/public/app/plugins/datasource/elasticsearch/query_def.js index ca915c68dd4..baab2378e9f 100644 --- a/public/app/plugins/datasource/elasticsearch/query_def.js +++ b/public/app/plugins/datasource/elasticsearch/query_def.js @@ -6,14 +6,15 @@ function (_) { return { metricAggTypes: [ - {text: "Count", value: 'count' }, - {text: "Average", value: 'avg' }, - {text: "Sum", value: 'sum' }, - {text: "Max", value: 'max' }, - {text: "Min", value: 'min' }, - {text: "Extended Stats", value: 'extended_stats' }, - {text: "Percentiles", value: 'percentiles' }, - {text: "Unique Count", value: "cardinality" } + {text: "Count", value: 'count', requiresField: false}, + {text: "Average", value: 'avg', requiresField: true}, + {text: "Sum", value: 'sum', requiresField: true}, + {text: "Max", value: 'max', requiresField: true}, + {text: "Min", value: 'min', requiresField: true}, + {text: "Extended Stats", value: 'extended_stats', requiresField: true}, + {text: "Percentiles", value: 'percentiles', requiresField: true}, + {text: "Unique Count", value: "cardinality", requiresField: true}, + {text: "Raw Document", value: "raw_document", requiresField: false} ], bucketAggTypes: [ diff --git a/public/app/plugins/datasource/elasticsearch/specs/datasource_specs.ts b/public/app/plugins/datasource/elasticsearch/specs/datasource_specs.ts index f087f847a19..4747030ff3d 100644 --- a/public/app/plugins/datasource/elasticsearch/specs/datasource_specs.ts +++ b/public/app/plugins/datasource/elasticsearch/specs/datasource_specs.ts @@ -80,4 +80,36 @@ describe('ElasticDatasource', function() { expect(body.query.filtered.query.query_string.query).to.be('escape\\:test'); }); }); + + describe('When issueing document query', function() { + var requestOptions, parts, header; + + beforeEach(function() { + ctx.ds = new ctx.service({url: 'http://es.com', index: 'test', jsonData: {}}); + + ctx.backendSrv.datasourceRequest = function(options) { + requestOptions = options; + return ctx.$q.when({data: {responses: []}}); + }; + + ctx.ds.query({ + range: { from: moment([2015, 4, 30, 10]), to: moment([2015, 5, 1, 10]) }, + targets: [{ bucketAggs: [], metrics: [{type: 'raw_document'}], query: 'test' }] + }); + + ctx.$rootScope.$apply(); + parts = requestOptions.data.split('\n'); + header = angular.fromJson(parts[0]); + }); + + it('should set search type to query_then_fetch', function() { + expect(header.search_type).to.eql('query_then_fetch'); + }); + + it('should set size', function() { + var body = angular.fromJson(parts[1]); + expect(body.query.size).to.be(500); + }); + }); + }); From 4e37290a7f28039251c61b0b3d78df5fda02b2b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Thu, 5 Nov 2015 09:56:19 +0100 Subject: [PATCH 145/269] feat(tablepanel/elasticsearch): extended elasticsearch data source and query editor to support document queries --- public/app/panels/table/transformers.ts | 20 +++++--- .../datasource/elasticsearch/datasource.js | 18 ++++--- .../elasticsearch/elastic_response.js | 47 ++++++++++++++++--- .../datasource/elasticsearch/query_builder.js | 19 ++++++++ .../elasticsearch/specs/datasource_specs.ts | 2 +- .../specs/elastic_response_specs.ts | 36 ++++++++++++++ .../specs/query_builder_specs.ts | 10 ++++ 7 files changed, 132 insertions(+), 20 deletions(-) diff --git a/public/app/panels/table/transformers.ts b/public/app/panels/table/transformers.ts index afca521c942..42ccae1982e 100644 --- a/public/app/panels/table/transformers.ts +++ b/public/app/panels/table/transformers.ts @@ -14,8 +14,6 @@ transformers['timeseries_to_rows'] = { {text: 'Value'}, ]; - model.rows = []; - for (var i = 0; i < data.length; i++) { var series = data[i]; for (var y = 0; y < series.datapoints.length; y++) { @@ -31,8 +29,7 @@ transformers['timeseries_to_rows'] = { transformers['timeseries_to_columns'] = { description: 'Time series to columns', transform: function(data, panel, model) { - model.columns = [{text: 'Time'}]; - model.rows = []; + model.columns.push({text: 'Time'}); // group by time var points = {}; @@ -75,8 +72,19 @@ transformers['annotations'] = { transformers['json'] = { description: 'JSON', + transform: function(data, panel, model) { + model.columns.push({text: 'JSON'}); + debugger; + + for (var i = 0; i < data.length; i++) { + var series = data[i]; + + for (var y = 0; y < series.datapoints.length; y++) { + var dp = series.datapoints[y]; + model.rows.push([JSON.stringify(dp)]); + } + } + } }; export {transformers} - - diff --git a/public/app/plugins/datasource/elasticsearch/datasource.js b/public/app/plugins/datasource/elasticsearch/datasource.js index f8770064b8e..ce370c639d2 100644 --- a/public/app/plugins/datasource/elasticsearch/datasource.js +++ b/public/app/plugins/datasource/elasticsearch/datasource.js @@ -153,8 +153,8 @@ function (angular, _, moment, kbn, ElasticQueryBuilder, IndexPattern, ElasticRes }); }; - ElasticDatasource.prototype.getQueryHeader = function(timeFrom, timeTo) { - var header = {search_type: "count", "ignore_unavailable": true}; + ElasticDatasource.prototype.getQueryHeader = function(searchType, timeFrom, timeTo) { + var header = {search_type: searchType, "ignore_unavailable": true}; header.index = this.indexPattern.getIndexList(timeFrom, timeTo); return angular.toJson(header); }; @@ -163,8 +163,7 @@ function (angular, _, moment, kbn, ElasticQueryBuilder, IndexPattern, ElasticRes var payload = ""; var target; var sentTargets = []; - - var header = this.getQueryHeader(options.range.from, options.range.to); + var headerAdded = false; for (var i = 0; i < options.targets.length; i++) { target = options.targets[i]; @@ -177,7 +176,14 @@ function (angular, _, moment, kbn, ElasticQueryBuilder, IndexPattern, ElasticRes luceneQuery = luceneQuery.substr(1, luceneQuery.length - 2); esQuery = esQuery.replace("$lucene_query", luceneQuery); - payload += header + '\n' + esQuery + '\n'; + if (!headerAdded) { + var searchType = queryObj.size === 0 ? 'count' : 'query_then_fetch'; + var header = this.getQueryHeader(searchType, options.range.from, options.range.to); + payload += header + '\n'; + headerAdded = true; + } + + payload += esQuery + '\n'; sentTargets.push(target); } @@ -230,7 +236,7 @@ function (angular, _, moment, kbn, ElasticQueryBuilder, IndexPattern, ElasticRes ElasticDatasource.prototype.getTerms = function(queryDef) { var range = timeSrv.timeRange(); - var header = this.getQueryHeader(range.from, range.to); + var header = this.getQueryHeader('count', range.from, range.to); var esQuery = angular.toJson(this.queryBuilder.getTermsQuery(queryDef)); esQuery = esQuery.replace("$lucene_query", queryDef.query || '*'); diff --git a/public/app/plugins/datasource/elasticsearch/elastic_response.js b/public/app/plugins/datasource/elasticsearch/elastic_response.js index bfbcb2034ab..aaac2e46ea1 100644 --- a/public/app/plugins/datasource/elasticsearch/elastic_response.js +++ b/public/app/plugins/datasource/elasticsearch/elastic_response.js @@ -173,6 +173,33 @@ function (_, queryDef) { } }; + ElasticResponse.prototype.processHits = function(hits, seriesList) { + var series = {target: 'docs', type: 'docs', datapoints: [], total: hits.total}; + var propName, hit, doc, i; + + for (i = 0; i < hits.hits.length; i++) { + hit = hits.hits[i]; + doc = { + _id: hit._id, + _type: hit._type, + _index: hit._index + }; + + if (hit._source) { + for (propName in hit._source) { + doc[propName] = hit._source[propName]; + } + } + + for (propName in hit.fields) { + doc[propName] = hit.fields[propName]; + } + series.datapoints.push(doc); + } + + seriesList.push(series); + }; + ElasticResponse.prototype.getTimeSeries = function() { var seriesList = []; @@ -182,15 +209,21 @@ function (_, queryDef) { throw { message: response.error }; } - var aggregations = response.aggregations; - var target = this.targets[i]; - var tmpSeriesList = []; + if (response.hits) { + this.processHits(response.hits, seriesList); + } - this.processBuckets(aggregations, target, tmpSeriesList, {}); - this.nameSeries(tmpSeriesList, target); + if (response.aggregations) { + var aggregations = response.aggregations; + var target = this.targets[i]; + var tmpSeriesList = []; - for (var y = 0; y < tmpSeriesList.length; y++) { - seriesList.push(tmpSeriesList[y]); + this.processBuckets(aggregations, target, tmpSeriesList, {}); + this.nameSeries(tmpSeriesList, target); + + for (var y = 0; y < tmpSeriesList.length; y++) { + seriesList.push(tmpSeriesList[y]); + } } } diff --git a/public/app/plugins/datasource/elasticsearch/query_builder.js b/public/app/plugins/datasource/elasticsearch/query_builder.js index d0fbb6a603a..3a956012a86 100644 --- a/public/app/plugins/datasource/elasticsearch/query_builder.js +++ b/public/app/plugins/datasource/elasticsearch/query_builder.js @@ -71,6 +71,16 @@ function (angular) { return filterObj; }; + ElasticQueryBuilder.prototype.documentQuery = function(query) { + query.size = 500; + query.sort = {}; + query.sort[this.timeField] = {order: 'desc', unmapped_type: 'boolean'}; + query.fields = ["*", "_source"]; + query.script_fields = {}, + query.fielddata_fields = [this.timeField]; + return query; + }; + ElasticQueryBuilder.prototype.build = function(target) { if (target.rawQuery) { return angular.fromJson(target.rawQuery); @@ -96,6 +106,15 @@ function (angular) { } }; + // handle document query + if (target.bucketAggs.length === 0) { + metric = target.metrics[0]; + if (metric && metric.type !== 'raw_document') { + throw {message: 'Invalid query'}; + } + return this.documentQuery(query, target); + } + nestedAggs = query; for (i = 0; i < target.bucketAggs.length; i++) { diff --git a/public/app/plugins/datasource/elasticsearch/specs/datasource_specs.ts b/public/app/plugins/datasource/elasticsearch/specs/datasource_specs.ts index 4747030ff3d..1e5d39ba817 100644 --- a/public/app/plugins/datasource/elasticsearch/specs/datasource_specs.ts +++ b/public/app/plugins/datasource/elasticsearch/specs/datasource_specs.ts @@ -108,7 +108,7 @@ describe('ElasticDatasource', function() { it('should set size', function() { var body = angular.fromJson(parts[1]); - expect(body.query.size).to.be(500); + expect(body.size).to.be(500); }); }); diff --git a/public/app/plugins/datasource/elasticsearch/specs/elastic_response_specs.ts b/public/app/plugins/datasource/elasticsearch/specs/elastic_response_specs.ts index df810e3a9d9..5ae67f92d78 100644 --- a/public/app/plugins/datasource/elasticsearch/specs/elastic_response_specs.ts +++ b/public/app/plugins/datasource/elasticsearch/specs/elastic_response_specs.ts @@ -411,4 +411,40 @@ describe('ElasticResponse', function() { }); }); + describe('Raw documents query', function() { + beforeEach(function() { + targets = [{ refId: 'A', metrics: [{type: 'raw_document', id: '1'}], bucketAggs: [] }]; + response = { + responses: [{ + hits: { + total: 100, + hits: [ + { + _id: '1', + _type: 'type', + _index: 'index', + _source: {sourceProp: "asd"}, + fields: {fieldProp: "field" }, + }, + { + _source: {sourceProp: "asd2"}, + fields: {fieldProp: "field2" }, + } + ] + } + }] + }; + + result = new ElasticResponse(targets, response).getTimeSeries(); + }); + + it('should return docs', function() { + expect(result.data.length).to.be(1); + expect(result.data[0].type).to.be('docs'); + expect(result.data[0].total).to.be(100); + expect(result.data[0].datapoints.length).to.be(2); + expect(result.data[0].datapoints[0].sourceProp).to.be("asd"); + expect(result.data[0].datapoints[0].fieldProp).to.be("field"); + }); + }); }); diff --git a/public/app/plugins/datasource/elasticsearch/specs/query_builder_specs.ts b/public/app/plugins/datasource/elasticsearch/specs/query_builder_specs.ts index c32b1463ca3..bcae7d6e852 100644 --- a/public/app/plugins/datasource/elasticsearch/specs/query_builder_specs.ts +++ b/public/app/plugins/datasource/elasticsearch/specs/query_builder_specs.ts @@ -120,4 +120,14 @@ describe('ElasticQueryBuilder', function() { expect(query.aggs["2"].aggs["4"].date_histogram.field).to.be("@timestamp"); }); + it('with raw_document metric', function() { + var query = builder.build({ + metrics: [{type: 'raw_document', id: '1'}], + timeField: '@timestamp', + bucketAggs: [], + }); + + expect(query.size).to.be(500); + }); + }); From 90cca9395110ff84b48b5b5a6287248c31f256c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Thu, 5 Nov 2015 13:13:13 +0100 Subject: [PATCH 146/269] feat(tablepanel): lots of work on table panel --- .../app/core/directives/dropdown_typeahead.js | 24 ++- public/app/features/panel/panel_helper.js | 4 +- public/app/panels/table/controller.ts | 43 +---- public/app/panels/table/editor.html | 167 ++++++++++++++++++ public/app/panels/table/editor.ts | 106 +++++++++++ public/app/panels/table/module.ts | 13 +- public/app/panels/table/options.html | 119 +------------ .../panels/table/specs/transformers_specs.ts | 35 ++++ public/app/panels/table/transformers.ts | 36 ++-- 9 files changed, 365 insertions(+), 182 deletions(-) create mode 100644 public/app/panels/table/editor.html create mode 100644 public/app/panels/table/editor.ts diff --git a/public/app/core/directives/dropdown_typeahead.js b/public/app/core/directives/dropdown_typeahead.js index c306b9ff8e5..ad484bb18d7 100644 --- a/public/app/core/directives/dropdown_typeahead.js +++ b/public/app/core/directives/dropdown_typeahead.js @@ -45,16 +45,25 @@ function (_, $, coreModule) { } var typeaheadValues = _.reduce($scope.menuItems, function(memo, value, index) { - _.each(value.submenu, function(item, subIndex) { - item.click = 'menuItemSelected(' + index + ',' + subIndex + ')'; - memo.push(value.text + ' ' + item.text); - }); + if (!value.submenu) { + value.click = 'menuItemSelected(' + index + ')'; + memo.push(value.text); + } else { + _.each(value.submenu, function(item, subIndex) { + item.click = 'menuItemSelected(' + index + ',' + subIndex + ')'; + memo.push(value.text + ' ' + item.text); + }); + } return memo; }, []); $scope.menuItemSelected = function(index, subIndex) { - var item = $scope.menuItems[index]; - $scope.dropdownTypeaheadOnSelect({$item: item, $subItem: item.submenu[subIndex]}); + var menuItem = $scope.menuItems[index]; + var payload = {$item: menuItem}; + if (menuItem.submenu && subIndex !== void 0) { + payload.$subItem = menuItem.submenu[subIndex]; + } + $scope.dropdownTypeaheadOnSelect(payload); }; $input.attr('data-provide', 'typeahead'); @@ -65,9 +74,10 @@ function (_, $, coreModule) { updater: function (value) { var result = {}; _.each($scope.menuItems, function(menuItem) { + result.$item = menuItem; + _.each(menuItem.submenu, function(submenuItem) { if (value === (menuItem.text + ' ' + submenuItem.text)) { - result.$item = menuItem; result.$subItem = submenuItem; } }); diff --git a/public/app/features/panel/panel_helper.js b/public/app/features/panel/panel_helper.js index c3ccbfe7e09..52a6727eb2c 100644 --- a/public/app/features/panel/panel_helper.js +++ b/public/app/features/panel/panel_helper.js @@ -32,9 +32,9 @@ function (angular, _, $, kbn, dateMath, rangeUtil) { scope.timing.renderEnd = new Date().getTime(); }; - this.broadcastRender = function(scope, data) { + this.broadcastRender = function(scope, arg1, arg2) { this.setTimeRenderStart(scope); - scope.$broadcast('render', data); + scope.$broadcast('render', arg1, arg2); this.setTimeRenderEnd(scope); if ($rootScope.profilingEnabled) { diff --git a/public/app/panels/table/controller.ts b/public/app/panels/table/controller.ts index 4ae5a1807fa..7c22ba2823f 100644 --- a/public/app/panels/table/controller.ts +++ b/public/app/panels/table/controller.ts @@ -3,24 +3,15 @@ import angular = require('angular'); import _ = require('lodash'); import moment = require('moment'); -import kbn = require('app/core/utils/kbn'); import PanelMeta = require('app/features/panel/panel_meta'); import {TableModel} from './table_model'; -import {transformers} from './transformers'; export class TablePanelCtrl { constructor($scope, $rootScope, $q, panelSrv, panelHelper) { $scope.ctrl = this; - $scope.transformers = transformers; $scope.pageIndex = 0; - $scope.unitFormats = kbn.getUnitFormats(); - $scope.colorModes = { - 'cell': {text: 'Cell'}, - 'value': {text: 'Value'}, - 'row': {text: 'Row'}, - }; $scope.panelMeta = new PanelMeta({ panelName: 'Table', @@ -38,23 +29,18 @@ export class TablePanelCtrl { pageSize: 50, showHeader: true, columns: [], + fields: [] }; $scope.init = function() { _.defaults($scope.panel, panelDefaults); if ($scope.panel.columns.length === 0) { - $scope.addColumnStyle(); } panelSrv.init($scope); }; - $scope.setUnitFormat = function(column, subItem) { - column.unit = subItem.value; - $scope.render(); - }; - $scope.refreshData = function(datasource) { panelHelper.updateTimeRange($scope); @@ -73,32 +59,7 @@ export class TablePanelCtrl { $scope.render = function() { $scope.table = TableModel.transform($scope.dataRaw, $scope.panel); - panelHelper.broadcastRender($scope, $scope.table); - }; - - $scope.getColumnNames = function() { - if (!$scope.table) { - return []; - } - return _.map($scope.table.columns, function(col: any) { - return col.text; - }); - }; - - $scope.addColumnStyle = function() { - var columnStyleDefaults = { - unit: 'short', - decimals: 2, - colors: ["rgba(245, 54, 54, 0.9)", "rgba(237, 129, 40, 0.89)", "rgba(50, 172, 45, 0.97)"], - pattern: '/.*/', - colorMode: 'value', - }; - - $scope.panel.columns.push(angular.copy(columnStyleDefaults)); - }; - - $scope.removeColumnStyle = function(col) { - $scope.panel.columns = _.without($scope.panel.columns, col); + panelHelper.broadcastRender($scope, $scope.table, $scope.dataRaw); }; $scope.init(); diff --git a/public/app/panels/table/editor.html b/public/app/panels/table/editor.html new file mode 100644 index 00000000000..e7c76402974 --- /dev/null +++ b/public/app/panels/table/editor.html @@ -0,0 +1,167 @@ +
          +
          +
          Data
          +
          +
          +
            +
          • + To Table Transform +
          • +
          • + +
          • +
          +
          +
          +
          +
            +
          • + Fields +
          • +
          • + + + {{field.name}} + +
          • + +
          +
          +
          +
          +
          + +
          +
          Table Display
          +
          +
          +
            +
          • + Pagination (Page size) +
          • +
          • + +
          • +
          +
          +
          +
          +
          +
          + +
          +
          Column Styles
          + +
          +
          +
          +
            +
          • + +
          • +
          • + Name or regex +
          • +
          • + +
          • +
          • + Type +
          • +
          • + +
          • +
          +
          +
          +
          +
            +
          • + +
          • +
          • + Format +
          • +
          • + +
          • +
          +
          +
          +
          +
            +
          • + +
          • +
          • + Coloring +
          • +
          • + +
          • +
          • + ThresholdsComma seperated values +
          • +
          • + +
          • +
          • + Colors +
          • +
          • + + + +
          • +
          • + invert order +
          • +
          +
          +
          +
          +
            +
          • + +
          • +
          • + Unit +
          • + +
          • + Decimals +
          • +
          • + +
          • +
          +
          +
          + +
          +
          + + +
          + diff --git a/public/app/panels/table/editor.ts b/public/app/panels/table/editor.ts new file mode 100644 index 00000000000..4cd4070dd1b --- /dev/null +++ b/public/app/panels/table/editor.ts @@ -0,0 +1,106 @@ + +/// + +import angular = require('angular'); +import $ = require('jquery'); +import _ = require('lodash'); +import kbn = require('app/core/utils/kbn'); +import moment = require('moment'); + +import {transformers} from './transformers'; + +export function tablePanelEditor() { + 'use strict'; + return { + restrict: 'E', + scope: true, + templateUrl: 'app/panels/table/editor.html', + link: function(scope, elem) { + scope.transformers = transformers; + scope.unitFormats = kbn.getUnitFormats(); + scope.colorModes = { + 'cell': {text: 'Cell'}, + 'value': {text: 'Value'}, + 'row': {text: 'Row'}, + }; + scope.columnTypes = { + 'number': {text: 'Number'}, + 'string': {text: 'String'}, + 'date': {text: 'Date'}, + }; + + scope.updateJsonFieldsMenu = function(data) { + scope.jsonFieldsMenu = []; + if (!data || data.length === 0) { + return; + } + + var names = {}; + for (var i = 0; i < data.length; i++) { + var series = data[i]; + if (series.type !== 'docs') { + continue; + } + + for (var y = 0; y < series.datapoints.length; y++) { + var doc = series.datapoints[y]; + for (var propName in doc) { + names[propName] = true; + } + } + } + + _.each(names, function(value, key) { + scope.jsonFieldsMenu.push({text: key}); + }); + }; + + scope.updateJsonFieldsMenu(scope.dataRaw); + + scope.$on('render', function(event, table, rawData) { + scope.updateJsonFieldsMenu(rawData); + }); + + scope.addJsonField = function(menuItem) { + scope.panel.fields.push({name: menuItem.text}); + }; + + scope.removeJsonField = function(field) { + scope.panel.fields = _.without(scope.panel.fields, field); + }; + + scope.setUnitFormat = function(column, subItem) { + column.unit = subItem.value; + scope.render(); + }; + + scope.addColumnStyle = function() { + var columnStyleDefaults = { + unit: 'short', + type: 'number', + decimals: 2, + colors: ["rgba(245, 54, 54, 0.9)", "rgba(237, 129, 40, 0.89)", "rgba(50, 172, 45, 0.97)"], + colorMode: 'value', + pattern: '/.*/', + }; + + scope.panel.columns.push(angular.copy(columnStyleDefaults)); + }; + + scope.removeColumnStyle = function(col) { + scope.panel.columns = _.without(scope.panel.columns, col); + }; + + scope.getColumnNames = function() { + if (!scope.table) { + return []; + } + return _.map(scope.table.columns, function(col: any) { + return col.text; + }); + }; + + } + }; +} + diff --git a/public/app/panels/table/module.ts b/public/app/panels/table/module.ts index 39cd1056290..84955070be4 100644 --- a/public/app/panels/table/module.ts +++ b/public/app/panels/table/module.ts @@ -4,10 +4,12 @@ import angular = require('angular'); import $ = require('jquery'); import _ = require('lodash'); import kbn = require('app/core/utils/kbn'); +import moment = require('moment'); import {TablePanelCtrl} from './controller'; +import {tablePanelEditor} from './editor'; -export function tablePanelDirective() { +export function tablePanel() { 'use strict'; return { restrict: 'E', @@ -45,9 +47,13 @@ export function tablePanelDirective() { if (v === null || v === void 0) { return '-'; } - if (_.isString(v) || style) { + if (_.isString(v) || !style) { return v; } + if (style.type === 'date') { + var date = moment(v); + return date.format(style.dateFormat); + } let valueFormater = kbn.valueFormats[style.unit]; return valueFormater(v, style.decimals); }; @@ -136,4 +142,5 @@ export function tablePanelDirective() { }; } -angular.module('grafana.directives').directive('grafanaPanelTable', tablePanelDirective); +angular.module('grafana.directives').directive('grafanaPanelTable', tablePanel); +angular.module('grafana.directives').directive('grafanaPanelTableEditor', tablePanelEditor); diff --git a/public/app/panels/table/options.html b/public/app/panels/table/options.html index c1d4ca658ac..d43ff958c5d 100644 --- a/public/app/panels/table/options.html +++ b/public/app/panels/table/options.html @@ -1,117 +1,2 @@ -
          -
          -
          Data
          -
          -
          -
            -
          • - To Table Transform -
          • -
          • - -
          • -
          -
          -
          -
          -
          - -
          -
          Table Display
          -
          -
          -
            -
          • - Pagination (Page size) -
          • -
          • - -
          • -
          -
          -
          -
          -
          -
          - -
          -
          Column Styles
          - -
          -
          -
          -
            -
          • - -
          • -
          • - Name or regex -
          • -
          • - -
          • -
          • - Unit -
          • - -
          • - Decimals -
          • -
          • - -
          • -
          -
          -
          -
          -
            -
          • - -
          • -
          • - Coloring -
          • -
          • - -
          • -
          • - ThresholdsComma seperated values -
          • -
          • - -
          • -
          • - Colors -
          • -
          • - - - -
          • -
          • - invert order -
          • -
          -
          -
          -
          -
          - - -
          - + + diff --git a/public/app/panels/table/specs/transformers_specs.ts b/public/app/panels/table/specs/transformers_specs.ts index ea3eb609976..af9dd880cf1 100644 --- a/public/app/panels/table/specs/transformers_specs.ts +++ b/public/app/panels/table/specs/transformers_specs.ts @@ -67,6 +67,41 @@ describe('when transforming time series table', () => { expect(table.rows[1][2]).to.be(undefined); }); }); + + describe('JSON Data', () => { + var panel = { + transform: 'json', + fields: [{name: 'timestamp'}, {name: 'message'}] + }; + var rawData = [ + { + type: 'docs', + datapoints: [ + { + timestamp: 'time', + message: 'message' + } + ] + } + ]; + + beforeEach(() => { + table = TableModel.transform(rawData, panel); + }); + + it ('should return 2 columns', () => { + expect(table.columns.length).to.be(2); + expect(table.columns[0].text).to.be('timestamp'); + expect(table.columns[1].text).to.be('message'); + }); + + it ('should return 2 rows', () => { + expect(table.rows.length).to.be(2); + expect(table.rows[0][0]).to.be('time'); + expect(table.rows[0][1]).to.be('message'); + }); + + }); }); }); diff --git a/public/app/panels/table/transformers.ts b/public/app/panels/table/transformers.ts index 42ccae1982e..096ebb73051 100644 --- a/public/app/panels/table/transformers.ts +++ b/public/app/panels/table/transformers.ts @@ -9,7 +9,7 @@ transformers['timeseries_to_rows'] = { description: 'Time series to rows', transform: function(data, panel, model) { model.columns = [ - {text: 'Time'}, + {text: 'Time', type: 'date'}, {text: 'Series'}, {text: 'Value'}, ]; @@ -18,9 +18,7 @@ transformers['timeseries_to_rows'] = { var series = data[i]; for (var y = 0; y < series.datapoints.length; y++) { var dp = series.datapoints[y]; - var time = moment(dp[1]).format('LLL'); - var value = dp[0]; - model.rows.push([time, series.target, value]); + model.rows.push([dp[1], series.target, dp[0]]); } } }, @@ -29,7 +27,7 @@ transformers['timeseries_to_rows'] = { transformers['timeseries_to_columns'] = { description: 'Time series to columns', transform: function(data, panel, model) { - model.columns.push({text: 'Time'}); + model.columns.push({text: 'Time', type: 'date'}); // group by time var points = {}; @@ -54,7 +52,7 @@ transformers['timeseries_to_columns'] = { for (var time in points) { var point = points[time]; - var values = [moment(point.time).format('LLL')]; + var values = [point.time]; for (var i = 0; i < data.length; i++) { var value = point[i]; @@ -71,17 +69,31 @@ transformers['annotations'] = { }; transformers['json'] = { - description: 'JSON', + description: 'JSON Data', transform: function(data, panel, model) { - model.columns.push({text: 'JSON'}); - debugger; + var i, y, z; + for (i = 0; i < panel.fields.length; i++) { + model.columns.push({text: panel.fields[i].name}); + } - for (var i = 0; i < data.length; i++) { + if (model.columns.length === 0) { + model.columns.push({text: 'JSON'}); + } + + for (i = 0; i < data.length; i++) { var series = data[i]; - for (var y = 0; y < series.datapoints.length; y++) { + for (y = 0; y < series.datapoints.length; y++) { var dp = series.datapoints[y]; - model.rows.push([JSON.stringify(dp)]); + var values = []; + for (z = 0; z < panel.fields.length; z++) { + values.push(dp[panel.fields[z].name]); + } + + if (values.length === 0) { + values.push([JSON.stringify(dp)]); + } + model.rows.push(values); } } } From 1b83742e3e9f6fde94e4efa26a940b7a31dd78a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Thu, 5 Nov 2015 15:55:42 +0100 Subject: [PATCH 147/269] feat(tablepanel): began refactorin out table row html generation to write unit tests for it --- public/app/panels/table/editor.html | 16 +++------- public/app/panels/table/editor.ts | 2 ++ public/app/panels/table/module.ts | 28 ++++++++--------- public/app/panels/table/renderer.ts | 31 +++++++++++++++++++ .../app/panels/table/specs/renderer_specs.ts | 25 +++++++++++++++ .../panels/table/specs/transformers_specs.ts | 2 +- public/app/panels/table/transformers.ts | 2 +- 7 files changed, 78 insertions(+), 28 deletions(-) create mode 100644 public/app/panels/table/renderer.ts create mode 100644 public/app/panels/table/specs/renderer_specs.ts diff --git a/public/app/panels/table/editor.html b/public/app/panels/table/editor.html index e7c76402974..8540885514d 100644 --- a/public/app/panels/table/editor.html +++ b/public/app/panels/table/editor.html @@ -60,10 +60,13 @@
          -
            -
          • +
              +
            • +
            + +
            • Name or regex
            • @@ -86,9 +89,6 @@
            -
          • - -
          • Format
          • @@ -100,9 +100,6 @@
            -
          • - -
          • Coloring
          • @@ -136,9 +133,6 @@
            -
          • - -
          • Unit
          • diff --git a/public/app/panels/table/editor.ts b/public/app/panels/table/editor.ts index 4cd4070dd1b..ab10cba7f1d 100644 --- a/public/app/panels/table/editor.ts +++ b/public/app/panels/table/editor.ts @@ -63,10 +63,12 @@ export function tablePanelEditor() { scope.addJsonField = function(menuItem) { scope.panel.fields.push({name: menuItem.text}); + scope.render(); }; scope.removeJsonField = function(field) { scope.panel.fields = _.without(scope.panel.fields, field); + scope.render(); }; scope.setUnitFormat = function(column, subItem) { diff --git a/public/app/panels/table/module.ts b/public/app/panels/table/module.ts index 84955070be4..00610ca0e72 100644 --- a/public/app/panels/table/module.ts +++ b/public/app/panels/table/module.ts @@ -29,19 +29,6 @@ export function tablePanel() { return (panelHeight - 40) + 'px'; } - function appendTableHeader(tableElem) { - var rowElem = $(''); - for (var i = 0; i < data.columns.length; i++) { - var column = data.columns[i]; - var colElem = $('' + column.text + ''); - rowElem.append(colElem); - } - - var headElem = $(''); - headElem.append(rowElem); - headElem.appendTo(tableElem); - } - function createColumnFormater(style) { return function(v) { if (v === null || v === void 0) { @@ -50,12 +37,23 @@ export function tablePanel() { if (_.isString(v) || !style) { return v; } + if (style.type === 'date') { + if (_.isArray(v)) { v = v[0]; } var date = moment(v); return date.format(style.dateFormat); } - let valueFormater = kbn.valueFormats[style.unit]; - return valueFormater(v, style.decimals); + + if (_.isNumber(v) && style.type === 'number') { + let valueFormater = kbn.valueFormats[style.unit]; + return valueFormater(v, style.decimals); + } + + if (_.isArray(v)) { + v = v.join(', '); + } + + return v; }; } diff --git a/public/app/panels/table/renderer.ts b/public/app/panels/table/renderer.ts new file mode 100644 index 00000000000..c3b09ee45da --- /dev/null +++ b/public/app/panels/table/renderer.ts @@ -0,0 +1,31 @@ + +export class TableRenderer { + constructor(private panel, private table) { + } + + formatColumnValue(columnIndex, value) { + return "value"; + } + + renderCell(columnIndex, value) { + var colValue = this.formatColumnValue(columnIndex, value); + return '' + colValue + ''; + } + + render(page) { + let endPos = Math.min(this.panel.pageSize, this.table.rows.length); + let startPos = 0; + var html = ""; + + for (var y = startPos; y < endPos; y++) { + let row = this.table.rows[y]; + html += ''; + for (var i = 0; i < this.table.columns.length; i++) { + html += this.renderCell(i, row[i]); + } + html += ''; + } + + return html; + } +} diff --git a/public/app/panels/table/specs/renderer_specs.ts b/public/app/panels/table/specs/renderer_specs.ts new file mode 100644 index 00000000000..c4c5ff5d3c3 --- /dev/null +++ b/public/app/panels/table/specs/renderer_specs.ts @@ -0,0 +1,25 @@ +import {describe, beforeEach, it, sinon, expect} from 'test/lib/common'; + +import {TableModel} from '../table_model'; +import {TableRenderer} from '../renderer'; + +describe('when rendering table', () => { + describe('given 2 columns', () => { + var table = new TableModel(); + table.columns = [{text: 'Time'}, {text: 'Value'}]; + table.rows.push([1446733230253, 12.4]); + table.rows.push([1446733231253, 10.4]); + + var panel = { + pageSize: 10 + }; + + it('render should return html', () => { + var html = new TableRenderer(panel, table).render(0); + expect(html).to.be('value'); + }); + + }); +}); + + diff --git a/public/app/panels/table/specs/transformers_specs.ts b/public/app/panels/table/specs/transformers_specs.ts index af9dd880cf1..597b8913b82 100644 --- a/public/app/panels/table/specs/transformers_specs.ts +++ b/public/app/panels/table/specs/transformers_specs.ts @@ -96,7 +96,7 @@ describe('when transforming time series table', () => { }); it ('should return 2 rows', () => { - expect(table.rows.length).to.be(2); + expect(table.rows.length).to.be(1); expect(table.rows[0][0]).to.be('time'); expect(table.rows[0][1]).to.be('message'); }); diff --git a/public/app/panels/table/transformers.ts b/public/app/panels/table/transformers.ts index 096ebb73051..dce0098dde3 100644 --- a/public/app/panels/table/transformers.ts +++ b/public/app/panels/table/transformers.ts @@ -91,7 +91,7 @@ transformers['json'] = { } if (values.length === 0) { - values.push([JSON.stringify(dp)]); + values.push(JSON.stringify(dp)); } model.rows.push(values); } From e1433ebb417cc94dc9df3c36c8864a11da8be4e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Thu, 5 Nov 2015 12:42:47 -0500 Subject: [PATCH 148/269] feat(tablepanel) more refactoring --- public/app/panels/table/module.ts | 71 +------------------ public/app/panels/table/renderer.ts | 63 +++++++++++++++- .../app/panels/table/specs/renderer_specs.ts | 19 +++-- .../datasource/influxdb/partials/config.html | 1 - 4 files changed, 76 insertions(+), 78 deletions(-) diff --git a/public/app/panels/table/module.ts b/public/app/panels/table/module.ts index 00610ca0e72..beb6273fd62 100644 --- a/public/app/panels/table/module.ts +++ b/public/app/panels/table/module.ts @@ -7,6 +7,7 @@ import kbn = require('app/core/utils/kbn'); import moment = require('moment'); import {TablePanelCtrl} from './controller'; +import {TableRenderer} from './renderer'; import {tablePanelEditor} from './editor'; export function tablePanel() { @@ -29,76 +30,10 @@ export function tablePanel() { return (panelHeight - 40) + 'px'; } - function createColumnFormater(style) { - return function(v) { - if (v === null || v === void 0) { - return '-'; - } - if (_.isString(v) || !style) { - return v; - } - - if (style.type === 'date') { - if (_.isArray(v)) { v = v[0]; } - var date = moment(v); - return date.format(style.dateFormat); - } - - if (_.isNumber(v) && style.type === 'number') { - let valueFormater = kbn.valueFormats[style.unit]; - return valueFormater(v, style.decimals); - } - - if (_.isArray(v)) { - v = v.join(', '); - } - - return v; - }; - } - - function formatColumnValue(colIndex, value) { - if (formaters[colIndex]) { - return formaters[colIndex](value); - } - - for (let i = 0; i < panel.columns.length; i++) { - let style = panel.columns[i]; - let column = data.columns[colIndex]; - var regex = kbn.stringToJsRegex(style.pattern); - if (column.text.match(regex)) { - formaters[colIndex] = createColumnFormater(style); - return formaters[colIndex](value); - } - } - - formaters[colIndex] = function(v) { - return v; - }; - - return formaters[colIndex](value); - } - function appendTableRows(tbodyElem) { - let rowElements = $(document.createDocumentFragment()); - let rowEnd = Math.min(panel.pageSize, data.rows.length); - let rowStart = 0; - // reset formater cache - formaters = []; - - for (var y = rowStart; y < rowEnd; y++) { - let row = data.rows[y]; - let rowElem = $(''); - for (var i = 0; i < data.columns.length; i++) { - var colValue = formatColumnValue(i, row[i]); - let colElem = $(' ' + colValue + ''); - rowElem.append(colElem); - } - rowElements.append(rowElem); - } - + var renderer = new TableRenderer(panel, data, scope.dashboard.timezone); tbodyElem.empty(); - tbodyElem.append(rowElements); + tbodyElem.html(renderer.render(0)); } function appendPaginationControls(footerElem) { diff --git a/public/app/panels/table/renderer.ts b/public/app/panels/table/renderer.ts index c3b09ee45da..8672629a23b 100644 --- a/public/app/panels/table/renderer.ts +++ b/public/app/panels/table/renderer.ts @@ -1,10 +1,67 @@ +/// + +import _ = require('lodash'); +import kbn = require('app/core/utils/kbn'); +import moment = require('moment'); export class TableRenderer { - constructor(private panel, private table) { + formaters: any[]; + + constructor(private panel, private table, private timezone) { + this.formaters = []; } - formatColumnValue(columnIndex, value) { - return "value"; + createColumnFormater(style) { + return (v) => { + if (v === null || v === void 0) { + return '-'; + } + if (_.isString(v) || !style) { + return v; + } + + if (style.type === 'date') { + if (_.isArray(v)) { v = v[0]; } + var date = moment(v); + if (this.timezone === 'utc') { + date = date.utc(); + } + return date.format(style.dateFormat); + } + + if (_.isNumber(v) && style.type === 'number') { + let valueFormater = kbn.valueFormats[style.unit]; + return valueFormater(v, style.decimals); + } + + if (_.isArray(v)) { + v = v.join(', '); + } + + return v; + }; + } + + formatColumnValue(colIndex, value) { + if (this.formaters[colIndex]) { + return this.formaters[colIndex](value); + } + + for (let i = 0; i < this.panel.columns.length; i++) { + let style = this.panel.columns[i]; + let column = this.table.columns[colIndex]; + var regex = kbn.stringToJsRegex(style.pattern); + if (column.text.match(regex)) { + this.formaters[colIndex] = this.createColumnFormater(style); + return this.formaters[colIndex](value); + } + } + + this.formaters[colIndex] = function(v) { + return v; + }; + + return this.formaters[colIndex](value); } renderCell(columnIndex, value) { diff --git a/public/app/panels/table/specs/renderer_specs.ts b/public/app/panels/table/specs/renderer_specs.ts index c4c5ff5d3c3..8bf6dd308d0 100644 --- a/public/app/panels/table/specs/renderer_specs.ts +++ b/public/app/panels/table/specs/renderer_specs.ts @@ -7,16 +7,23 @@ describe('when rendering table', () => { describe('given 2 columns', () => { var table = new TableModel(); table.columns = [{text: 'Time'}, {text: 'Value'}]; - table.rows.push([1446733230253, 12.4]); - table.rows.push([1446733231253, 10.4]); var panel = { - pageSize: 10 + pageSize: 10, + columns: [ + { + pattern: 'Time', + type: 'date', + format: 'LLL' + } + ] }; - it('render should return html', () => { - var html = new TableRenderer(panel, table).render(0); - expect(html).to.be('value'); + var renderer = new TableRenderer(panel, table, 'utc'); + + it('time column should be formated', () => { + var html = renderer.renderCell(0, 1388556366666); + expect(html).to.be('2014-01-01T06:06:06+00:00'); }); }); diff --git a/public/app/plugins/datasource/influxdb/partials/config.html b/public/app/plugins/datasource/influxdb/partials/config.html index 66c39fe7b69..4d51a33e6b2 100644 --- a/public/app/plugins/datasource/influxdb/partials/config.html +++ b/public/app/plugins/datasource/influxdb/partials/config.html @@ -1,4 +1,3 @@ -

            From b678daa744ea78cf4b3928a11080b8fd86aeb30e Mon Sep 17 00:00:00 2001 From: utkarshcmu Date: Thu, 5 Nov 2015 22:31:33 -0800 Subject: [PATCH 149/269] Added throughput units. --- public/app/components/kbn.js | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/public/app/components/kbn.js b/public/app/components/kbn.js index ad2d4c3c422..825df91ff3c 100644 --- a/public/app/components/kbn.js +++ b/public/app/components/kbn.js @@ -344,6 +344,12 @@ function($, _) { kbn.valueFormats.bps = kbn.formatBuilders.decimalSIPrefix('bps'); kbn.valueFormats.Bps = kbn.formatBuilders.decimalSIPrefix('Bps'); + // Throughput + kbn.valueFormats.ops = kbn.formatBuilders.fixedUnit('ops'); + kbn.valueFormats.rps = kbn.formatBuilders.fixedUnit('rps'); + kbn.valueFormats.wps = kbn.formatBuilders.fixedUnit('wps'); + kbn.valueFormats.iops = kbn.formatBuilders.fixedUnit('iops'); + // Energy kbn.valueFormats.watt = kbn.formatBuilders.decimalSIPrefix('W'); kbn.valueFormats.kwatt = kbn.formatBuilders.decimalSIPrefix('W', 1); @@ -522,6 +528,15 @@ function($, _) { {text: 'bytes/sec', value: 'Bps'}, ] }, + { + text: 'throughput', + submenu: [ + {text: 'ops/sec (ops)', value: 'ops' }, + {text: 'reads/sec (rps)', value: 'rps' }, + {text: 'writes/sec (wps)', value: 'wps' }, + {text: 'I/O ops/sec (iops)', value: 'iops'}, + ] + }, { text: 'length', submenu: [ @@ -576,7 +591,7 @@ function($, _) { {text: 'Inches of mercury', value: 'pressurehg' }, {text: 'PSI', value: 'pressurepsi' }, ] - }, + } ]; }; From 22c3ec2d638e94c985e40bff3aea6e8515f7841b Mon Sep 17 00:00:00 2001 From: utkarshcmu Date: Thu, 5 Nov 2015 22:57:05 -0800 Subject: [PATCH 150/269] Made the units more readable --- public/app/components/kbn.js | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/public/app/components/kbn.js b/public/app/components/kbn.js index 825df91ff3c..34d943ed028 100644 --- a/public/app/components/kbn.js +++ b/public/app/components/kbn.js @@ -310,6 +310,16 @@ function($, _) { }; }; + kbn.formatBuilders.simpleCountUnit = function(symbol) { + var units = ['', 'K', 'M', 'B', 'T']; + var scaler = kbn.formatBuilders.scaledUnits(1000, units); + return function(size, decimals, scaledDecimals) { + if (size === null) { return ""; } + var scaled = scaler(size, decimals, scaledDecimals); + return scaled + " " + symbol; + }; + }; + ///// VALUE FORMATS ///// // Dimensionless Units @@ -345,10 +355,10 @@ function($, _) { kbn.valueFormats.Bps = kbn.formatBuilders.decimalSIPrefix('Bps'); // Throughput - kbn.valueFormats.ops = kbn.formatBuilders.fixedUnit('ops'); - kbn.valueFormats.rps = kbn.formatBuilders.fixedUnit('rps'); - kbn.valueFormats.wps = kbn.formatBuilders.fixedUnit('wps'); - kbn.valueFormats.iops = kbn.formatBuilders.fixedUnit('iops'); + kbn.valueFormats.ops = kbn.formatBuilders.simpleCountUnit('ops'); + kbn.valueFormats.rps = kbn.formatBuilders.simpleCountUnit('rps'); + kbn.valueFormats.wps = kbn.formatBuilders.simpleCountUnit('wps'); + kbn.valueFormats.iops = kbn.formatBuilders.simpleCountUnit('iops'); // Energy kbn.valueFormats.watt = kbn.formatBuilders.decimalSIPrefix('W'); From b5f18561ab401a49446d5e46cf334679b94c0b67 Mon Sep 17 00:00:00 2001 From: utkarshcmu Date: Thu, 5 Nov 2015 23:13:53 -0800 Subject: [PATCH 151/269] Added unit tests to verify units --- public/test/specs/kbn-format-specs.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/public/test/specs/kbn-format-specs.js b/public/test/specs/kbn-format-specs.js index f84544fff4f..3e4803633e3 100644 --- a/public/test/specs/kbn-format-specs.js +++ b/public/test/specs/kbn-format-specs.js @@ -62,6 +62,12 @@ define([ describeValueFormat('ns', 25, 1, 0, '25 ns'); describeValueFormat('ns', 2558, 50, 0, '2.56 µs'); + describeValueFormat('ops', 123, 1, 0, '123 ops'); + describeValueFormat('rps', 456000, 1000, -1, '456K rps'); + describeValueFormat('rps', 123456789, 1000000, 2, '123.457M rps'); + describeValueFormat('wps', 789000000, 1000000, -1, '789M wps'); + describeValueFormat('iops', 11000000000, 1000000000, -1, '11B iops'); + describe('kbn.toFixed and negative decimals', function() { it('should treat as zero decimals', function() { var str = kbn.toFixed(186.123, -2); From b8e6fcfeaebad99da576e08e5d90214c428ef6bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Fri, 6 Nov 2015 13:16:17 +0100 Subject: [PATCH 152/269] feat(tablepanel): worked on cell / value threshold coloring --- public/app/panels/table/editor.html | 15 ++--- public/app/panels/table/editor.ts | 24 +++---- public/app/panels/table/renderer.ts | 65 +++++++++++++++---- .../app/panels/table/specs/renderer_specs.ts | 30 ++++++++- 4 files changed, 99 insertions(+), 35 deletions(-) diff --git a/public/app/panels/table/editor.html b/public/app/panels/table/editor.html index 8540885514d..72bc1cf8a1e 100644 --- a/public/app/panels/table/editor.html +++ b/public/app/panels/table/editor.html @@ -79,21 +79,18 @@
          -
          -
          -
          -
            -
          • +
              +
            • Format
            • - +
            @@ -106,7 +103,7 @@
          • @@ -115,7 +112,7 @@ ThresholdsComma seperated values
          • - +
          • Colors diff --git a/public/app/panels/table/editor.ts b/public/app/panels/table/editor.ts index ab10cba7f1d..8aae1840629 100644 --- a/public/app/panels/table/editor.ts +++ b/public/app/panels/table/editor.ts @@ -18,16 +18,17 @@ export function tablePanelEditor() { link: function(scope, elem) { scope.transformers = transformers; scope.unitFormats = kbn.getUnitFormats(); - scope.colorModes = { - 'cell': {text: 'Cell'}, - 'value': {text: 'Value'}, - 'row': {text: 'Row'}, - }; - scope.columnTypes = { - 'number': {text: 'Number'}, - 'string': {text: 'String'}, - 'date': {text: 'Date'}, - }; + scope.colorModes = [ + {text: 'Disabled', value: null}, + {text: 'Cell', value: 'cell'}, + {text: 'Value', value: 'value'}, + {text: 'Row', value: 'row'}, + ]; + scope.columnTypes = [ + {text: 'Number', value: 'number'}, + {text: 'String', value: 'string'}, + {text: 'Date', value: 'date'}, + ]; scope.updateJsonFieldsMenu = function(data) { scope.jsonFieldsMenu = []; @@ -82,8 +83,9 @@ export function tablePanelEditor() { type: 'number', decimals: 2, colors: ["rgba(245, 54, 54, 0.9)", "rgba(237, 129, 40, 0.89)", "rgba(50, 172, 45, 0.97)"], - colorMode: 'value', + colorMode: null, pattern: '/.*/', + thresholds: [], }; scope.panel.columns.push(angular.copy(columnStyleDefaults)); diff --git a/public/app/panels/table/renderer.ts b/public/app/panels/table/renderer.ts index 8672629a23b..a2c86d940b9 100644 --- a/public/app/panels/table/renderer.ts +++ b/public/app/panels/table/renderer.ts @@ -6,32 +6,59 @@ import moment = require('moment'); export class TableRenderer { formaters: any[]; + colorState: any; constructor(private panel, private table, private timezone) { this.formaters = []; + this.colorState = {}; + } + + getColorForValue(value, style) { + if (!style.thresholds) { return null; } + + for (var i = style.thresholds.length - 1; i >= 0 ; i--) { + if (value >= style.thresholds[i]) { + return style.colors[i]; + } + } + return null; } createColumnFormater(style) { - return (v) => { - if (v === null || v === void 0) { - return '-'; - } - if (_.isString(v) || !style) { - return v; - } + if (!style) { + return v => v; + } - if (style.type === 'date') { + if (style.type === 'date') { + return v => { if (_.isArray(v)) { v = v[0]; } var date = moment(v); if (this.timezone === 'utc') { date = date.utc(); } return date.format(style.dateFormat); - } + }; + } - if (_.isNumber(v) && style.type === 'number') { - let valueFormater = kbn.valueFormats[style.unit]; - return valueFormater(v, style.decimals); + if (style.type === 'number') { + let valueFormater = kbn.valueFormats[style.unit]; + + return v => { + if (v === null || v === void 0) { + return '-'; + } + + if (style.colorMode) { + this.colorState[style.colorMode] = this.getColorForValue(v, style); + } + + return valueFormater(v, style.decimals, null); + }; + } + + return v => { + if (v === null || v === void 0) { + return '-'; } if (_.isArray(v)) { @@ -65,8 +92,18 @@ export class TableRenderer { } renderCell(columnIndex, value) { - var colValue = this.formatColumnValue(columnIndex, value); - return '' + colValue + ''; + var value = this.formatColumnValue(columnIndex, value); + var style = ''; + if (this.colorState.cell) { + style = ' style="background-color:' + this.colorState.cell + ';color: white"'; + this.colorState.cell = null; + } + else if (this.colorState.value) { + style = ' style="color:' + this.colorState.value + '"'; + this.colorState.value = null; + } + + return '' + value + ''; } render(page) { diff --git a/public/app/panels/table/specs/renderer_specs.ts b/public/app/panels/table/specs/renderer_specs.ts index 8bf6dd308d0..08f63dfe799 100644 --- a/public/app/panels/table/specs/renderer_specs.ts +++ b/public/app/panels/table/specs/renderer_specs.ts @@ -6,7 +6,11 @@ import {TableRenderer} from '../renderer'; describe('when rendering table', () => { describe('given 2 columns', () => { var table = new TableModel(); - table.columns = [{text: 'Time'}, {text: 'Value'}]; + table.columns = [ + {text: 'Time'}, + {text: 'Value'}, + {text: 'Colored'} + ]; var panel = { pageSize: 10, @@ -15,6 +19,21 @@ describe('when rendering table', () => { pattern: 'Time', type: 'date', format: 'LLL' + }, + { + pattern: 'Value', + type: 'number', + unit: 'ms', + decimals: 3, + }, + { + pattern: 'Colored', + type: 'number', + unit: 'none', + decimals: 1, + colorMode: 'value', + thresholds: [0, 50, 80], + colors: ['green', 'orange', 'red'] } ] }; @@ -26,6 +45,15 @@ describe('when rendering table', () => { expect(html).to.be('2014-01-01T06:06:06+00:00'); }); + it('number column should be formated', () => { + var html = renderer.renderCell(1, 1230); + expect(html).to.be('1.230 s'); + }); + + it('colored cell should have style', () => { + var html = renderer.renderCell(2, 55); + expect(html).to.be('55.0'); + }); }); }); From 2676f24e0a09040331d49c391cb774ca447a8b11 Mon Sep 17 00:00:00 2001 From: utkarshcmu Date: Fri, 6 Nov 2015 20:17:27 -0800 Subject: [PATCH 153/269] Fixed user deletion in Postgres SQL --- pkg/services/sqlstore/user.go | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/pkg/services/sqlstore/user.go b/pkg/services/sqlstore/user.go index 6c6f581dcc4..cf39199c1da 100644 --- a/pkg/services/sqlstore/user.go +++ b/pkg/services/sqlstore/user.go @@ -319,10 +319,15 @@ func SearchUsers(query *m.SearchUsersQuery) error { func DeleteUser(cmd *m.DeleteUserCommand) error { return inTransaction(func(sess *xorm.Session) error { - deletes := []string{ - "DELETE FROM star WHERE user_id = ?", - "DELETE FROM user WHERE id = ?", - } + var deletes [2]string + + if (sess.Engine.DriverName() == "postgres") { + deletes[0] = "DELETE FROM star WHERE user_id = ?" + deletes[1] = "DELETE FROM \"user\" WHERE id = ?" + } else { + deletes[0] = "DELETE FROM star WHERE user_id = ?" + deletes[1] = "DELETE FROM user WHERE id = ?" + } for _, sql := range deletes { _, err := sess.Exec(sql, cmd.UserId) From e16bbc660d7bc19e3ae0e81173dcf55817e24e5e Mon Sep 17 00:00:00 2001 From: Don Date: Sat, 7 Nov 2015 00:06:15 -0600 Subject: [PATCH 154/269] use [auth.github] -> api_url property; supports git enterprise --- pkg/social/social.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkg/social/social.go b/pkg/social/social.go index 1a00934b937..06932f3d500 100644 --- a/pkg/social/social.go +++ b/pkg/social/social.go @@ -193,7 +193,7 @@ func (s *SocialGithub) FetchPrivateEmail(client *http.Client) (string, error) { Verified bool `json:"verified"` } - emailsUrl := fmt.Sprintf("https://api.github.com/user/emails") + emailsUrl := fmt.Sprintf(s.apiUrl + "/emails") r, err := client.Get(emailsUrl) if err != nil { return "", err @@ -222,7 +222,7 @@ func (s *SocialGithub) FetchTeamMemberships(client *http.Client) ([]int, error) Id int `json:"id"` } - membershipUrl := fmt.Sprintf("https://api.github.com/user/teams") + membershipUrl := fmt.Sprintf(s.apiUrl + "/teams") r, err := client.Get(membershipUrl) if err != nil { return nil, err @@ -249,7 +249,7 @@ func (s *SocialGithub) FetchOrganizations(client *http.Client) ([]string, error) Login string `json:"login"` } - url := fmt.Sprintf("https://api.github.com/user/orgs") + url := fmt.Sprintf(s.apiUrl + "/orgs") r, err := client.Get(url) if err != nil { return nil, err From fe2d8f1ea0175b3c3b6e6868b26286f56277648c Mon Sep 17 00:00:00 2001 From: utkarshcmu Date: Sat, 7 Nov 2015 05:21:22 -0800 Subject: [PATCH 155/269] Used dialect for postgres --- pkg/services/sqlstore/user.go | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/pkg/services/sqlstore/user.go b/pkg/services/sqlstore/user.go index cf39199c1da..96b8c24b8fc 100644 --- a/pkg/services/sqlstore/user.go +++ b/pkg/services/sqlstore/user.go @@ -319,15 +319,10 @@ func SearchUsers(query *m.SearchUsersQuery) error { func DeleteUser(cmd *m.DeleteUserCommand) error { return inTransaction(func(sess *xorm.Session) error { - var deletes [2]string - - if (sess.Engine.DriverName() == "postgres") { - deletes[0] = "DELETE FROM star WHERE user_id = ?" - deletes[1] = "DELETE FROM \"user\" WHERE id = ?" - } else { - deletes[0] = "DELETE FROM star WHERE user_id = ?" - deletes[1] = "DELETE FROM user WHERE id = ?" - } + deletes := []string{ + "DELETE FROM star WHERE user_id = ?", + "DELETE FROM " + dialect.Quote("user") + " WHERE id = ?", + } for _, sql := range deletes { _, err := sess.Exec(sql, cmd.UserId) From b345c7cf461a3647ab8d0e376dc6d959a75084f8 Mon Sep 17 00:00:00 2001 From: Don Thapa Date: Sat, 7 Nov 2015 11:32:06 -0600 Subject: [PATCH 156/269] gofmt happiness --- pkg/social/social.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/social/social.go b/pkg/social/social.go index 06932f3d500..4a8cb8bac5d 100644 --- a/pkg/social/social.go +++ b/pkg/social/social.go @@ -222,7 +222,7 @@ func (s *SocialGithub) FetchTeamMemberships(client *http.Client) ([]int, error) Id int `json:"id"` } - membershipUrl := fmt.Sprintf(s.apiUrl + "/teams") + membershipUrl := fmt.Sprintf(s.apiUrl + "/teams") r, err := client.Get(membershipUrl) if err != nil { return nil, err From b0cb6d6d4c5ae63119f282b1c1cc26ffcc808b51 Mon Sep 17 00:00:00 2001 From: Nick Owens Date: Sat, 7 Nov 2015 18:17:05 -0800 Subject: [PATCH 157/269] pkg/api/cloudwatch: fix api client construction against aws-sdk-go v0.10.2 --- pkg/api/cloudwatch/cloudwatch.go | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/pkg/api/cloudwatch/cloudwatch.go b/pkg/api/cloudwatch/cloudwatch.go index 763eb3d489a..6311d62f43e 100644 --- a/pkg/api/cloudwatch/cloudwatch.go +++ b/pkg/api/cloudwatch/cloudwatch.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/aws/credentials" "github.com/aws/aws-sdk-go/aws/credentials/ec2rolecreds" + "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/cloudwatch" "github.com/aws/aws-sdk-go/service/ec2" "github.com/grafana/grafana/pkg/middleware" @@ -45,10 +46,13 @@ func handleGetMetricStatistics(req *cwRequest, c *middleware.Context) { &credentials.SharedCredentialsProvider{Filename: "", Profile: req.DataSource.Database}, &ec2rolecreds.EC2RoleProvider{ExpiryWindow: 5 * time.Minute}, }) - svc := cloudwatch.New(&aws.Config{ + + cfg := &aws.Config{ Region: aws.String(req.Region), Credentials: creds, - }) + } + + svc := cloudwatch.New(session.New(cfg), cfg) reqParam := &struct { Parameters struct { @@ -89,10 +93,13 @@ func handleListMetrics(req *cwRequest, c *middleware.Context) { &credentials.SharedCredentialsProvider{Filename: "", Profile: req.DataSource.Database}, &ec2rolecreds.EC2RoleProvider{ExpiryWindow: 5 * time.Minute}, }) - svc := cloudwatch.New(&aws.Config{ + + cfg := &aws.Config{ Region: aws.String(req.Region), Credentials: creds, - }) + } + + svc := cloudwatch.New(session.New(cfg), cfg) reqParam := &struct { Parameters struct { @@ -119,7 +126,11 @@ func handleListMetrics(req *cwRequest, c *middleware.Context) { } func handleDescribeInstances(req *cwRequest, c *middleware.Context) { - svc := ec2.New(&aws.Config{Region: aws.String(req.Region)}) + cfg := &aws.Config{ + Region: aws.String(req.Region), + } + + svc := ec2.New(session.New(cfg), cfg) reqParam := &struct { Parameters struct { From efc0b60d4122f1b40a1ea5df520f7ec023c67b03 Mon Sep 17 00:00:00 2001 From: utkarshcmu Date: Sun, 8 Nov 2015 21:44:58 -0800 Subject: [PATCH 158/269] Fixed opentsdb queryctrl uncheck Rate UI bug --- .../datasource/opentsdb/partials/query.editor.html | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/public/app/plugins/datasource/opentsdb/partials/query.editor.html b/public/app/plugins/datasource/opentsdb/partials/query.editor.html index f2fc4afb181..5cd4fd4f283 100644 --- a/public/app/plugins/datasource/opentsdb/partials/query.editor.html +++ b/public/app/plugins/datasource/opentsdb/partials/query.editor.html @@ -162,20 +162,20 @@
          • -
          • +
          • Counter Max:
          • -
          • +
          • -
          • +
          • Reset Value:
          • -
          • +
          • Date: Mon, 9 Nov 2015 00:28:16 -0800 Subject: [PATCH 159/269] Added missing AWS Regions --- pkg/api/cloudwatch/metrics.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/api/cloudwatch/metrics.go b/pkg/api/cloudwatch/metrics.go index 6d6ff10dfb9..bc21da81f44 100644 --- a/pkg/api/cloudwatch/metrics.go +++ b/pkg/api/cloudwatch/metrics.go @@ -67,8 +67,8 @@ func init() { func handleGetRegions(req *cwRequest, c *middleware.Context) { regions := []string{ - "us-west-2", "us-west-1", "eu-west-1", "eu-central-1", "ap-southeast-1", - "ap-southeast-2", "ap-northeast-1", "sa-east-1", + "us-east-1", "us-west-2", "us-west-1", "eu-west-1", "eu-central-1", "ap-southeast-1", + "ap-southeast-2", "ap-northeast-1", "sa-east-1", "cn-north-1", } result := []interface{}{} From 5d166dc8cb52e2c63e7fb342c9b7a06cfbc06db5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Mon, 9 Nov 2015 09:46:49 +0100 Subject: [PATCH 160/269] feat(tablepanel): added new renderer spec --- public/app/panels/table/renderer.ts | 4 ++++ public/app/panels/table/specs/renderer_specs.ts | 5 +++++ 2 files changed, 9 insertions(+) diff --git a/public/app/panels/table/renderer.ts b/public/app/panels/table/renderer.ts index a2c86d940b9..acfef961f07 100644 --- a/public/app/panels/table/renderer.ts +++ b/public/app/panels/table/renderer.ts @@ -48,6 +48,10 @@ export class TableRenderer { return '-'; } + if (_.isString(v)) { + return v; + } + if (style.colorMode) { this.colorState[style.colorMode] = this.getColorForValue(v, style); } diff --git a/public/app/panels/table/specs/renderer_specs.ts b/public/app/panels/table/specs/renderer_specs.ts index 08f63dfe799..fad4f993acf 100644 --- a/public/app/panels/table/specs/renderer_specs.ts +++ b/public/app/panels/table/specs/renderer_specs.ts @@ -50,6 +50,11 @@ describe('when rendering table', () => { expect(html).to.be('1.230 s'); }); + it('number style should ignore string values', () => { + var html = renderer.renderCell(1, 'asd'); + expect(html).to.be('asd'); + }); + it('colored cell should have style', () => { var html = renderer.renderCell(2, 55); expect(html).to.be('55.0'); From 88d27fe649a0d312c57581237b2ed1fcdb015e78 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Mon, 9 Nov 2015 09:48:02 +0100 Subject: [PATCH 161/269] log(color): disabled console log formating by default --- conf/defaults.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conf/defaults.ini b/conf/defaults.ini index 69d045dc4ae..8b2b34f3fbc 100644 --- a/conf/defaults.ini +++ b/conf/defaults.ini @@ -225,7 +225,7 @@ level = Info [log.console] level = # Set formatting to "false" to disable color formatting of console logs -formatting = true +formatting = false # For "file" mode only [log.file] From 9f066d01b1cf368bb71783532046cbfb4d1684a5 Mon Sep 17 00:00:00 2001 From: utkarshcmu Date: Mon, 9 Nov 2015 03:35:51 -0800 Subject: [PATCH 162/269] Check specified AWS Region and not us-east-1 --- public/app/plugins/datasource/cloudwatch/datasource.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/app/plugins/datasource/cloudwatch/datasource.js b/public/app/plugins/datasource/cloudwatch/datasource.js index 576fb9ffcdd..6847d714975 100644 --- a/public/app/plugins/datasource/cloudwatch/datasource.js +++ b/public/app/plugins/datasource/cloudwatch/datasource.js @@ -216,7 +216,7 @@ function (angular, _) { CloudWatchDatasource.prototype.testDatasource = function() { /* use billing metrics for test */ - var region = 'us-east-1'; + var region = this.defaultRegion; var namespace = 'AWS/Billing'; var metricName = 'EstimatedCharges'; var dimensions = {}; From d06b9401ea3b47a5970c2bab312b64f7af7fcff2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Mon, 9 Nov 2015 17:58:02 +0100 Subject: [PATCH 163/269] feat(tablepanel): added support for column sorting --- public/app/panels/table/controller.ts | 19 ++++++- public/app/panels/table/module.html | 6 ++- .../panels/table/specs/table_model_specs.ts | 51 +++++++++++++++++++ .../panels/table/specs/transformers_specs.ts | 5 +- public/app/panels/table/table_model.ts | 25 +++++++++ 5 files changed, 103 insertions(+), 3 deletions(-) create mode 100644 public/app/panels/table/specs/table_model_specs.ts diff --git a/public/app/panels/table/controller.ts b/public/app/panels/table/controller.ts index 7c22ba2823f..463096f097c 100644 --- a/public/app/panels/table/controller.ts +++ b/public/app/panels/table/controller.ts @@ -29,7 +29,8 @@ export class TablePanelCtrl { pageSize: 50, showHeader: true, columns: [], - fields: [] + fields: [], + sort: {col: null, desc: true}, }; $scope.init = function() { @@ -52,6 +53,21 @@ export class TablePanelCtrl { }); }; + $scope.toggleColumnSort = function(col, colIndex) { + if ($scope.panel.sort.col === colIndex) { + if ($scope.panel.sort.desc) { + $scope.panel.sort.desc = false; + } else { + $scope.panel.sort.col = null; + } + } else { + $scope.panel.sort.col = colIndex; + $scope.panel.sort.desc = true; + } + + $scope.render(); + }; + $scope.dataHandler = function(results) { $scope.dataRaw = results.data; $scope.render(); @@ -59,6 +75,7 @@ export class TablePanelCtrl { $scope.render = function() { $scope.table = TableModel.transform($scope.dataRaw, $scope.panel); + $scope.table.sort($scope.panel.sort); panelHelper.broadcastRender($scope, $scope.table, $scope.dataRaw); }; diff --git a/public/app/panels/table/module.html b/public/app/panels/table/module.html index 1ceb7f52647..030324c325c 100644 --- a/public/app/panels/table/module.html +++ b/public/app/panels/table/module.html @@ -7,8 +7,12 @@ -
            +
            {{col.text}} + + + +
            diff --git a/public/app/panels/table/specs/table_model_specs.ts b/public/app/panels/table/specs/table_model_specs.ts new file mode 100644 index 00000000000..ad515835730 --- /dev/null +++ b/public/app/panels/table/specs/table_model_specs.ts @@ -0,0 +1,51 @@ +import {describe, beforeEach, it, sinon, expect} from 'test/lib/common'; + +import {TableModel} from '../table_model'; + +describe('when sorting table desc', () => { + var table; + var panel = { + sort: {col: 0, desc: true}, + }; + + beforeEach(() => { + table = new TableModel(); + table.columns = [{}, {}]; + table.rows = [[100, 12], [105, 10], [103, 11]]; + table.sort(panel.sort); + }); + + it('should sort by time', () => { + expect(table.rows[0][0]).to.be(105); + expect(table.rows[1][0]).to.be(103); + expect(table.rows[2][0]).to.be(100); + }); + + it ('should mark column being sorted', () => { + expect(table.columns[0].sort).to.be(true); + expect(table.columns[0].desc).to.be(true); + }); + +}); + +describe('when sorting table asc', () => { + var table; + var panel = { + sort: {col: 1, desc: false}, + }; + + beforeEach(() => { + table = new TableModel(); + table.columns = [{}, {}]; + table.rows = [[100, 11], [105, 15], [103, 10]]; + table.sort(panel.sort); + }); + + it('should sort by time', () => { + expect(table.rows[0][1]).to.be(10); + expect(table.rows[1][1]).to.be(11); + expect(table.rows[2][1]).to.be(15); + }); + +}); + diff --git a/public/app/panels/table/specs/transformers_specs.ts b/public/app/panels/table/specs/transformers_specs.ts index 597b8913b82..6e002a5d561 100644 --- a/public/app/panels/table/specs/transformers_specs.ts +++ b/public/app/panels/table/specs/transformers_specs.ts @@ -19,7 +19,10 @@ describe('when transforming time series table', () => { ]; describe('timeseries_to_rows', () => { - var panel = {transform: 'timeseries_to_rows'}; + var panel = { + transform: 'timeseries_to_rows', + sort: {col: 0, desc: true}, + }; beforeEach(() => { table = TableModel.transform(timeSeries, panel); diff --git a/public/app/panels/table/table_model.ts b/public/app/panels/table/table_model.ts index 943234bcd89..c881dd82d8f 100644 --- a/public/app/panels/table/table_model.ts +++ b/public/app/panels/table/table_model.ts @@ -9,6 +9,31 @@ export class TableModel { this.rows = []; } + sort(options) { + if (options.col === null || this.columns.length < options.col) { + return; + } + + this.rows.sort(function(a, b) { + a = a[options.col]; + b = b[options.col]; + if (a < b) { + return -1; + } + if (a > b) { + return 1; + } + return 0; + }); + + this.columns[options.col].sort = true; + + if (options.desc) { + this.rows.reverse(); + this.columns[options.col].desc = true; + } + } + static transform(data, panel) { var model = new TableModel(); From 7612e47aee5424bdca82ec7a7d9b63921b5f607d Mon Sep 17 00:00:00 2001 From: utkarshcmu Date: Mon, 9 Nov 2015 12:08:40 -0800 Subject: [PATCH 164/269] Select AWS region from dropdown --- pkg/api/cloudwatch/metrics.go | 2 ++ public/app/features/org/datasourceEditCtrl.js | 18 ------------------ .../datasource/cloudwatch/partials/config.html | 9 +++++++-- 3 files changed, 9 insertions(+), 20 deletions(-) diff --git a/pkg/api/cloudwatch/metrics.go b/pkg/api/cloudwatch/metrics.go index 6d6ff10dfb9..ab4df6784c7 100644 --- a/pkg/api/cloudwatch/metrics.go +++ b/pkg/api/cloudwatch/metrics.go @@ -65,6 +65,8 @@ func init() { } } +// Whenever this list is updated, frontend list should also be updated. +// Please update the region list in public/app/features/org/datasourceEditCtrl.js func handleGetRegions(req *cwRequest, c *middleware.Context) { regions := []string{ "us-west-2", "us-west-1", "eu-west-1", "eu-central-1", "ap-southeast-1", diff --git a/public/app/features/org/datasourceEditCtrl.js b/public/app/features/org/datasourceEditCtrl.js index 46b8ab11abc..09dd8606092 100644 --- a/public/app/features/org/datasourceEditCtrl.js +++ b/public/app/features/org/datasourceEditCtrl.js @@ -50,34 +50,16 @@ function (angular, config, _) { }); }; - $scope.loadAWSRegions = function() { - var options = { - method: 'POST', - url: '/api/datasources/proxy/' + $scope.current.id, - data: { action: '__GetRegions' } - }; - - return backendSrv.datasourceRequest(options).then(function(result) { - $scope.current.jsonData.allRegions = result.data.map(function(region) { - return region.text; - }); - }); - }; - $scope.getDatasourceById = function(id) { backendSrv.get('/api/datasources/' + id).then(function(ds) { $scope.isNew = false; $scope.current = ds; - console.log($scope.current); $scope.typeChanged(); }); }; $scope.typeChanged = function() { $scope.datasourceMeta = $scope.types[$scope.current.type]; - if ($scope.current.type === 'cloudwatch') { - $scope.loadAWSRegions(); - } }; $scope.updateFrontendSettings = function() { diff --git a/public/app/plugins/datasource/cloudwatch/partials/config.html b/public/app/plugins/datasource/cloudwatch/partials/config.html index 0d7bf81777f..311ca0ae3dc 100644 --- a/public/app/plugins/datasource/cloudwatch/partials/config.html +++ b/public/app/plugins/datasource/cloudwatch/partials/config.html @@ -19,8 +19,13 @@
          • Default RegionSpecify the region, such as for US West (Oregon) use ` us-west-2 ` as the region.
          • -
          • - + +
          • +
          From 6325635fce4159d632ef21c75ba9bf4eb46b3bb4 Mon Sep 17 00:00:00 2001 From: utkarshcmu Date: Mon, 9 Nov 2015 12:31:35 -0800 Subject: [PATCH 165/269] Corrected the frontend filename --- pkg/api/cloudwatch/metrics.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/api/cloudwatch/metrics.go b/pkg/api/cloudwatch/metrics.go index ab4df6784c7..a5e738a2ae9 100644 --- a/pkg/api/cloudwatch/metrics.go +++ b/pkg/api/cloudwatch/metrics.go @@ -66,7 +66,7 @@ func init() { } // Whenever this list is updated, frontend list should also be updated. -// Please update the region list in public/app/features/org/datasourceEditCtrl.js +// Please update the region list in public/app/plugins/datasource/cloudwatch/partials/config.html func handleGetRegions(req *cwRequest, c *middleware.Context) { regions := []string{ "us-west-2", "us-west-1", "eu-west-1", "eu-central-1", "ap-southeast-1", From 99ee38cea31e29ff911b010f0e3cc346fef46ca4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Tue, 10 Nov 2015 08:38:34 +0100 Subject: [PATCH 166/269] feat(tablepanel): minor change --- public/app/panels/table/module.html | 2 +- public/app/panels/table/module.ts | 10 +++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/public/app/panels/table/module.html b/public/app/panels/table/module.html index 030324c325c..75b9b4ce136 100644 --- a/public/app/panels/table/module.html +++ b/public/app/panels/table/module.html @@ -7,7 +7,7 @@ -
          +
          {{col.text}} diff --git a/public/app/panels/table/module.ts b/public/app/panels/table/module.ts index beb6273fd62..9ed800f827c 100644 --- a/public/app/panels/table/module.ts +++ b/public/app/panels/table/module.ts @@ -37,9 +37,14 @@ export function tablePanel() { } function appendPaginationControls(footerElem) { - var paginationList = $('
            '); + footerElem.empty(); - var pageCount = data.rows.length / panel.pageSize; + var pageCount = Math.ceil(data.rows.length / panel.pageSize); + if (pageCount === 1) { + return; + } + + var paginationList = $('
              '); for (var i = 0; i < pageCount; i++) { var pageLinkElem = $('
            • ' + (i+1) + '
            • '); paginationList.append(pageLinkElem); @@ -48,7 +53,6 @@ export function tablePanel() { var nextLink = $('
            • »
            • '); paginationList.append(nextLink); - footerElem.empty(); footerElem.append(paginationList); } From 65bc194c422b10b5a2b6541e438062b82bead796 Mon Sep 17 00:00:00 2001 From: Mitsuhiro Tanda Date: Tue, 10 Nov 2015 19:01:37 +0900 Subject: [PATCH 167/269] fix templating error dialog for Prometheus --- public/app/services/backendSrv.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/public/app/services/backendSrv.js b/public/app/services/backendSrv.js index 819ce9d938e..dcd922b886d 100644 --- a/public/app/services/backendSrv.js +++ b/public/app/services/backendSrv.js @@ -106,6 +106,11 @@ function (angular, _, config) { }); } + // for Prometheus + if (!err.data.message && _.isString(err.data.error)) { + err.data.message = err.data.error; + } + throw err; }); }; From 5339ec66b7dcdbb7fcc78b20088f5ee268d7e24e Mon Sep 17 00:00:00 2001 From: utkarshcmu Date: Tue, 10 Nov 2015 02:22:15 -0800 Subject: [PATCH 168/269] added now-3h option --- public/app/core/utils/rangeutil.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/public/app/core/utils/rangeutil.ts b/public/app/core/utils/rangeutil.ts index 1e64fcc0061..5975ccbd181 100644 --- a/public/app/core/utils/rangeutil.ts +++ b/public/app/core/utils/rangeutil.ts @@ -34,11 +34,12 @@ var rangeOptions = [ { from: 'now-15m', to: 'now', display: 'Last 15 minutes', section: 3 }, { from: 'now-30m', to: 'now', display: 'Last 30 minutes', section: 3 }, { from: 'now-1h', to: 'now', display: 'Last 1 hour', section: 3 }, + { from: 'now-3h', to: 'now', display: 'Last 3 hour', section: 3 }, { from: 'now-6h', to: 'now', display: 'Last 6 hours', section: 3 }, { from: 'now-12h', to: 'now', display: 'Last 12 hours', section: 3 }, { from: 'now-24h', to: 'now', display: 'Last 24 hours', section: 3 }, - { from: 'now-7d', to: 'now', display: 'Last 7 days', section: 3 }, + { from: 'now-7d', to: 'now', display: 'Last 7 days', section: 0 }, { from: 'now-30d', to: 'now', display: 'Last 30 days', section: 0 }, { from: 'now-60d', to: 'now', display: 'Last 60 days', section: 0 }, { from: 'now-90d', to: 'now', display: 'Last 90 days', section: 0 }, From 0c50a7437b19fa13c178c1191c3b813512c297b8 Mon Sep 17 00:00:00 2001 From: utkarshcmu Date: Tue, 10 Nov 2015 02:29:02 -0800 Subject: [PATCH 169/269] missed an S at the end --- public/app/core/utils/rangeutil.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/app/core/utils/rangeutil.ts b/public/app/core/utils/rangeutil.ts index 5975ccbd181..21fea34fe68 100644 --- a/public/app/core/utils/rangeutil.ts +++ b/public/app/core/utils/rangeutil.ts @@ -34,7 +34,7 @@ var rangeOptions = [ { from: 'now-15m', to: 'now', display: 'Last 15 minutes', section: 3 }, { from: 'now-30m', to: 'now', display: 'Last 30 minutes', section: 3 }, { from: 'now-1h', to: 'now', display: 'Last 1 hour', section: 3 }, - { from: 'now-3h', to: 'now', display: 'Last 3 hour', section: 3 }, + { from: 'now-3h', to: 'now', display: 'Last 3 hours', section: 3 }, { from: 'now-6h', to: 'now', display: 'Last 6 hours', section: 3 }, { from: 'now-12h', to: 'now', display: 'Last 12 hours', section: 3 }, { from: 'now-24h', to: 'now', display: 'Last 24 hours', section: 3 }, From 167c02d7731049a20699ba767cc2783a023bc86f Mon Sep 17 00:00:00 2001 From: utkarshcmu Date: Tue, 10 Nov 2015 04:53:42 -0800 Subject: [PATCH 170/269] Timepicker display fixed for now-* --- public/app/core/utils/rangeutil.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/public/app/core/utils/rangeutil.ts b/public/app/core/utils/rangeutil.ts index 1e64fcc0061..3fc4252ceaf 100644 --- a/public/app/core/utils/rangeutil.ts +++ b/public/app/core/utils/rangeutil.ts @@ -133,6 +133,10 @@ _.each(rangeOptions, function (frame) { return from.fromNow() + ' to ' + formatDate(range.to); } + if (!moment.isMoment(range.from) && !moment.isMoment(range.to)) { + return formatDate(dateMath.parse(range.from, true)) + ' to ' + formatDate(dateMath.parse(range.to, true)); + } + var res = describeTextRange(range.from); return res.display; } From 1bec6c2aae625284e67dd63d1d724021b72816dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Tue, 10 Nov 2015 16:15:23 +0100 Subject: [PATCH 171/269] feat(tablepanel): made annotations transform work --- public/app/panels/table/controller.ts | 15 +++++---- public/app/panels/table/renderer.ts | 32 +++++++++---------- .../app/panels/table/specs/renderer_specs.ts | 8 ++++- .../panels/table/specs/transformers_specs.ts | 31 +++++++++++++++++- public/app/panels/table/transformers.ts | 15 +++++++++ 5 files changed, 77 insertions(+), 24 deletions(-) diff --git a/public/app/panels/table/controller.ts b/public/app/panels/table/controller.ts index 463096f097c..cfd2fdf7786 100644 --- a/public/app/panels/table/controller.ts +++ b/public/app/panels/table/controller.ts @@ -9,7 +9,7 @@ import {TableModel} from './table_model'; export class TablePanelCtrl { - constructor($scope, $rootScope, $q, panelSrv, panelHelper) { + constructor($scope, $rootScope, $q, panelSrv, panelHelper, annotationsSrv) { $scope.ctrl = this; $scope.pageIndex = 0; @@ -36,19 +36,22 @@ export class TablePanelCtrl { $scope.init = function() { _.defaults($scope.panel, panelDefaults); - if ($scope.panel.columns.length === 0) { - } - panelSrv.init($scope); }; $scope.refreshData = function(datasource) { panelHelper.updateTimeRange($scope); + if ($scope.panel.transform === 'annotations') { + return annotationsSrv.getAnnotations($scope.dashboard).then(annotations => { + $scope.dataRaw = annotations; + $scope.render(); + }); + } + return panelHelper.issueMetricQuery($scope, datasource) .then($scope.dataHandler, function(err) { - $scope.seriesList = []; - $scope.render([]); + $scope.render(); throw err; }); }; diff --git a/public/app/panels/table/renderer.ts b/public/app/panels/table/renderer.ts index acfef961f07..fae851e54b5 100644 --- a/public/app/panels/table/renderer.ts +++ b/public/app/panels/table/renderer.ts @@ -24,9 +24,22 @@ export class TableRenderer { return null; } + defaultCellFormater(v) { + if (v === null || v === void 0) { + return ''; + } + + if (_.isArray(v)) { + v = v.join(', '); + } + + return v; + } + + createColumnFormater(style) { if (!style) { - return v => v; + return this.defaultCellFormater; } if (style.type === 'date') { @@ -60,17 +73,7 @@ export class TableRenderer { }; } - return v => { - if (v === null || v === void 0) { - return '-'; - } - - if (_.isArray(v)) { - v = v.join(', '); - } - - return v; - }; + return this.defaultCellFormater; } formatColumnValue(colIndex, value) { @@ -88,10 +91,7 @@ export class TableRenderer { } } - this.formaters[colIndex] = function(v) { - return v; - }; - + this.formaters[colIndex] = this.defaultCellFormater; return this.formaters[colIndex](value); } diff --git a/public/app/panels/table/specs/renderer_specs.ts b/public/app/panels/table/specs/renderer_specs.ts index fad4f993acf..43b60c1b364 100644 --- a/public/app/panels/table/specs/renderer_specs.ts +++ b/public/app/panels/table/specs/renderer_specs.ts @@ -9,7 +9,8 @@ describe('when rendering table', () => { table.columns = [ {text: 'Time'}, {text: 'Value'}, - {text: 'Colored'} + {text: 'Colored'}, + {text: 'Undefined'}, ]; var panel = { @@ -59,6 +60,11 @@ describe('when rendering table', () => { var html = renderer.renderCell(2, 55); expect(html).to.be('55.0'); }); + + it('unformated undefined should be rendered as -', () => { + var html = renderer.renderCell(3, undefined); + expect(html).to.be(''); + }); }); }); diff --git a/public/app/panels/table/specs/transformers_specs.ts b/public/app/panels/table/specs/transformers_specs.ts index 6e002a5d561..c41143ab016 100644 --- a/public/app/panels/table/specs/transformers_specs.ts +++ b/public/app/panels/table/specs/transformers_specs.ts @@ -103,8 +103,37 @@ describe('when transforming time series table', () => { expect(table.rows[0][0]).to.be('time'); expect(table.rows[0][1]).to.be('message'); }); - }); + + describe('Annnotations', () => { + var panel = {transform: 'annotations'}; + var rawData = [ + { + min: 1000, + text: 'hej', + tags: ['tags', 'asd'], + title: 'title', + } + ]; + + beforeEach(() => { + table = TableModel.transform(rawData, panel); + }); + + it ('should return 4 columns', () => { + expect(table.columns.length).to.be(4); + expect(table.columns[0].text).to.be('Time'); + expect(table.columns[1].text).to.be('Title'); + expect(table.columns[2].text).to.be('Text'); + expect(table.columns[3].text).to.be('Tags'); + }); + + it ('should return 1 rows', () => { + expect(table.rows.length).to.be(1); + expect(table.rows[0][0]).to.be(1000); + }); + }); + }); }); diff --git a/public/app/panels/table/transformers.ts b/public/app/panels/table/transformers.ts index dce0098dde3..044a20c8c0b 100644 --- a/public/app/panels/table/transformers.ts +++ b/public/app/panels/table/transformers.ts @@ -66,6 +66,21 @@ transformers['timeseries_to_columns'] = { transformers['annotations'] = { description: 'Annotations', + transform: function(data, panel, model) { + model.columns.push({text: 'Time', type: 'date'}); + model.columns.push({text: 'Title'}); + model.columns.push({text: 'Text'}); + model.columns.push({text: 'Tags'}); + + if (!data || data.length === 0) { + return; + } + + for (var i = 0; i < data.length; i++) { + var evt = data[i]; + model.rows.push([evt.min, evt.title, evt.text, evt.tags]); + } + } }; transformers['json'] = { From a7deca1df54282b64d0f97434861c12db2ae8ccc Mon Sep 17 00:00:00 2001 From: Mitsuhiro Tanda Date: Wed, 11 Nov 2015 14:06:47 +0900 Subject: [PATCH 172/269] sort regions by alphabetical order --- pkg/api/cloudwatch/metrics.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/api/cloudwatch/metrics.go b/pkg/api/cloudwatch/metrics.go index 1357fccb127..4dbc86c420d 100644 --- a/pkg/api/cloudwatch/metrics.go +++ b/pkg/api/cloudwatch/metrics.go @@ -69,8 +69,8 @@ func init() { // Please update the region list in public/app/plugins/datasource/cloudwatch/partials/config.html func handleGetRegions(req *cwRequest, c *middleware.Context) { regions := []string{ - "us-east-1", "us-west-2", "us-west-1", "eu-west-1", "eu-central-1", "ap-southeast-1", - "ap-southeast-2", "ap-northeast-1", "sa-east-1", "cn-north-1", + "ap-northeast-1", "ap-southeast-1", "ap-southeast-2", "cn-north-1", + "eu-central-1", "eu-west-1", "sa-east-1", "us-east-1", "us-west-1", "us-west-2", } result := []interface{}{} From 02a37d670cd234b537ef3c46ac0c28f968fbd1b2 Mon Sep 17 00:00:00 2001 From: Mitsuhiro Tanda Date: Wed, 11 Nov 2015 14:15:20 +0900 Subject: [PATCH 173/269] sort namespaces by alphabetical order --- pkg/api/cloudwatch/metrics.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/pkg/api/cloudwatch/metrics.go b/pkg/api/cloudwatch/metrics.go index 4dbc86c420d..813dc9d0b89 100644 --- a/pkg/api/cloudwatch/metrics.go +++ b/pkg/api/cloudwatch/metrics.go @@ -2,6 +2,7 @@ package cloudwatch import ( "encoding/json" + "sort" "github.com/grafana/grafana/pkg/middleware" "github.com/grafana/grafana/pkg/util" @@ -82,8 +83,14 @@ func handleGetRegions(req *cwRequest, c *middleware.Context) { } func handleGetNamespaces(req *cwRequest, c *middleware.Context) { - result := []interface{}{} + keys := []string{} for key := range metricsMap { + keys = append(keys, key) + } + sort.Sort(sort.StringSlice(keys)) + + result := []interface{}{} + for _, key := range keys { result = append(result, util.DynMap{"text": key, "value": key}) } From 509c3dc715b89c3599d464cdf353931a0544ffbb Mon Sep 17 00:00:00 2001 From: utkarshcmu Date: Wed, 11 Nov 2015 01:34:24 -0800 Subject: [PATCH 174/269] Fixed time range when using NOW from and to --- public/app/core/utils/rangeutil.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/public/app/core/utils/rangeutil.ts b/public/app/core/utils/rangeutil.ts index 3fc4252ceaf..dda67725208 100644 --- a/public/app/core/utils/rangeutil.ts +++ b/public/app/core/utils/rangeutil.ts @@ -133,12 +133,12 @@ _.each(rangeOptions, function (frame) { return from.fromNow() + ' to ' + formatDate(range.to); } - if (!moment.isMoment(range.from) && !moment.isMoment(range.to)) { - return formatDate(dateMath.parse(range.from, true)) + ' to ' + formatDate(dateMath.parse(range.to, true)); + if (range.to.toString() === 'now') { + var res = describeTextRange(range.from); + return res.display; } - var res = describeTextRange(range.from); - return res.display; + return range.from.toString() + ' to ' + range.to.toString(); } export = { From 9f17e4ee2cf1aa34b27395e7d60f928251d576ea Mon Sep 17 00:00:00 2001 From: utkarshcmu Date: Wed, 11 Nov 2015 01:34:53 -0800 Subject: [PATCH 175/269] Added unit tests to verify time range fix --- public/test/specs/core/utils/rangeutil_specs.ts | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/public/test/specs/core/utils/rangeutil_specs.ts b/public/test/specs/core/utils/rangeutil_specs.ts index 8816a15f73d..32286764c20 100644 --- a/public/test/specs/core/utils/rangeutil_specs.ts +++ b/public/test/specs/core/utils/rangeutil_specs.ts @@ -80,6 +80,22 @@ describe("rangeUtil", () => { var text = rangeUtil.describeTimeRange({from: 'now-13h', to: 'now'}); expect(text).to.be('Last 13 hours') }); + + it('Date range with from and to both are in now-* format', () => { + var text = rangeUtil.describeTimeRange({from: 'now-6h', to: 'now-3h'}); + expect(text).to.be('now-6h to now-3h') + }); + + it('Date range with from and to both are either in now-* or now/* format', () => { + var text = rangeUtil.describeTimeRange({from: 'now/d+6h', to: 'now-3h'}); + expect(text).to.be('now/d+6h to now-3h') + }); + + it('Date range with from and to both are either in now-* or now+* format', () => { + var text = rangeUtil.describeTimeRange({from: 'now-6h', to: 'now+1h'}); + expect(text).to.be('now-6h to now+1h') + }); + }); }); From cc80191cd176e65a681bd74be1359e0536a70e87 Mon Sep 17 00:00:00 2001 From: Mitsuhiro Tanda Date: Wed, 11 Nov 2015 19:04:51 +0900 Subject: [PATCH 176/269] CloudWatch ebs templating fix --- public/app/plugins/datasource/cloudwatch/datasource.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/app/plugins/datasource/cloudwatch/datasource.js b/public/app/plugins/datasource/cloudwatch/datasource.js index 576fb9ffcdd..b2d761bef3c 100644 --- a/public/app/plugins/datasource/cloudwatch/datasource.js +++ b/public/app/plugins/datasource/cloudwatch/datasource.js @@ -204,7 +204,7 @@ function (angular, _) { return this.performEC2DescribeInstances(region, [], instanceIds).then(function(result) { var volumeIds = _.map(result.Reservations[0].Instances[0].BlockDeviceMappings, function(mapping) { - return mapping.EBS.VolumeID; + return mapping.Ebs.VolumeId; }); return transformSuggestData(volumeIds); From 8a61ec4b4e2d9d61ee81efeb5a57dbdcb8385c36 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Wed, 11 Nov 2015 16:40:36 +0100 Subject: [PATCH 177/269] feat(tablepanel): paging is starting to work --- public/app/panels/table/controller.ts | 8 ++++++++ public/app/panels/table/editor.html | 2 +- public/app/panels/table/module.ts | 29 ++++++++++++++++++++++++--- public/app/panels/table/renderer.ts | 4 ++-- public/less/panel_table.less | 26 ++++++++++++++++-------- 5 files changed, 55 insertions(+), 14 deletions(-) diff --git a/public/app/panels/table/controller.ts b/public/app/panels/table/controller.ts index cfd2fdf7786..99570d4b6c6 100644 --- a/public/app/panels/table/controller.ts +++ b/public/app/panels/table/controller.ts @@ -42,6 +42,8 @@ export class TablePanelCtrl { $scope.refreshData = function(datasource) { panelHelper.updateTimeRange($scope); + $scope.pageIndex = 0; + if ($scope.panel.transform === 'annotations') { return annotationsSrv.getAnnotations($scope.dashboard).then(annotations => { $scope.dataRaw = annotations; @@ -79,6 +81,12 @@ export class TablePanelCtrl { $scope.render = function() { $scope.table = TableModel.transform($scope.dataRaw, $scope.panel); $scope.table.sort($scope.panel.sort); + + $scope.pageCount = Math.ceil($scope.table.rows.length / $scope.panel.pageSize); + $scope.showPagination = $scope.pageCount > 1; + $scope.showPrevPageLink = $scope.pageIndex > 0; + $scope.showNextPageLink = $scope.pageIndex < $scope.pageCount; + panelHelper.broadcastRender($scope, $scope.table, $scope.dataRaw); }; diff --git a/public/app/panels/table/editor.html b/public/app/panels/table/editor.html index 72bc1cf8a1e..aced71a8a98 100644 --- a/public/app/panels/table/editor.html +++ b/public/app/panels/table/editor.html @@ -44,7 +44,7 @@ Pagination (Page size)
            • -
            diff --git a/public/app/panels/table/module.ts b/public/app/panels/table/module.ts index 9ed800f827c..745045c8139 100644 --- a/public/app/panels/table/module.ts +++ b/public/app/panels/table/module.ts @@ -20,6 +20,7 @@ export function tablePanel() { var data; var panel = scope.panel; var formaters = []; + var pageIndex = 0; function getTableHeight() { var panelHeight = scope.height || scope.panel.height || scope.row.height; @@ -33,7 +34,13 @@ export function tablePanel() { function appendTableRows(tbodyElem) { var renderer = new TableRenderer(panel, data, scope.dashboard.timezone); tbodyElem.empty(); - tbodyElem.html(renderer.render(0)); + tbodyElem.html(renderer.render(pageIndex)); + } + + function switchPage(e) { + var el = $(e.currentTarget); + pageIndex = (parseInt(el.text(), 10)-1); + renderPanel(); } function appendPaginationControls(footerElem) { @@ -44,9 +51,17 @@ export function tablePanel() { return; } + var startPage = Math.max(pageIndex - 3, 0); + var endPage = Math.min(pageCount, startPage + 9); + var paginationList = $('
              '); - for (var i = 0; i < pageCount; i++) { - var pageLinkElem = $('
            • ' + (i+1) + '
            • '); + + var prevLink = $('
            • «
            • '); + paginationList.append(prevLink); + + for (var i = startPage; i < endPage; i++) { + var activeClass = i === pageIndex ? 'active' : ''; + var pageLinkElem = $('
            • ' + (i+1) + '
            • '); paginationList.append(pageLinkElem); } @@ -67,12 +82,20 @@ export function tablePanel() { appendPaginationControls(footerElem); } + elem.on('click', '.table-panel-page-link', switchPage); + + scope.$on('$destroy', function() { + elem.off('click', '.table-panel-page-link'); + }); + scope.$on('render', function(event, renderData) { data = renderData || data; if (!data) { scope.get_data(); return; } + + pageIndex = 0; renderPanel(); }); } diff --git a/public/app/panels/table/renderer.ts b/public/app/panels/table/renderer.ts index fae851e54b5..dd5eb9ed0e1 100644 --- a/public/app/panels/table/renderer.ts +++ b/public/app/panels/table/renderer.ts @@ -111,8 +111,8 @@ export class TableRenderer { } render(page) { - let endPos = Math.min(this.panel.pageSize, this.table.rows.length); - let startPos = 0; + let startPos = page * this.panel.pageSize; + let endPos = Math.min(startPos + this.panel.pageSize, this.table.rows.length); var html = ""; for (var y = startPos; y < endPos; y++) { diff --git a/public/less/panel_table.less b/public/less/panel_table.less index 58fb6376f5c..7f7512c691a 100644 --- a/public/less/panel_table.less +++ b/public/less/panel_table.less @@ -18,7 +18,7 @@ .table-panel-footer { text-align: center; - font-size: 80%; + font-size: 90%; line-height: 2px; ul { @@ -35,6 +35,15 @@ padding: 4px 12px; text-decoration: none; border-left-width: 0; + + &:hover { + background-color: @grafanaTargetFuncBackground; + } + + &.active { + font-weight: bold; + color: @blue; + } } } @@ -42,10 +51,6 @@ width: 100%; border-collapse: collapse; - tr { - border-bottom: 2px solid @bodyBackground; - } - th { padding: 0; @@ -57,11 +62,16 @@ } td { - padding: 10px 0 10px 15px; + padding: 6px 0 6px 15px; + border-bottom: 2px solid @bodyBackground; + border-right: 2px solid @bodyBackground; &:first-child { padding-left: 15px; } + &:last-child { + border-right: none; + } } } @@ -69,7 +79,7 @@ background: @grafanaListAccent; border-top: 2px solid @bodyBackground; border-bottom: 2px solid @bodyBackground; - height: 30px; + height: 32px; position: absolute; top: 0; right: 0; @@ -77,7 +87,7 @@ } .table-panel-table-header-inner { - padding: 5px 0 5px 15px; + padding: 6px 0 6px 15px; text-align: left; color: @blue; From 5c0cf9f5d74e7cc55f8574297d0343815dbe3ff2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Thu, 12 Nov 2015 11:36:16 +0100 Subject: [PATCH 178/269] feat(tablepanel): worked on more display options for table panel --- public/app/core/directives/metric_segment.js | 2 ++ public/app/panels/table/controller.ts | 9 +++------ public/app/panels/table/editor.html | 11 ++++++++++- public/app/panels/table/editor.ts | 7 ++++++- public/app/panels/table/module.ts | 17 ++++++++++------- public/less/panel_table.less | 10 ++++------ 6 files changed, 35 insertions(+), 21 deletions(-) diff --git a/public/app/core/directives/metric_segment.js b/public/app/core/directives/metric_segment.js index 6fdc171c1f8..9babb74dc2d 100644 --- a/public/app/core/directives/metric_segment.js +++ b/public/app/core/directives/metric_segment.js @@ -192,6 +192,8 @@ function (_, $, coreModule) { var option = _.findWhere($scope.options, {text: $scope.segment.value}); if (option && option.value !== $scope.property) { $scope.property = option.value; + } else if (attrs.custom !== 'false') { + $scope.property = $scope.segment.value; } } else { $scope.property = $scope.segment.value; diff --git a/public/app/panels/table/controller.ts b/public/app/panels/table/controller.ts index 99570d4b6c6..4cca50ff337 100644 --- a/public/app/panels/table/controller.ts +++ b/public/app/panels/table/controller.ts @@ -30,6 +30,8 @@ export class TablePanelCtrl { showHeader: true, columns: [], fields: [], + scroll: true, + fontSize: '100%', sort: {col: null, desc: true}, }; @@ -75,18 +77,13 @@ export class TablePanelCtrl { $scope.dataHandler = function(results) { $scope.dataRaw = results.data; + $scope.pageIndex = 0; $scope.render(); }; $scope.render = function() { $scope.table = TableModel.transform($scope.dataRaw, $scope.panel); $scope.table.sort($scope.panel.sort); - - $scope.pageCount = Math.ceil($scope.table.rows.length / $scope.panel.pageSize); - $scope.showPagination = $scope.pageCount > 1; - $scope.showPrevPageLink = $scope.pageIndex > 0; - $scope.showNextPageLink = $scope.pageIndex < $scope.pageCount; - panelHelper.broadcastRender($scope, $scope.table, $scope.dataRaw); }; diff --git a/public/app/panels/table/editor.html b/public/app/panels/table/editor.html index aced71a8a98..64bc0c997e5 100644 --- a/public/app/panels/table/editor.html +++ b/public/app/panels/table/editor.html @@ -47,6 +47,15 @@ +
            • + +
            • +
            • + Font size +
            • +
            • + +
            @@ -90,7 +99,7 @@ Format
          • - +
          diff --git a/public/app/panels/table/editor.ts b/public/app/panels/table/editor.ts index 8aae1840629..06fbea3167f 100644 --- a/public/app/panels/table/editor.ts +++ b/public/app/panels/table/editor.ts @@ -29,6 +29,12 @@ export function tablePanelEditor() { {text: 'String', value: 'string'}, {text: 'Date', value: 'date'}, ]; + scope.fontSizes = ['80%', '90%', '100%', '110%', '120%', '130%', '150%', '160%', '180%', '200%', '220%', '250%']; + scope.dateFormats = [ + {text: 'YYYY-MM-DD HH:mm:ss', value: 'YYYY-MM-DD HH:mm:ss'}, + {text: 'MM/DD/YY h:mm:ss a', value: 'MM/DD/YY h:mm:ss a'}, + {text: 'MMMM D, YYYY LT', value: 'MMMM D, YYYY LT'}, + ]; scope.updateJsonFieldsMenu = function(data) { scope.jsonFieldsMenu = []; @@ -103,7 +109,6 @@ export function tablePanelEditor() { return col.text; }); }; - } }; } diff --git a/public/app/panels/table/module.ts b/public/app/panels/table/module.ts index 745045c8139..beb62127c2d 100644 --- a/public/app/panels/table/module.ts +++ b/public/app/panels/table/module.ts @@ -20,7 +20,6 @@ export function tablePanel() { var data; var panel = scope.panel; var formaters = []; - var pageIndex = 0; function getTableHeight() { var panelHeight = scope.height || scope.panel.height || scope.row.height; @@ -34,12 +33,12 @@ export function tablePanel() { function appendTableRows(tbodyElem) { var renderer = new TableRenderer(panel, data, scope.dashboard.timezone); tbodyElem.empty(); - tbodyElem.html(renderer.render(pageIndex)); + tbodyElem.html(renderer.render(scope.pageIndex)); } function switchPage(e) { var el = $(e.currentTarget); - pageIndex = (parseInt(el.text(), 10)-1); + scope.pageIndex = (parseInt(el.text(), 10)-1); renderPanel(); } @@ -51,7 +50,7 @@ export function tablePanel() { return; } - var startPage = Math.max(pageIndex - 3, 0); + var startPage = Math.max(scope.pageIndex - 3, 0); var endPage = Math.min(pageCount, startPage + 9); var paginationList = $('
            '); @@ -60,7 +59,7 @@ export function tablePanel() { paginationList.append(prevLink); for (var i = startPage; i < endPage; i++) { - var activeClass = i === pageIndex ? 'active' : ''; + var activeClass = i === scope.pageIndex ? 'active' : ''; var pageLinkElem = $('
          • ' + (i+1) + '
          • '); paginationList.append(pageLinkElem); } @@ -72,13 +71,18 @@ export function tablePanel() { } function renderPanel() { + var container = elem.find('.table-panel-container'); var rootElem = elem.find('.table-panel-scroll'); var tbodyElem = elem.find('tbody'); var footerElem = elem.find('.table-panel-footer'); appendTableRows(tbodyElem); - rootElem.css({'max-height': getTableHeight()}); + rootElem.css({ + 'max-height': panel.scroll ? getTableHeight() : '' + }); + + container.css({'font-size': panel.fontSize}); appendPaginationControls(footerElem); } @@ -95,7 +99,6 @@ export function tablePanel() { return; } - pageIndex = 0; renderPanel(); }); } diff --git a/public/less/panel_table.less b/public/less/panel_table.less index 7f7512c691a..23a17cd0976 100644 --- a/public/less/panel_table.less +++ b/public/less/panel_table.less @@ -12,7 +12,7 @@ } .table-panel-container { - padding-top: 32px; + padding-top: 2em; position: relative; } @@ -62,7 +62,7 @@ } td { - padding: 6px 0 6px 15px; + padding: 0.45em 0 0.45em 1.1em; border-bottom: 2px solid @bodyBackground; border-right: 2px solid @bodyBackground; @@ -79,7 +79,7 @@ background: @grafanaListAccent; border-top: 2px solid @bodyBackground; border-bottom: 2px solid @bodyBackground; - height: 32px; + height: 2.0em; position: absolute; top: 0; right: 0; @@ -87,12 +87,10 @@ } .table-panel-table-header-inner { - padding: 6px 0 6px 15px; + padding: 0.45em 0 0.45em 1.1em; text-align: left; color: @blue; - position: absolute; top: 0; - line-height: 23px; } From bbdf75bdfa85416319f010332f98d65839e35ee3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Thu, 12 Nov 2015 11:49:07 +0100 Subject: [PATCH 179/269] feat(dashboard): Automatically go into panel edit mode after adding a new panel to the dashboard --- public/app/core/settings.js | 2 +- public/app/features/dashboard/rowCtrl.js | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/public/app/core/settings.js b/public/app/core/settings.js index e452b59b904..2fa484a9cba 100644 --- a/public/app/core/settings.js +++ b/public/app/core/settings.js @@ -15,7 +15,7 @@ function (_) { 'text': { path: 'app/panels/text', name: 'Text' }, 'dashlist': { path: 'app/panels/dashlist', name: 'Dashboard list' }, }, - new_panel_title: 'no title (click here)', + new_panel_title: 'Panel Title', plugins: {}, playlist_timespan: "1m", unsaved_changes_warning: true, diff --git a/public/app/features/dashboard/rowCtrl.js b/public/app/features/dashboard/rowCtrl.js index 0d8ee5d9473..723481d2d65 100644 --- a/public/app/features/dashboard/rowCtrl.js +++ b/public/app/features/dashboard/rowCtrl.js @@ -91,13 +91,14 @@ function (angular, _, config) { error: false, span: _as < defaultSpan && _as > 0 ? _as : defaultSpan, editable: true, - type: type + type: type, + isNew: true, }; $scope.addPanel(panel); $timeout(function() { - $scope.$broadcast('render'); + $scope.dashboardViewState.update({fullscreen: true, edit: true, panelId: panel.id }); }); }; From e04678f33c8c68fd773a82d28ab0756d286de537 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Thu, 12 Nov 2015 12:01:44 +0100 Subject: [PATCH 180/269] feat(dasbboard): fix to issues when setting fullscreen/edit state for panel that have yet to get a scope --- public/app/features/dashboard/viewStateSrv.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/public/app/features/dashboard/viewStateSrv.js b/public/app/features/dashboard/viewStateSrv.js index 749aced2bf2..58403766a31 100644 --- a/public/app/features/dashboard/viewStateSrv.js +++ b/public/app/features/dashboard/viewStateSrv.js @@ -89,6 +89,11 @@ function (angular, _, $) { this.leaveFullscreen(false); } var panelScope = this.getPanelScope(this.state.panelId); + // panel could be about to be created/added and scope does + // not exist yet + if (!panelScope) { + return; + } this.enterFullscreen(panelScope); return; } From 87c718f5497d2c7fd0b022c11142457887294227 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Thu, 12 Nov 2015 12:39:16 +0100 Subject: [PATCH 181/269] feat(tablepanel): worked on issues and improving defaults --- public/app/panels/table/controller.ts | 19 +++++++++++++++++-- public/app/panels/table/editor.html | 5 +---- public/app/panels/table/editor.ts | 4 ++++ public/app/panels/table/module.ts | 8 ++++---- public/app/panels/table/renderer.ts | 25 ++++++++++++++++++++----- public/app/panels/table/table_model.ts | 2 +- public/less/panel_table.less | 7 ++++++- 7 files changed, 53 insertions(+), 17 deletions(-) diff --git a/public/app/panels/table/controller.ts b/public/app/panels/table/controller.ts index 4cca50ff337..bd7c0acc140 100644 --- a/public/app/panels/table/controller.ts +++ b/public/app/panels/table/controller.ts @@ -28,11 +28,26 @@ export class TablePanelCtrl { transform: 'timeseries_to_rows', pageSize: 50, showHeader: true, - columns: [], + columns: [ + { + type: 'date', + pattern: 'Time', + dateFormat: 'YYYY-MM-DD HH:mm:ss', + }, + { + unit: 'short', + type: 'number', + decimals: 2, + colors: ["rgba(245, 54, 54, 0.9)", "rgba(237, 129, 40, 0.89)", "rgba(50, 172, 45, 0.97)"], + colorMode: null, + pattern: '/.*/', + thresholds: [], + } + ], fields: [], scroll: true, fontSize: '100%', - sort: {col: null, desc: true}, + sort: {col: 0, desc: true}, }; $scope.init = function() { diff --git a/public/app/panels/table/editor.html b/public/app/panels/table/editor.html index 64bc0c997e5..a1cc25b52fc 100644 --- a/public/app/panels/table/editor.html +++ b/public/app/panels/table/editor.html @@ -11,7 +11,7 @@ + ng-change="transformChanged()">
            @@ -131,9 +131,6 @@ -
          • - invert order -
          • diff --git a/public/app/panels/table/editor.ts b/public/app/panels/table/editor.ts index 06fbea3167f..e2f07cf8bd2 100644 --- a/public/app/panels/table/editor.ts +++ b/public/app/panels/table/editor.ts @@ -73,6 +73,10 @@ export function tablePanelEditor() { scope.render(); }; + scope.transformChanged = function() { + scope.render(); + }; + scope.removeJsonField = function(field) { scope.panel.fields = _.without(scope.panel.fields, field); scope.render(); diff --git a/public/app/panels/table/module.ts b/public/app/panels/table/module.ts index beb62127c2d..f09a7389a59 100644 --- a/public/app/panels/table/module.ts +++ b/public/app/panels/table/module.ts @@ -55,8 +55,8 @@ export function tablePanel() { var paginationList = $('
              '); - var prevLink = $('
            • «
            • '); - paginationList.append(prevLink); + // var prevLink = $('
            • «
            • '); + // paginationList.append(prevLink); for (var i = startPage; i < endPage; i++) { var activeClass = i === scope.pageIndex ? 'active' : ''; @@ -64,8 +64,8 @@ export function tablePanel() { paginationList.append(pageLinkElem); } - var nextLink = $('
            • »
            • '); - paginationList.append(nextLink); + // var nextLink = $('
            • »
            • '); + // paginationList.append(nextLink); footerElem.append(paginationList); } diff --git a/public/app/panels/table/renderer.ts b/public/app/panels/table/renderer.ts index dd5eb9ed0e1..983852111c8 100644 --- a/public/app/panels/table/renderer.ts +++ b/public/app/panels/table/renderer.ts @@ -95,7 +95,7 @@ export class TableRenderer { return this.formaters[colIndex](value); } - renderCell(columnIndex, value) { + renderCell(columnIndex, value, addWidthHack = false) { var value = this.formatColumnValue(columnIndex, value); var style = ''; if (this.colorState.cell) { @@ -107,7 +107,15 @@ export class TableRenderer { this.colorState.value = null; } - return '' + value + ''; + // because of the fixed table headers css only solution + // there is an issue if header cell is wider the cell + // this hack adds header content to cell (not visible) + var widthHack = ''; + if (addWidthHack) { + widthHack = '
              ' + this.table.columns[columnIndex].text + '
              '; + } + + return '' + value + widthHack + ''; } render(page) { @@ -117,11 +125,18 @@ export class TableRenderer { for (var y = startPos; y < endPos; y++) { let row = this.table.rows[y]; - html += ''; + let cellHtml = ''; + let rowStyle = ''; for (var i = 0; i < this.table.columns.length; i++) { - html += this.renderCell(i, row[i]); + cellHtml += this.renderCell(i, row[i], y === 0); } - html += ''; + + if (this.colorState.row) { + rowStyle = ' style="background-color:' + this.colorState.row + ';color: white"'; + this.colorState.row = null; + } + + html += '' + cellHtml + ''; } return html; diff --git a/public/app/panels/table/table_model.ts b/public/app/panels/table/table_model.ts index c881dd82d8f..1fa4007e6e3 100644 --- a/public/app/panels/table/table_model.ts +++ b/public/app/panels/table/table_model.ts @@ -10,7 +10,7 @@ export class TableModel { } sort(options) { - if (options.col === null || this.columns.length < options.col) { + if (options.col === null || this.columns.length <= options.col) { return; } diff --git a/public/less/panel_table.less b/public/less/panel_table.less index 23a17cd0976..51b7449c7a8 100644 --- a/public/less/panel_table.less +++ b/public/less/panel_table.less @@ -12,7 +12,7 @@ } .table-panel-container { - padding-top: 2em; + padding-top: 2.2em; position: relative; } @@ -94,3 +94,8 @@ top: 0; } +.table-panel-width-hack { + visibility: hidden; + height: 0px; + line-height: 0px; +} From 163b45cf37ec077e018ff2b9fe03fb0be36e0a80 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Thu, 12 Nov 2015 13:41:53 +0100 Subject: [PATCH 182/269] feat(tablepanel): minor fix --- public/app/panels/table/editor.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/public/app/panels/table/editor.ts b/public/app/panels/table/editor.ts index e2f07cf8bd2..4da8e5c5967 100644 --- a/public/app/panels/table/editor.ts +++ b/public/app/panels/table/editor.ts @@ -95,6 +95,7 @@ export function tablePanelEditor() { colors: ["rgba(245, 54, 54, 0.9)", "rgba(237, 129, 40, 0.89)", "rgba(50, 172, 45, 0.97)"], colorMode: null, pattern: '/.*/', + dateFormat: 'YYYY-MM-DD HH:mm:ss', thresholds: [], }; From d315ff2b964238a1eace6793d2c96f6f4737be55 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Thu, 12 Nov 2015 13:47:12 +0100 Subject: [PATCH 183/269] changelog: updated master version to 2.6 and merged develop branch --- CHANGELOG.md | 5 ++++- package.json | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4cc80e2d533..2215d0ff660 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,7 @@ -# 2.5.1 (unreleased) +# 2.6.0 (unreleased) + +### New Table Panel +* **table**: New powerful and flexible table panel, closes [#215](https://github.com/grafana/grafana/issues/215) ### Enhancements * **CloudWatch**: Support for multiple AWS Credentials, closes [#3053](https://github.com/grafana/grafana/issues/3053), [#3080](https://github.com/grafana/grafana/issues/3080) diff --git a/package.json b/package.json index 543b6362d76..4e3890be19f 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "company": "Coding Instinct AB" }, "name": "grafana", - "version": "2.5.1-pre1", + "version": "2.6.0-pre1", "repository": { "type": "git", "url": "http://github.com/torkelo/grafana.git" From bad6a40a123c021d0e65ad936e7ceb1a860c9893 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Thu, 12 Nov 2015 13:50:57 +0100 Subject: [PATCH 184/269] updated readme --- README.md | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 8c48a4f7366..2c2adc7ab3f 100644 --- a/README.md +++ b/README.md @@ -6,16 +6,14 @@ [Email](mailto:contact@grafana.org) Grafana is an open source, feature rich metrics dashboard and graph editor for -Graphite, InfluxDB & OpenTSDB. +Graphite, Elasticsearch, OpenTSDB, Prometheus and InfluxDB. ![](http://grafana.org/assets/img/start_page_bg.png) -## Grafana 2.0 -The develop branch has now been merged with master. For 1.9 users this is a big change as Grafana is no longer -a standalone frontend only web application. Grafana 2.0 comes with a backend. -- [Install instructions](http://docs.grafana.org/v2.0/installation/) -- [Migrating from 1.x to 2.x](http://docs.grafana.org/v2.0/installation/migrating_to2/) -- [What's New in Grafana 2.0](http://docs.grafana.org/v2.0/guides/whats-new-in-v2/) +- [Install instructions](http://docs.grafana.org/installation/) +- [What's New in Grafana 2.0](http://docs.grafana.org/guides/whats-new-in-v2/) +- [What's New in Grafana 2.1](http://docs.grafana.org/guides/whats-new-in-v2-1/) +- [What's New in Grafana 2.5](http://docs.grafana.org/guides/whats-new-in-v2-5/) ## Features ### Graphite Target Editor @@ -47,6 +45,9 @@ a standalone frontend only web application. Grafana 2.0 comes with a backend. - [Time range controls](http://docs.grafana.org/reference/timerange/) - [Share snapshots publicly](http://docs.grafana.org/v2.0/reference/sharing/) +### Elasticsearch +- Feature rich query editor UI + ### InfluxDB - Use InfluxDB as a metric data source, annotation source - Query editor with series and column typeahead, easy group by and function selection From f1caae126e705230374cd81ca7191d078533f394 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Thu, 12 Nov 2015 14:28:35 +0100 Subject: [PATCH 185/269] feat(build): fixed build issues --- public/app/panels/table/controller.ts | 1 + tasks/options/ngtemplates.js | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/public/app/panels/table/controller.ts b/public/app/panels/table/controller.ts index bd7c0acc140..d269ee1b7a6 100644 --- a/public/app/panels/table/controller.ts +++ b/public/app/panels/table/controller.ts @@ -9,6 +9,7 @@ import {TableModel} from './table_model'; export class TablePanelCtrl { + /** @ngInject */ constructor($scope, $rootScope, $q, panelSrv, panelHelper, annotationsSrv) { $scope.ctrl = this; $scope.pageIndex = 0; diff --git a/tasks/options/ngtemplates.js b/tasks/options/ngtemplates.js index 10c39a49c39..cf965e0162d 100644 --- a/tasks/options/ngtemplates.js +++ b/tasks/options/ngtemplates.js @@ -3,11 +3,11 @@ module.exports = function(config) { grafana: { cwd: '<%= genDir %>', src: ['app/**/*.html'], - dest: '<%= genDir %>/app/components/partials.js', + dest: '<%= genDir %>/app/core/partials.js', options: { bootstrap: function(module, script) { - return "define('app/components/partials', ['angular'], function(angular) { \n" + - "angular.module('grafana').run(['$templateCache', function($templateCache) { \n" + + return "define('app/core/partials', ['app/core/core_module'], function(coreModule) { \n" + + "coreModule.run(['$templateCache', function($templateCache) { \n" + script + '\n}]);' + '\n});'; From dbe35bfed1c02bb590b11203d729f033776a6eb2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Thu, 12 Nov 2015 16:06:10 +0100 Subject: [PATCH 186/269] change(elasticsearch): changed min_doc_count to zero in query to get buckets for missing values, fixes #3131 --- public/app/plugins/datasource/elasticsearch/query_builder.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/app/plugins/datasource/elasticsearch/query_builder.js b/public/app/plugins/datasource/elasticsearch/query_builder.js index 3a956012a86..129c52d3f02 100644 --- a/public/app/plugins/datasource/elasticsearch/query_builder.js +++ b/public/app/plugins/datasource/elasticsearch/query_builder.js @@ -126,7 +126,7 @@ function (angular) { esAgg["date_histogram"] = { "interval": this.getInterval(aggDef), "field": this.timeField, - "min_doc_count": 1, + "min_doc_count": 0, "extended_bounds": { "min": "$timeFrom", "max": "$timeTo" } }; break; From 850ad1c0fb77724dfa7150cda7d41117a0039415 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Thu, 12 Nov 2015 16:30:15 +0100 Subject: [PATCH 187/269] fix(tablepanel): fixed width fix for page2+, #3219 --- public/app/panels/table/renderer.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/app/panels/table/renderer.ts b/public/app/panels/table/renderer.ts index 983852111c8..37fec0642be 100644 --- a/public/app/panels/table/renderer.ts +++ b/public/app/panels/table/renderer.ts @@ -128,7 +128,7 @@ export class TableRenderer { let cellHtml = ''; let rowStyle = ''; for (var i = 0; i < this.table.columns.length; i++) { - cellHtml += this.renderCell(i, row[i], y === 0); + cellHtml += this.renderCell(i, row[i], y === startPos); } if (this.colorState.row) { From fbd6417c8abccbab063b92e66221c48175f681d3 Mon Sep 17 00:00:00 2001 From: Matt Toback Date: Thu, 12 Nov 2015 12:03:33 -0500 Subject: [PATCH 188/269] Updating singlestat article to include troubleshooting --- docs/sources/reference/singlestat.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/docs/sources/reference/singlestat.md b/docs/sources/reference/singlestat.md index 6f7c9fbd965..7de047197f7 100644 --- a/docs/sources/reference/singlestat.md +++ b/docs/sources/reference/singlestat.md @@ -54,4 +54,21 @@ Value to text mapping allows you to translate the value of the summary stat into +## Troubleshooting +### Multiple Series Error + + + + +Grafana 2.5 introduced stricter checking for multiple-series on singlestat panels. In previous versions, the panel logic did not verify that only a single series was used, and instead, displayed the first series encountered. Depending on your data source, this could have lead to inconsistent data being shown and/or a general confusion about which metric was being displayed. + +To fix your singlestat panel: + +- Edit your panel by clicking the Panel Title and selecting *Edit*. + +- Do you have multiple queries in the metrics tab? + - Solution: Select a single query to vizualize. You can toggle whether a query is vizualized by clicking the eye icon on each line. If the error persists, continue to the next solution. + +- Do you have one query? + - Solution: This likely means your query is returning multiple series. You will want to reduce this down to a single series. This can be accomplished in many ways, depending on your data source. Some common practices include summing the series, averaging or any number of other functions. Consult the documentation for your data source for additional information. From b43315c36d51bef7685f6e89d2cce66402792340 Mon Sep 17 00:00:00 2001 From: Matt Toback Date: Thu, 12 Nov 2015 12:07:09 -0500 Subject: [PATCH 189/269] Update singlestat.md --- docs/sources/reference/singlestat.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/sources/reference/singlestat.md b/docs/sources/reference/singlestat.md index 7de047197f7..a982871a5cd 100644 --- a/docs/sources/reference/singlestat.md +++ b/docs/sources/reference/singlestat.md @@ -58,7 +58,7 @@ Value to text mapping allows you to translate the value of the summary stat into ### Multiple Series Error - + Grafana 2.5 introduced stricter checking for multiple-series on singlestat panels. In previous versions, the panel logic did not verify that only a single series was used, and instead, displayed the first series encountered. Depending on your data source, this could have lead to inconsistent data being shown and/or a general confusion about which metric was being displayed. From 7888c1c61429ea154e939a7d40b350f9bae07988 Mon Sep 17 00:00:00 2001 From: Matt Toback Date: Thu, 12 Nov 2015 12:35:45 -0500 Subject: [PATCH 190/269] Update singlestat.md --- docs/sources/reference/singlestat.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/sources/reference/singlestat.md b/docs/sources/reference/singlestat.md index a982871a5cd..91724e89882 100644 --- a/docs/sources/reference/singlestat.md +++ b/docs/sources/reference/singlestat.md @@ -68,7 +68,7 @@ To fix your singlestat panel: - Edit your panel by clicking the Panel Title and selecting *Edit*. - Do you have multiple queries in the metrics tab? - - Solution: Select a single query to vizualize. You can toggle whether a query is vizualized by clicking the eye icon on each line. If the error persists, continue to the next solution. + - Solution: Select a single query to visualize. You can toggle whether a query is visualized by clicking the eye icon on each line. If the error persists, continue to the next solution. - Do you have one query? - Solution: This likely means your query is returning multiple series. You will want to reduce this down to a single series. This can be accomplished in many ways, depending on your data source. Some common practices include summing the series, averaging or any number of other functions. Consult the documentation for your data source for additional information. From c5b39a5100fda8efb2671236493d64158163ad1f Mon Sep 17 00:00:00 2001 From: utkarshcmu Date: Thu, 12 Nov 2015 09:56:46 -0800 Subject: [PATCH 191/269] Added currency units --- public/app/core/utils/kbn.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/public/app/core/utils/kbn.js b/public/app/core/utils/kbn.js index 1d60ba48fd6..a9e8d219ce6 100644 --- a/public/app/core/utils/kbn.js +++ b/public/app/core/utils/kbn.js @@ -341,6 +341,8 @@ function($, _) { // Currencies kbn.valueFormats.currencyUSD = kbn.formatBuilders.currency('$'); kbn.valueFormats.currencyGBP = kbn.formatBuilders.currency('£'); + kbn.valueFormats.currencyEUR = kbn.formatBuilders.currency('€'); + kbn.valueFormats.currencyJPY = kbn.formatBuilders.currency('¥'); // Data kbn.valueFormats.bits = kbn.formatBuilders.binarySIPrefix('b'); @@ -508,6 +510,8 @@ function($, _) { submenu: [ {text: 'Dollars ($)', value: 'currencyUSD'}, {text: 'Pounds (£)', value: 'currencyGBP'}, + {text: 'Euro (€)', value: 'currencyEUR'}, + {text: 'Yen (¥)', value: 'currencyJPY'}, ] }, { From 3c54d14460f7356188718714a872337773f212ba Mon Sep 17 00:00:00 2001 From: utkarshcmu Date: Thu, 12 Nov 2015 20:26:59 -0800 Subject: [PATCH 192/269] Added UI for time units, minute scalability --- public/app/core/utils/kbn.js | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/public/app/core/utils/kbn.js b/public/app/core/utils/kbn.js index a9e8d219ce6..70487fe46e4 100644 --- a/public/app/core/utils/kbn.js +++ b/public/app/core/utils/kbn.js @@ -489,6 +489,26 @@ function($, _) { } }; + kbn.valueFormats.m = function(size, decimals, scaledDecimals) { + if (size === null) { return ""; } + + if (Math.abs(size) < 60) { + return kbn.toFixed(size, decimals) + " min"; + } + else if (Math.abs(size) < 1440) { + return kbn.toFixedScaled(size / 60, decimals, scaledDecimals, 2, " hour"); + } + else if (Math.abs(size) < 10080) { + return kbn.toFixedScaled(size / 1440, decimals, scaledDecimals, 3, " day"); + } + else if (Math.abs(size) < 604800) { + return kbn.toFixedScaled(size / 86400, decimals, scaledDecimals, 4, " week"); + } + else { + return kbn.toFixedScaled(size / 5.25948e5, decimals, scaledDecimals, 5, " year"); + } + }; + ///// FORMAT MENU ///// kbn.getUnitFormats = function() { @@ -522,6 +542,9 @@ function($, _) { {text: 'microseconds (µs)', value: 'µs' }, {text: 'milliseconds (ms)', value: 'ms' }, {text: 'seconds (s)', value: 's' }, + {text: 'minutes (m)', value: 'm' }, + {text: 'hours (h)', value: 'h' }, + {text: 'days (d)', value: 'd' }, ] }, { From 7f9c8a19357017c427fae258642108c746ed01f6 Mon Sep 17 00:00:00 2001 From: utkarshcmu Date: Thu, 12 Nov 2015 23:56:24 -0800 Subject: [PATCH 193/269] Added hours, days units and tests for all --- public/app/core/utils/kbn.js | 35 +++++++++++++++++++++++++++-- public/test/core/utils/kbn_specs.js | 21 +++++++++++++++++ 2 files changed, 54 insertions(+), 2 deletions(-) diff --git a/public/app/core/utils/kbn.js b/public/app/core/utils/kbn.js index 70487fe46e4..123e8e16be1 100644 --- a/public/app/core/utils/kbn.js +++ b/public/app/core/utils/kbn.js @@ -432,7 +432,7 @@ function($, _) { kbn.valueFormats.s = function(size, decimals, scaledDecimals) { if (size === null) { return ""; } - if (Math.abs(size) < 600) { + if (Math.abs(size) < 60) { return kbn.toFixed(size, decimals) + " s"; } // Less than 1 hour, devide in minutes @@ -502,13 +502,44 @@ function($, _) { return kbn.toFixedScaled(size / 1440, decimals, scaledDecimals, 3, " day"); } else if (Math.abs(size) < 604800) { - return kbn.toFixedScaled(size / 86400, decimals, scaledDecimals, 4, " week"); + return kbn.toFixedScaled(size / 10080, decimals, scaledDecimals, 4, " week"); } else { return kbn.toFixedScaled(size / 5.25948e5, decimals, scaledDecimals, 5, " year"); } }; + kbn.valueFormats.h = function(size, decimals, scaledDecimals) { + if (size === null) { return ""; } + + if (Math.abs(size) < 24) { + return kbn.toFixed(size, decimals) + " hour"; + } + else if (Math.abs(size) < 168) { + return kbn.toFixedScaled(size / 24, decimals, scaledDecimals, 2, " day"); + } + else if (Math.abs(size) < 8760) { + return kbn.toFixedScaled(size / 168, decimals, scaledDecimals, 3, " week"); + } + else { + return kbn.toFixedScaled(size / 8760, decimals, scaledDecimals, 4, " year"); + } + }; + + kbn.valueFormats.d = function(size, decimals, scaledDecimals) { + if (size === null) { return ""; } + + if (Math.abs(size) < 7) { + return kbn.toFixed(size, decimals) + " day"; + } + else if (Math.abs(size) < 365) { + return kbn.toFixedScaled(size / 7, decimals, scaledDecimals, 2, " week"); + } + else { + return kbn.toFixedScaled(size / 365, decimals, scaledDecimals, 3, " year"); + } + }; + ///// FORMAT MENU ///// kbn.getUnitFormats = function() { diff --git a/public/test/core/utils/kbn_specs.js b/public/test/core/utils/kbn_specs.js index 2253f4d8ecd..23c752fe471 100644 --- a/public/test/core/utils/kbn_specs.js +++ b/public/test/core/utils/kbn_specs.js @@ -68,6 +68,27 @@ define([ describeValueFormat('wps', 789000000, 1000000, -1, '789M wps'); describeValueFormat('iops', 11000000000, 1000000000, -1, '11B iops'); + describeValueFormat('s', 24, 1, 0, '24 s'); + describeValueFormat('s', 246, 1, 0, '4.1 min'); + describeValueFormat('s', 24567, 100, 0, '6.82 hour'); + describeValueFormat('s', 24567890, 10000, 0, '40.62 week'); + describeValueFormat('s', 24567890000, 1000000, 0, '778.53 year'); + + describeValueFormat('m', 24, 1, 0, '24 min'); + describeValueFormat('m', 246, 10, 0, '4.1 hour'); + describeValueFormat('m', 6545, 10, 0, '4.55 day'); + describeValueFormat('m', 24567, 100, 0, '2.44 week'); + describeValueFormat('m', 24567892, 10000, 0, '46.7 year'); + + describeValueFormat('h', 21, 1, 0, '21 hour'); + describeValueFormat('h', 145, 1, 0, '6.04 day'); + describeValueFormat('h', 1234, 100, 0, '7.3 week'); + describeValueFormat('h', 9458, 1000, 0, '1.08 year'); + + describeValueFormat('d', 3, 1, 0, '3 day'); + describeValueFormat('d', 245, 100, 0, '35 week'); + describeValueFormat('d', 2456, 10, 0, '6.73 year'); + describe('kbn.toFixed and negative decimals', function() { it('should treat as zero decimals', function() { var str = kbn.toFixed(186.123, -2); From cc125f5fd79cff3dbb8a43944250a73ff501b1e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Fri, 13 Nov 2015 09:25:31 +0100 Subject: [PATCH 194/269] change(shortcuts): changed CTRL+F search shortcut to just F --- docs/sources/reference/keyboard_shortcuts.md | 4 ++-- public/app/features/dashboard/keybindings.js | 2 +- public/app/partials/help_modal.html | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/sources/reference/keyboard_shortcuts.md b/docs/sources/reference/keyboard_shortcuts.md index 627bfc5c3dd..039c3002cfe 100644 --- a/docs/sources/reference/keyboard_shortcuts.md +++ b/docs/sources/reference/keyboard_shortcuts.md @@ -17,7 +17,7 @@ Press `Shift`+`?` to open the keyboard shortcut dialog from anywhere within the |Shortcut|Action| |---|---| |`Esc`|Exit fullscreen edit/view mode, close search or any editor view| -|`CTRL`+`F`|Open dashboard search view (also contains import/playlist controls)| +|`F`|Open dashboard search view (also contains import/playlist controls)| |`CTRL`+`S`|Save dashboard| |`CTRL`+`H`|Hide row controls| |`CTRL`+`Z`|Zoom out| @@ -29,4 +29,4 @@ Press `Shift`+`?` to open the keyboard shortcut dialog from anywhere within the **Note**: Grafana keyboard shortcuts are the same across operating system. For example, `CTRL`+`F` will open the dashboard picker on a Mac as well, **not** `⌘`+`F` -Have a suggestion for a new keyboard shortcut? Let us know. \ No newline at end of file +Have a suggestion for a new keyboard shortcut? Let us know. diff --git a/public/app/features/dashboard/keybindings.js b/public/app/features/dashboard/keybindings.js index b417382bc45..2219cab2d4c 100644 --- a/public/app/features/dashboard/keybindings.js +++ b/public/app/features/dashboard/keybindings.js @@ -33,7 +33,7 @@ function(angular, $) { }, { inputDisabled: true }); - keyboardManager.bind('ctrl+f', function() { + keyboardManager.bind('f', function() { scope.appEvent('show-dash-search'); }, { inputDisabled: true }); diff --git a/public/app/partials/help_modal.html b/public/app/partials/help_modal.html index 5b9452a94f3..5d7abfe2490 100644 --- a/public/app/partials/help_modal.html +++ b/public/app/partials/help_modal.html @@ -21,7 +21,7 @@ Exit fullscreen edit/view mode, close search or any editor view - CTRL+F + F Open dashboard search view (also contains import/playlist controls) From 2cbc62d6c0a8b35f427a29db3ed214461829f345 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Fri, 13 Nov 2015 09:30:28 +0100 Subject: [PATCH 195/269] fix(elasticsearch): fixed elasticsearch issue, ghost docs series, fixes #3223 --- public/app/plugins/datasource/elasticsearch/elastic_response.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/app/plugins/datasource/elasticsearch/elastic_response.js b/public/app/plugins/datasource/elasticsearch/elastic_response.js index aaac2e46ea1..7eb4378831d 100644 --- a/public/app/plugins/datasource/elasticsearch/elastic_response.js +++ b/public/app/plugins/datasource/elasticsearch/elastic_response.js @@ -209,7 +209,7 @@ function (_, queryDef) { throw { message: response.error }; } - if (response.hits) { + if (response.hits && response.hits.hits.length > 0) { this.processHits(response.hits, seriesList); } From a71b681e80870ac7afe7b03bcfea40948b7e49b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Fri, 13 Nov 2015 09:32:16 +0100 Subject: [PATCH 196/269] fix(docs): minor docs fix --- docs/sources/reference/keyboard_shortcuts.md | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/docs/sources/reference/keyboard_shortcuts.md b/docs/sources/reference/keyboard_shortcuts.md index 039c3002cfe..c9da3d5c6a1 100644 --- a/docs/sources/reference/keyboard_shortcuts.md +++ b/docs/sources/reference/keyboard_shortcuts.md @@ -25,8 +25,6 @@ Press `Shift`+`?` to open the keyboard shortcut dialog from anywhere within the |`CTRL`+`O`|Enable/Disable shared graph crosshair| - -**Note**: Grafana keyboard shortcuts are the same across operating system. For example, `CTRL`+`F` will open the dashboard picker on a Mac as well, **not** `⌘`+`F` - +**Note**: Grafana keyboard shortcuts are the same across operating system. Have a suggestion for a new keyboard shortcut? Let us know. From e4208441b3430a540a3f07533da765b8cd73d6c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Fri, 13 Nov 2015 09:36:52 +0100 Subject: [PATCH 197/269] fix(inspector): added close button to inspector modal, fixes #3213 --- public/app/partials/inspector.html | 3 +++ 1 file changed, 3 insertions(+) diff --git a/public/app/partials/inspector.html b/public/app/partials/inspector.html index 7e7c25209f5..5a83afe9a3b 100644 --- a/public/app/partials/inspector.html +++ b/public/app/partials/inspector.html @@ -10,6 +10,9 @@
              +
              From 32f9f8fcceba3bcfd47bc398e524178019ed2faa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Fri, 13 Nov 2015 09:43:25 +0100 Subject: [PATCH 198/269] fix(http api): correct return status code for /api/datasources/:id so it eturns 404 when not found, fixes #3217 --- pkg/api/api.go | 2 +- pkg/api/datasources.go | 10 ++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/pkg/api/api.go b/pkg/api/api.go index 013b2ebe076..3d1b28d7aa3 100644 --- a/pkg/api/api.go +++ b/pkg/api/api.go @@ -148,7 +148,7 @@ func Register(r *macaron.Macaron) { r.Post("/", quota("data_source"), bind(m.AddDataSourceCommand{}), AddDataSource) r.Put("/:id", bind(m.UpdateDataSourceCommand{}), UpdateDataSource) r.Delete("/:id", DeleteDataSource) - r.Get("/:id", GetDataSourceById) + r.Get("/:id", wrap(GetDataSourceById)) r.Get("/plugins", GetDataSourcePlugins) }, regOrgAdmin) diff --git a/pkg/api/datasources.go b/pkg/api/datasources.go index 717211d438d..38a4004c241 100644 --- a/pkg/api/datasources.go +++ b/pkg/api/datasources.go @@ -37,20 +37,22 @@ func GetDataSources(c *middleware.Context) { c.JSON(200, result) } -func GetDataSourceById(c *middleware.Context) { +func GetDataSourceById(c *middleware.Context) Response { query := m.GetDataSourceByIdQuery{ Id: c.ParamsInt64(":id"), OrgId: c.OrgId, } if err := bus.Dispatch(&query); err != nil { - c.JsonApiErr(500, "Failed to query datasources", err) - return + if err == m.ErrDataSourceNotFound { + return ApiError(404, "Data source not found", nil) + } + return ApiError(500, "Failed to query datasources", err) } ds := query.Result - c.JSON(200, &dtos.DataSource{ + return Json(200, &dtos.DataSource{ Id: ds.Id, OrgId: ds.OrgId, Name: ds.Name, From 00a479de6ffcd5cfd21adbb021fac02b0d630e33 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Fri, 13 Nov 2015 10:32:01 +0100 Subject: [PATCH 199/269] feat(tablepanel): renamed some table panel schema things --- public/app/panels/table/controller.ts | 11 ++++- public/app/panels/table/editor.html | 44 +++++++++---------- public/app/panels/table/editor.ts | 24 +++++----- public/app/panels/table/renderer.ts | 4 +- .../app/panels/table/specs/renderer_specs.ts | 2 +- .../panels/table/specs/transformers_specs.ts | 28 +++++++++++- public/app/panels/table/transformers.ts | 8 ++-- 7 files changed, 77 insertions(+), 44 deletions(-) diff --git a/public/app/panels/table/controller.ts b/public/app/panels/table/controller.ts index d269ee1b7a6..e2166f82577 100644 --- a/public/app/panels/table/controller.ts +++ b/public/app/panels/table/controller.ts @@ -29,7 +29,7 @@ export class TablePanelCtrl { transform: 'timeseries_to_rows', pageSize: 50, showHeader: true, - columns: [ + styles: [ { type: 'date', pattern: 'Time', @@ -45,13 +45,20 @@ export class TablePanelCtrl { thresholds: [], } ], - fields: [], + columns: [], scroll: true, fontSize: '100%', sort: {col: 0, desc: true}, }; $scope.init = function() { + if ($scope.panel.styles === void 0) { + $scope.panel.styles = $scope.panel.columns; + $scope.panel.columns = $scope.panel.fields; + delete $scope.panel.columns; + delete $scope.panel.fields; + } + _.defaults($scope.panel, panelDefaults); panelSrv.init($scope); diff --git a/public/app/panels/table/editor.html b/public/app/panels/table/editor.html index a1cc25b52fc..50cb18f3d07 100644 --- a/public/app/panels/table/editor.html +++ b/public/app/panels/table/editor.html @@ -19,15 +19,15 @@
              • - Fields + Columns
              • -
              • - +
              • + - {{field.name}} + {{column.name}}
              • -
              @@ -67,11 +67,11 @@
              Column Styles
              -
              +
              • - +
              @@ -80,38 +80,38 @@ Name or regex
            • - +
            • Type
            • -
                +
                • Format
                • - +
              -
              +
              • Coloring
              • +
              • Colors
              • - - - + + +
              -
              +
              • Unit
              • Decimals
              • - +
              @@ -158,7 +158,7 @@
              diff --git a/public/app/panels/table/editor.ts b/public/app/panels/table/editor.ts index 4da8e5c5967..971b273cb50 100644 --- a/public/app/panels/table/editor.ts +++ b/public/app/panels/table/editor.ts @@ -36,8 +36,8 @@ export function tablePanelEditor() { {text: 'MMMM D, YYYY LT', value: 'MMMM D, YYYY LT'}, ]; - scope.updateJsonFieldsMenu = function(data) { - scope.jsonFieldsMenu = []; + scope.updateColumnsMenu = function(data) { + scope.columnsMenu = []; if (!data || data.length === 0) { return; } @@ -58,18 +58,18 @@ export function tablePanelEditor() { } _.each(names, function(value, key) { - scope.jsonFieldsMenu.push({text: key}); + scope.columnsMenu.push({text: key}); }); }; - scope.updateJsonFieldsMenu(scope.dataRaw); + scope.updateColumnsMenu(scope.dataRaw); scope.$on('render', function(event, table, rawData) { - scope.updateJsonFieldsMenu(rawData); + scope.updateColumnsMenu(rawData); }); - scope.addJsonField = function(menuItem) { - scope.panel.fields.push({name: menuItem.text}); + scope.addColumn = function(menuItem) { + scope.panel.columns.push({name: menuItem.text}); scope.render(); }; @@ -77,8 +77,8 @@ export function tablePanelEditor() { scope.render(); }; - scope.removeJsonField = function(field) { - scope.panel.fields = _.without(scope.panel.fields, field); + scope.removeColumn = function(column) { + scope.panel.column = _.without(scope.panel.column, column); scope.render(); }; @@ -99,11 +99,11 @@ export function tablePanelEditor() { thresholds: [], }; - scope.panel.columns.push(angular.copy(columnStyleDefaults)); + scope.panel.styles.push(angular.copy(columnStyleDefaults)); }; - scope.removeColumnStyle = function(col) { - scope.panel.columns = _.without(scope.panel.columns, col); + scope.removeColumnStyle = function(style) { + scope.panel.styles = _.without(scope.panel.styles, style); }; scope.getColumnNames = function() { diff --git a/public/app/panels/table/renderer.ts b/public/app/panels/table/renderer.ts index 37fec0642be..3ecb6d68643 100644 --- a/public/app/panels/table/renderer.ts +++ b/public/app/panels/table/renderer.ts @@ -81,8 +81,8 @@ export class TableRenderer { return this.formaters[colIndex](value); } - for (let i = 0; i < this.panel.columns.length; i++) { - let style = this.panel.columns[i]; + for (let i = 0; i < this.panel.styles.length; i++) { + let style = this.panel.styles[i]; let column = this.table.columns[colIndex]; var regex = kbn.stringToJsRegex(style.pattern); if (column.text.match(regex)) { diff --git a/public/app/panels/table/specs/renderer_specs.ts b/public/app/panels/table/specs/renderer_specs.ts index 43b60c1b364..f8fdebb9ab0 100644 --- a/public/app/panels/table/specs/renderer_specs.ts +++ b/public/app/panels/table/specs/renderer_specs.ts @@ -15,7 +15,7 @@ describe('when rendering table', () => { var panel = { pageSize: 10, - columns: [ + styles: [ { pattern: 'Time', type: 'date', diff --git a/public/app/panels/table/specs/transformers_specs.ts b/public/app/panels/table/specs/transformers_specs.ts index c41143ab016..c6e287a7ed7 100644 --- a/public/app/panels/table/specs/transformers_specs.ts +++ b/public/app/panels/table/specs/transformers_specs.ts @@ -71,10 +71,36 @@ describe('when transforming time series table', () => { }); }); + describe('timeseries_to_summaries', () => { + var panel = { + transform: 'timeseries_to_summaries', + sort: {col: 0, desc: true}, + }; + + beforeEach(() => { + table = TableModel.transform(timeSeries, panel); + }); + + // it('should return 2 rows', () => { + // expect(table.rows.length).to.be(2); + // expect(table.rows[0][0]).to.be('series1'); + // expect(table.rows[0][1]).to.be('Min'); + // expect(table.rows[1][0]).to.be('series2'); + // }); + // + // it('should return 2 columns', () => { + // expect(table.columns.length).to.be(3); + // expect(table.columns[0].text).to.be('Series'); + // expect(table.columns[1].text).to.be('Min'); + // expect(table.columns[2].text).to.be('Value'); + // }); + }); + + describe('JSON Data', () => { var panel = { transform: 'json', - fields: [{name: 'timestamp'}, {name: 'message'}] + columns: [{name: 'timestamp'}, {name: 'message'}] }; var rawData = [ { diff --git a/public/app/panels/table/transformers.ts b/public/app/panels/table/transformers.ts index 044a20c8c0b..8302be662eb 100644 --- a/public/app/panels/table/transformers.ts +++ b/public/app/panels/table/transformers.ts @@ -87,8 +87,8 @@ transformers['json'] = { description: 'JSON Data', transform: function(data, panel, model) { var i, y, z; - for (i = 0; i < panel.fields.length; i++) { - model.columns.push({text: panel.fields[i].name}); + for (i = 0; i < panel.columns.length; i++) { + model.columns.push({text: panel.columns[i].name}); } if (model.columns.length === 0) { @@ -101,8 +101,8 @@ transformers['json'] = { for (y = 0; y < series.datapoints.length; y++) { var dp = series.datapoints[y]; var values = []; - for (z = 0; z < panel.fields.length; z++) { - values.push(dp[panel.fields[z].name]); + for (z = 0; z < panel.columns.length; z++) { + values.push(dp[panel.columns[z].name]); } if (values.length === 0) { From 3a66d7c4538c7f71d9f740fd8904e61a5cf512a1 Mon Sep 17 00:00:00 2001 From: utkarshcmu Date: Fri, 13 Nov 2015 03:08:48 -0800 Subject: [PATCH 200/269] Made opentsdb query editor consistent --- .../opentsdb/partials/query.editor.html | 30 +++++++++---------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/public/app/plugins/datasource/opentsdb/partials/query.editor.html b/public/app/plugins/datasource/opentsdb/partials/query.editor.html index 5cd4fd4f283..5ab9f226dc3 100644 --- a/public/app/plugins/datasource/opentsdb/partials/query.editor.html +++ b/public/app/plugins/datasource/opentsdb/partials/query.editor.html @@ -37,7 +37,7 @@
              diff --git a/public/app/plugins/datasource/elasticsearch/query_ctrl.js b/public/app/plugins/datasource/elasticsearch/query_ctrl.js index 3965286ac12..08eb734ec33 100644 --- a/public/app/plugins/datasource/elasticsearch/query_ctrl.js +++ b/public/app/plugins/datasource/elasticsearch/query_ctrl.js @@ -1,13 +1,12 @@ define([ 'angular', - 'lodash', ], -function (angular, _) { +function (angular) { 'use strict'; var module = angular.module('grafana.controllers'); - module.controller('ElasticQueryCtrl', function($scope, $timeout, uiSegmentSrv, templateSrv) { + module.controller('ElasticQueryCtrl', function($scope, $timeout, uiSegmentSrv) { $scope.init = function() { var target = $scope.target; @@ -21,7 +20,7 @@ function (angular, _) { $scope.getFields = function(type) { var jsonStr = angular.toJson({find: 'fields', type: type}); return $scope.datasource.metricFindQuery(jsonStr) - .then($scope.transformToSegments(false)) + .then(uiSegmentSrv.transformToSegments(false)) .then(null, $scope.handleQueryError); }; @@ -35,21 +34,6 @@ function (angular, _) { $scope.appEvent('elastic-query-updated'); }; - $scope.transformToSegments = function(addTemplateVars) { - return function(results) { - var segments = _.map(results, function(segment) { - return uiSegmentSrv.newSegment({ value: segment.text, expandable: segment.expandable }); - }); - - if (addTemplateVars) { - _.each(templateSrv.variables, function(variable) { - segments.unshift(uiSegmentSrv.newSegment({ type: 'template', value: '$' + variable.name, expandable: true })); - }); - } - return segments; - }; - }; - $scope.handleQueryError = function(err) { $scope.parserError = err.message || 'Failed to issue metric query'; return []; From cf1e167430d2a68db155f7b01d1f86e2d39ded2b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Mon, 23 Nov 2015 16:10:32 +0100 Subject: [PATCH 233/269] feat(table panel): table panel can now show nested object data, closes #3263 --- public/app/panels/table/editor.html | 2 +- .../panels/table/specs/transformers_specs.ts | 47 ++++++++++++++----- public/app/panels/table/transformers.ts | 19 +++++--- 3 files changed, 48 insertions(+), 20 deletions(-) diff --git a/public/app/panels/table/editor.html b/public/app/panels/table/editor.html index 27bf9002d56..b3632c96d19 100644 --- a/public/app/panels/table/editor.html +++ b/public/app/panels/table/editor.html @@ -158,7 +158,7 @@
              diff --git a/public/app/panels/table/specs/transformers_specs.ts b/public/app/panels/table/specs/transformers_specs.ts index 6e22e176e66..bb42b997d33 100644 --- a/public/app/panels/table/specs/transformers_specs.ts +++ b/public/app/panels/table/specs/transformers_specs.ts @@ -1,6 +1,7 @@ import {describe, beforeEach, it, sinon, expect} from 'test/lib/common'; import {TableModel} from '../table_model'; +import {transformers} from '../transformers'; describe('when transforming time series table', () => { var table; @@ -100,7 +101,11 @@ describe('when transforming time series table', () => { describe('JSON Data', () => { var panel = { transform: 'json', - columns: [{text: 'Timestamp', value: 'timestamp'}, {text: 'Message', value: 'message'}] + columns: [ + {text: 'Timestamp', value: 'timestamp'}, + {text: 'Message', value: 'message'}, + {text: 'nested.level2', value: 'nested.level2'}, + ] }; var rawData = [ { @@ -108,26 +113,42 @@ describe('when transforming time series table', () => { datapoints: [ { timestamp: 'time', - message: 'message' + message: 'message', + nested: { + level2: 'level2-value' + } } ] } ]; - beforeEach(() => { - table = TableModel.transform(rawData, panel); + describe('getColumns', function() { + it('should return nested properties', function() { + var columns = transformers['json'].getColumns(rawData); + expect(columns[0].text).to.be('timestamp'); + expect(columns[1].text).to.be('message'); + expect(columns[2].text).to.be('nested.level2'); + }); }); - it ('should return 2 columns', () => { - expect(table.columns.length).to.be(2); - expect(table.columns[0].text).to.be('Timestamp'); - expect(table.columns[1].text).to.be('Message'); - }); + describe('transform', function() { + beforeEach(() => { + table = TableModel.transform(rawData, panel); + }); - it ('should return 2 rows', () => { - expect(table.rows.length).to.be(1); - expect(table.rows[0][0]).to.be('time'); - expect(table.rows[0][1]).to.be('message'); + it ('should return 2 columns', () => { + expect(table.columns.length).to.be(3); + expect(table.columns[0].text).to.be('Timestamp'); + expect(table.columns[1].text).to.be('Message'); + expect(table.columns[2].text).to.be('nested.level2'); + }); + + it ('should return 2 rows', () => { + expect(table.rows.length).to.be(1); + expect(table.rows[0][0]).to.be('time'); + expect(table.rows[0][1]).to.be('message'); + expect(table.rows[0][2]).to.be('level2-value'); + }); }); }); diff --git a/public/app/panels/table/transformers.ts b/public/app/panels/table/transformers.ts index 1a5482693e7..a4d0d4395c5 100644 --- a/public/app/panels/table/transformers.ts +++ b/public/app/panels/table/transformers.ts @@ -2,6 +2,7 @@ import moment = require('moment'); import _ = require('lodash'); +import flatten = require('app/core/utils/flatten'); import TimeSeries = require('app/core/time_series'); var transformers = {}; @@ -149,9 +150,12 @@ transformers['json'] = { continue; } - for (var y = 0; y < series.datapoints.length; y++) { + // only look at 100 docs + var maxDocs = Math.min(series.datapoints.length, 100); + for (var y = 0; y < maxDocs; y++) { var doc = series.datapoints[y]; - for (var propName in doc) { + var flattened = flatten(doc, null); + for (var propName in flattened) { names[propName] = true; } } @@ -177,13 +181,16 @@ transformers['json'] = { for (y = 0; y < series.datapoints.length; y++) { var dp = series.datapoints[y]; var values = []; - for (z = 0; z < panel.columns.length; z++) { - values.push(dp[panel.columns[z].value]); - } - if (values.length === 0) { + if (_.isObject(dp) && panel.columns.length > 0) { + var flattened = flatten(dp, null); + for (z = 0; z < panel.columns.length; z++) { + values.push(flattened[panel.columns[z].value]); + } + } else { values.push(JSON.stringify(dp)); } + model.rows.push(values); } } From 24b9bc1e553a16abf675c273c69ef94715440d10 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Mon, 23 Nov 2015 18:20:12 +0100 Subject: [PATCH 234/269] fix(missing files): added missing files, oops --- public/app/core/utils/flatten.ts | 39 +++++++++++++++++++++++++ public/test/core/utils/flatten_specs.ts | 24 +++++++++++++++ 2 files changed, 63 insertions(+) create mode 100644 public/app/core/utils/flatten.ts create mode 100644 public/test/core/utils/flatten_specs.ts diff --git a/public/app/core/utils/flatten.ts b/public/app/core/utils/flatten.ts new file mode 100644 index 00000000000..fb4c47d1e3d --- /dev/null +++ b/public/app/core/utils/flatten.ts @@ -0,0 +1,39 @@ +// Copyright (c) 2014, Hugh Kennedy +// Based on code from https://github.com/hughsk/flat/blob/master/index.js +// +function flatten(target, opts): any { + opts = opts || {}; + + var delimiter = opts.delimiter || '.'; + var maxDepth = opts.maxDepth || 3; + var currentDepth = 1; + var output = {}; + + function step(object, prev) { + Object.keys(object).forEach(function(key) { + var value = object[key]; + var isarray = opts.safe && Array.isArray(value); + var type = Object.prototype.toString.call(value); + var isobject = type === "[object Object]"; + + var newKey = prev ? prev + delimiter + key : key; + + if (!opts.maxDepth) { + maxDepth = currentDepth + 1; + } + + if (!isarray && isobject && Object.keys(value).length && currentDepth < maxDepth) { + ++currentDepth; + return step(value, newKey); + } + + output[newKey] = value; + }); + } + + step(target, null); + + return output; +} + +export = flatten; diff --git a/public/test/core/utils/flatten_specs.ts b/public/test/core/utils/flatten_specs.ts new file mode 100644 index 00000000000..01815df8607 --- /dev/null +++ b/public/test/core/utils/flatten_specs.ts @@ -0,0 +1,24 @@ +import {describe, beforeEach, it, sinon, expect} from 'test/lib/common' + +import flatten = require('app/core/utils/flatten') + +describe("flatten", () => { + + it('should return flatten object', () => { + var flattened = flatten({ + level1: 'level1-value', + deeper: { + level2: 'level2-value', + deeper: { + level3: 'level3-value' + } + } + }, null); + + expect(flattened['level1']).to.be('level1-value'); + expect(flattened['deeper.level2']).to.be('level2-value'); + expect(flattened['deeper.deeper.level3']).to.be('level3-value'); + }); + +}); + From ca5d0496ee70037bdd051ef82ab8f80300c1d0b4 Mon Sep 17 00:00:00 2001 From: utkarshcmu Date: Mon, 23 Nov 2015 19:19:26 -0800 Subject: [PATCH 235/269] Validated HTTP responses --- docs/sources/reference/http_api.md | 66 +++++++++++++++--------------- 1 file changed, 32 insertions(+), 34 deletions(-) diff --git a/docs/sources/reference/http_api.md b/docs/sources/reference/http_api.md index 5c917a7096f..15e7a06f3b8 100644 --- a/docs/sources/reference/http_api.md +++ b/docs/sources/reference/http_api.md @@ -142,10 +142,10 @@ Will return the dashboard given the dashboard slug. Slug is the url friendly ver "rows": [ { } - ] + ], "schemaVersion": 6, "version": 0 - }, + } } ### Delete dashboard @@ -787,7 +787,7 @@ Update Organisation, fields *Adress 1*, *Adress 2*, *City* are not implemented y "id": 2, "name": "User", "login": "user", - "email": "user@mygraf.com" + "email": "user@mygraf.com", "isAdmin": false } ] @@ -1046,7 +1046,7 @@ Deletes the starring of the given Dashboard for the actual user. "timezone":"browser", "title":"Home", "version":5 - } + }, "expires": 3600 } @@ -1091,34 +1091,33 @@ Keys: "canStar":false, "slug":"", "expires":"2200-13-32T25:23:23+02:00", - "created":"2200-13-32T28:24:23+02:00"}, - - { - "dashboard": { - "editable":false, - "hideControls":true, - "nav":[ - { - "enable":false, - "type":"timepicker" - } - ], - "rows": [ + "created":"2200-13-32T28:24:23+02:00" + }, + "dashboard": { + "editable":false, + "hideControls":true, + "nav":[ { - + "enable":false, + "type":"timepicker" } - ], - "style":"dark", - "tags":[], - "templating":{ - "list":[ - ] - }, - "time":{ - }, - "timezone":"browser", - "title":"Home", - "version":5 + ], + "rows": [ + { + + } + ], + "style":"dark", + "tags":[], + "templating":{ + "list":[ + ] + }, + "time":{ + }, + "timezone":"browser", + "title":"Home", + "version":5 } } @@ -1181,11 +1180,10 @@ Keys: "pluginType":"datasource", "serviceName":"Grafana", "type":"grafanasearch" + } } - } - } - - defaultDatasource: "Grafana" + }, + "defaultDatasource": "Grafana" } ## Login From 9c0141e84ea31386bb9be929421584107b1d1757 Mon Sep 17 00:00:00 2001 From: Joakim Lahtinen Date: Tue, 24 Nov 2015 07:29:52 +0100 Subject: [PATCH 236/269] Fixed some broken HTML. Simplified some control flow. --- public/app/core/settings.js | 3 +-- public/app/core/store.js | 2 +- public/app/features/dashboard/dashboardSrv.js | 11 +++++------ .../features/dashboard/partials/graphiteImport.html | 2 +- public/app/features/dashboard/unsavedChangesSrv.js | 6 +----- public/app/features/dashlinks/module.js | 2 +- public/app/features/org/partials/orgUsers.html | 2 +- public/app/features/panel/panel_menu.js | 3 +-- public/app/panels/text/lib/showdown.js | 6 +++--- .../app/plugins/datasource/influxdb/query_builder.js | 3 +-- .../app/plugins/datasource/prometheus/datasource.js | 6 ++---- 11 files changed, 18 insertions(+), 28 deletions(-) diff --git a/public/app/core/settings.js b/public/app/core/settings.js index 2fa484a9cba..59eaf8ea8b9 100644 --- a/public/app/core/settings.js +++ b/public/app/core/settings.js @@ -22,7 +22,6 @@ function (_) { appSubUrl: "" }; - var settings = _.extend({}, defaults, options); - return settings; + return _.extend({}, defaults, options); }; }); diff --git a/public/app/core/store.js b/public/app/core/store.js index 84e72b96314..504b0e5aff5 100644 --- a/public/app/core/store.js +++ b/public/app/core/store.js @@ -12,7 +12,7 @@ define([], function() { if (def !== void 0 && !this.exists(key)) { return def; } - return window.localStorage[key] === 'true' ? true : false; + return window.localStorage[key] === 'true'; }, exists: function(key) { return window.localStorage[key] !== void 0; diff --git a/public/app/features/dashboard/dashboardSrv.js b/public/app/features/dashboard/dashboardSrv.js index ce7cbeb11d2..698abcc51fd 100644 --- a/public/app/features/dashboard/dashboardSrv.js +++ b/public/app/features/dashboard/dashboardSrv.js @@ -26,7 +26,7 @@ function (angular, $, _, moment) { this.tags = data.tags || []; this.style = data.style || "dark"; this.timezone = data.timezone || 'browser'; - this.editable = data.editable === false ? false : true; + this.editable = data.editable !== false; this.hideControls = data.hideControls || false; this.sharedCrosshair = data.sharedCrosshair || false; this.rows = data.rows || []; @@ -48,10 +48,10 @@ function (angular, $, _, moment) { p._initMeta = function(meta) { meta = meta || {}; - meta.canShare = meta.canShare === false ? false : true; - meta.canSave = meta.canSave === false ? false : true; - meta.canStar = meta.canStar === false ? false : true; - meta.canEdit = meta.canEdit === false ? false : true; + meta.canShare = meta.canShare !== false; + meta.canSave = meta.canSave !== false; + meta.canStar = meta.canStar !== false; + meta.canEdit = meta.canEdit !== false; if (!this.editable) { meta.canEdit = false; @@ -151,7 +151,6 @@ function (angular, $, _, moment) { result.panel = panel; result.row = row; result.index = index; - return; } }); }); diff --git a/public/app/features/dashboard/partials/graphiteImport.html b/public/app/features/dashboard/partials/graphiteImport.html index 343b5d52e41..9c351346fe6 100644 --- a/public/app/features/dashboard/partials/graphiteImport.html +++ b/public/app/features/dashboard/partials/graphiteImport.html @@ -25,7 +25,7 @@ diff --git a/public/app/features/dashboard/unsavedChangesSrv.js b/public/app/features/dashboard/unsavedChangesSrv.js index 758c06b1975..bbb38d745c7 100644 --- a/public/app/features/dashboard/unsavedChangesSrv.js +++ b/public/app/features/dashboard/unsavedChangesSrv.js @@ -122,11 +122,7 @@ function(angular, _) { var currentJson = angular.toJson(current); var originalJson = angular.toJson(original); - if (currentJson !== originalJson) { - return true; - } - - return false; + return currentJson !== originalJson; }; p.open_modal = function() { diff --git a/public/app/features/dashlinks/module.js b/public/app/features/dashlinks/module.js index 6b5677e5d2d..b7029e6cf2d 100644 --- a/public/app/features/dashlinks/module.js +++ b/public/app/features/dashlinks/module.js @@ -52,7 +52,7 @@ function (angular, _) { if (link.asDropdown) { template += ' - -
                -
              • - -
              • -
              • - +
              - -
              • diff --git a/public/app/plugins/datasource/influxdb/query_part.ts b/public/app/plugins/datasource/influxdb/query_part.ts index 84dab84806a..c528a6c56dd 100644 --- a/public/app/plugins/datasource/influxdb/query_part.ts +++ b/public/app/plugins/datasource/influxdb/query_part.ts @@ -8,6 +8,7 @@ var categories = { Transformations: [], Math: [], Aliasing: [], + Fields: [], }; class QueryPartDef { @@ -64,19 +65,27 @@ function quotedIdentityRenderer(part, innerExpr) { return '"' + part.params[0] + '"'; } +QueryPartDef.register({ + name: 'field', + category: categories.Fields, + params: [{type: 'field'}], + defaultParams: ['value'], + renderer: quotedIdentityRenderer, +}); + QueryPartDef.register({ name: 'mean', category: categories.Aggregations, - params: [{type: 'field', quote: 'double'}], - defaultParams: ['value'], + params: [], + defaultParams: [], renderer: functionRenderer, }); QueryPartDef.register({ name: 'sum', category: categories.Aggregations, - params: [{type: 'field', quote: 'double'}], - defaultParams: ['value'], + params: [], + defaultParams: [], renderer: functionRenderer, }); diff --git a/public/app/plugins/datasource/influxdb/specs/influx_query_specs.ts b/public/app/plugins/datasource/influxdb/specs/influx_query_specs.ts index 9634e327c67..a6f70249a68 100644 --- a/public/app/plugins/datasource/influxdb/specs/influx_query_specs.ts +++ b/public/app/plugins/datasource/influxdb/specs/influx_query_specs.ts @@ -21,7 +21,8 @@ describe.only('InfluxQuery', function() { measurement: 'cpu', select: [ [ - {name: 'mean', params: ['value']}, + {name: 'field', params: ['value']}, + {name: 'mean', params: []}, {name: 'math', params: ['/100']}, {name: 'alias', params: ['text']}, ] From 31e2a8b8e9a6c8f7db1faf1b09ea6e9ca02b7644 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Tue, 24 Nov 2015 17:01:18 +0100 Subject: [PATCH 239/269] feat(influxdb): more work onnew influxdb editor --- .../datasource/influxdb/influx_query.ts | 34 +++++++++++++++---- .../influxdb/partials/query.editor.html | 8 ++--- .../influxdb/partials/query_part.html | 2 +- .../plugins/datasource/influxdb/query_ctrl.js | 34 +++++++------------ .../plugins/datasource/influxdb/query_part.ts | 3 +- .../datasource/influxdb/query_part_editor.js | 5 +-- 6 files changed, 50 insertions(+), 36 deletions(-) diff --git a/public/app/plugins/datasource/influxdb/influx_query.ts b/public/app/plugins/datasource/influxdb/influx_query.ts index 218d7d4b0a5..ec75bc8d75b 100644 --- a/public/app/plugins/datasource/influxdb/influx_query.ts +++ b/public/app/plugins/datasource/influxdb/influx_query.ts @@ -6,9 +6,19 @@ import queryPart = require('./query_part'); declare var InfluxQueryBuilder: any; +class InfluxSelectModel { + modelParts: any[]; + persistedParts: any[]; + + constructor(persistedParts: any[]) { + this.persistedParts = persistedParts; + this.modelParts = _.map(persistedParts, queryPart.create); + } +} + class InfluxQuery { target: any; - selectParts: any[]; + selectModels: any[]; groupByParts: any; queryBuilder: any; @@ -29,10 +39,8 @@ class InfluxQuery { } updateSelectParts() { - this.selectParts = _.map(this.target.select, function(parts: any) { - return _.map(parts, function(part: any) { - return queryPart.create(part); - }); + this.selectModels = _.map(this.target.select, function(parts: any) { + return new InfluxSelectModel(parts); }); } @@ -41,6 +49,18 @@ class InfluxQuery { this.updateSelectParts(); } + removeSelectPart(selectModel, part) { + var partIndex = _.indexOf(selectModel.modelParts, part); + selectModel.persistedParts.splice(partIndex, 1); + this.updateSelectParts(); + } + + addSelectPart(selectModel, name) { + var partModel = queryPart.create({name: name}); + selectModel.persistedParts.push(partModel.part); + selectModel.modelParts.push(partModel); + } + addSelect() { this.target.select.push([ {name: 'mean', params: ['value']}, @@ -92,8 +112,8 @@ class InfluxQuery { var query = 'SELECT '; var i, y; - for (i = 0; i < this.selectParts.length; i++) { - let parts = this.selectParts[i]; + for (i = 0; i < this.selectModels.length; i++) { + let parts = this.selectModels[i].modelParts; var selectText = ""; for (y = 0; y < parts.length; y++) { let part = parts[y]; diff --git a/public/app/plugins/datasource/influxdb/partials/query.editor.html b/public/app/plugins/datasource/influxdb/partials/query.editor.html index 59835405da3..0af29a39981 100644 --- a/public/app/plugins/datasource/influxdb/partials/query.editor.html +++ b/public/app/plugins/datasource/influxdb/partials/query.editor.html @@ -65,15 +65,15 @@
                -
                +
                • SELECT
                • -
                • - +
                • +
                • -
                diff --git a/public/app/plugins/datasource/influxdb/partials/query_part.html b/public/app/plugins/datasource/influxdb/partials/query_part.html index 0a28bee11f7..ea66c010efa 100644 --- a/public/app/plugins/datasource/influxdb/partials/query_part.html +++ b/public/app/plugins/datasource/influxdb/partials/query_part.html @@ -1,6 +1,6 @@
                - +
                {{part.def.name}}() diff --git a/public/app/plugins/datasource/influxdb/query_ctrl.js b/public/app/plugins/datasource/influxdb/query_ctrl.js index 1eba65c7c87..9bfb5b036e4 100644 --- a/public/app/plugins/datasource/influxdb/query_ctrl.js +++ b/public/app/plugins/datasource/influxdb/query_ctrl.js @@ -62,8 +62,18 @@ function (angular, _, InfluxQueryBuilder, InfluxQuery, queryPart) { }, []); }; - $scope.selectMenuAction = function(selectParts, cat, subitem) { - selectParts.push(queryPart.create({name: subitem.value })); + $scope.selectMenuAction = function(selectModel, cat, subitem) { + $scope.queryModel.addSelectPart(selectModel, subitem.value); + $scope.get_data(); + }; + + $scope.removeSelectPart = function(selectModel, part) { + $scope.queryModel.removeSelectPart(selectModel, part); + $scope.get_data(); + }; + + $scope.selectPartUpdated = function() { + $scope.get_data(); }; $scope.fixTagSegments = function() { @@ -75,27 +85,9 @@ function (angular, _, InfluxQueryBuilder, InfluxQuery, queryPart) { } }; - $scope.addGroupBy = function() { - $scope.target.groupBy.push({type: 'tag', key: "select tag"}); - }; - - $scope.removeGroupBy = function(index) { - $scope.target.groupBy.splice(index, 1); - $scope.get_data(); - }; - - $scope.addSelect = function() { - $scope.queryModel.addSelect(); - }; - - $scope.removeSelect = function(index) { - $scope.queryModel.removeSelect(index); - $scope.get_data(); - }; - $scope.measurementChanged = function() { $scope.target.measurement = $scope.measurementSegment.value; - $scope.$parent.get_data(); + $scope.get_data(); }; $scope.getFields = function() { diff --git a/public/app/plugins/datasource/influxdb/query_part.ts b/public/app/plugins/datasource/influxdb/query_part.ts index c528a6c56dd..1e750a361bc 100644 --- a/public/app/plugins/datasource/influxdb/query_part.ts +++ b/public/app/plugins/datasource/influxdb/query_part.ts @@ -135,7 +135,8 @@ class QueryPart { throw {message: 'Could not find query part ' + part.name}; } - this.params = part.params || _.clone(this.def.defaultParams); + part.params = part.params || _.clone(this.def.defaultParams); + this.params = part.params; this.updateText(); } diff --git a/public/app/plugins/datasource/influxdb/query_part_editor.js b/public/app/plugins/datasource/influxdb/query_part_editor.js index 6adf41f9c3f..c7e16d86ec6 100644 --- a/public/app/plugins/datasource/influxdb/query_part_editor.js +++ b/public/app/plugins/datasource/influxdb/query_part_editor.js @@ -17,7 +17,8 @@ function (angular, _, $) { templateUrl: 'app/plugins/datasource/influxdb/partials/query_part.html', scope: { part: "=", - deleteAction: "&", + removeAction: "&", + partUpdated: "&", }, link: function postLink($scope, elem) { var part = $scope.part; @@ -55,7 +56,7 @@ function (angular, _, $) { $link.html(templateSrv.highlightVariablesAsHtml(newValue)); part.updateParam($input.val(), paramIndex); - $scope.$apply($scope.targetChanged); + $scope.$apply($scope.partUpdated); } $input.hide(); From c9ba856c527c316d8a5ecdd1d177dfe861df1ba8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Wed, 25 Nov 2015 10:22:20 +0100 Subject: [PATCH 240/269] feat(influxdb): more work on influxdb editor --- .../datasource/influxdb/influx_query.ts | 36 +++++---- .../influxdb/partials/query.editor.html | 8 +- .../influxdb/partials/query_part.html | 3 +- .../plugins/datasource/influxdb/query_ctrl.js | 8 +- .../plugins/datasource/influxdb/query_part.ts | 74 ++++++++++++++++++- .../datasource/influxdb/query_part_editor.js | 5 ++ .../influxdb/specs/influx_query_specs.ts | 59 +++++++++++++++ 7 files changed, 163 insertions(+), 30 deletions(-) diff --git a/public/app/plugins/datasource/influxdb/influx_query.ts b/public/app/plugins/datasource/influxdb/influx_query.ts index ec75bc8d75b..0ba2df1833f 100644 --- a/public/app/plugins/datasource/influxdb/influx_query.ts +++ b/public/app/plugins/datasource/influxdb/influx_query.ts @@ -6,16 +6,6 @@ import queryPart = require('./query_part'); declare var InfluxQueryBuilder: any; -class InfluxSelectModel { - modelParts: any[]; - persistedParts: any[]; - - constructor(persistedParts: any[]) { - this.persistedParts = persistedParts; - this.modelParts = _.map(persistedParts, queryPart.create); - } -} - class InfluxQuery { target: any; selectModels: any[]; @@ -40,7 +30,15 @@ class InfluxQuery { updateSelectParts() { this.selectModels = _.map(this.target.select, function(parts: any) { - return new InfluxSelectModel(parts); + return _.map(parts, queryPart.create); + }); + } + + updatePersistedParts() { + this.target.select = _.map(this.selectModels, function(selectParts) { + return _.map(selectParts, function(part: any) { + return {name: part.def.name, params: part.params}; + }); }); } @@ -49,16 +47,16 @@ class InfluxQuery { this.updateSelectParts(); } - removeSelectPart(selectModel, part) { - var partIndex = _.indexOf(selectModel.modelParts, part); - selectModel.persistedParts.splice(partIndex, 1); - this.updateSelectParts(); + removeSelectPart(selectParts, part) { + var partIndex = _.indexOf(selectParts, part); + selectParts.splice(partIndex, 1); + this.updatePersistedParts(); } - addSelectPart(selectModel, name) { + addSelectPart(selectParts, name) { var partModel = queryPart.create({name: name}); - selectModel.persistedParts.push(partModel.part); - selectModel.modelParts.push(partModel); + partModel.def.addStrategy(selectParts, partModel); + this.updatePersistedParts(); } addSelect() { @@ -113,7 +111,7 @@ class InfluxQuery { var query = 'SELECT '; var i, y; for (i = 0; i < this.selectModels.length; i++) { - let parts = this.selectModels[i].modelParts; + let parts = this.selectModels[i]; var selectText = ""; for (y = 0; y < parts.length; y++) { let part = parts[y]; diff --git a/public/app/plugins/datasource/influxdb/partials/query.editor.html b/public/app/plugins/datasource/influxdb/partials/query.editor.html index 0af29a39981..86ab92dbcaa 100644 --- a/public/app/plugins/datasource/influxdb/partials/query.editor.html +++ b/public/app/plugins/datasource/influxdb/partials/query.editor.html @@ -65,15 +65,15 @@
                -
                +
                • SELECT
                • -
                • - +
                • +
                • -
                diff --git a/public/app/plugins/datasource/influxdb/partials/query_part.html b/public/app/plugins/datasource/influxdb/partials/query_part.html index ea66c010efa..27bd44dec92 100644 --- a/public/app/plugins/datasource/influxdb/partials/query_part.html +++ b/public/app/plugins/datasource/influxdb/partials/query_part.html @@ -1,6 +1,5 @@
                - - +
                {{part.def.name}}() diff --git a/public/app/plugins/datasource/influxdb/query_ctrl.js b/public/app/plugins/datasource/influxdb/query_ctrl.js index 9bfb5b036e4..bbc12bfc432 100644 --- a/public/app/plugins/datasource/influxdb/query_ctrl.js +++ b/public/app/plugins/datasource/influxdb/query_ctrl.js @@ -62,13 +62,13 @@ function (angular, _, InfluxQueryBuilder, InfluxQuery, queryPart) { }, []); }; - $scope.selectMenuAction = function(selectModel, cat, subitem) { - $scope.queryModel.addSelectPart(selectModel, subitem.value); + $scope.addSelectPart = function(selectParts, cat, subitem) { + $scope.queryModel.addSelectPart(selectParts, subitem.value); $scope.get_data(); }; - $scope.removeSelectPart = function(selectModel, part) { - $scope.queryModel.removeSelectPart(selectModel, part); + $scope.removeSelectPart = function(selectParts, part) { + $scope.queryModel.removeSelectPart(selectParts, part); $scope.get_data(); }; diff --git a/public/app/plugins/datasource/influxdb/query_part.ts b/public/app/plugins/datasource/influxdb/query_part.ts index 1e750a361bc..9df0fddee3e 100644 --- a/public/app/plugins/datasource/influxdb/query_part.ts +++ b/public/app/plugins/datasource/influxdb/query_part.ts @@ -11,17 +11,23 @@ var categories = { Fields: [], }; +var groupByTimeFunctions = []; + class QueryPartDef { name: string; params: any[]; defaultParams: any[]; renderer: any; + category: any; + addStrategy: any; constructor(options: any) { this.name = options.name; this.params = options.params; this.defaultParams = options.defaultParams; this.renderer = options.renderer; + this.category = options.category; + this.addStrategy = options.addStrategy; } static register(options: any) { @@ -65,6 +71,67 @@ function quotedIdentityRenderer(part, innerExpr) { return '"' + part.params[0] + '"'; } +function replaceAggregationAddStrategy(selectParts, partModel) { + // look for existing aggregation + for (var i = 0; i < selectParts.length; i++) { + var part = selectParts[i]; + if (part.def.category === categories.Aggregations) { + selectParts[i] = partModel; + return; + } + } + + selectParts.splice(1, 0, partModel); +} + +function addTransformationStrategy(selectParts, partModel) { + var i; + // look for index to add transformation + for (i = 0; i < selectParts.length; i++) { + var part = selectParts[i]; + if (part.def.category === categories.Math || part.def.category === categories.Aliasing) { + break; + } + } + + selectParts.splice(i, 0, partModel); +} + +function addMathStrategy(selectParts, partModel) { + var partCount = selectParts.length; + if (partCount > 0) { + // if last is math, replace it + if (selectParts[partCount-1].def.name === 'math') { + selectParts[partCount-1] = partModel; + return; + } + // if next to last is math, replace it + if (selectParts[partCount-2].def.name === 'math') { + selectParts[partCount-2] = partModel; + return; + } + // if last is alias add it before + else if (selectParts[partCount-1].def.name === 'alias') { + selectParts.splice(partCount-1, 0, partModel); + return; + } + } + selectParts.push(partModel); +} + +function addAliasStrategy(selectParts, partModel) { + var partCount = selectParts.length; + if (partCount > 0) { + // if last is alias, replace it + if (selectParts[partCount-1].def.name === 'alias') { + selectParts[partCount-1] = partModel; + return; + } + } + selectParts.push(partModel); +} + + QueryPartDef.register({ name: 'field', category: categories.Fields, @@ -75,6 +142,7 @@ QueryPartDef.register({ QueryPartDef.register({ name: 'mean', + addStrategy: replaceAggregationAddStrategy, category: categories.Aggregations, params: [], defaultParams: [], @@ -83,6 +151,7 @@ QueryPartDef.register({ QueryPartDef.register({ name: 'sum', + addStrategy: replaceAggregationAddStrategy, category: categories.Aggregations, params: [], defaultParams: [], @@ -91,6 +160,7 @@ QueryPartDef.register({ QueryPartDef.register({ name: 'derivative', + addStrategy: addTransformationStrategy, category: categories.Transformations, params: [{ name: "duration", type: "interval", options: ['1s', '10s', '1m', '5min', '10m', '15m', '1h']}], defaultParams: ['10s'], @@ -99,7 +169,7 @@ QueryPartDef.register({ QueryPartDef.register({ name: 'time', - category: categories.Transformations, + category: groupByTimeFunctions, params: [{ name: "rate", type: "interval", options: ['$interval', '1s', '10s', '1m', '5min', '10m', '15m', '1h'] }], defaultParams: ['$interval'], renderer: functionRenderer, @@ -107,6 +177,7 @@ QueryPartDef.register({ QueryPartDef.register({ name: 'math', + addStrategy: addMathStrategy, category: categories.Math, params: [{ name: "expr", type: "string"}], defaultParams: [' / 100'], @@ -115,6 +186,7 @@ QueryPartDef.register({ QueryPartDef.register({ name: 'alias', + addStrategy: addAliasStrategy, category: categories.Aliasing, params: [{ name: "name", type: "string", quote: 'double'}], defaultParams: ['alias'], diff --git a/public/app/plugins/datasource/influxdb/query_part_editor.js b/public/app/plugins/datasource/influxdb/query_part_editor.js index c7e16d86ec6..9fbe02acf21 100644 --- a/public/app/plugins/datasource/influxdb/query_part_editor.js +++ b/public/app/plugins/datasource/influxdb/query_part_editor.js @@ -117,6 +117,11 @@ function (angular, _, $) { $controlsContainer.show(); }; + $scope.removeActionInternal = function() { + $scope.toggleControls(); + $scope.removeAction(); + }; + function addElementsAndCompile() { _.each(partDef.params, function(param, index) { if (param.optional && part.params.length <= index) { diff --git a/public/app/plugins/datasource/influxdb/specs/influx_query_specs.ts b/public/app/plugins/datasource/influxdb/specs/influx_query_specs.ts index a6f70249a68..038ad5140c1 100644 --- a/public/app/plugins/datasource/influxdb/specs/influx_query_specs.ts +++ b/public/app/plugins/datasource/influxdb/specs/influx_query_specs.ts @@ -34,4 +34,63 @@ describe.only('InfluxQuery', function() { }); }); + describe('when adding select part', function() { + + it('should add mean after after field', function() { + var query = new InfluxQuery({ + measurement: 'cpu', + select: [[{name: 'field', params: ['value']}]] + }); + + query.addSelectPart(query.selectModels[0], 'mean'); + expect(query.target.select[0].length).to.be(2); + expect(query.target.select[0][1].name).to.be('mean'); + }); + + it('should replace sum by mean', function() { + var query = new InfluxQuery({ + measurement: 'cpu', + select: [[{name: 'field', params: ['value']}, {name: 'mean'}]] + }); + + query.addSelectPart(query.selectModels[0], 'sum'); + expect(query.target.select[0].length).to.be(2); + expect(query.target.select[0][1].name).to.be('sum'); + }); + + it('should add math before alias', function() { + var query = new InfluxQuery({ + measurement: 'cpu', + select: [[{name: 'field', params: ['value']}, {name: 'mean'}, {name: 'alias'}]] + }); + + query.addSelectPart(query.selectModels[0], 'math'); + expect(query.target.select[0].length).to.be(4); + expect(query.target.select[0][2].name).to.be('math'); + }); + + it('should add math last', function() { + var query = new InfluxQuery({ + measurement: 'cpu', + select: [[{name: 'field', params: ['value']}, {name: 'mean'}]] + }); + + query.addSelectPart(query.selectModels[0], 'math'); + expect(query.target.select[0].length).to.be(3); + expect(query.target.select[0][2].name).to.be('math'); + }); + + it('should replace math', function() { + var query = new InfluxQuery({ + measurement: 'cpu', + select: [[{name: 'field', params: ['value']}, {name: 'mean'}, {name: 'math'}]] + }); + + query.addSelectPart(query.selectModels[0], 'math'); + expect(query.target.select[0].length).to.be(3); + expect(query.target.select[0][2].name).to.be('math'); + }); + + }); + }); From 5ba19144d5da7e1be35a5eb2f2df63c63e4f1429 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Wed, 25 Nov 2015 12:30:56 +0100 Subject: [PATCH 241/269] feat(influxdb): more work on query editor --- .../datasource/influxdb/influx_query.ts | 42 ++++++++------- .../influxdb/partials/query.editor.html | 3 ++ .../influxdb/partials/query_part.html | 2 +- .../plugins/datasource/influxdb/query_ctrl.js | 12 ++++- .../plugins/datasource/influxdb/query_part.ts | 53 ++++++++++--------- 5 files changed, 66 insertions(+), 46 deletions(-) diff --git a/public/app/plugins/datasource/influxdb/influx_query.ts b/public/app/plugins/datasource/influxdb/influx_query.ts index 0ba2df1833f..7675583fe03 100644 --- a/public/app/plugins/datasource/influxdb/influx_query.ts +++ b/public/app/plugins/datasource/influxdb/influx_query.ts @@ -18,13 +18,13 @@ class InfluxQuery { target.tags = target.tags || []; target.groupBy = target.groupBy || [{type: 'time', interval: 'auto'}]; target.select = target.select || [[ - {name: 'field', params: ['value']}, - {name: 'mean', params: []}, + {type: 'field', params: ['value']}, + {type: 'mean', params: []}, ]]; this.updateSelectParts(); this.groupByParts = [ - queryPart.create({name: 'time', params: ['$interval']}) + queryPart.create({type: 'time', params: ['$interval']}) ]; } @@ -37,7 +37,7 @@ class InfluxQuery { updatePersistedParts() { this.target.select = _.map(this.selectModels, function(selectParts) { return _.map(selectParts, function(part: any) { - return {name: part.def.name, params: part.params}; + return {type: part.def.type, params: part.params}; }); }); } @@ -48,24 +48,26 @@ class InfluxQuery { } removeSelectPart(selectParts, part) { - var partIndex = _.indexOf(selectParts, part); - selectParts.splice(partIndex, 1); + // if we remove the field remove the whole statement + if (part.def.type === 'field') { + if (this.selectModels.length > 1) { + var modelsIndex = _.indexOf(this.selectModels, selectParts); + this.selectModels.splice(modelsIndex, 1); + } + } else { + var partIndex = _.indexOf(selectParts, part); + selectParts.splice(partIndex, 1); + } + this.updatePersistedParts(); } - addSelectPart(selectParts, name) { - var partModel = queryPart.create({name: name}); - partModel.def.addStrategy(selectParts, partModel); + addSelectPart(selectParts, type) { + var partModel = queryPart.create({type: type}); + partModel.def.addStrategy(selectParts, partModel, this); this.updatePersistedParts(); } - addSelect() { - this.target.select.push([ - {name: 'mean', params: ['value']}, - ]); - this.updateSelectParts(); - } - private renderTagCondition(tag, index) { var str = ""; var operator = tag.operator; @@ -100,12 +102,12 @@ class InfluxQuery { render() { var target = this.target; - if (!target.measurement) { - throw "Metric measurement is missing"; + if (target.rawQuery) { + return target.query; } - if (!target.fields) { - target.fields = [{name: 'value', func: target.function || 'mean'}]; + if (!target.measurement) { + throw "Metric measurement is missing"; } var query = 'SELECT '; diff --git a/public/app/plugins/datasource/influxdb/partials/query.editor.html b/public/app/plugins/datasource/influxdb/partials/query.editor.html index 86ab92dbcaa..854690fbe31 100644 --- a/public/app/plugins/datasource/influxdb/partials/query.editor.html +++ b/public/app/plugins/datasource/influxdb/partials/query.editor.html @@ -73,6 +73,9 @@
              • +
              • + +
              diff --git a/public/app/plugins/datasource/influxdb/partials/query_part.html b/public/app/plugins/datasource/influxdb/partials/query_part.html index 27bd44dec92..0eb0146ec13 100644 --- a/public/app/plugins/datasource/influxdb/partials/query_part.html +++ b/public/app/plugins/datasource/influxdb/partials/query_part.html @@ -2,4 +2,4 @@
              -{{part.def.name}}() +{{part.def.type}}() diff --git a/public/app/plugins/datasource/influxdb/query_ctrl.js b/public/app/plugins/datasource/influxdb/query_ctrl.js index bbc12bfc432..5a3a64b0bf3 100644 --- a/public/app/plugins/datasource/influxdb/query_ctrl.js +++ b/public/app/plugins/datasource/influxdb/query_ctrl.js @@ -55,11 +55,21 @@ function (angular, _, InfluxQueryBuilder, InfluxQuery, queryPart) { $scope.selectMenu = _.reduce(categories, function(memo, cat, key) { var menu = {text: key}; menu.submenu = _.map(cat, function(item) { - return {text: item.name, value: item.name}; + return {text: item.type, value: item.type}; }); memo.push(menu); return memo; }, []); + + $scope.groupByMenu = _.reduce(categories, function(memo, cat, key) { + var menu = {text: key}; + menu.submenu = _.map(cat, function(item) { + return {text: item.type, value: item.type}; + }); + memo.push(menu); + return memo; + }, []); + }; $scope.addSelectPart = function(selectParts, cat, subitem) { diff --git a/public/app/plugins/datasource/influxdb/query_part.ts b/public/app/plugins/datasource/influxdb/query_part.ts index 9df0fddee3e..664dfb3dec6 100644 --- a/public/app/plugins/datasource/influxdb/query_part.ts +++ b/public/app/plugins/datasource/influxdb/query_part.ts @@ -14,7 +14,7 @@ var categories = { var groupByTimeFunctions = []; class QueryPartDef { - name: string; + type: string; params: any[]; defaultParams: any[]; renderer: any; @@ -22,7 +22,7 @@ class QueryPartDef { addStrategy: any; constructor(options: any) { - this.name = options.name; + this.type = options.type; this.params = options.params; this.defaultParams = options.defaultParams; this.renderer = options.renderer; @@ -31,13 +31,13 @@ class QueryPartDef { } static register(options: any) { - index[options.name] = new QueryPartDef(options); - options.category.push(index[options.name]); + index[options.type] = new QueryPartDef(options); + options.category.push(index[options.type]); } } function functionRenderer(part, innerExpr) { - var str = part.def.name + '('; + var str = part.def.type + '('; var parameters = _.map(part.params, (value, index) => { var paramType = part.def.params[index]; if (paramType.quote === 'single') { @@ -101,17 +101,17 @@ function addMathStrategy(selectParts, partModel) { var partCount = selectParts.length; if (partCount > 0) { // if last is math, replace it - if (selectParts[partCount-1].def.name === 'math') { + if (selectParts[partCount-1].def.type === 'math') { selectParts[partCount-1] = partModel; return; } // if next to last is math, replace it - if (selectParts[partCount-2].def.name === 'math') { + if (selectParts[partCount-2].def.type === 'math') { selectParts[partCount-2] = partModel; return; } // if last is alias add it before - else if (selectParts[partCount-1].def.name === 'alias') { + else if (selectParts[partCount-1].def.type === 'alias') { selectParts.splice(partCount-1, 0, partModel); return; } @@ -123,7 +123,7 @@ function addAliasStrategy(selectParts, partModel) { var partCount = selectParts.length; if (partCount > 0) { // if last is alias, replace it - if (selectParts[partCount-1].def.name === 'alias') { + if (selectParts[partCount-1].def.type === 'alias') { selectParts[partCount-1] = partModel; return; } @@ -131,9 +131,18 @@ function addAliasStrategy(selectParts, partModel) { selectParts.push(partModel); } +function addFieldStrategy(selectParts, partModel, query) { + // copy all parts + var parts = _.map(selectParts, function(part: any) { + return new QueryPart({type: part.def.type, params: _.clone(part.params)}); + }); + + query.selectModels.push(parts); +} QueryPartDef.register({ - name: 'field', + type: 'field', + addStrategy: addFieldStrategy, category: categories.Fields, params: [{type: 'field'}], defaultParams: ['value'], @@ -141,7 +150,7 @@ QueryPartDef.register({ }); QueryPartDef.register({ - name: 'mean', + type: 'mean', addStrategy: replaceAggregationAddStrategy, category: categories.Aggregations, params: [], @@ -150,7 +159,7 @@ QueryPartDef.register({ }); QueryPartDef.register({ - name: 'sum', + type: 'sum', addStrategy: replaceAggregationAddStrategy, category: categories.Aggregations, params: [], @@ -159,7 +168,7 @@ QueryPartDef.register({ }); QueryPartDef.register({ - name: 'derivative', + type: 'derivative', addStrategy: addTransformationStrategy, category: categories.Transformations, params: [{ name: "duration", type: "interval", options: ['1s', '10s', '1m', '5min', '10m', '15m', '1h']}], @@ -168,7 +177,7 @@ QueryPartDef.register({ }); QueryPartDef.register({ - name: 'time', + type: 'time', category: groupByTimeFunctions, params: [{ name: "rate", type: "interval", options: ['$interval', '1s', '10s', '1m', '5min', '10m', '15m', '1h'] }], defaultParams: ['$interval'], @@ -176,7 +185,7 @@ QueryPartDef.register({ }); QueryPartDef.register({ - name: 'math', + type: 'math', addStrategy: addMathStrategy, category: categories.Math, params: [{ name: "expr", type: "string"}], @@ -185,7 +194,7 @@ QueryPartDef.register({ }); QueryPartDef.register({ - name: 'alias', + type: 'alias', addStrategy: addAliasStrategy, category: categories.Aliasing, params: [{ name: "name", type: "string", quote: 'double'}], @@ -202,9 +211,9 @@ class QueryPart { constructor(part: any) { this.part = part; - this.def = index[part.name]; + this.def = index[part.type]; if (!this.def) { - throw {message: 'Could not find query part ' + part.name}; + throw {message: 'Could not find query part ' + part.type}; } part.params = part.params || _.clone(this.def.defaultParams); @@ -247,11 +256,11 @@ class QueryPart { updateText() { if (this.params.length === 0) { - this.text = this.def.name + '()'; + this.text = this.def.type + '()'; return; } - var text = this.def.name + '('; + var text = this.def.type + '('; text += this.params.join(', '); text += ')'; this.text = text; @@ -263,10 +272,6 @@ export = { return new QueryPart(part); }, - getFuncDef: function(name) { - return index[name]; - }, - getCategories: function() { return categories; } From 0ff5ff5dbe8ebc492385f6b49ce355d29daa29f1 Mon Sep 17 00:00:00 2001 From: utkarshcmu Date: Wed, 25 Nov 2015 04:05:40 -0800 Subject: [PATCH 242/269] Enabled refresh interval for absolute time range --- public/app/features/dashboard/timeSrv.js | 7 +------ public/test/specs/time_srv_specs.js | 11 +++++++++-- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/public/app/features/dashboard/timeSrv.js b/public/app/features/dashboard/timeSrv.js index e0e0ed47dab..1aff02bea90 100644 --- a/public/app/features/dashboard/timeSrv.js +++ b/public/app/features/dashboard/timeSrv.js @@ -93,12 +93,7 @@ define([ this.setTime = function(time) { _.extend(this.time, time); - // disable refresh if we have an absolute time - if (moment.isMoment(time.to)) { - this.old_refresh = this.dashboard.refresh || this.old_refresh; - this.setAutoRefresh(false); - } - else if (this.old_refresh && this.old_refresh !== this.dashboard.refresh) { + if (this.old_refresh && this.old_refresh !== this.dashboard.refresh) { this.setAutoRefresh(this.old_refresh); this.old_refresh = null; } diff --git a/public/test/specs/time_srv_specs.js b/public/test/specs/time_srv_specs.js index 4f065af6cf8..8c110483b47 100644 --- a/public/test/specs/time_srv_specs.js +++ b/public/test/specs/time_srv_specs.js @@ -78,17 +78,24 @@ define([ }); describe('setTime', function() { - it('should return disable refresh for absolute times', function() { + it('should return disable refresh if refresh is disabled for any range', function() { _dashboard.refresh = false; ctx.service.setTime({from: '2011-01-01', to: '2015-01-01' }); expect(_dashboard.refresh).to.be(false); }); + it('should restore refresh for absolute time range', function() { + _dashboard.refresh = '30s'; + + ctx.service.setTime({from: '2011-01-01', to: '2015-01-01' }); + expect(_dashboard.refresh).to.be('30s'); + }); + it('should restore refresh after relative time range is set', function() { _dashboard.refresh = '10s'; ctx.service.setTime({from: moment([2011,1,1]), to: moment([2015,1,1])}); - expect(_dashboard.refresh).to.be(false); + expect(_dashboard.refresh).to.be('10s'); ctx.service.setTime({from: '2011-01-01', to: 'now' }); expect(_dashboard.refresh).to.be('10s'); }); From 1f57cf08a7e63539b6d8d930205919f3ea156650 Mon Sep 17 00:00:00 2001 From: utkarshcmu Date: Wed, 25 Nov 2015 04:38:54 -0800 Subject: [PATCH 243/269] Added an option to hide zero values --- public/app/core/time_series.ts | 6 ++++++ public/app/panels/graph/axisEditor.html | 3 +++ public/app/panels/graph/graph.tooltip.js | 5 +++++ public/app/panels/graph/legend.js | 4 ++++ 4 files changed, 18 insertions(+) diff --git a/public/app/core/time_series.ts b/public/app/core/time_series.ts index 0fb2b83b7e0..429e3882e8b 100644 --- a/public/app/core/time_series.ts +++ b/public/app/core/time_series.ts @@ -28,6 +28,7 @@ class TimeSeries { stats: any; legend: boolean; allIsNull: boolean; + allIsZero: boolean; decimals: number; scaledDecimals: number; @@ -96,6 +97,7 @@ class TimeSeries { this.stats.avg = null; this.stats.current = null; this.allIsNull = true; + this.allIsZero = true; var ignoreNulls = fillStyle === 'connected'; var nullAsZero = fillStyle === 'null as zero'; @@ -130,6 +132,10 @@ class TimeSeries { } } + if (currentValue != 0) { + this.allIsZero = false; + } + result.push([currentTime, currentValue]); } diff --git a/public/app/panels/graph/axisEditor.html b/public/app/panels/graph/axisEditor.html index 41ea8dd3696..e2bc4d36b1d 100644 --- a/public/app/panels/graph/axisEditor.html +++ b/public/app/panels/graph/axisEditor.html @@ -167,6 +167,9 @@
            • +
            • + +
            • diff --git a/public/app/panels/graph/graph.tooltip.js b/public/app/panels/graph/graph.tooltip.js index 8a747b61e0c..c56d7ce8c30 100644 --- a/public/app/panels/graph/graph.tooltip.js +++ b/public/app/panels/graph/graph.tooltip.js @@ -52,6 +52,11 @@ function ($) { continue; } + if (!series.data.length || (scope.panel.legend.hideZero && series.allIsZero)) { + results.push({ hidden: true }); + continue; + } + hoverIndex = this.findHoverIndexFromData(pos.x, series); results.time = series.data[hoverIndex][0]; diff --git a/public/app/panels/graph/legend.js b/public/app/panels/graph/legend.js index 065e74fed30..8604dff4f08 100644 --- a/public/app/panels/graph/legend.js +++ b/public/app/panels/graph/legend.js @@ -137,6 +137,10 @@ function (angular, _, $) { if (!series.legend) { continue; } + // ignore zero series + if (panel.legend.hideZero && series.allIsZero) { + continue; + } var html = '
              0) { + query += ', '; } + query += part.render(''); } if (target.fill) { diff --git a/public/app/plugins/datasource/influxdb/partials/query.editor.html b/public/app/plugins/datasource/influxdb/partials/query.editor.html index 854690fbe31..c77157324aa 100644 --- a/public/app/plugins/datasource/influxdb/partials/query.editor.html +++ b/public/app/plugins/datasource/influxdb/partials/query.editor.html @@ -73,24 +73,22 @@
            • -
            • - -
            • -
              +
              • GROUP BY
              • -
              • - +
              • +
              • -
              • +
              diff --git a/public/app/plugins/datasource/influxdb/query_ctrl.js b/public/app/plugins/datasource/influxdb/query_ctrl.js index 5a3a64b0bf3..774a1d84108 100644 --- a/public/app/plugins/datasource/influxdb/query_ctrl.js +++ b/public/app/plugins/datasource/influxdb/query_ctrl.js @@ -19,6 +19,7 @@ function (angular, _, InfluxQueryBuilder, InfluxQuery, queryPart) { $scope.target = $scope.target; $scope.queryModel = new InfluxQuery($scope.target); $scope.queryBuilder = new InfluxQueryBuilder($scope.target); + $scope.groupBySegment = uiSegmentSrv.newPlusButton(); if (!$scope.target.measurement) { $scope.measurementSegment = uiSegmentSrv.newSelectMeasurement(); @@ -60,16 +61,39 @@ function (angular, _, InfluxQueryBuilder, InfluxQuery, queryPart) { memo.push(menu); return memo; }, []); + }; - $scope.groupByMenu = _.reduce(categories, function(memo, cat, key) { - var menu = {text: key}; - menu.submenu = _.map(cat, function(item) { - return {text: item.type, value: item.type}; + $scope.getGroupByOptions = function() { + var query = $scope.queryBuilder.buildExploreQuery('TAG_KEYS'); + + return $scope.datasource.metricFindQuery(query) + .then(function(tags) { + var options = []; + if (!$scope.queryModel.hasFill()) { + options.push(uiSegmentSrv.newSegment({value: 'fill(option)'})); + } + if (!$scope.queryModel.hasGroupByTime()) { + options.push(uiSegmentSrv.newSegment({value: 'time($interval)'})); + } + _.each(tags, function(tag) { + options.push(uiSegmentSrv.newSegment({value: 'tag(' + tag.text + ')'})); }); - memo.push(menu); - return memo; - }, []); + return options; + }) + .then(null, $scope.handleQueryError); + }; + $scope.groupByAction = function() { + $scope.queryModel.addGroupBy($scope.groupBySegment.value); + var plusButton = uiSegmentSrv.newPlusButton(); + $scope.groupBySegment.value = plusButton.value; + $scope.groupBySegment.html = plusButton.html; + $scope.get_data(); + }; + + $scope.removeGroupByPart = function(part, index) { + $scope.queryModel.removeGroupByPart(part, index); + $scope.get_data(); }; $scope.addSelectPart = function(selectParts, cat, subitem) { @@ -178,12 +202,7 @@ function (angular, _, InfluxQueryBuilder, InfluxQuery, queryPart) { }; $scope.getTagOptions = function() { - var query = $scope.queryBuilder.buildExploreQuery('TAG_KEYS'); - - return $scope.datasource.metricFindQuery(query) - .then($scope.transformToSegments(false)) - .then(null, $scope.handleQueryError); - }; + }; $scope.setFill = function(fill) { $scope.target.fill = fill; diff --git a/public/app/plugins/datasource/influxdb/query_part.ts b/public/app/plugins/datasource/influxdb/query_part.ts index 664dfb3dec6..5338b9b48c1 100644 --- a/public/app/plugins/datasource/influxdb/query_part.ts +++ b/public/app/plugins/datasource/influxdb/query_part.ts @@ -184,6 +184,14 @@ QueryPartDef.register({ renderer: functionRenderer, }); +QueryPartDef.register({ + type: 'tag', + category: groupByTimeFunctions, + params: [{name: 'tag', type: 'string'}], + defaultParams: ['tag'], + renderer: quotedIdentityRenderer, +}); + QueryPartDef.register({ type: 'math', addStrategy: addMathStrategy, diff --git a/public/app/plugins/datasource/influxdb/specs/influx_query_specs.ts b/public/app/plugins/datasource/influxdb/specs/influx_query_specs.ts index 038ad5140c1..1e6e32ec8e9 100644 --- a/public/app/plugins/datasource/influxdb/specs/influx_query_specs.ts +++ b/public/app/plugins/datasource/influxdb/specs/influx_query_specs.ts @@ -21,10 +21,10 @@ describe.only('InfluxQuery', function() { measurement: 'cpu', select: [ [ - {name: 'field', params: ['value']}, - {name: 'mean', params: []}, - {name: 'math', params: ['/100']}, - {name: 'alias', params: ['text']}, + {type: 'field', params: ['value']}, + {type: 'mean', params: []}, + {type: 'math', params: ['/100']}, + {type: 'alias', params: ['text']}, ] ] }); @@ -39,56 +39,56 @@ describe.only('InfluxQuery', function() { it('should add mean after after field', function() { var query = new InfluxQuery({ measurement: 'cpu', - select: [[{name: 'field', params: ['value']}]] + select: [[{type: 'field', params: ['value']}]] }); query.addSelectPart(query.selectModels[0], 'mean'); expect(query.target.select[0].length).to.be(2); - expect(query.target.select[0][1].name).to.be('mean'); + expect(query.target.select[0][1].type).to.be('mean'); }); it('should replace sum by mean', function() { var query = new InfluxQuery({ measurement: 'cpu', - select: [[{name: 'field', params: ['value']}, {name: 'mean'}]] + select: [[{type: 'field', params: ['value']}, {type: 'mean'}]] }); query.addSelectPart(query.selectModels[0], 'sum'); expect(query.target.select[0].length).to.be(2); - expect(query.target.select[0][1].name).to.be('sum'); + expect(query.target.select[0][1].type).to.be('sum'); }); it('should add math before alias', function() { var query = new InfluxQuery({ measurement: 'cpu', - select: [[{name: 'field', params: ['value']}, {name: 'mean'}, {name: 'alias'}]] + select: [[{type: 'field', params: ['value']}, {type: 'mean'}, {type: 'alias'}]] }); query.addSelectPart(query.selectModels[0], 'math'); expect(query.target.select[0].length).to.be(4); - expect(query.target.select[0][2].name).to.be('math'); + expect(query.target.select[0][2].type).to.be('math'); }); it('should add math last', function() { var query = new InfluxQuery({ measurement: 'cpu', - select: [[{name: 'field', params: ['value']}, {name: 'mean'}]] + select: [[{type: 'field', params: ['value']}, {type: 'mean'}]] }); query.addSelectPart(query.selectModels[0], 'math'); expect(query.target.select[0].length).to.be(3); - expect(query.target.select[0][2].name).to.be('math'); + expect(query.target.select[0][2].type).to.be('math'); }); it('should replace math', function() { var query = new InfluxQuery({ measurement: 'cpu', - select: [[{name: 'field', params: ['value']}, {name: 'mean'}, {name: 'math'}]] + select: [[{type: 'field', params: ['value']}, {type: 'mean'}, {type: 'math'}]] }); query.addSelectPart(query.selectModels[0], 'math'); expect(query.target.select[0].length).to.be(3); - expect(query.target.select[0][2].name).to.be('math'); + expect(query.target.select[0][2].type).to.be('math'); }); }); diff --git a/public/app/plugins/datasource/influxdb/specs/query_part_specs.ts b/public/app/plugins/datasource/influxdb/specs/query_part_specs.ts index ea354bf1439..ee939fdab42 100644 --- a/public/app/plugins/datasource/influxdb/specs/query_part_specs.ts +++ b/public/app/plugins/datasource/influxdb/specs/query_part_specs.ts @@ -3,12 +3,12 @@ import {describe, beforeEach, it, sinon, expect} from 'test/lib/common'; import queryPart = require('../query_part'); -describe('InfluxQueryBuilder', () => { +describe('InfluxQueryPart', () => { describe('series with mesurement only', () => { it('should handle nested function parts', () => { var part = queryPart.create({ - name: 'derivative', + type: 'derivative', params: ['10s'], }); @@ -18,7 +18,7 @@ describe('InfluxQueryBuilder', () => { it('should handle suffirx parts', () => { var part = queryPart.create({ - name: 'math', + type: 'math', params: ['/ 100'], }); @@ -28,7 +28,7 @@ describe('InfluxQueryBuilder', () => { it('should handle alias parts', () => { var part = queryPart.create({ - name: 'alias', + type: 'alias', params: ['test'], }); From f972863f496e3752ca14e942172d90608c65983b Mon Sep 17 00:00:00 2001 From: Mitsuhiro Tanda Date: Thu, 26 Nov 2015 13:21:38 +0900 Subject: [PATCH 245/269] add credential setting to handleDescribeInstances --- pkg/api/cloudwatch/cloudwatch.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/pkg/api/cloudwatch/cloudwatch.go b/pkg/api/cloudwatch/cloudwatch.go index 6311d62f43e..739d9aad4c9 100644 --- a/pkg/api/cloudwatch/cloudwatch.go +++ b/pkg/api/cloudwatch/cloudwatch.go @@ -126,8 +126,16 @@ func handleListMetrics(req *cwRequest, c *middleware.Context) { } func handleDescribeInstances(req *cwRequest, c *middleware.Context) { + creds := credentials.NewChainCredentials( + []credentials.Provider{ + &credentials.EnvProvider{}, + &credentials.SharedCredentialsProvider{Filename: "", Profile: req.DataSource.Database}, + &ec2rolecreds.EC2RoleProvider{ExpiryWindow: 5 * time.Minute}, + }) + cfg := &aws.Config{ - Region: aws.String(req.Region), + Region: aws.String(req.Region), + Credentials: creds, } svc := ec2.New(session.New(cfg), cfg) From 2aabb387b154074966fb90a565d132964a1b0344 Mon Sep 17 00:00:00 2001 From: Mitsuhiro Tanda Date: Thu, 26 Nov 2015 15:59:56 +0900 Subject: [PATCH 246/269] fix EC2RoleProvider parameter --- pkg/api/cloudwatch/cloudwatch.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/pkg/api/cloudwatch/cloudwatch.go b/pkg/api/cloudwatch/cloudwatch.go index 739d9aad4c9..f4cde0ebd6a 100644 --- a/pkg/api/cloudwatch/cloudwatch.go +++ b/pkg/api/cloudwatch/cloudwatch.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/aws/credentials" "github.com/aws/aws-sdk-go/aws/credentials/ec2rolecreds" + "github.com/aws/aws-sdk-go/aws/ec2metadata" "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/cloudwatch" "github.com/aws/aws-sdk-go/service/ec2" @@ -40,11 +41,12 @@ func init() { } func handleGetMetricStatistics(req *cwRequest, c *middleware.Context) { + sess := session.New() creds := credentials.NewChainCredentials( []credentials.Provider{ &credentials.EnvProvider{}, &credentials.SharedCredentialsProvider{Filename: "", Profile: req.DataSource.Database}, - &ec2rolecreds.EC2RoleProvider{ExpiryWindow: 5 * time.Minute}, + &ec2rolecreds.EC2RoleProvider{Client: ec2metadata.New(sess), ExpiryWindow: 5 * time.Minute}, }) cfg := &aws.Config{ @@ -87,11 +89,12 @@ func handleGetMetricStatistics(req *cwRequest, c *middleware.Context) { } func handleListMetrics(req *cwRequest, c *middleware.Context) { + sess := session.New() creds := credentials.NewChainCredentials( []credentials.Provider{ &credentials.EnvProvider{}, &credentials.SharedCredentialsProvider{Filename: "", Profile: req.DataSource.Database}, - &ec2rolecreds.EC2RoleProvider{ExpiryWindow: 5 * time.Minute}, + &ec2rolecreds.EC2RoleProvider{Client: ec2metadata.New(sess), ExpiryWindow: 5 * time.Minute}, }) cfg := &aws.Config{ @@ -126,11 +129,12 @@ func handleListMetrics(req *cwRequest, c *middleware.Context) { } func handleDescribeInstances(req *cwRequest, c *middleware.Context) { + sess := session.New() creds := credentials.NewChainCredentials( []credentials.Provider{ &credentials.EnvProvider{}, &credentials.SharedCredentialsProvider{Filename: "", Profile: req.DataSource.Database}, - &ec2rolecreds.EC2RoleProvider{ExpiryWindow: 5 * time.Minute}, + &ec2rolecreds.EC2RoleProvider{Client: ec2metadata.New(sess), ExpiryWindow: 5 * time.Minute}, }) cfg := &aws.Config{ From aa13a80d833d1722b72fb8468d46beaae394bab9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Thu, 26 Nov 2015 09:28:59 +0100 Subject: [PATCH 247/269] fix(influxdb): fixed issue with metric segment component that caused double events --- public/app/core/directives/metric_segment.js | 35 +++++++++++--------- 1 file changed, 20 insertions(+), 15 deletions(-) diff --git a/public/app/core/directives/metric_segment.js b/public/app/core/directives/metric_segment.js index 9babb74dc2d..d8e3fb90c95 100644 --- a/public/app/core/directives/metric_segment.js +++ b/public/app/core/directives/metric_segment.js @@ -27,6 +27,7 @@ function (_, $, coreModule) { var segment = $scope.segment; var options = null; var cancelBlur = null; + var linkMode = true; $input.appendTo(elem); $button.appendTo(elem); @@ -55,19 +56,21 @@ function (_, $, coreModule) { }); }; - $scope.switchToLink = function(now) { - if (now === true || cancelBlur) { - clearTimeout(cancelBlur); - cancelBlur = null; - $input.hide(); - $button.show(); - $scope.updateVariableValue($input.val()); - } - else { - // need to have long delay because the blur - // happens long before the click event on the typeahead options - cancelBlur = setTimeout($scope.switchToLink, 100); - } + $scope.switchToLink = function() { + if (linkMode) { return; } + + clearTimeout(cancelBlur); + cancelBlur = null; + linkMode = true; + $input.hide(); + $button.show(); + $scope.updateVariableValue($input.val()); + }; + + $scope.inputBlur = function() { + // happens long before the click event on the typeahead options + // need to have long delay because the blur + cancelBlur = setTimeout($scope.switchToLink, 100); }; $scope.source = function(query, callback) { @@ -98,7 +101,7 @@ function (_, $, coreModule) { } $input.val(value); - $scope.switchToLink(true); + $scope.switchToLink(); return value; }; @@ -139,6 +142,8 @@ function (_, $, coreModule) { $input.show(); $input.focus(); + linkMode = false; + var typeahead = $input.data('typeahead'); if (typeahead) { $input.val(''); @@ -146,7 +151,7 @@ function (_, $, coreModule) { } }); - $input.blur($scope.switchToLink); + $input.blur($scope.inputBlur); $compile(elem.contents())($scope); } From 72d9fcdcb428224026d8999f797d66c91ab617d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Fri, 27 Nov 2015 16:35:40 +0100 Subject: [PATCH 248/269] feat(influxdb): progress with new influxdb editor --- .../datasource/influxdb/influx_query.ts | 16 +++++++--- .../plugins/datasource/influxdb/query_ctrl.js | 2 +- .../plugins/datasource/influxdb/query_part.ts | 19 +++++++++-- .../influxdb/specs/influx_query_specs.ts | 32 ++++++++++++++++--- 4 files changed, 58 insertions(+), 11 deletions(-) diff --git a/public/app/plugins/datasource/influxdb/influx_query.ts b/public/app/plugins/datasource/influxdb/influx_query.ts index cf5de4c2f49..a18562f90ed 100644 --- a/public/app/plugins/datasource/influxdb/influx_query.ts +++ b/public/app/plugins/datasource/influxdb/influx_query.ts @@ -16,7 +16,10 @@ class InfluxQuery { this.target = target; target.tags = target.tags || []; - target.groupBy = target.groupBy || [{type: 'time', params: ['$interval']}]; + target.groupBy = target.groupBy || [ + {type: 'time', params: ['$interval']}, + {type: 'fill', params: ['null']}, + ]; target.select = target.select || [[ {type: 'field', params: ['value']}, {type: 'mean', params: []}, @@ -160,13 +163,18 @@ class InfluxQuery { query += conditions.join(' '); query += (conditions.length > 0 ? ' AND ' : '') + '$timeFilter'; - query += ' GROUP BY '; + var groupBySection = ""; for (i = 0; i < this.groupByParts.length; i++) { var part = this.groupByParts[i]; if (i > 0) { - query += ', '; + // for some reason fill has no seperator + groupBySection += part.def.type === 'fill' ? ' ' : ', '; } - query += part.render(''); + groupBySection += part.render(''); + } + + if (groupBySection.length) { + query += ' GROUP BY ' + groupBySection; } if (target.fill) { diff --git a/public/app/plugins/datasource/influxdb/query_ctrl.js b/public/app/plugins/datasource/influxdb/query_ctrl.js index 774a1d84108..bf89b550db3 100644 --- a/public/app/plugins/datasource/influxdb/query_ctrl.js +++ b/public/app/plugins/datasource/influxdb/query_ctrl.js @@ -70,7 +70,7 @@ function (angular, _, InfluxQueryBuilder, InfluxQuery, queryPart) { .then(function(tags) { var options = []; if (!$scope.queryModel.hasFill()) { - options.push(uiSegmentSrv.newSegment({value: 'fill(option)'})); + options.push(uiSegmentSrv.newSegment({value: 'fill(null)'})); } if (!$scope.queryModel.hasGroupByTime()) { options.push(uiSegmentSrv.newSegment({value: 'time($interval)'})); diff --git a/public/app/plugins/datasource/influxdb/query_part.ts b/public/app/plugins/datasource/influxdb/query_part.ts index 5338b9b48c1..09aae007750 100644 --- a/public/app/plugins/datasource/influxdb/query_part.ts +++ b/public/app/plugins/datasource/influxdb/query_part.ts @@ -71,6 +71,13 @@ function quotedIdentityRenderer(part, innerExpr) { return '"' + part.params[0] + '"'; } +function fieldRenderer(part, innerExpr) { + if (part.params[0] === '*') { + return '*'; + } + return '"' + part.params[0] + '"'; +} + function replaceAggregationAddStrategy(selectParts, partModel) { // look for existing aggregation for (var i = 0; i < selectParts.length; i++) { @@ -146,7 +153,7 @@ QueryPartDef.register({ category: categories.Fields, params: [{type: 'field'}], defaultParams: ['value'], - renderer: quotedIdentityRenderer, + renderer: fieldRenderer, }); QueryPartDef.register({ @@ -184,12 +191,20 @@ QueryPartDef.register({ renderer: functionRenderer, }); +QueryPartDef.register({ + type: 'fill', + category: groupByTimeFunctions, + params: [{ name: "fill", type: "string", options: ['none', 'null', '0', 'previous'] }], + defaultParams: ['null'], + renderer: functionRenderer, +}); + QueryPartDef.register({ type: 'tag', category: groupByTimeFunctions, params: [{name: 'tag', type: 'string'}], defaultParams: ['tag'], - renderer: quotedIdentityRenderer, + renderer: fieldRenderer, }); QueryPartDef.register({ diff --git a/public/app/plugins/datasource/influxdb/specs/influx_query_specs.ts b/public/app/plugins/datasource/influxdb/specs/influx_query_specs.ts index 1e6e32ec8e9..7b7ce8e4ae8 100644 --- a/public/app/plugins/datasource/influxdb/specs/influx_query_specs.ts +++ b/public/app/plugins/datasource/influxdb/specs/influx_query_specs.ts @@ -4,18 +4,18 @@ import InfluxQuery = require('../influx_query'); describe.only('InfluxQuery', function() { - describe('series with mesurement only', function() { + describe('render series with mesurement only', function() { it('should generate correct query', function() { var query = new InfluxQuery({ measurement: 'cpu', }); var queryText = query.render(); - expect(queryText).to.be('SELECT mean("value") FROM "cpu" WHERE $timeFilter GROUP BY time($interval)'); + expect(queryText).to.be('SELECT mean("value") FROM "cpu" WHERE $timeFilter GROUP BY time($interval) fill(null)'); }); }); - describe('series with math and alias', function() { + describe('render series with math and alias', function() { it('should generate correct query', function() { var query = new InfluxQuery({ measurement: 'cpu', @@ -30,7 +30,31 @@ describe.only('InfluxQuery', function() { }); var queryText = query.render(); - expect(queryText).to.be('SELECT mean("value") /100 AS "text" FROM "cpu" WHERE $timeFilter GROUP BY time($interval)'); + expect(queryText).to.be('SELECT mean("value") /100 AS "text" FROM "cpu" WHERE $timeFilter GROUP BY time($interval) fill(null)'); + }); + }); + + describe('render series without group by', function() { + it('should generate correct query', function() { + var query = new InfluxQuery({ + measurement: 'cpu', + select: [[{type: 'field', params: ['value']}]], + groupBy: [], + }); + var queryText = query.render(); + expect(queryText).to.be('SELECT "value" FROM "cpu" WHERE $timeFilter'); + }); + }); + + describe('render series without group by and fill', function() { + it('should generate correct query', function() { + var query = new InfluxQuery({ + measurement: 'cpu', + select: [[{type: 'field', params: ['value']}]], + groupBy: [{type: 'time'}, {type: 'fill', params: ['0']}], + }); + var queryText = query.render(); + expect(queryText).to.be('SELECT "value" FROM "cpu" WHERE $timeFilter GROUP BY time($interval) fill(0)'); }); }); From 712a420217f48d13908ed2b571b419031be7c3f1 Mon Sep 17 00:00:00 2001 From: utkarshcmu Date: Sun, 29 Nov 2015 03:12:48 -0800 Subject: [PATCH 249/269] Fixed refresh setting for absolute time --- public/app/features/dashboard/timeSrv.js | 9 +++++++-- public/app/features/dashboard/timepicker/timepicker.ts | 2 +- public/test/specs/time_srv_specs.js | 9 ++++++++- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/public/app/features/dashboard/timeSrv.js b/public/app/features/dashboard/timeSrv.js index 1aff02bea90..691bfd07904 100644 --- a/public/app/features/dashboard/timeSrv.js +++ b/public/app/features/dashboard/timeSrv.js @@ -90,10 +90,15 @@ define([ timer.cancel(this.refresh_timer); }; - this.setTime = function(time) { + this.setTime = function(time, enableRefresh) { _.extend(this.time, time); - if (this.old_refresh && this.old_refresh !== this.dashboard.refresh) { + // disable refresh if zoom in or zoom out + if (!enableRefresh && moment.isMoment(time.to)) { + this.old_refresh = this.dashboard.refresh || this.old_refresh; + this.setAutoRefresh(false); + } + else if (this.old_refresh && this.old_refresh !== this.dashboard.refresh) { this.setAutoRefresh(this.old_refresh); this.old_refresh = null; } diff --git a/public/app/features/dashboard/timepicker/timepicker.ts b/public/app/features/dashboard/timepicker/timepicker.ts index c6d2680ce02..0f99210f3fa 100644 --- a/public/app/features/dashboard/timepicker/timepicker.ts +++ b/public/app/features/dashboard/timepicker/timepicker.ts @@ -115,7 +115,7 @@ export class TimePickerCtrl { this.timeSrv.setAutoRefresh(this.refresh.value); } - this.timeSrv.setTime(this.timeRaw); + this.timeSrv.setTime(this.timeRaw, true); this.$rootScope.appEvent('hide-dash-editor'); } diff --git a/public/test/specs/time_srv_specs.js b/public/test/specs/time_srv_specs.js index 8c110483b47..d645df3fd1e 100644 --- a/public/test/specs/time_srv_specs.js +++ b/public/test/specs/time_srv_specs.js @@ -92,10 +92,17 @@ define([ expect(_dashboard.refresh).to.be('30s'); }); + it('should restore refresh for absolute time range', function() { + _dashboard.refresh = '30s'; + + ctx.service.setTime({from: '2011-01-01', to: '2015-01-01' }); + expect(_dashboard.refresh).to.be('30s'); + }); + it('should restore refresh after relative time range is set', function() { _dashboard.refresh = '10s'; ctx.service.setTime({from: moment([2011,1,1]), to: moment([2015,1,1])}); - expect(_dashboard.refresh).to.be('10s'); + expect(_dashboard.refresh).to.be(false); ctx.service.setTime({from: '2011-01-01', to: 'now' }); expect(_dashboard.refresh).to.be('10s'); }); From 8cdaa044e1eda21afa34f47caa18503d6a590e0d Mon Sep 17 00:00:00 2001 From: utkarshcmu Date: Sun, 29 Nov 2015 03:14:26 -0800 Subject: [PATCH 250/269] Removed repeating test --- public/test/specs/time_srv_specs.js | 7 ------- 1 file changed, 7 deletions(-) diff --git a/public/test/specs/time_srv_specs.js b/public/test/specs/time_srv_specs.js index d645df3fd1e..9943aae6cc3 100644 --- a/public/test/specs/time_srv_specs.js +++ b/public/test/specs/time_srv_specs.js @@ -92,13 +92,6 @@ define([ expect(_dashboard.refresh).to.be('30s'); }); - it('should restore refresh for absolute time range', function() { - _dashboard.refresh = '30s'; - - ctx.service.setTime({from: '2011-01-01', to: '2015-01-01' }); - expect(_dashboard.refresh).to.be('30s'); - }); - it('should restore refresh after relative time range is set', function() { _dashboard.refresh = '10s'; ctx.service.setTime({from: moment([2011,1,1]), to: moment([2015,1,1])}); From 0dbd7d0e17c215007a4f08fb6783a8db3bda0368 Mon Sep 17 00:00:00 2001 From: utkarshcmu Date: Sun, 29 Nov 2015 03:28:07 -0800 Subject: [PATCH 251/269] Fixed #3357 --- public/app/features/admin/partials/orgs.html | 1 + 1 file changed, 1 insertion(+) diff --git a/public/app/features/admin/partials/orgs.html b/public/app/features/admin/partials/orgs.html index fe87073eb6c..573c0799c68 100644 --- a/public/app/features/admin/partials/orgs.html +++ b/public/app/features/admin/partials/orgs.html @@ -17,6 +17,7 @@ + {{org.id}} {{org.name}} From 85ec70e92b2101f735a1045832e93f4e3dd19e74 Mon Sep 17 00:00:00 2001 From: Mat Schaffer Date: Mon, 30 Nov 2015 15:55:07 +0900 Subject: [PATCH 252/269] Use of `` seems to confuse angular so changing to DIMENSION_NAME --- .../plugins/datasource/cloudwatch/partials/query.editor.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/app/plugins/datasource/cloudwatch/partials/query.editor.html b/public/app/plugins/datasource/cloudwatch/partials/query.editor.html index d05ffd8547f..0984bc521e2 100644 --- a/public/app/plugins/datasource/cloudwatch/partials/query.editor.html +++ b/public/app/plugins/datasource/cloudwatch/partials/query.editor.html @@ -73,7 +73,7 @@
              -
              +
              • Columns @@ -27,7 +27,8 @@ {{column.text}}
              • -
              • +
              diff --git a/public/app/panels/table/editor.ts b/public/app/panels/table/editor.ts index 2908023d330..e41ff422800 100644 --- a/public/app/panels/table/editor.ts +++ b/public/app/panels/table/editor.ts @@ -1,6 +1,6 @@ - /// + import angular = require('angular'); import $ = require('jquery'); import _ = require('lodash'); @@ -9,93 +9,103 @@ import moment = require('moment'); import {transformers} from './transformers'; -export function tablePanelEditor() { +export class TablePanelEditorCtrl { + + /** @ngInject */ + constructor($scope, $q, uiSegmentSrv) { + $scope.transformers = transformers; + $scope.unitFormats = kbn.getUnitFormats(); + $scope.colorModes = [ + {text: 'Disabled', value: null}, + {text: 'Cell', value: 'cell'}, + {text: 'Value', value: 'value'}, + {text: 'Row', value: 'row'}, + ]; + $scope.columnTypes = [ + {text: 'Number', value: 'number'}, + {text: 'String', value: 'string'}, + {text: 'Date', value: 'date'}, + ]; + $scope.fontSizes = ['80%', '90%', '100%', '110%', '120%', '130%', '150%', '160%', '180%', '200%', '220%', '250%']; + $scope.dateFormats = [ + {text: 'YYYY-MM-DD HH:mm:ss', value: 'YYYY-MM-DD HH:mm:ss'}, + {text: 'MM/DD/YY h:mm:ss a', value: 'MM/DD/YY h:mm:ss a'}, + {text: 'MMMM D, YYYY LT', value: 'MMMM D, YYYY LT'}, + ]; + + $scope.addColumnSegment = uiSegmentSrv.newPlusButton(); + + $scope.getColumnOptions = function() { + if (!$scope.dataRaw) { + return $q.when([]); + } + var columns = transformers[$scope.panel.transform].getColumns($scope.dataRaw); + var segments = _.map(columns, (c: any) => uiSegmentSrv.newSegment({value: c.text})); + return $q.when(segments); + }; + + $scope.addColumn = function() { + $scope.panel.columns.push({text: $scope.addColumnSegment.value, value: $scope.addColumnSegment.value}); + $scope.render(); + + var plusButton = uiSegmentSrv.newPlusButton(); + $scope.addColumnSegment.html = plusButton.html; + }; + + $scope.transformChanged = function() { + $scope.panel.columns = []; + $scope.render(); + }; + + $scope.removeColumn = function(column) { + $scope.panel.columns = _.without($scope.panel.columns, column); + $scope.render(); + }; + + $scope.setUnitFormat = function(column, subItem) { + column.unit = subItem.value; + $scope.render(); + }; + + $scope.addColumnStyle = function() { + var columnStyleDefaults = { + unit: 'short', + type: 'number', + decimals: 2, + colors: ["rgba(245, 54, 54, 0.9)", "rgba(237, 129, 40, 0.89)", "rgba(50, 172, 45, 0.97)"], + colorMode: null, + pattern: '/.*/', + dateFormat: 'YYYY-MM-DD HH:mm:ss', + thresholds: [], + }; + + $scope.panel.styles.push(angular.copy(columnStyleDefaults)); + }; + + $scope.removeColumnStyle = function(style) { + $scope.panel.styles = _.without($scope.panel.styles, style); + }; + + $scope.getColumnNames = function() { + if (!$scope.table) { + return []; + } + return _.map($scope.table.columns, function(col: any) { + return col.text; + }); + }; + + } +} + + +export function tablePanelEditor($q, uiSegmentSrv) { 'use strict'; return { restrict: 'E', scope: true, templateUrl: 'app/panels/table/editor.html', - link: function(scope, elem) { - scope.transformers = transformers; - scope.unitFormats = kbn.getUnitFormats(); - scope.colorModes = [ - {text: 'Disabled', value: null}, - {text: 'Cell', value: 'cell'}, - {text: 'Value', value: 'value'}, - {text: 'Row', value: 'row'}, - ]; - scope.columnTypes = [ - {text: 'Number', value: 'number'}, - {text: 'String', value: 'string'}, - {text: 'Date', value: 'date'}, - ]; - scope.fontSizes = ['80%', '90%', '100%', '110%', '120%', '130%', '150%', '160%', '180%', '200%', '220%', '250%']; - scope.dateFormats = [ - {text: 'YYYY-MM-DD HH:mm:ss', value: 'YYYY-MM-DD HH:mm:ss'}, - {text: 'MM/DD/YY h:mm:ss a', value: 'MM/DD/YY h:mm:ss a'}, - {text: 'MMMM D, YYYY LT', value: 'MMMM D, YYYY LT'}, - ]; - - scope.updateColumnsMenu = function(data) { - scope.columnsMenu = transformers[scope.panel.transform].getColumns(data); - scope.showColumnOptions = true; - }; - - scope.$on('render', function(event, table, rawData) { - scope.updateColumnsMenu(rawData); - }); - - scope.addColumn = function(menuItem) { - scope.panel.columns.push({text: menuItem.text, value: menuItem.value}); - scope.render(); - }; - - scope.transformChanged = function() { - scope.panel.columns = []; - scope.updateColumnsMenu(); - scope.render(); - }; - - scope.removeColumn = function(column) { - scope.panel.columns = _.without(scope.panel.columns, column); - scope.render(); - }; - - scope.setUnitFormat = function(column, subItem) { - column.unit = subItem.value; - scope.render(); - }; - - scope.addColumnStyle = function() { - var columnStyleDefaults = { - unit: 'short', - type: 'number', - decimals: 2, - colors: ["rgba(245, 54, 54, 0.9)", "rgba(237, 129, 40, 0.89)", "rgba(50, 172, 45, 0.97)"], - colorMode: null, - pattern: '/.*/', - dateFormat: 'YYYY-MM-DD HH:mm:ss', - thresholds: [], - }; - - scope.panel.styles.push(angular.copy(columnStyleDefaults)); - }; - - scope.removeColumnStyle = function(style) { - scope.panel.styles = _.without(scope.panel.styles, style); - }; - - scope.getColumnNames = function() { - if (!scope.table) { - return []; - } - return _.map(scope.table.columns, function(col: any) { - return col.text; - }); - }; - - scope.updateColumnsMenu(scope.dataRaw); - } + controller: TablePanelEditorCtrl, }; } From 82d8e3c2b6d5ffa467e258cf98c6b25b1df548f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Tue, 1 Dec 2015 13:34:42 +0100 Subject: [PATCH 266/269] feat(graph panel): refactoring of hide zero option, #3336 --- CHANGELOG.md | 2 ++ public/app/panels/graph/axisEditor.html | 41 ++++++++++++------------- 2 files changed, 22 insertions(+), 21 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 72211224636..81b315d6323 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,8 @@ ### Enhancements * **CloudWatch**: Support for multiple AWS Credentials, closes [#3053](https://github.com/grafana/grafana/issues/3053), [#3080](https://github.com/grafana/grafana/issues/3080) * **Elasticsearch**: Support for dynamic daily indices for annotations, closes [#3061](https://github.com/grafana/grafana/issues/3061) +* **Graph Panel**: Option to hide series with all zeroes from legend and tooltip, closes [#1381](https://github.com/grafana/grafana/issues/1381), [#3336](https://github.com/grafana/grafana/issues/3336) + ### Bug Fixes * **cloudwatch**: fix for handling of period for long time ranges, fixes [#3086](https://github.com/grafana/grafana/issues/3086) diff --git a/public/app/panels/graph/axisEditor.html b/public/app/panels/graph/axisEditor.html index e2bc4d36b1d..175c0c78fa7 100644 --- a/public/app/panels/graph/axisEditor.html +++ b/public/app/panels/graph/axisEditor.html @@ -150,9 +150,9 @@
              -
              +
                -
              • +
              • Legend
              • @@ -164,21 +164,13 @@
              • -
              • - -
              • -
              • - -
              -
              -
                -
              • - Legend values +
              • + Values
              • @@ -195,13 +187,8 @@
              • -
              -
              -
              -
              -
                -
              • - Decimals +
              • + Decimals
              - - +
              +
                +
              • + Hide +
              • +
              • + +
              • +
              • + +
              • +
              +
              +
              From 75b83af08ff4056ee0cdd6e5ef231be1d22c6a6b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Tue, 1 Dec 2015 14:04:44 +0100 Subject: [PATCH 267/269] refactoring(ui): minor ui improvement to graph axis tab --- public/app/panels/graph/axisEditor.html | 118 ++++++++++++++---------- 1 file changed, 68 insertions(+), 50 deletions(-) diff --git a/public/app/panels/graph/axisEditor.html b/public/app/panels/graph/axisEditor.html index 175c0c78fa7..2c22dee8359 100644 --- a/public/app/panels/graph/axisEditor.html +++ b/public/app/panels/graph/axisEditor.html @@ -6,7 +6,7 @@
            • Left Y
            • -
            • +
            • Unit
            • -
            • -    Grid Max -
            • -
            • - -
            • -
            • - Min -
            • -
            • - -
            • Scale type
            • @@ -46,12 +30,36 @@
              -
              +
              +
                +
              • + +
              • +
              • + Y-Max +
              • +
              • + +
              • +
              • + Y-Min +
              • +
              • + +
              • +
              +
              +
              +
              • Right Y
              • -
              • +
              • Unit
              • -
              • -    Grid Max -
              • -
              • - -
              • -
              • - Min -
              • -
              • - -
              • Scale type
              • @@ -91,6 +83,31 @@
              +
              +
                +
              • + +
              • +
              • + Y-Max +
              • +
              • + +
              • +
              • + Y-Min +
              • +
              • + +
              • +
              +
              +
              +
              @@ -168,6 +185,21 @@
              +
                +
              • + Hide series +
              • +
              • + +
              • +
              • + +
              • +
              +
              +
              + +
              • Values @@ -184,7 +216,7 @@
              • -
              • +
              • @@ -197,19 +229,5 @@
              -
              -
                -
              • - Hide -
              • -
              • - -
              • -
              • - -
              • -
              -
              -
              From 2436cda7ac21da46daa099165ec21f3e6447c568 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Tue, 1 Dec 2015 15:28:34 +0100 Subject: [PATCH 268/269] fix(graph panel): minor spelling change --- public/app/panels/graph/axisEditor.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/public/app/panels/graph/axisEditor.html b/public/app/panels/graph/axisEditor.html index 2c22dee8359..d8a537dda46 100644 --- a/public/app/panels/graph/axisEditor.html +++ b/public/app/panels/graph/axisEditor.html @@ -190,10 +190,10 @@ Hide series
            • - +
            • - +
            • From 8eb3e48bc7c65f3682d71cc1923b3d4170f3edb9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Wed, 2 Dec 2015 18:22:47 +0100 Subject: [PATCH 269/269] fix(build): fixed build issues with concat not including require_config --- package.json | 2 +- public/views/index.html | 8 ++++---- tasks/build_task.js | 6 +++--- tasks/options/concat.js | 2 +- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/package.json b/package.json index 4e3890be19f..75136e48f1a 100644 --- a/package.json +++ b/package.json @@ -21,7 +21,7 @@ "grunt-contrib-connect": "~0.5.0", "grunt-contrib-copy": "~0.5.0", "grunt-contrib-cssmin": "~0.6.1", - "grunt-contrib-htmlmin": "~0.1.3", + "grunt-contrib-htmlmin": "~0.6.0", "grunt-contrib-jshint": "~0.10.0", "grunt-contrib-less": "~0.7.0", "grunt-contrib-requirejs": "~0.4.4", diff --git a/public/views/index.html b/public/views/index.html index 5b4e2f5bd92..b9a1bc3c825 100644 --- a/public/views/index.html +++ b/public/views/index.html @@ -9,15 +9,15 @@ Grafana [[if .User.LightTheme]] - + [[else]] - + [[end]] - + - + diff --git a/tasks/build_task.js b/tasks/build_task.js index 7773299a06d..54562dfbde1 100644 --- a/tasks/build_task.js +++ b/tasks/build_task.js @@ -13,7 +13,7 @@ module.exports = function(grunt) { 'karma:test', 'phantomjs', 'css', - 'htmlmin:build', + // 'htmlmin:build', 'ngtemplates', 'cssmin:build', 'ngAnnotate:build', @@ -34,8 +34,8 @@ module.exports = function(grunt) { for(var key in summary){ if(summary.hasOwnProperty(key)){ - var orig = key.replace(root, root+'/[[.AppSubUrl]]'); - var revved = summary[key].replace(root, root+'/[[.AppSubUrl]]'); + var orig = key.replace(root, root+'/[[.AppSubUrl]]/public'); + var revved = summary[key].replace(root, root+'/[[.AppSubUrl]]/public'); fixed[orig] = revved; } } diff --git a/tasks/options/concat.js b/tasks/options/concat.js index c15aa8a2d6e..4e6927b306a 100644 --- a/tasks/options/concat.js +++ b/tasks/options/concat.js @@ -27,7 +27,7 @@ module.exports = function(config) { js: { src: [ '<%= tempDir %>/vendor/requirejs/require.js', - '<%= tempDir %>/app/components/require.config.js', + '<%= tempDir %>/app/require_config.js', '<%= tempDir %>/app/app.js', ], dest: '<%= genDir %>/app/app.js'