1// Code generated by smithy-go-codegen DO NOT EDIT.
2
3package codeguruprofiler
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/codeguruprofiler/types"
10	"github.com/aws/smithy-go/middleware"
11	smithyhttp "github.com/aws/smithy-go/transport/http"
12)
13
14// Removes permissions from a profiling group's resource-based policy that are
15// provided using an action group. The one supported action group that can be
16// removed is agentPermission which grants ConfigureAgent and PostAgent
17// permissions. For more information, see Resource-based policies in CodeGuru
18// Profiler
19// (https://docs.aws.amazon.com/codeguru/latest/profiler-ug/resource-based-policies.html)
20// in the Amazon CodeGuru Profiler User Guide, ConfigureAgent
21// (https://docs.aws.amazon.com/codeguru/latest/profiler-api/API_ConfigureAgent.html),
22// and PostAgentProfile
23// (https://docs.aws.amazon.com/codeguru/latest/profiler-api/API_PostAgentProfile.html).
24func (c *Client) RemovePermission(ctx context.Context, params *RemovePermissionInput, optFns ...func(*Options)) (*RemovePermissionOutput, error) {
25	if params == nil {
26		params = &RemovePermissionInput{}
27	}
28
29	result, metadata, err := c.invokeOperation(ctx, "RemovePermission", params, optFns, addOperationRemovePermissionMiddlewares)
30	if err != nil {
31		return nil, err
32	}
33
34	out := result.(*RemovePermissionOutput)
35	out.ResultMetadata = metadata
36	return out, nil
37}
38
39// The structure representing the removePermissionRequest.
40type RemovePermissionInput struct {
41
42	// Specifies an action group that contains the permissions to remove from a
43	// profiling group's resource-based policy. One action group is supported,
44	// agentPermissions, which grants ConfigureAgent and PostAgentProfile permissions.
45	//
46	// This member is required.
47	ActionGroup types.ActionGroup
48
49	// The name of the profiling group.
50	//
51	// This member is required.
52	ProfilingGroupName *string
53
54	// A universally unique identifier (UUID) for the revision of the resource-based
55	// policy from which you want to remove permissions.
56	//
57	// This member is required.
58	RevisionId *string
59}
60
61// The structure representing the removePermissionResponse.
62type RemovePermissionOutput struct {
63
64	// The JSON-formatted resource-based policy on the profiling group after the
65	// specified permissions were removed.
66	//
67	// This member is required.
68	Policy *string
69
70	// A universally unique identifier (UUID) for the revision of the resource-based
71	// policy after the specified permissions were removed. The updated JSON-formatted
72	// policy is in the policy element of the response.
73	//
74	// This member is required.
75	RevisionId *string
76
77	// Metadata pertaining to the operation's result.
78	ResultMetadata middleware.Metadata
79}
80
81func addOperationRemovePermissionMiddlewares(stack *middleware.Stack, options Options) (err error) {
82	err = stack.Serialize.Add(&awsRestjson1_serializeOpRemovePermission{}, middleware.After)
83	if err != nil {
84		return err
85	}
86	err = stack.Deserialize.Add(&awsRestjson1_deserializeOpRemovePermission{}, middleware.After)
87	if err != nil {
88		return err
89	}
90	if err = addSetLoggerMiddleware(stack, options); err != nil {
91		return err
92	}
93	if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
94		return err
95	}
96	if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
97		return err
98	}
99	if err = addResolveEndpointMiddleware(stack, options); err != nil {
100		return err
101	}
102	if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
103		return err
104	}
105	if err = addRetryMiddlewares(stack, options); err != nil {
106		return err
107	}
108	if err = addHTTPSignerV4Middleware(stack, options); err != nil {
109		return err
110	}
111	if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
112		return err
113	}
114	if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
115		return err
116	}
117	if err = addClientUserAgent(stack); err != nil {
118		return err
119	}
120	if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
121		return err
122	}
123	if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
124		return err
125	}
126	if err = addOpRemovePermissionValidationMiddleware(stack); err != nil {
127		return err
128	}
129	if err = addRequestIDRetrieverMiddleware(stack); err != nil {
130		return err
131	}
132	if err = addResponseErrorMiddleware(stack); err != nil {
133		return err
134	}
135	if err = addRequestResponseLogging(stack, options); err != nil {
136		return err
137	}
138	return nil
139}
140