1// Code generated by smithy-go-codegen DO NOT EDIT.
2
3package devicefarm
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/devicefarm/types"
10	"github.com/aws/smithy-go/middleware"
11	smithyhttp "github.com/aws/smithy-go/transport/http"
12)
13
14// Modifies the name, description, and rules in a device pool given the attributes
15// and the pool ARN. Rule updates are all-or-nothing, meaning they can only be
16// updated as a whole (or not at all).
17func (c *Client) UpdateDevicePool(ctx context.Context, params *UpdateDevicePoolInput, optFns ...func(*Options)) (*UpdateDevicePoolOutput, error) {
18	if params == nil {
19		params = &UpdateDevicePoolInput{}
20	}
21
22	result, metadata, err := c.invokeOperation(ctx, "UpdateDevicePool", params, optFns, c.addOperationUpdateDevicePoolMiddlewares)
23	if err != nil {
24		return nil, err
25	}
26
27	out := result.(*UpdateDevicePoolOutput)
28	out.ResultMetadata = metadata
29	return out, nil
30}
31
32// Represents a request to the update device pool operation.
33type UpdateDevicePoolInput struct {
34
35	// The Amazon Resource Name (ARN) of the Device Farm device pool to update.
36	//
37	// This member is required.
38	Arn *string
39
40	// Sets whether the maxDevices parameter applies to your device pool. If you set
41	// this parameter to true, the maxDevices parameter does not apply, and Device Farm
42	// does not limit the number of devices that it adds to your device pool. In this
43	// case, Device Farm adds all available devices that meet the criteria specified in
44	// the rules parameter. If you use this parameter in your request, you cannot use
45	// the maxDevices parameter in the same request.
46	ClearMaxDevices *bool
47
48	// A description of the device pool to update.
49	Description *string
50
51	// The number of devices that Device Farm can add to your device pool. Device Farm
52	// adds devices that are available and that meet the criteria that you assign for
53	// the rules parameter. Depending on how many devices meet these constraints, your
54	// device pool might contain fewer devices than the value for this parameter. By
55	// specifying the maximum number of devices, you can control the costs that you
56	// incur by running tests. If you use this parameter in your request, you cannot
57	// use the clearMaxDevices parameter in the same request.
58	MaxDevices *int32
59
60	// A string that represents the name of the device pool to update.
61	Name *string
62
63	// Represents the rules to modify for the device pool. Updating rules is optional.
64	// If you update rules for your request, the update replaces the existing rules.
65	Rules []types.Rule
66
67	noSmithyDocumentSerde
68}
69
70// Represents the result of an update device pool request.
71type UpdateDevicePoolOutput struct {
72
73	// The device pool you just updated.
74	DevicePool *types.DevicePool
75
76	// Metadata pertaining to the operation's result.
77	ResultMetadata middleware.Metadata
78
79	noSmithyDocumentSerde
80}
81
82func (c *Client) addOperationUpdateDevicePoolMiddlewares(stack *middleware.Stack, options Options) (err error) {
83	err = stack.Serialize.Add(&awsAwsjson11_serializeOpUpdateDevicePool{}, middleware.After)
84	if err != nil {
85		return err
86	}
87	err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpUpdateDevicePool{}, middleware.After)
88	if err != nil {
89		return err
90	}
91	if err = addSetLoggerMiddleware(stack, options); err != nil {
92		return err
93	}
94	if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
95		return err
96	}
97	if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
98		return err
99	}
100	if err = addResolveEndpointMiddleware(stack, options); err != nil {
101		return err
102	}
103	if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
104		return err
105	}
106	if err = addRetryMiddlewares(stack, options); err != nil {
107		return err
108	}
109	if err = addHTTPSignerV4Middleware(stack, options); err != nil {
110		return err
111	}
112	if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
113		return err
114	}
115	if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
116		return err
117	}
118	if err = addClientUserAgent(stack); err != nil {
119		return err
120	}
121	if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
122		return err
123	}
124	if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
125		return err
126	}
127	if err = addOpUpdateDevicePoolValidationMiddleware(stack); err != nil {
128		return err
129	}
130	if err = stack.Initialize.Add(newServiceMetadataMiddleware_opUpdateDevicePool(options.Region), middleware.Before); err != nil {
131		return err
132	}
133	if err = addRequestIDRetrieverMiddleware(stack); err != nil {
134		return err
135	}
136	if err = addResponseErrorMiddleware(stack); err != nil {
137		return err
138	}
139	if err = addRequestResponseLogging(stack, options); err != nil {
140		return err
141	}
142	return nil
143}
144
145func newServiceMetadataMiddleware_opUpdateDevicePool(region string) *awsmiddleware.RegisterServiceMetadata {
146	return &awsmiddleware.RegisterServiceMetadata{
147		Region:        region,
148		ServiceID:     ServiceID,
149		SigningName:   "devicefarm",
150		OperationName: "UpdateDevicePool",
151	}
152}
153