1// Code generated by smithy-go-codegen DO NOT EDIT.
2
3package xray
4
5import (
6	"context"
7	awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
8	"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
9	"github.com/aws/aws-sdk-go-v2/service/xray/types"
10	"github.com/aws/smithy-go/middleware"
11	smithyhttp "github.com/aws/smithy-go/transport/http"
12)
13
14// Creates a group resource with a name and a filter expression.
15func (c *Client) CreateGroup(ctx context.Context, params *CreateGroupInput, optFns ...func(*Options)) (*CreateGroupOutput, error) {
16	if params == nil {
17		params = &CreateGroupInput{}
18	}
19
20	result, metadata, err := c.invokeOperation(ctx, "CreateGroup", params, optFns, addOperationCreateGroupMiddlewares)
21	if err != nil {
22		return nil, err
23	}
24
25	out := result.(*CreateGroupOutput)
26	out.ResultMetadata = metadata
27	return out, nil
28}
29
30type CreateGroupInput struct {
31
32	// The case-sensitive name of the new group. Default is a reserved name and names
33	// must be unique.
34	//
35	// This member is required.
36	GroupName *string
37
38	// The filter expression defining criteria by which to group traces.
39	FilterExpression *string
40
41	// The structure containing configurations related to insights.
42	//
43	// * The
44	// InsightsEnabled boolean can be set to true to enable insights for the new group
45	// or false to disable insights for the new group.
46	//
47	// * The NotifcationsEnabled
48	// boolean can be set to true to enable insights notifications for the new group.
49	// Notifications may only be enabled on a group with InsightsEnabled set to true.
50	InsightsConfiguration *types.InsightsConfiguration
51
52	// A map that contains one or more tag keys and tag values to attach to an X-Ray
53	// group. For more information about ways to use tags, see Tagging AWS resources
54	// (https://docs.aws.amazon.com/general/latest/gr/aws_tagging.html) in the AWS
55	// General Reference. The following restrictions apply to tags:
56	//
57	// * Maximum number
58	// of user-applied tags per resource: 50
59	//
60	// * Maximum tag key length: 128 Unicode
61	// characters
62	//
63	// * Maximum tag value length: 256 Unicode characters
64	//
65	// * Valid values
66	// for key and value: a-z, A-Z, 0-9, space, and the following characters: _ . : / =
67	// + - and @
68	//
69	// * Tag keys and values are case sensitive.
70	//
71	// * Don't use aws: as a
72	// prefix for keys; it's reserved for AWS use.
73	Tags []types.Tag
74}
75
76type CreateGroupOutput struct {
77
78	// The group that was created. Contains the name of the group that was created, the
79	// Amazon Resource Name (ARN) of the group that was generated based on the group
80	// name, the filter expression, and the insight configuration that was assigned to
81	// the group.
82	Group *types.Group
83
84	// Metadata pertaining to the operation's result.
85	ResultMetadata middleware.Metadata
86}
87
88func addOperationCreateGroupMiddlewares(stack *middleware.Stack, options Options) (err error) {
89	err = stack.Serialize.Add(&awsRestjson1_serializeOpCreateGroup{}, middleware.After)
90	if err != nil {
91		return err
92	}
93	err = stack.Deserialize.Add(&awsRestjson1_deserializeOpCreateGroup{}, middleware.After)
94	if err != nil {
95		return err
96	}
97	if err = addSetLoggerMiddleware(stack, options); err != nil {
98		return err
99	}
100	if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
101		return err
102	}
103	if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
104		return err
105	}
106	if err = addResolveEndpointMiddleware(stack, options); err != nil {
107		return err
108	}
109	if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
110		return err
111	}
112	if err = addRetryMiddlewares(stack, options); err != nil {
113		return err
114	}
115	if err = addHTTPSignerV4Middleware(stack, options); err != nil {
116		return err
117	}
118	if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
119		return err
120	}
121	if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
122		return err
123	}
124	if err = addClientUserAgent(stack); err != nil {
125		return err
126	}
127	if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
128		return err
129	}
130	if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
131		return err
132	}
133	if err = addOpCreateGroupValidationMiddleware(stack); err != nil {
134		return err
135	}
136	if err = stack.Initialize.Add(newServiceMetadataMiddleware_opCreateGroup(options.Region), middleware.Before); err != nil {
137		return err
138	}
139	if err = addRequestIDRetrieverMiddleware(stack); err != nil {
140		return err
141	}
142	if err = addResponseErrorMiddleware(stack); err != nil {
143		return err
144	}
145	if err = addRequestResponseLogging(stack, options); err != nil {
146		return err
147	}
148	return nil
149}
150
151func newServiceMetadataMiddleware_opCreateGroup(region string) *awsmiddleware.RegisterServiceMetadata {
152	return &awsmiddleware.RegisterServiceMetadata{
153		Region:        region,
154		ServiceID:     ServiceID,
155		SigningName:   "xray",
156		OperationName: "CreateGroup",
157	}
158}
159