Skip to content

Commit

Permalink
Removed space between snippet-start/end: and '['
Browse files Browse the repository at this point in the history
  • Loading branch information
Doug-AWS committed Apr 30, 2020
1 parent 8a98764 commit 610bf86
Show file tree
Hide file tree
Showing 128 changed files with 9,872 additions and 9,872 deletions.
34 changes: 17 additions & 17 deletions go/Readme.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
.. Copyright 2010-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.

This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0
International License (the "License"). You may not use this file except in compliance with the
License. A copy of the License is located at http://creativecommons.org/licenses/by-nc-sa/4.0/.

This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
either express or implied. See the License for the specific language governing permissions and
limitations under the License.

######################################
AWS SDK for Go Documentation Examples
######################################

This is a collection of examples for the AWS SDK for Go public documentation.

These examples were tested using Go version 1.14 and version 1 of the AWS SDK for Go.
.. Copyright 2010-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.

This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0
International License (the "License"). You may not use this file except in compliance with the
License. A copy of the License is located at http://creativecommons.org/licenses/by-nc-sa/4.0/.

This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
either express or implied. See the License for the specific language governing permissions and
limitations under the License.

######################################
AWS SDK for Go Documentation Examples
######################################

This is a collection of examples for the AWS SDK for Go public documentation.

These examples were tested using Go version 1.14 and version 1 of the AWS SDK for Go.
20 changes: 10 additions & 10 deletions go/cloudwatch/CreateCustomMetric/CreateCustomMetric.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,18 @@
CONDITIONS OF ANY KIND, either express or implied. See the License for the
specific language governing permissions and limitations under the License.
*/
// snippet-start: [cloudwatch.go.create_custom_metric]
// snippet-start:[cloudwatch.go.create_custom_metric]
package main

// snippet-start: [cloudwatch.go.create_custom_metric.import]
// snippet-start:[cloudwatch.go.create_custom_metric.import]
import (
"flag"
"fmt"

"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/cloudwatch"
)
// snippet-end: [cloudwatch.go.create_custom_metric.import]
// snippet-end:[cloudwatch.go.create_custom_metric.import]

// CreateCustomMetric creates a new metric in a namespace
// Inputs:
Expand All @@ -38,7 +38,7 @@ import (
// Otherwise, an error from a call to PutMetricData
func CreateCustomMetric(sess *session.Session, namespace *string, metricName *string, unit *string, value *float64, dimensionName *string, dimensionValue *string) error {
// Create new Amazon CloudWatch client
// snippet-start: [cloudwatch.go.create_custom_metric.call]
// snippet-start:[cloudwatch.go.create_custom_metric.call]
svc := cloudwatch.New(sess)

_, err := svc.PutMetricData(&cloudwatch.PutMetricDataInput{
Expand All @@ -57,7 +57,7 @@ func CreateCustomMetric(sess *session.Session, namespace *string, metricName *st
},
},
})
// snippet-end: [cloudwatch.go.create_custom_metric.call]
// snippet-end:[cloudwatch.go.create_custom_metric.call]
if err != nil {
return err
}
Expand All @@ -66,7 +66,7 @@ func CreateCustomMetric(sess *session.Session, namespace *string, metricName *st
}

func main() {
// snippet-start: [cloudwatch.go.create_custom_metric.args]
// snippet-start:[cloudwatch.go.create_custom_metric.args]
namespace := flag.String("n", "", "The namespace for the metric")
metricName := flag.String("m", "", "The name of the metric")
unit := flag.String("u", "", "The units for the metric")
Expand All @@ -79,20 +79,20 @@ func main() {
fmt.Println("You must supply a namespace, metric name, value, dimension name, and dimension value")
return
}
// snippet-end: [cloudwatch.go.create_custom_metric.args]
// snippet-end:[cloudwatch.go.create_custom_metric.args]

// Initialize a session that the SDK uses to load
// credentials from the shared credentials file ~/.aws/credentials
// and configuration from the shared configuration file ~/.aws/config.
// snippet-start: [cloudwatch.go.create_custom_metric.session]
// snippet-start:[cloudwatch.go.create_custom_metric.session]
sess := session.Must(session.NewSessionWithOptions(session.Options{
SharedConfigState: session.SharedConfigEnable,
}))
// snippet-start: [cloudwatch.go.create_custom_metric.session]
// snippet-start:[cloudwatch.go.create_custom_metric.session]

err := CreateCustomMetric(sess, namespace, metricName, unit, value, dimensionName, dimensionValue)
if err != nil {
fmt.Println()
}
}
// snippet-end: [cloudwatch.go.create_custom_metric]
// snippet-end:[cloudwatch.go.create_custom_metric]
Loading

0 comments on commit 610bf86

Please sign in to comment.