1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215
|
// Code generated by smithy-go-codegen DO NOT EDIT.
package applicationsignals
import (
"context"
"fmt"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/service/applicationsignals/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Creates a service level objective (SLO), which can help you ensure that your
// critical business operations are meeting customer expectations. Use SLOs to set
// and track specific target levels for the reliability and availability of your
// applications and services. SLOs use service level indicators (SLIs) to calculate
// whether the application is performing at the level that you want.
//
// Create an SLO to set a target for a service or operation’s availability or
// latency. CloudWatch measures this target frequently you can find whether it has
// been breached.
//
// When you create an SLO, you set an attainment goal for it. An attainment goal
// is the ratio of good periods that meet the threshold requirements to the total
// periods within the interval. For example, an attainment goal of 99.9% means that
// within your interval, you are targeting 99.9% of the periods to be in healthy
// state.
//
// After you have created an SLO, you can retrieve error budget reports for it. An
// error budget is the number of periods or amount of time that your service can
// accumulate during an interval before your overall SLO budget health is breached
// and the SLO is considered to be unmet. for example, an SLO with a threshold that
// 99.95% of requests must be completed under 2000ms every month translates to an
// error budget of 21.9 minutes of downtime per month.
//
// When you call this operation, Application Signals creates the
// AWSServiceRoleForCloudWatchApplicationSignals service-linked role, if it doesn't
// already exist in your account. This service- linked role has the following
// permissions:
//
// - xray:GetServiceGraph
//
// - logs:StartQuery
//
// - logs:GetQueryResults
//
// - cloudwatch:GetMetricData
//
// - cloudwatch:ListMetrics
//
// - tag:GetResources
//
// - autoscaling:DescribeAutoScalingGroups
//
// You can easily set SLO targets for your applications that are discovered by
// Application Signals, using critical metrics such as latency and availability.
// You can also set SLOs against any CloudWatch metric or math expression that
// produces a time series.
//
// For more information about SLOs, see [Service level objectives (SLOs)].
//
// [Service level objectives (SLOs)]: https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch-ServiceLevelObjectives.html
func (c *Client) CreateServiceLevelObjective(ctx context.Context, params *CreateServiceLevelObjectiveInput, optFns ...func(*Options)) (*CreateServiceLevelObjectiveOutput, error) {
if params == nil {
params = &CreateServiceLevelObjectiveInput{}
}
result, metadata, err := c.invokeOperation(ctx, "CreateServiceLevelObjective", params, optFns, c.addOperationCreateServiceLevelObjectiveMiddlewares)
if err != nil {
return nil, err
}
out := result.(*CreateServiceLevelObjectiveOutput)
out.ResultMetadata = metadata
return out, nil
}
type CreateServiceLevelObjectiveInput struct {
// A name for this SLO.
//
// This member is required.
Name *string
// A structure that contains information about what service and what performance
// metric that this SLO will monitor.
//
// This member is required.
SliConfig *types.ServiceLevelIndicatorConfig
// An optional description for this SLO.
Description *string
// A structure that contains the attributes that determine the goal of the SLO.
// This includes the time period for evaluation and the attainment threshold.
Goal *types.Goal
// A list of key-value pairs to associate with the SLO. You can associate as many
// as 50 tags with an SLO. To be able to associate tags with the SLO when you
// create the SLO, you must have the cloudwatch:TagResource permission.
//
// Tags can help you organize and categorize your resources. You can also use them
// to scope user permissions by granting a user permission to access or change only
// resources with certain tag values.
Tags []types.Tag
noSmithyDocumentSerde
}
type CreateServiceLevelObjectiveOutput struct {
// A structure that contains information about the SLO that you just created.
//
// This member is required.
Slo *types.ServiceLevelObjective
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationCreateServiceLevelObjectiveMiddlewares(stack *middleware.Stack, options Options) (err error) {
if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil {
return err
}
err = stack.Serialize.Add(&awsRestjson1_serializeOpCreateServiceLevelObjective{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsRestjson1_deserializeOpCreateServiceLevelObjective{}, middleware.After)
if err != nil {
return err
}
if err := addProtocolFinalizerMiddlewares(stack, options, "CreateServiceLevelObjective"); err != nil {
return fmt.Errorf("add protocol finalizers: %v", err)
}
if err = addlegacyEndpointContextSetter(stack, options); err != nil {
return err
}
if err = addSetLoggerMiddleware(stack, options); err != nil {
return err
}
if err = addClientRequestID(stack); err != nil {
return err
}
if err = addComputeContentLength(stack); err != nil {
return err
}
if err = addResolveEndpointMiddleware(stack, options); err != nil {
return err
}
if err = addComputePayloadSHA256(stack); err != nil {
return err
}
if err = addRetry(stack, options); err != nil {
return err
}
if err = addRawResponseToMetadata(stack); err != nil {
return err
}
if err = addRecordResponseTiming(stack); err != nil {
return err
}
if err = addClientUserAgent(stack, options); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil {
return err
}
if err = addTimeOffsetBuild(stack, c); err != nil {
return err
}
if err = addUserAgentRetryMode(stack, options); err != nil {
return err
}
if err = addOpCreateServiceLevelObjectiveValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opCreateServiceLevelObjective(options.Region), middleware.Before); err != nil {
return err
}
if err = addRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}
if err = addResponseErrorMiddleware(stack); err != nil {
return err
}
if err = addRequestResponseLogging(stack, options); err != nil {
return err
}
if err = addDisableHTTPSMiddleware(stack, options); err != nil {
return err
}
return nil
}
func newServiceMetadataMiddleware_opCreateServiceLevelObjective(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
OperationName: "CreateServiceLevelObjective",
}
}
|