1// Code generated by smithy-go-codegen DO NOT EDIT.
2
3package iot
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/smithy-go/middleware"
10	smithyhttp "github.com/aws/smithy-go/transport/http"
11)
12
13// Gets information about the specified thing.
14func (c *Client) DescribeThing(ctx context.Context, params *DescribeThingInput, optFns ...func(*Options)) (*DescribeThingOutput, error) {
15	if params == nil {
16		params = &DescribeThingInput{}
17	}
18
19	result, metadata, err := c.invokeOperation(ctx, "DescribeThing", params, optFns, addOperationDescribeThingMiddlewares)
20	if err != nil {
21		return nil, err
22	}
23
24	out := result.(*DescribeThingOutput)
25	out.ResultMetadata = metadata
26	return out, nil
27}
28
29// The input for the DescribeThing operation.
30type DescribeThingInput struct {
31
32	// The name of the thing.
33	//
34	// This member is required.
35	ThingName *string
36}
37
38// The output from the DescribeThing operation.
39type DescribeThingOutput struct {
40
41	// The thing attributes.
42	Attributes map[string]string
43
44	// The name of the billing group the thing belongs to.
45	BillingGroupName *string
46
47	// The default MQTT client ID. For a typical device, the thing name is also used as
48	// the default MQTT client ID. Although we don’t require a mapping between a
49	// thing's registry name and its use of MQTT client IDs, certificates, or shadow
50	// state, we recommend that you choose a thing name and use it as the MQTT client
51	// ID for the registry and the Device Shadow service. This lets you better organize
52	// your AWS IoT fleet without removing the flexibility of the underlying device
53	// certificate model or shadows.
54	DefaultClientId *string
55
56	// The ARN of the thing to describe.
57	ThingArn *string
58
59	// The ID of the thing to describe.
60	ThingId *string
61
62	// The name of the thing.
63	ThingName *string
64
65	// The thing type name.
66	ThingTypeName *string
67
68	// The current version of the thing record in the registry. To avoid unintentional
69	// changes to the information in the registry, you can pass the version information
70	// in the expectedVersion parameter of the UpdateThing and DeleteThing calls.
71	Version int64
72
73	// Metadata pertaining to the operation's result.
74	ResultMetadata middleware.Metadata
75}
76
77func addOperationDescribeThingMiddlewares(stack *middleware.Stack, options Options) (err error) {
78	err = stack.Serialize.Add(&awsRestjson1_serializeOpDescribeThing{}, middleware.After)
79	if err != nil {
80		return err
81	}
82	err = stack.Deserialize.Add(&awsRestjson1_deserializeOpDescribeThing{}, middleware.After)
83	if err != nil {
84		return err
85	}
86	if err = addSetLoggerMiddleware(stack, options); err != nil {
87		return err
88	}
89	if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
90		return err
91	}
92	if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
93		return err
94	}
95	if err = addResolveEndpointMiddleware(stack, options); err != nil {
96		return err
97	}
98	if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
99		return err
100	}
101	if err = addRetryMiddlewares(stack, options); err != nil {
102		return err
103	}
104	if err = addHTTPSignerV4Middleware(stack, options); err != nil {
105		return err
106	}
107	if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
108		return err
109	}
110	if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
111		return err
112	}
113	if err = addClientUserAgent(stack); err != nil {
114		return err
115	}
116	if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
117		return err
118	}
119	if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
120		return err
121	}
122	if err = addOpDescribeThingValidationMiddleware(stack); err != nil {
123		return err
124	}
125	if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDescribeThing(options.Region), middleware.Before); err != nil {
126		return err
127	}
128	if err = addRequestIDRetrieverMiddleware(stack); err != nil {
129		return err
130	}
131	if err = addResponseErrorMiddleware(stack); err != nil {
132		return err
133	}
134	if err = addRequestResponseLogging(stack, options); err != nil {
135		return err
136	}
137	return nil
138}
139
140func newServiceMetadataMiddleware_opDescribeThing(region string) *awsmiddleware.RegisterServiceMetadata {
141	return &awsmiddleware.RegisterServiceMetadata{
142		Region:        region,
143		ServiceID:     ServiceID,
144		SigningName:   "execute-api",
145		OperationName: "DescribeThing",
146	}
147}
148