diff --git a/.changelog/3e883149d1de4a94af05c0c5c62a5b0c.json b/.changelog/3e883149d1de4a94af05c0c5c62a5b0c.json new file mode 100644 index 00000000000..bbed994bbb4 --- /dev/null +++ b/.changelog/3e883149d1de4a94af05c0c5c62a5b0c.json @@ -0,0 +1,8 @@ +{ + "id": "3e883149-d1de-4a94-af05-c0c5c62a5b0c", + "type": "feature", + "description": "This release adds a new API, GetCurrentUserData, which returns real-time details about users' current activity.", + "modules": [ + "service/connect" + ] +} \ No newline at end of file diff --git a/.changelog/e14a0c14bd304e7b84e4901d0d599183.json b/.changelog/e14a0c14bd304e7b84e4901d0d599183.json new file mode 100644 index 00000000000..098b93da957 --- /dev/null +++ b/.changelog/e14a0c14bd304e7b84e4901d0d599183.json @@ -0,0 +1,8 @@ +{ + "id": "e14a0c14-bd30-4e7b-84e4-901d0d599183", + "type": "feature", + "description": "This release adds support for searching channels by members via the SearchChannels API, removes required restrictions for Name and Mode in UpdateChannel API and enhances CreateChannel API by exposing member and moderator list as well as channel id as optional parameters.", + "modules": [ + "service/chimesdkmessaging" + ] +} \ No newline at end of file diff --git a/service/chimesdkmessaging/api_op_CreateChannel.go b/service/chimesdkmessaging/api_op_CreateChannel.go index 1e50b451a77..cfb6e401dd1 100644 --- a/service/chimesdkmessaging/api_op_CreateChannel.go +++ b/service/chimesdkmessaging/api_op_CreateChannel.go @@ -53,6 +53,12 @@ type CreateChannelInput struct { // This member is required. Name *string + // The ID of the channel in the request. + ChannelId *string + + // The ARNs of the channel members in the request. + MemberArns []string + // The metadata of the creation request. Limited to 1KB and UTF-8. Metadata *string @@ -61,6 +67,9 @@ type CreateChannelInput struct { // Only administrators and moderators can add members to restricted channels. Mode types.ChannelMode + // The ARNs of the channel moderators in the request. + ModeratorArns []string + // The channel's privacy level: PUBLIC or PRIVATE. Private channels aren't // discoverable by users outside the channel. Public channels are discoverable by // anyone in the AppInstance. diff --git a/service/chimesdkmessaging/api_op_ListChannelMembershipsForAppInstanceUser.go b/service/chimesdkmessaging/api_op_ListChannelMembershipsForAppInstanceUser.go index a5182c2ee76..da35163b516 100644 --- a/service/chimesdkmessaging/api_op_ListChannelMembershipsForAppInstanceUser.go +++ b/service/chimesdkmessaging/api_op_ListChannelMembershipsForAppInstanceUser.go @@ -53,7 +53,7 @@ type ListChannelMembershipsForAppInstanceUserInput struct { type ListChannelMembershipsForAppInstanceUserOutput struct { - // The token passed by previous API calls until all requested users are returned. + // The information for the requested channel memberships. ChannelMemberships []types.ChannelMembershipForAppInstanceUserSummary // The token passed by previous API calls until all requested users are returned. diff --git a/service/chimesdkmessaging/api_op_SearchChannels.go b/service/chimesdkmessaging/api_op_SearchChannels.go new file mode 100644 index 00000000000..ff95160d74a --- /dev/null +++ b/service/chimesdkmessaging/api_op_SearchChannels.go @@ -0,0 +1,228 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package chimesdkmessaging + +import ( + "context" + "fmt" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + "github.com/aws/aws-sdk-go-v2/service/chimesdkmessaging/types" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Allows an AppInstanceUser to search the channels that they belong to. The +// AppInstanceUser can search by membership or external ID. An AppInstanceAdmin can +// search across all channels within the AppInstance. +func (c *Client) SearchChannels(ctx context.Context, params *SearchChannelsInput, optFns ...func(*Options)) (*SearchChannelsOutput, error) { + if params == nil { + params = &SearchChannelsInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "SearchChannels", params, optFns, c.addOperationSearchChannelsMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*SearchChannelsOutput) + out.ResultMetadata = metadata + return out, nil +} + +type SearchChannelsInput struct { + + // A list of the Field objects in the channel being searched. + // + // This member is required. + Fields []types.SearchField + + // The AppInstanceUserArn of the user making the API call. + ChimeBearer *string + + // The maximum number of channels that you want returned. + MaxResults *int32 + + // The token returned from previous API requests until the number of channels is + // reached. + NextToken *string + + noSmithyDocumentSerde +} + +type SearchChannelsOutput struct { + + // A list of the channels in the request. + Channels []types.ChannelSummary + + // The token returned from previous API responses until the number of channels is + // reached. + NextToken *string + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationSearchChannelsMiddlewares(stack *middleware.Stack, options Options) (err error) { + err = stack.Serialize.Add(&awsRestjson1_serializeOpSearchChannels{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpSearchChannels{}, middleware.After) + if err != nil { + return err + } + if err = addSetLoggerMiddleware(stack, options); err != nil { + return err + } + if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { + return err + } + if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { + return err + } + if err = addResolveEndpointMiddleware(stack, options); err != nil { + return err + } + if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { + return err + } + if err = addRetryMiddlewares(stack, options); err != nil { + return err + } + if err = addHTTPSignerV4Middleware(stack, options); err != nil { + return err + } + if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { + return err + } + if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { + return err + } + if err = addClientUserAgent(stack); err != nil { + return err + } + if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = addOpSearchChannelsValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opSearchChannels(options.Region), middleware.Before); 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 + } + return nil +} + +// SearchChannelsAPIClient is a client that implements the SearchChannels +// operation. +type SearchChannelsAPIClient interface { + SearchChannels(context.Context, *SearchChannelsInput, ...func(*Options)) (*SearchChannelsOutput, error) +} + +var _ SearchChannelsAPIClient = (*Client)(nil) + +// SearchChannelsPaginatorOptions is the paginator options for SearchChannels +type SearchChannelsPaginatorOptions struct { + // The maximum number of channels that you want returned. + Limit int32 + + // Set to true if pagination should stop if the service returns a pagination token + // that matches the most recent token provided to the service. + StopOnDuplicateToken bool +} + +// SearchChannelsPaginator is a paginator for SearchChannels +type SearchChannelsPaginator struct { + options SearchChannelsPaginatorOptions + client SearchChannelsAPIClient + params *SearchChannelsInput + nextToken *string + firstPage bool +} + +// NewSearchChannelsPaginator returns a new SearchChannelsPaginator +func NewSearchChannelsPaginator(client SearchChannelsAPIClient, params *SearchChannelsInput, optFns ...func(*SearchChannelsPaginatorOptions)) *SearchChannelsPaginator { + if params == nil { + params = &SearchChannelsInput{} + } + + options := SearchChannelsPaginatorOptions{} + if params.MaxResults != nil { + options.Limit = *params.MaxResults + } + + for _, fn := range optFns { + fn(&options) + } + + return &SearchChannelsPaginator{ + options: options, + client: client, + params: params, + firstPage: true, + nextToken: params.NextToken, + } +} + +// HasMorePages returns a boolean indicating whether more pages are available +func (p *SearchChannelsPaginator) HasMorePages() bool { + return p.firstPage || (p.nextToken != nil && len(*p.nextToken) != 0) +} + +// NextPage retrieves the next SearchChannels page. +func (p *SearchChannelsPaginator) NextPage(ctx context.Context, optFns ...func(*Options)) (*SearchChannelsOutput, error) { + if !p.HasMorePages() { + return nil, fmt.Errorf("no more pages available") + } + + params := *p.params + params.NextToken = p.nextToken + + var limit *int32 + if p.options.Limit > 0 { + limit = &p.options.Limit + } + params.MaxResults = limit + + result, err := p.client.SearchChannels(ctx, ¶ms, optFns...) + if err != nil { + return nil, err + } + p.firstPage = false + + prevToken := p.nextToken + p.nextToken = result.NextToken + + if p.options.StopOnDuplicateToken && + prevToken != nil && + p.nextToken != nil && + *prevToken == *p.nextToken { + p.nextToken = nil + } + + return result, nil +} + +func newServiceMetadataMiddleware_opSearchChannels(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + SigningName: "chime", + OperationName: "SearchChannels", + } +} diff --git a/service/chimesdkmessaging/api_op_UpdateChannel.go b/service/chimesdkmessaging/api_op_UpdateChannel.go index e23936a6782..ac938da2096 100644 --- a/service/chimesdkmessaging/api_op_UpdateChannel.go +++ b/service/chimesdkmessaging/api_op_UpdateChannel.go @@ -42,19 +42,15 @@ type UpdateChannelInput struct { // This member is required. ChimeBearer *string + // The metadata for the update request. + Metadata *string + // The mode of the update request. - // - // This member is required. Mode types.ChannelMode // The name of the channel. - // - // This member is required. Name *string - // The metadata for the update request. - Metadata *string - noSmithyDocumentSerde } diff --git a/service/chimesdkmessaging/deserializers.go b/service/chimesdkmessaging/deserializers.go index 73a7560b792..aa082b34941 100644 --- a/service/chimesdkmessaging/deserializers.go +++ b/service/chimesdkmessaging/deserializers.go @@ -5912,6 +5912,9 @@ func awsRestjson1_deserializeOpErrorRedactChannelMessage(response *smithyhttp.Re case strings.EqualFold("BadRequestException", errorCode): return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) + case strings.EqualFold("ConflictException", errorCode): + return awsRestjson1_deserializeErrorConflictException(response, errorBody) + case strings.EqualFold("ForbiddenException", errorCode): return awsRestjson1_deserializeErrorForbiddenException(response, errorBody) @@ -5986,6 +5989,177 @@ func awsRestjson1_deserializeOpDocumentRedactChannelMessageOutput(v **RedactChan return nil } +type awsRestjson1_deserializeOpSearchChannels struct { +} + +func (*awsRestjson1_deserializeOpSearchChannels) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpSearchChannels) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( + out middleware.DeserializeOutput, metadata middleware.Metadata, err error, +) { + out, metadata, err = next.HandleDeserialize(ctx, in) + if err != nil { + return out, metadata, err + } + + response, ok := out.RawResponse.(*smithyhttp.Response) + if !ok { + return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} + } + + if response.StatusCode < 200 || response.StatusCode >= 300 { + return out, metadata, awsRestjson1_deserializeOpErrorSearchChannels(response, &metadata) + } + output := &SearchChannelsOutput{} + out.Result = output + + var buff [1024]byte + ringBuffer := smithyio.NewRingBuffer(buff[:]) + + body := io.TeeReader(response.Body, ringBuffer) + + decoder := json.NewDecoder(body) + decoder.UseNumber() + var shape interface{} + if err := decoder.Decode(&shape); err != nil && err != io.EOF { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return out, metadata, err + } + + err = awsRestjson1_deserializeOpDocumentSearchChannelsOutput(&output, shape) + if err != nil { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + return out, metadata, &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), + Snapshot: snapshot.Bytes(), + } + } + + return out, metadata, err +} + +func awsRestjson1_deserializeOpErrorSearchChannels(response *smithyhttp.Response, metadata *middleware.Metadata) error { + var errorBuffer bytes.Buffer + if _, err := io.Copy(&errorBuffer, response.Body); err != nil { + return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} + } + errorBody := bytes.NewReader(errorBuffer.Bytes()) + + errorCode := "UnknownError" + errorMessage := errorCode + + code := response.Header.Get("X-Amzn-ErrorType") + if len(code) != 0 { + errorCode = restjson.SanitizeErrorCode(code) + } + + var buff [1024]byte + ringBuffer := smithyio.NewRingBuffer(buff[:]) + + body := io.TeeReader(errorBody, ringBuffer) + decoder := json.NewDecoder(body) + decoder.UseNumber() + code, message, err := restjson.GetErrorInfo(decoder) + if err != nil { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + errorBody.Seek(0, io.SeekStart) + if len(code) != 0 { + errorCode = restjson.SanitizeErrorCode(code) + } + if len(message) != 0 { + errorMessage = message + } + + switch { + case strings.EqualFold("BadRequestException", errorCode): + return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) + + case strings.EqualFold("ForbiddenException", errorCode): + return awsRestjson1_deserializeErrorForbiddenException(response, errorBody) + + case strings.EqualFold("ServiceFailureException", errorCode): + return awsRestjson1_deserializeErrorServiceFailureException(response, errorBody) + + case strings.EqualFold("ServiceUnavailableException", errorCode): + return awsRestjson1_deserializeErrorServiceUnavailableException(response, errorBody) + + case strings.EqualFold("ThrottledClientException", errorCode): + return awsRestjson1_deserializeErrorThrottledClientException(response, errorBody) + + case strings.EqualFold("UnauthorizedClientException", errorCode): + return awsRestjson1_deserializeErrorUnauthorizedClientException(response, errorBody) + + default: + genericError := &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, + } + return genericError + + } +} + +func awsRestjson1_deserializeOpDocumentSearchChannelsOutput(v **SearchChannelsOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *SearchChannelsOutput + if *v == nil { + sv = &SearchChannelsOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "Channels": + if err := awsRestjson1_deserializeDocumentChannelSummaryList(&sv.Channels, value); err != nil { + return err + } + + case "NextToken": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected NextToken to be of type string, got %T instead", value) + } + sv.NextToken = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + type awsRestjson1_deserializeOpSendChannelMessage struct { } diff --git a/service/chimesdkmessaging/doc.go b/service/chimesdkmessaging/doc.go index bede864e660..9d44d7bbba9 100644 --- a/service/chimesdkmessaging/doc.go +++ b/service/chimesdkmessaging/doc.go @@ -7,5 +7,5 @@ // send and receive messages in custom messaging applications. These APIs depend on // the frameworks provided by the Amazon Chime SDK Identity APIs. For more // information about the messaging APIs, see Amazon Chime SDK messaging -// (https://docs.aws.amazon.com/chime/latest/APIReference/API_Operations_Amazon_Chime_SDK_Messaging) +// (https://docs.aws.amazon.com/chime/latest/APIReference/API_Operations_Amazon_Chime_SDK_Messaging.html). package chimesdkmessaging diff --git a/service/chimesdkmessaging/generated.json b/service/chimesdkmessaging/generated.json index 143fff847c9..209dee024ac 100644 --- a/service/chimesdkmessaging/generated.json +++ b/service/chimesdkmessaging/generated.json @@ -46,6 +46,7 @@ "api_op_ListTagsForResource.go", "api_op_PutChannelMembershipPreferences.go", "api_op_RedactChannelMessage.go", + "api_op_SearchChannels.go", "api_op_SendChannelMessage.go", "api_op_TagResource.go", "api_op_UntagResource.go", diff --git a/service/chimesdkmessaging/serializers.go b/service/chimesdkmessaging/serializers.go index 9cf94fcd872..8db2649f2de 100644 --- a/service/chimesdkmessaging/serializers.go +++ b/service/chimesdkmessaging/serializers.go @@ -361,11 +361,23 @@ func awsRestjson1_serializeOpDocumentCreateChannelInput(v *CreateChannelInput, v ok.String(*v.AppInstanceArn) } + if v.ChannelId != nil { + ok := object.Key("ChannelId") + ok.String(*v.ChannelId) + } + if v.ClientRequestToken != nil { ok := object.Key("ClientRequestToken") ok.String(*v.ClientRequestToken) } + if v.MemberArns != nil { + ok := object.Key("MemberArns") + if err := awsRestjson1_serializeDocumentChannelMemberArns(v.MemberArns, ok); err != nil { + return err + } + } + if v.Metadata != nil { ok := object.Key("Metadata") ok.String(*v.Metadata) @@ -376,6 +388,13 @@ func awsRestjson1_serializeOpDocumentCreateChannelInput(v *CreateChannelInput, v ok.String(string(v.Mode)) } + if v.ModeratorArns != nil { + ok := object.Key("ModeratorArns") + if err := awsRestjson1_serializeDocumentChannelModeratorArns(v.ModeratorArns, ok); err != nil { + return err + } + } + if v.Name != nil { ok := object.Key("Name") ok.String(*v.Name) @@ -2810,6 +2829,93 @@ func awsRestjson1_serializeOpHttpBindingsRedactChannelMessageInput(v *RedactChan return nil } +type awsRestjson1_serializeOpSearchChannels struct { +} + +func (*awsRestjson1_serializeOpSearchChannels) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpSearchChannels) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( + out middleware.SerializeOutput, metadata middleware.Metadata, err error, +) { + request, ok := in.Request.(*smithyhttp.Request) + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} + } + + input, ok := in.Parameters.(*SearchChannelsInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/channels?operation=search") + request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) + request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) + request.Method = "POST" + restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) + if err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + if err := awsRestjson1_serializeOpHttpBindingsSearchChannelsInput(input, restEncoder); err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + restEncoder.SetHeader("Content-Type").String("application/json") + + jsonEncoder := smithyjson.NewEncoder() + if err := awsRestjson1_serializeOpDocumentSearchChannelsInput(input, jsonEncoder.Value); err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + if request, err = request.SetStream(bytes.NewReader(jsonEncoder.Bytes())); err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + if request.Request, err = restEncoder.Encode(request.Request); err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + in.Request = request + + return next.HandleSerialize(ctx, in) +} +func awsRestjson1_serializeOpHttpBindingsSearchChannelsInput(v *SearchChannelsInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if v.ChimeBearer != nil && len(*v.ChimeBearer) > 0 { + locationName := "X-Amz-Chime-Bearer" + encoder.SetHeader(locationName).String(*v.ChimeBearer) + } + + if v.MaxResults != nil { + encoder.SetQuery("max-results").Integer(*v.MaxResults) + } + + if v.NextToken != nil { + encoder.SetQuery("next-token").String(*v.NextToken) + } + + return nil +} + +func awsRestjson1_serializeOpDocumentSearchChannelsInput(v *SearchChannelsInput, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.Fields != nil { + ok := object.Key("Fields") + if err := awsRestjson1_serializeDocumentSearchFields(v.Fields, ok); err != nil { + return err + } + } + + return nil +} + type awsRestjson1_serializeOpSendChannelMessage struct { } @@ -3427,6 +3533,17 @@ func awsRestjson1_serializeOpHttpBindingsUpdateChannelReadMarkerInput(v *UpdateC return nil } +func awsRestjson1_serializeDocumentChannelMemberArns(v []string, value smithyjson.Value) error { + array := value.Array() + defer array.Close() + + for i := range v { + av := array.Value() + av.String(v[i]) + } + return nil +} + func awsRestjson1_serializeDocumentChannelMembershipPreferences(v *types.ChannelMembershipPreferences, value smithyjson.Value) error { object := value.Object() defer object.Close() @@ -3477,6 +3594,17 @@ func awsRestjson1_serializeDocumentChannelMessageCallback(v *types.ChannelMessag return nil } +func awsRestjson1_serializeDocumentChannelModeratorArns(v []string, value smithyjson.Value) error { + array := value.Array() + defer array.Close() + + for i := range v { + av := array.Value() + av.String(v[i]) + } + return nil +} + func awsRestjson1_serializeDocumentLambdaConfiguration(v *types.LambdaConfiguration, value smithyjson.Value) error { object := value.Object() defer object.Close() @@ -3639,6 +3767,54 @@ func awsRestjson1_serializeDocumentPushNotificationPreferences(v *types.PushNoti return nil } +func awsRestjson1_serializeDocumentSearchField(v *types.SearchField, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if len(v.Key) > 0 { + ok := object.Key("Key") + ok.String(string(v.Key)) + } + + if len(v.Operator) > 0 { + ok := object.Key("Operator") + ok.String(string(v.Operator)) + } + + if v.Values != nil { + ok := object.Key("Values") + if err := awsRestjson1_serializeDocumentSearchFieldValues(v.Values, ok); err != nil { + return err + } + } + + return nil +} + +func awsRestjson1_serializeDocumentSearchFields(v []types.SearchField, value smithyjson.Value) error { + array := value.Array() + defer array.Close() + + for i := range v { + av := array.Value() + if err := awsRestjson1_serializeDocumentSearchField(&v[i], av); err != nil { + return err + } + } + return nil +} + +func awsRestjson1_serializeDocumentSearchFieldValues(v []string, value smithyjson.Value) error { + array := value.Array() + defer array.Close() + + for i := range v { + av := array.Value() + av.String(v[i]) + } + return nil +} + func awsRestjson1_serializeDocumentTag(v *types.Tag, value smithyjson.Value) error { object := value.Object() defer object.Close() diff --git a/service/chimesdkmessaging/types/enums.go b/service/chimesdkmessaging/types/enums.go index eb5907af1ce..c93bd170714 100644 --- a/service/chimesdkmessaging/types/enums.go +++ b/service/chimesdkmessaging/types/enums.go @@ -231,6 +231,40 @@ func (PushNotificationType) Values() []PushNotificationType { } } +type SearchFieldKey string + +// Enum values for SearchFieldKey +const ( + SearchFieldKeyMembers SearchFieldKey = "MEMBERS" +) + +// Values returns all known values for SearchFieldKey. Note that this can be +// expanded in the future, and so it is only as up to date as the client. The +// ordering of this slice is not guaranteed to be stable across updates. +func (SearchFieldKey) Values() []SearchFieldKey { + return []SearchFieldKey{ + "MEMBERS", + } +} + +type SearchFieldOperator string + +// Enum values for SearchFieldOperator +const ( + SearchFieldOperatorEquals SearchFieldOperator = "EQUALS" + SearchFieldOperatorIncludes SearchFieldOperator = "INCLUDES" +) + +// Values returns all known values for SearchFieldOperator. Note that this can be +// expanded in the future, and so it is only as up to date as the client. The +// ordering of this slice is not guaranteed to be stable across updates. +func (SearchFieldOperator) Values() []SearchFieldOperator { + return []SearchFieldOperator{ + "EQUALS", + "INCLUDES", + } +} + type SortOrder string // Enum values for SortOrder diff --git a/service/chimesdkmessaging/types/types.go b/service/chimesdkmessaging/types/types.go index fd3ef4c2894..307cc9f98ef 100644 --- a/service/chimesdkmessaging/types/types.go +++ b/service/chimesdkmessaging/types/types.go @@ -10,7 +10,7 @@ import ( // Summary of the membership details of an AppInstanceUser. type AppInstanceUserMembershipSummary struct { - // The time at which a message was last read. + // The time at which an AppInstanceUser last marked a channel as read. ReadMarkerTimestamp *time.Time // The type of ChannelMembership. @@ -529,12 +529,42 @@ type PushNotificationPreferences struct { AllowNotifications AllowNotifications // The simple JSON object used to send a subset of a push notification to the - // requsted member. + // requested member. FilterRule *string noSmithyDocumentSerde } +// A Field of the channel that you want to search. +type SearchField struct { + + // An enum value that indicates the key to search the channel on. MEMBERS allows + // you to search channels based on memberships. You can use it with the EQUALS + // operator to get channels whose memberships are equal to the specified values, + // and with the INCLUDES operator to get channels whose memberships include the + // specified values. + // + // This member is required. + Key SearchFieldKey + + // The operator used to compare field values, currently EQUALS or INCLUDES. Use the + // EQUALS operator to find channels whose memberships equal the specified values. + // Use the INCLUDES operator to find channels whose memberships include the + // specified values. + // + // This member is required. + Operator SearchFieldOperator + + // The values that you want to search for, a list of strings. The values must be + // AppInstanceUserArns specified as a list of strings. This operation isn't + // supported for AppInstanceUsers with large number of memberships. + // + // This member is required. + Values []string + + noSmithyDocumentSerde +} + // A tag object containing a key-value pair. type Tag struct { diff --git a/service/chimesdkmessaging/validators.go b/service/chimesdkmessaging/validators.go index 9df9f9b3a74..c865510dbdd 100644 --- a/service/chimesdkmessaging/validators.go +++ b/service/chimesdkmessaging/validators.go @@ -750,6 +750,26 @@ func (m *validateOpRedactChannelMessage) HandleInitialize(ctx context.Context, i return next.HandleInitialize(ctx, in) } +type validateOpSearchChannels struct { +} + +func (*validateOpSearchChannels) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpSearchChannels) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*SearchChannelsInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpSearchChannelsInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + type validateOpSendChannelMessage struct { } @@ -1038,6 +1058,10 @@ func addOpRedactChannelMessageValidationMiddleware(stack *middleware.Stack) erro return stack.Initialize.Add(&validateOpRedactChannelMessage{}, middleware.After) } +func addOpSearchChannelsValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpSearchChannels{}, middleware.After) +} + func addOpSendChannelMessageValidationMiddleware(stack *middleware.Stack) error { return stack.Initialize.Add(&validateOpSendChannelMessage{}, middleware.After) } @@ -1195,6 +1219,44 @@ func validatePushNotificationPreferences(v *types.PushNotificationPreferences) e } } +func validateSearchField(v *types.SearchField) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "SearchField"} + if len(v.Key) == 0 { + invalidParams.Add(smithy.NewErrParamRequired("Key")) + } + if v.Values == nil { + invalidParams.Add(smithy.NewErrParamRequired("Values")) + } + if len(v.Operator) == 0 { + invalidParams.Add(smithy.NewErrParamRequired("Operator")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateSearchFields(v []types.SearchField) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "SearchFields"} + for i := range v { + if err := validateSearchField(&v[i]); err != nil { + invalidParams.AddNested(fmt.Sprintf("[%d]", i), err.(smithy.InvalidParamsError)) + } + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + func validateTag(v *types.Tag) error { if v == nil { return nil @@ -1978,6 +2040,25 @@ func validateOpRedactChannelMessageInput(v *RedactChannelMessageInput) error { } } +func validateOpSearchChannelsInput(v *SearchChannelsInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "SearchChannelsInput"} + if v.Fields == nil { + invalidParams.Add(smithy.NewErrParamRequired("Fields")) + } else if v.Fields != nil { + if err := validateSearchFields(v.Fields); err != nil { + invalidParams.AddNested("Fields", err.(smithy.InvalidParamsError)) + } + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + func validateOpSendChannelMessageInput(v *SendChannelMessageInput) error { if v == nil { return nil @@ -2081,12 +2162,6 @@ func validateOpUpdateChannelInput(v *UpdateChannelInput) error { if v.ChannelArn == nil { invalidParams.Add(smithy.NewErrParamRequired("ChannelArn")) } - if v.Name == nil { - invalidParams.Add(smithy.NewErrParamRequired("Name")) - } - if len(v.Mode) == 0 { - invalidParams.Add(smithy.NewErrParamRequired("Mode")) - } if v.ChimeBearer == nil { invalidParams.Add(smithy.NewErrParamRequired("ChimeBearer")) } diff --git a/service/connect/api_op_GetCurrentUserData.go b/service/connect/api_op_GetCurrentUserData.go new file mode 100644 index 00000000000..5df179218b7 --- /dev/null +++ b/service/connect/api_op_GetCurrentUserData.go @@ -0,0 +1,227 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package connect + +import ( + "context" + "fmt" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + "github.com/aws/aws-sdk-go-v2/service/connect/types" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Gets the real-time active user data from the specified Amazon Connect instance. +func (c *Client) GetCurrentUserData(ctx context.Context, params *GetCurrentUserDataInput, optFns ...func(*Options)) (*GetCurrentUserDataOutput, error) { + if params == nil { + params = &GetCurrentUserDataInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "GetCurrentUserData", params, optFns, c.addOperationGetCurrentUserDataMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*GetCurrentUserDataOutput) + out.ResultMetadata = metadata + return out, nil +} + +type GetCurrentUserDataInput struct { + + // Filters up to 100 Queues, or up to 9 ContactStates. The user data is retrieved + // only for those users who are associated with the queues and have contacts that + // are in the specified ContactState. + // + // This member is required. + Filters *types.UserDataFilters + + // The identifier of the Amazon Connect instance. You can find the instanceId in + // the ARN of the instance. + // + // This member is required. + InstanceId *string + + // The maximum number of results to return per page. + MaxResults int32 + + // The token for the next set of results. Use the value returned in the previous + // response in the next request to retrieve the next set of results. + NextToken *string + + noSmithyDocumentSerde +} + +type GetCurrentUserDataOutput struct { + + // If there are additional results, this is the token for the next set of results. + NextToken *string + + // A list of the user data that is returned. + UserDataList []types.UserData + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationGetCurrentUserDataMiddlewares(stack *middleware.Stack, options Options) (err error) { + err = stack.Serialize.Add(&awsRestjson1_serializeOpGetCurrentUserData{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpGetCurrentUserData{}, middleware.After) + if err != nil { + return err + } + if err = addSetLoggerMiddleware(stack, options); err != nil { + return err + } + if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { + return err + } + if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { + return err + } + if err = addResolveEndpointMiddleware(stack, options); err != nil { + return err + } + if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { + return err + } + if err = addRetryMiddlewares(stack, options); err != nil { + return err + } + if err = addHTTPSignerV4Middleware(stack, options); err != nil { + return err + } + if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { + return err + } + if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { + return err + } + if err = addClientUserAgent(stack); err != nil { + return err + } + if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = addOpGetCurrentUserDataValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opGetCurrentUserData(options.Region), middleware.Before); 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 + } + return nil +} + +// GetCurrentUserDataAPIClient is a client that implements the GetCurrentUserData +// operation. +type GetCurrentUserDataAPIClient interface { + GetCurrentUserData(context.Context, *GetCurrentUserDataInput, ...func(*Options)) (*GetCurrentUserDataOutput, error) +} + +var _ GetCurrentUserDataAPIClient = (*Client)(nil) + +// GetCurrentUserDataPaginatorOptions is the paginator options for +// GetCurrentUserData +type GetCurrentUserDataPaginatorOptions struct { + // The maximum number of results to return per page. + Limit int32 + + // Set to true if pagination should stop if the service returns a pagination token + // that matches the most recent token provided to the service. + StopOnDuplicateToken bool +} + +// GetCurrentUserDataPaginator is a paginator for GetCurrentUserData +type GetCurrentUserDataPaginator struct { + options GetCurrentUserDataPaginatorOptions + client GetCurrentUserDataAPIClient + params *GetCurrentUserDataInput + nextToken *string + firstPage bool +} + +// NewGetCurrentUserDataPaginator returns a new GetCurrentUserDataPaginator +func NewGetCurrentUserDataPaginator(client GetCurrentUserDataAPIClient, params *GetCurrentUserDataInput, optFns ...func(*GetCurrentUserDataPaginatorOptions)) *GetCurrentUserDataPaginator { + if params == nil { + params = &GetCurrentUserDataInput{} + } + + options := GetCurrentUserDataPaginatorOptions{} + if params.MaxResults != 0 { + options.Limit = params.MaxResults + } + + for _, fn := range optFns { + fn(&options) + } + + return &GetCurrentUserDataPaginator{ + options: options, + client: client, + params: params, + firstPage: true, + nextToken: params.NextToken, + } +} + +// HasMorePages returns a boolean indicating whether more pages are available +func (p *GetCurrentUserDataPaginator) HasMorePages() bool { + return p.firstPage || (p.nextToken != nil && len(*p.nextToken) != 0) +} + +// NextPage retrieves the next GetCurrentUserData page. +func (p *GetCurrentUserDataPaginator) NextPage(ctx context.Context, optFns ...func(*Options)) (*GetCurrentUserDataOutput, error) { + if !p.HasMorePages() { + return nil, fmt.Errorf("no more pages available") + } + + params := *p.params + params.NextToken = p.nextToken + + params.MaxResults = p.options.Limit + + result, err := p.client.GetCurrentUserData(ctx, ¶ms, optFns...) + if err != nil { + return nil, err + } + p.firstPage = false + + prevToken := p.nextToken + p.nextToken = result.NextToken + + if p.options.StopOnDuplicateToken && + prevToken != nil && + p.nextToken != nil && + *prevToken == *p.nextToken { + p.nextToken = nil + } + + return result, nil +} + +func newServiceMetadataMiddleware_opGetCurrentUserData(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + SigningName: "connect", + OperationName: "GetCurrentUserData", + } +} diff --git a/service/connect/api_op_TransferContact.go b/service/connect/api_op_TransferContact.go index 1dbc1f1676a..e50b0745916 100644 --- a/service/connect/api_op_TransferContact.go +++ b/service/connect/api_op_TransferContact.go @@ -53,7 +53,7 @@ type TransferContactInput struct { // This member is required. ContactFlowId *string - // The identifier of the contact in this instance of Amazon Connect + // The identifier of the contact in this instance of Amazon Connect. // // This member is required. ContactId *string @@ -82,7 +82,7 @@ type TransferContactOutput struct { // The Amazon Resource Name (ARN) of the contact. ContactArn *string - // The identifier of the contact in this instance of Amazon Connect + // The identifier of the contact in this instance of Amazon Connect. ContactId *string // Metadata pertaining to the operation's result. diff --git a/service/connect/deserializers.go b/service/connect/deserializers.go index 0d37977203c..8e793daf28c 100644 --- a/service/connect/deserializers.go +++ b/service/connect/deserializers.go @@ -9262,6 +9262,174 @@ func awsRestjson1_deserializeOpDocumentGetCurrentMetricDataOutput(v **GetCurrent return nil } +type awsRestjson1_deserializeOpGetCurrentUserData struct { +} + +func (*awsRestjson1_deserializeOpGetCurrentUserData) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpGetCurrentUserData) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( + out middleware.DeserializeOutput, metadata middleware.Metadata, err error, +) { + out, metadata, err = next.HandleDeserialize(ctx, in) + if err != nil { + return out, metadata, err + } + + response, ok := out.RawResponse.(*smithyhttp.Response) + if !ok { + return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} + } + + if response.StatusCode < 200 || response.StatusCode >= 300 { + return out, metadata, awsRestjson1_deserializeOpErrorGetCurrentUserData(response, &metadata) + } + output := &GetCurrentUserDataOutput{} + out.Result = output + + var buff [1024]byte + ringBuffer := smithyio.NewRingBuffer(buff[:]) + + body := io.TeeReader(response.Body, ringBuffer) + + decoder := json.NewDecoder(body) + decoder.UseNumber() + var shape interface{} + if err := decoder.Decode(&shape); err != nil && err != io.EOF { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return out, metadata, err + } + + err = awsRestjson1_deserializeOpDocumentGetCurrentUserDataOutput(&output, shape) + if err != nil { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + return out, metadata, &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), + Snapshot: snapshot.Bytes(), + } + } + + return out, metadata, err +} + +func awsRestjson1_deserializeOpErrorGetCurrentUserData(response *smithyhttp.Response, metadata *middleware.Metadata) error { + var errorBuffer bytes.Buffer + if _, err := io.Copy(&errorBuffer, response.Body); err != nil { + return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} + } + errorBody := bytes.NewReader(errorBuffer.Bytes()) + + errorCode := "UnknownError" + errorMessage := errorCode + + code := response.Header.Get("X-Amzn-ErrorType") + if len(code) != 0 { + errorCode = restjson.SanitizeErrorCode(code) + } + + var buff [1024]byte + ringBuffer := smithyio.NewRingBuffer(buff[:]) + + body := io.TeeReader(errorBody, ringBuffer) + decoder := json.NewDecoder(body) + decoder.UseNumber() + code, message, err := restjson.GetErrorInfo(decoder) + if err != nil { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + errorBody.Seek(0, io.SeekStart) + if len(code) != 0 { + errorCode = restjson.SanitizeErrorCode(code) + } + if len(message) != 0 { + errorMessage = message + } + + switch { + case strings.EqualFold("InternalServiceException", errorCode): + return awsRestjson1_deserializeErrorInternalServiceException(response, errorBody) + + case strings.EqualFold("InvalidParameterException", errorCode): + return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) + + case strings.EqualFold("InvalidRequestException", errorCode): + return awsRestjson1_deserializeErrorInvalidRequestException(response, errorBody) + + case strings.EqualFold("ResourceNotFoundException", errorCode): + return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) + + case strings.EqualFold("ThrottlingException", errorCode): + return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) + + default: + genericError := &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, + } + return genericError + + } +} + +func awsRestjson1_deserializeOpDocumentGetCurrentUserDataOutput(v **GetCurrentUserDataOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *GetCurrentUserDataOutput + if *v == nil { + sv = &GetCurrentUserDataOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "NextToken": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected NextToken to be of type string, got %T instead", value) + } + sv.NextToken = ptr.String(jtv) + } + + case "UserDataList": + if err := awsRestjson1_deserializeDocumentUserDataList(&sv.UserDataList, value); err != nil { + return err + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + type awsRestjson1_deserializeOpGetFederationToken struct { } @@ -21540,7 +21708,7 @@ func awsRestjson1_deserializeDocumentAccessDeniedException(v **types.AccessDenie return nil } -func awsRestjson1_deserializeDocumentAgentInfo(v **types.AgentInfo, value interface{}) error { +func awsRestjson1_deserializeDocumentAgentContactReference(v **types.AgentContactReference, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) } @@ -21553,15 +21721,33 @@ func awsRestjson1_deserializeDocumentAgentInfo(v **types.AgentInfo, value interf return fmt.Errorf("unexpected JSON type %v", value) } - var sv *types.AgentInfo + var sv *types.AgentContactReference if *v == nil { - sv = &types.AgentInfo{} + sv = &types.AgentContactReference{} } else { sv = *v } for key, value := range shape { switch key { + case "AgentContactState": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected ContactState to be of type string, got %T instead", value) + } + sv.AgentContactState = types.ContactState(jtv) + } + + case "Channel": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected Channel to be of type string, got %T instead", value) + } + sv.Channel = types.Channel(jtv) + } + case "ConnectedToAgentTimestamp": if value != nil { switch jtv := value.(type) { @@ -21578,13 +21764,43 @@ func awsRestjson1_deserializeDocumentAgentInfo(v **types.AgentInfo, value interf } } - case "Id": + case "ContactId": if value != nil { jtv, ok := value.(string) if !ok { - return fmt.Errorf("expected AgentResourceId to be of type string, got %T instead", value) + return fmt.Errorf("expected ContactId to be of type string, got %T instead", value) + } + sv.ContactId = ptr.String(jtv) + } + + case "InitiationMethod": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected ContactInitiationMethod to be of type string, got %T instead", value) + } + sv.InitiationMethod = types.ContactInitiationMethod(jtv) + } + + case "Queue": + if err := awsRestjson1_deserializeDocumentQueueReference(&sv.Queue, value); err != nil { + return err + } + + case "StateStartTimestamp": + if value != nil { + switch jtv := value.(type) { + case json.Number: + f64, err := jtv.Float64() + if err != nil { + return err + } + sv.StateStartTimestamp = ptr.Time(smithytime.ParseEpochSeconds(f64)) + + default: + return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value) + } - sv.Id = ptr.String(jtv) } default: @@ -21596,7 +21812,41 @@ func awsRestjson1_deserializeDocumentAgentInfo(v **types.AgentInfo, value interf return nil } -func awsRestjson1_deserializeDocumentAgentStatus(v **types.AgentStatus, value interface{}) error { +func awsRestjson1_deserializeDocumentAgentContactReferenceList(v *[]types.AgentContactReference, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.([]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var cv []types.AgentContactReference + if *v == nil { + cv = []types.AgentContactReference{} + } else { + cv = *v + } + + for _, value := range shape { + var col types.AgentContactReference + destAddr := &col + if err := awsRestjson1_deserializeDocumentAgentContactReference(&destAddr, value); err != nil { + return err + } + col = *destAddr + cv = append(cv, col) + + } + *v = cv + return nil +} + +func awsRestjson1_deserializeDocumentAgentInfo(v **types.AgentInfo, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) } @@ -21609,28 +21859,84 @@ func awsRestjson1_deserializeDocumentAgentStatus(v **types.AgentStatus, value in return fmt.Errorf("unexpected JSON type %v", value) } - var sv *types.AgentStatus + var sv *types.AgentInfo if *v == nil { - sv = &types.AgentStatus{} + sv = &types.AgentInfo{} } else { sv = *v } for key, value := range shape { switch key { - case "AgentStatusARN": - if value != nil { - jtv, ok := value.(string) - if !ok { - return fmt.Errorf("expected ARN to be of type string, got %T instead", value) - } - sv.AgentStatusARN = ptr.String(jtv) - } - - case "AgentStatusId": + case "ConnectedToAgentTimestamp": if value != nil { - jtv, ok := value.(string) - if !ok { + switch jtv := value.(type) { + case json.Number: + f64, err := jtv.Float64() + if err != nil { + return err + } + sv.ConnectedToAgentTimestamp = ptr.Time(smithytime.ParseEpochSeconds(f64)) + + default: + return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value) + + } + } + + case "Id": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected AgentResourceId to be of type string, got %T instead", value) + } + sv.Id = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentAgentStatus(v **types.AgentStatus, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *types.AgentStatus + if *v == nil { + sv = &types.AgentStatus{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "AgentStatusARN": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected ARN to be of type string, got %T instead", value) + } + sv.AgentStatusARN = ptr.String(jtv) + } + + case "AgentStatusId": + if value != nil { + jtv, ok := value.(string) + if !ok { return fmt.Errorf("expected AgentStatusId to be of type string, got %T instead", value) } sv.AgentStatusId = ptr.String(jtv) @@ -21699,6 +22005,62 @@ func awsRestjson1_deserializeDocumentAgentStatus(v **types.AgentStatus, value in return nil } +func awsRestjson1_deserializeDocumentAgentStatusReference(v **types.AgentStatusReference, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *types.AgentStatusReference + if *v == nil { + sv = &types.AgentStatusReference{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "StatusArn": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected ARN to be of type string, got %T instead", value) + } + sv.StatusArn = ptr.String(jtv) + } + + case "StatusStartTimestamp": + if value != nil { + switch jtv := value.(type) { + case json.Number: + f64, err := jtv.Float64() + if err != nil { + return err + } + sv.StatusStartTimestamp = ptr.Time(smithytime.ParseEpochSeconds(f64)) + + default: + return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value) + + } + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + func awsRestjson1_deserializeDocumentAgentStatusSummary(v **types.AgentStatusSummary, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) @@ -22069,6 +22431,46 @@ func awsRestjson1_deserializeDocumentAvailableNumberSummary(v **types.AvailableN return nil } +func awsRestjson1_deserializeDocumentChannelToCountMap(v *map[string]int32, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var mv map[string]int32 + if *v == nil { + mv = map[string]int32{} + } else { + mv = *v + } + + for key, value := range shape { + var parsedVal int32 + if value != nil { + jtv, ok := value.(json.Number) + if !ok { + return fmt.Errorf("expected IntegerCount to be json.Number, got %T instead", value) + } + i64, err := jtv.Int64() + if err != nil { + return err + } + parsedVal = int32(i64) + } + mv[key] = parsedVal + + } + *v = mv + return nil +} + func awsRestjson1_deserializeDocumentClaimedPhoneNumberSummary(v **types.ClaimedPhoneNumberSummary, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) @@ -23726,6 +24128,55 @@ func awsRestjson1_deserializeDocumentHierarchyGroupSummaryList(v *[]types.Hierar return nil } +func awsRestjson1_deserializeDocumentHierarchyGroupSummaryReference(v **types.HierarchyGroupSummaryReference, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *types.HierarchyGroupSummaryReference + if *v == nil { + sv = &types.HierarchyGroupSummaryReference{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "Arn": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected ARN to be of type string, got %T instead", value) + } + sv.Arn = ptr.String(jtv) + } + + case "Id": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected HierarchyGroupId to be of type string, got %T instead", value) + } + sv.Id = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + func awsRestjson1_deserializeDocumentHierarchyLevel(v **types.HierarchyLevel, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) @@ -23840,6 +24291,62 @@ func awsRestjson1_deserializeDocumentHierarchyPath(v **types.HierarchyPath, valu return nil } +func awsRestjson1_deserializeDocumentHierarchyPathReference(v **types.HierarchyPathReference, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *types.HierarchyPathReference + if *v == nil { + sv = &types.HierarchyPathReference{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "LevelFive": + if err := awsRestjson1_deserializeDocumentHierarchyGroupSummaryReference(&sv.LevelFive, value); err != nil { + return err + } + + case "LevelFour": + if err := awsRestjson1_deserializeDocumentHierarchyGroupSummaryReference(&sv.LevelFour, value); err != nil { + return err + } + + case "LevelOne": + if err := awsRestjson1_deserializeDocumentHierarchyGroupSummaryReference(&sv.LevelOne, value); err != nil { + return err + } + + case "LevelThree": + if err := awsRestjson1_deserializeDocumentHierarchyGroupSummaryReference(&sv.LevelThree, value); err != nil { + return err + } + + case "LevelTwo": + if err := awsRestjson1_deserializeDocumentHierarchyGroupSummaryReference(&sv.LevelTwo, value); err != nil { + return err + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + func awsRestjson1_deserializeDocumentHierarchyStructure(v **types.HierarchyStructure, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) @@ -27837,6 +28344,55 @@ func awsRestjson1_deserializeDocumentRoutingProfileQueueConfigSummaryList(v *[]t return nil } +func awsRestjson1_deserializeDocumentRoutingProfileReference(v **types.RoutingProfileReference, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *types.RoutingProfileReference + if *v == nil { + sv = &types.RoutingProfileReference{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "Arn": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected ARN to be of type string, got %T instead", value) + } + sv.Arn = ptr.String(jtv) + } + + case "Id": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected RoutingProfileId to be of type string, got %T instead", value) + } + sv.Id = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + func awsRestjson1_deserializeDocumentRoutingProfileSummary(v **types.RoutingProfileSummary, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) @@ -29248,6 +29804,111 @@ func awsRestjson1_deserializeDocumentUser(v **types.User, value interface{}) err return nil } +func awsRestjson1_deserializeDocumentUserData(v **types.UserData, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *types.UserData + if *v == nil { + sv = &types.UserData{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "ActiveSlotsByChannel": + if err := awsRestjson1_deserializeDocumentChannelToCountMap(&sv.ActiveSlotsByChannel, value); err != nil { + return err + } + + case "AvailableSlotsByChannel": + if err := awsRestjson1_deserializeDocumentChannelToCountMap(&sv.AvailableSlotsByChannel, value); err != nil { + return err + } + + case "Contacts": + if err := awsRestjson1_deserializeDocumentAgentContactReferenceList(&sv.Contacts, value); err != nil { + return err + } + + case "HierarchyPath": + if err := awsRestjson1_deserializeDocumentHierarchyPathReference(&sv.HierarchyPath, value); err != nil { + return err + } + + case "MaxSlotsByChannel": + if err := awsRestjson1_deserializeDocumentChannelToCountMap(&sv.MaxSlotsByChannel, value); err != nil { + return err + } + + case "RoutingProfile": + if err := awsRestjson1_deserializeDocumentRoutingProfileReference(&sv.RoutingProfile, value); err != nil { + return err + } + + case "Status": + if err := awsRestjson1_deserializeDocumentAgentStatusReference(&sv.Status, value); err != nil { + return err + } + + case "User": + if err := awsRestjson1_deserializeDocumentUserReference(&sv.User, value); err != nil { + return err + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentUserDataList(v *[]types.UserData, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.([]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var cv []types.UserData + if *v == nil { + cv = []types.UserData{} + } else { + cv = *v + } + + for _, value := range shape { + var col types.UserData + destAddr := &col + if err := awsRestjson1_deserializeDocumentUserData(&destAddr, value); err != nil { + return err + } + col = *destAddr + cv = append(cv, col) + + } + *v = cv + return nil +} + func awsRestjson1_deserializeDocumentUserIdentityInfo(v **types.UserIdentityInfo, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) @@ -29515,6 +30176,55 @@ func awsRestjson1_deserializeDocumentUserQuickConnectConfig(v **types.UserQuickC return nil } +func awsRestjson1_deserializeDocumentUserReference(v **types.UserReference, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *types.UserReference + if *v == nil { + sv = &types.UserReference{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "Arn": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected ARN to be of type string, got %T instead", value) + } + sv.Arn = ptr.String(jtv) + } + + case "Id": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected UserId to be of type string, got %T instead", value) + } + sv.Id = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + func awsRestjson1_deserializeDocumentUserSearchSummary(v **types.UserSearchSummary, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) diff --git a/service/connect/generated.json b/service/connect/generated.json index 9fcb1a04bb5..553a0c0545b 100644 --- a/service/connect/generated.json +++ b/service/connect/generated.json @@ -74,6 +74,7 @@ "api_op_DisassociateSecurityKey.go", "api_op_GetContactAttributes.go", "api_op_GetCurrentMetricData.go", + "api_op_GetCurrentUserData.go", "api_op_GetFederationToken.go", "api_op_GetMetricData.go", "api_op_GetTaskTemplate.go", diff --git a/service/connect/serializers.go b/service/connect/serializers.go index c9b83f8c007..2debb7a0dce 100644 --- a/service/connect/serializers.go +++ b/service/connect/serializers.go @@ -5316,6 +5316,99 @@ func awsRestjson1_serializeOpDocumentGetCurrentMetricDataInput(v *GetCurrentMetr return nil } +type awsRestjson1_serializeOpGetCurrentUserData struct { +} + +func (*awsRestjson1_serializeOpGetCurrentUserData) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpGetCurrentUserData) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( + out middleware.SerializeOutput, metadata middleware.Metadata, err error, +) { + request, ok := in.Request.(*smithyhttp.Request) + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} + } + + input, ok := in.Parameters.(*GetCurrentUserDataInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/metrics/userdata/{InstanceId}") + request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) + request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) + request.Method = "POST" + restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) + if err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + if err := awsRestjson1_serializeOpHttpBindingsGetCurrentUserDataInput(input, restEncoder); err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + restEncoder.SetHeader("Content-Type").String("application/json") + + jsonEncoder := smithyjson.NewEncoder() + if err := awsRestjson1_serializeOpDocumentGetCurrentUserDataInput(input, jsonEncoder.Value); err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + if request, err = request.SetStream(bytes.NewReader(jsonEncoder.Bytes())); err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + if request.Request, err = restEncoder.Encode(request.Request); err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + in.Request = request + + return next.HandleSerialize(ctx, in) +} +func awsRestjson1_serializeOpHttpBindingsGetCurrentUserDataInput(v *GetCurrentUserDataInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if v.InstanceId == nil || len(*v.InstanceId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member InstanceId must not be empty")} + } + if v.InstanceId != nil { + if err := encoder.SetURI("InstanceId").String(*v.InstanceId); err != nil { + return err + } + } + + return nil +} + +func awsRestjson1_serializeOpDocumentGetCurrentUserDataInput(v *GetCurrentUserDataInput, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.Filters != nil { + ok := object.Key("Filters") + if err := awsRestjson1_serializeDocumentUserDataFilters(v.Filters, ok); err != nil { + return err + } + } + + if v.MaxResults != 0 { + ok := object.Key("MaxResults") + ok.Integer(v.MaxResults) + } + + if v.NextToken != nil { + ok := object.Key("NextToken") + ok.String(*v.NextToken) + } + + return nil +} + type awsRestjson1_serializeOpGetFederationToken struct { } @@ -12428,6 +12521,20 @@ func awsRestjson1_serializeDocumentChatStreamingConfiguration(v *types.ChatStrea return nil } +func awsRestjson1_serializeDocumentContactFilter(v *types.ContactFilter, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.ContactStates != nil { + ok := object.Key("ContactStates") + if err := awsRestjson1_serializeDocumentContactStates(v.ContactStates, ok); err != nil { + return err + } + } + + return nil +} + func awsRestjson1_serializeDocumentContactReferences(v map[string]types.Reference, value smithyjson.Value) error { object := value.Object() defer object.Close() @@ -12442,6 +12549,17 @@ func awsRestjson1_serializeDocumentContactReferences(v map[string]types.Referenc return nil } +func awsRestjson1_serializeDocumentContactStates(v []types.ContactState, value smithyjson.Value) error { + array := value.Array() + defer array.Close() + + for i := range v { + av := array.Value() + av.String(string(v[i])) + } + return nil +} + func awsRestjson1_serializeDocumentControlPlaneTagFilter(v *types.ControlPlaneTagFilter, value smithyjson.Value) error { object := value.Object() defer object.Close() @@ -13482,6 +13600,27 @@ func awsRestjson1_serializeDocumentThreshold(v *types.Threshold, value smithyjso return nil } +func awsRestjson1_serializeDocumentUserDataFilters(v *types.UserDataFilters, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.ContactFilter != nil { + ok := object.Key("ContactFilter") + if err := awsRestjson1_serializeDocumentContactFilter(v.ContactFilter, ok); err != nil { + return err + } + } + + if v.Queues != nil { + ok := object.Key("Queues") + if err := awsRestjson1_serializeDocumentQueues(v.Queues, ok); err != nil { + return err + } + } + + return nil +} + func awsRestjson1_serializeDocumentUserIdentityInfo(v *types.UserIdentityInfo, value smithyjson.Value) error { object := value.Object() defer object.Close() diff --git a/service/connect/types/enums.go b/service/connect/types/enums.go index ac9cb1a0a04..4246f09e1b6 100644 --- a/service/connect/types/enums.go +++ b/service/connect/types/enums.go @@ -188,6 +188,38 @@ func (ContactInitiationMethod) Values() []ContactInitiationMethod { } } +type ContactState string + +// Enum values for ContactState +const ( + ContactStateIncoming ContactState = "INCOMING" + ContactStatePending ContactState = "PENDING" + ContactStateConnecting ContactState = "CONNECTING" + ContactStateConnected ContactState = "CONNECTED" + ContactStateConnectedOnhold ContactState = "CONNECTED_ONHOLD" + ContactStateMissed ContactState = "MISSED" + ContactStateError ContactState = "ERROR" + ContactStateEnded ContactState = "ENDED" + ContactStateRejected ContactState = "REJECTED" +) + +// Values returns all known values for ContactState. Note that this can be expanded +// in the future, and so it is only as up to date as the client. The ordering of +// this slice is not guaranteed to be stable across updates. +func (ContactState) Values() []ContactState { + return []ContactState{ + "INCOMING", + "PENDING", + "CONNECTING", + "CONNECTED", + "CONNECTED_ONHOLD", + "MISSED", + "ERROR", + "ENDED", + "REJECTED", + } +} + type CurrentMetricName string // Enum values for CurrentMetricName diff --git a/service/connect/types/types.go b/service/connect/types/types.go index f750f0e542e..de9a76cb9de 100644 --- a/service/connect/types/types.go +++ b/service/connect/types/types.go @@ -7,6 +7,36 @@ import ( "time" ) +// Information about the contact +// (https://docs.aws.amazon.com/connect/latest/APIReference/API_Contact.html) +// associated to the user. +type AgentContactReference struct { + + // The state of the contact + // (https://docs.aws.amazon.com/connect/latest/adminguide/about-contact-states.html). + AgentContactState ContactState + + // The channel of the contact. + Channel Channel + + // The time at which the contact was connected to an agent. + ConnectedToAgentTimestamp *time.Time + + // The identifier of the contact in this instance of Amazon Connect. + ContactId *string + + // How the contact was initiated. + InitiationMethod ContactInitiationMethod + + // Contains information about a queue resource for which metrics are returned. + Queue *QueueReference + + // The epoch timestamp when the contact state started. + StateStartTimestamp *time.Time + + noSmithyDocumentSerde +} + // Information about the agent who accepted the contact. type AgentInfo struct { @@ -49,6 +79,18 @@ type AgentStatus struct { noSmithyDocumentSerde } +// Information about the agent's status. +type AgentStatusReference struct { + + // The Amazon Resource Name (ARN) of the agent's status. + StatusArn *string + + // The start timestamp of the agent's status. + StatusStartTimestamp *time.Time + + noSmithyDocumentSerde +} + // Summary information for an agent status. type AgentStatusSummary struct { @@ -244,6 +286,18 @@ type Contact struct { noSmithyDocumentSerde } +// Filters user data based on the contact information that is associated to the +// users. It contains a list of contact states +// (https://docs.aws.amazon.com/connect/latest/adminguide/about-contact-states.html). +type ContactFilter struct { + + // A list of up to 9 contact states + // (https://docs.aws.amazon.com/connect/latest/adminguide/about-contact-states.html). + ContactStates []ContactState + + noSmithyDocumentSerde +} + // Contains information about a contact flow. type ContactFlow struct { @@ -575,6 +629,18 @@ type HierarchyGroupSummary struct { noSmithyDocumentSerde } +// Information about the hierarchy group. +type HierarchyGroupSummaryReference struct { + + // The Amazon Resource Name (ARN) for the hierarchy group. + Arn *string + + // The unique identifier for the hierarchy group. + Id *string + + noSmithyDocumentSerde +} + // Contains information about a hierarchy level. type HierarchyLevel struct { @@ -622,6 +688,27 @@ type HierarchyPath struct { noSmithyDocumentSerde } +// Information about the levels in the hierarchy group. +type HierarchyPathReference struct { + + // Information about level five. + LevelFive *HierarchyGroupSummaryReference + + // Information about level four. + LevelFour *HierarchyGroupSummaryReference + + // Information about level one. + LevelOne *HierarchyGroupSummaryReference + + // Information about level three. + LevelThree *HierarchyGroupSummaryReference + + // Information about level two. + LevelTwo *HierarchyGroupSummaryReference + + noSmithyDocumentSerde +} + // Contains information about a hierarchy structure. type HierarchyStructure struct { @@ -1569,6 +1656,18 @@ type RoutingProfileQueueReference struct { noSmithyDocumentSerde } +// Information about the routing profile assigned to the user. +type RoutingProfileReference struct { + + // The Amazon Resource Name (ARN) of the routing profile. + Arn *string + + // The identifier of the routing profile. + Id *string + + noSmithyDocumentSerde +} + // Contains summary information about a routing profile. type RoutingProfileSummary struct { @@ -1870,6 +1969,56 @@ type User struct { noSmithyDocumentSerde } +// Data for a user. +type UserData struct { + + // A map of active slots by channel. The key is a channel name. The value is an + // integer: the number of active slots. + ActiveSlotsByChannel map[string]int32 + + // A map of available slots by channel. The key is a channel name. The value is an + // integer: the available number of slots. + AvailableSlotsByChannel map[string]int32 + + // A list of contact reference information. + Contacts []AgentContactReference + + // Contains information about the levels of a hierarchy group assigned to a user. + HierarchyPath *HierarchyPathReference + + // A map of maximum slots by channel. The key is a channel name. The value is an + // integer: the maximum number of slots. This is calculated from MediaConcurrency + // (https://docs.aws.amazon.com/connect/latest/APIReference/API_MediaConcurrency.html) + // of the RoutingProfile assigned to the agent. + MaxSlotsByChannel map[string]int32 + + // Information about the routing profile that is assigned to the user. + RoutingProfile *RoutingProfileReference + + // The status of the agent that they manually set in their Contact Control Panel + // (CCP), or that the supervisor manually changes in the real-time metrics report. + Status *AgentStatusReference + + // Information about the user for the data that is returned. It contains resourceId + // and ARN of the user. + User *UserReference + + noSmithyDocumentSerde +} + +// A filter for the user data. +type UserDataFilters struct { + + // A filter for the user data based on the contact information that is associated + // to the user. It contains a list of contact states. + ContactFilter *ContactFilter + + // Contains information about a queue resource for which metrics are returned. + Queues []string + + noSmithyDocumentSerde +} + // Contains information about the identity of a user. type UserIdentityInfo struct { @@ -1937,6 +2086,18 @@ type UserQuickConnectConfig struct { noSmithyDocumentSerde } +// Information about the user. +type UserReference struct { + + // The Amazon Resource Name (ARN) for the user. + Arn *string + + // The unique identifier for the user. + Id *string + + noSmithyDocumentSerde +} + // The search criteria to be used to return users. type UserSearchCriteria struct { diff --git a/service/connect/validators.go b/service/connect/validators.go index d63f0f79b5e..2d7963d3a3d 100644 --- a/service/connect/validators.go +++ b/service/connect/validators.go @@ -1330,6 +1330,26 @@ func (m *validateOpGetCurrentMetricData) HandleInitialize(ctx context.Context, i return next.HandleInitialize(ctx, in) } +type validateOpGetCurrentUserData struct { +} + +func (*validateOpGetCurrentUserData) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpGetCurrentUserData) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*GetCurrentUserDataInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpGetCurrentUserDataInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + type validateOpGetFederationToken struct { } @@ -3214,6 +3234,10 @@ func addOpGetCurrentMetricDataValidationMiddleware(stack *middleware.Stack) erro return stack.Initialize.Add(&validateOpGetCurrentMetricData{}, middleware.After) } +func addOpGetCurrentUserDataValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpGetCurrentUserData{}, middleware.After) +} + func addOpGetFederationTokenValidationMiddleware(stack *middleware.Stack) error { return stack.Initialize.Add(&validateOpGetFederationToken{}, middleware.After) } @@ -5391,6 +5415,24 @@ func validateOpGetCurrentMetricDataInput(v *GetCurrentMetricDataInput) error { } } +func validateOpGetCurrentUserDataInput(v *GetCurrentUserDataInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "GetCurrentUserDataInput"} + if v.InstanceId == nil { + invalidParams.Add(smithy.NewErrParamRequired("InstanceId")) + } + if v.Filters == nil { + invalidParams.Add(smithy.NewErrParamRequired("Filters")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + func validateOpGetFederationTokenInput(v *GetFederationTokenInput) error { if v == nil { return nil diff --git a/service/iotevents/internal/endpoints/endpoints.go b/service/iotevents/internal/endpoints/endpoints.go index 0d32b8a06a0..9855adfe4de 100644 --- a/service/iotevents/internal/endpoints/endpoints.go +++ b/service/iotevents/internal/endpoints/endpoints.go @@ -150,6 +150,9 @@ var defaultPartitions = endpoints.Partitions{ endpoints.EndpointKey{ Region: "ap-southeast-2", }: endpoints.Endpoint{}, + endpoints.EndpointKey{ + Region: "ca-central-1", + }: endpoints.Endpoint{}, endpoints.EndpointKey{ Region: "eu-central-1", }: endpoints.Endpoint{}, diff --git a/service/iotsitewise/internal/endpoints/endpoints.go b/service/iotsitewise/internal/endpoints/endpoints.go index c0cd77ea820..939ed707dbf 100644 --- a/service/iotsitewise/internal/endpoints/endpoints.go +++ b/service/iotsitewise/internal/endpoints/endpoints.go @@ -150,12 +150,30 @@ var defaultPartitions = endpoints.Partitions{ endpoints.EndpointKey{ Region: "ap-southeast-2", }: endpoints.Endpoint{}, + endpoints.EndpointKey{ + Region: "ca-central-1", + }: endpoints.Endpoint{}, + endpoints.EndpointKey{ + Region: "ca-central-1", + Variant: endpoints.FIPSVariant, + }: { + Hostname: "iotsitewise-fips.ca-central-1.amazonaws.com", + }, endpoints.EndpointKey{ Region: "eu-central-1", }: endpoints.Endpoint{}, endpoints.EndpointKey{ Region: "eu-west-1", }: endpoints.Endpoint{}, + endpoints.EndpointKey{ + Region: "fips-ca-central-1", + }: endpoints.Endpoint{ + Hostname: "iotsitewise-fips.ca-central-1.amazonaws.com", + CredentialScope: endpoints.CredentialScope{ + Region: "ca-central-1", + }, + Deprecated: aws.TrueTernary, + }, endpoints.EndpointKey{ Region: "fips-us-east-1", }: endpoints.Endpoint{ @@ -165,6 +183,15 @@ var defaultPartitions = endpoints.Partitions{ }, Deprecated: aws.TrueTernary, }, + endpoints.EndpointKey{ + Region: "fips-us-east-2", + }: endpoints.Endpoint{ + Hostname: "iotsitewise-fips.us-east-2.amazonaws.com", + CredentialScope: endpoints.CredentialScope{ + Region: "us-east-2", + }, + Deprecated: aws.TrueTernary, + }, endpoints.EndpointKey{ Region: "fips-us-west-2", }: endpoints.Endpoint{ @@ -183,6 +210,15 @@ var defaultPartitions = endpoints.Partitions{ }: { Hostname: "iotsitewise-fips.us-east-1.amazonaws.com", }, + endpoints.EndpointKey{ + Region: "us-east-2", + }: endpoints.Endpoint{}, + endpoints.EndpointKey{ + Region: "us-east-2", + Variant: endpoints.FIPSVariant, + }: { + Hostname: "iotsitewise-fips.us-east-2.amazonaws.com", + }, endpoints.EndpointKey{ Region: "us-west-2", }: endpoints.Endpoint{}, diff --git a/service/memorydb/internal/endpoints/endpoints.go b/service/memorydb/internal/endpoints/endpoints.go index 171196ae0e6..382e3c513ce 100644 --- a/service/memorydb/internal/endpoints/endpoints.go +++ b/service/memorydb/internal/endpoints/endpoints.go @@ -134,6 +134,64 @@ var defaultPartitions = endpoints.Partitions{ }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, + Endpoints: endpoints.Endpoints{ + endpoints.EndpointKey{ + Region: "ap-east-1", + }: endpoints.Endpoint{}, + endpoints.EndpointKey{ + Region: "ap-northeast-1", + }: endpoints.Endpoint{}, + endpoints.EndpointKey{ + Region: "ap-northeast-2", + }: endpoints.Endpoint{}, + endpoints.EndpointKey{ + Region: "ap-south-1", + }: endpoints.Endpoint{}, + endpoints.EndpointKey{ + Region: "ap-southeast-1", + }: endpoints.Endpoint{}, + endpoints.EndpointKey{ + Region: "ap-southeast-2", + }: endpoints.Endpoint{}, + endpoints.EndpointKey{ + Region: "ca-central-1", + }: endpoints.Endpoint{}, + endpoints.EndpointKey{ + Region: "eu-central-1", + }: endpoints.Endpoint{}, + endpoints.EndpointKey{ + Region: "eu-north-1", + }: endpoints.Endpoint{}, + endpoints.EndpointKey{ + Region: "eu-west-1", + }: endpoints.Endpoint{}, + endpoints.EndpointKey{ + Region: "eu-west-2", + }: endpoints.Endpoint{}, + endpoints.EndpointKey{ + Region: "fips", + }: endpoints.Endpoint{ + Hostname: "memory-db-fips.us-west-1.amazonaws.com", + CredentialScope: endpoints.CredentialScope{ + Region: "us-west-1", + }, + }, + endpoints.EndpointKey{ + Region: "sa-east-1", + }: endpoints.Endpoint{}, + endpoints.EndpointKey{ + Region: "us-east-1", + }: endpoints.Endpoint{}, + endpoints.EndpointKey{ + Region: "us-east-2", + }: endpoints.Endpoint{}, + endpoints.EndpointKey{ + Region: "us-west-1", + }: endpoints.Endpoint{}, + endpoints.EndpointKey{ + Region: "us-west-2", + }: endpoints.Endpoint{}, + }, }, { ID: "aws-cn", @@ -169,6 +227,14 @@ var defaultPartitions = endpoints.Partitions{ }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, + Endpoints: endpoints.Endpoints{ + endpoints.EndpointKey{ + Region: "cn-north-1", + }: endpoints.Endpoint{}, + endpoints.EndpointKey{ + Region: "cn-northwest-1", + }: endpoints.Endpoint{}, + }, }, { ID: "aws-iso", diff --git a/service/servicecatalogappregistry/internal/endpoints/endpoints.go b/service/servicecatalogappregistry/internal/endpoints/endpoints.go index 3c521548a23..6eac0e86752 100644 --- a/service/servicecatalogappregistry/internal/endpoints/endpoints.go +++ b/service/servicecatalogappregistry/internal/endpoints/endpoints.go @@ -390,42 +390,12 @@ var defaultPartitions = endpoints.Partitions{ RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ - endpoints.EndpointKey{ - Region: "fips-us-gov-east-1", - }: endpoints.Endpoint{ - Hostname: "servicecatalog-appregistry.us-gov-east-1.amazonaws.com", - CredentialScope: endpoints.CredentialScope{ - Region: "us-gov-east-1", - }, - Deprecated: aws.TrueTernary, - }, - endpoints.EndpointKey{ - Region: "fips-us-gov-west-1", - }: endpoints.Endpoint{ - Hostname: "servicecatalog-appregistry.us-gov-west-1.amazonaws.com", - CredentialScope: endpoints.CredentialScope{ - Region: "us-gov-west-1", - }, - Deprecated: aws.TrueTernary, - }, endpoints.EndpointKey{ Region: "us-gov-east-1", }: endpoints.Endpoint{}, - endpoints.EndpointKey{ - Region: "us-gov-east-1", - Variant: endpoints.FIPSVariant, - }: { - Hostname: "servicecatalog-appregistry.us-gov-east-1.amazonaws.com", - }, endpoints.EndpointKey{ Region: "us-gov-west-1", }: endpoints.Endpoint{}, - endpoints.EndpointKey{ - Region: "us-gov-west-1", - Variant: endpoints.FIPSVariant, - }: { - Hostname: "servicecatalog-appregistry.us-gov-west-1.amazonaws.com", - }, }, }, }