1// Code generated by smithy-go-codegen DO NOT EDIT. 2 3package iotsitewise 4 5import ( 6 "context" 7 "fmt" 8 awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" 9 "github.com/aws/aws-sdk-go-v2/aws/signer/v4" 10 "github.com/aws/aws-sdk-go-v2/service/iotsitewise/types" 11 "github.com/aws/smithy-go/middleware" 12 smithyhttp "github.com/aws/smithy-go/transport/http" 13 "time" 14) 15 16// Describes an access policy, which specifies an identity's access to an IoT 17// SiteWise Monitor portal or project. 18func (c *Client) DescribeAccessPolicy(ctx context.Context, params *DescribeAccessPolicyInput, optFns ...func(*Options)) (*DescribeAccessPolicyOutput, error) { 19 if params == nil { 20 params = &DescribeAccessPolicyInput{} 21 } 22 23 result, metadata, err := c.invokeOperation(ctx, "DescribeAccessPolicy", params, optFns, c.addOperationDescribeAccessPolicyMiddlewares) 24 if err != nil { 25 return nil, err 26 } 27 28 out := result.(*DescribeAccessPolicyOutput) 29 out.ResultMetadata = metadata 30 return out, nil 31} 32 33type DescribeAccessPolicyInput struct { 34 35 // The ID of the access policy. 36 // 37 // This member is required. 38 AccessPolicyId *string 39 40 noSmithyDocumentSerde 41} 42 43type DescribeAccessPolicyOutput struct { 44 45 // The ARN 46 // (https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html) of 47 // the access policy, which has the following format. 48 // arn:${Partition}:iotsitewise:${Region}:${Account}:access-policy/${AccessPolicyId} 49 // 50 // This member is required. 51 AccessPolicyArn *string 52 53 // The date the access policy was created, in Unix epoch time. 54 // 55 // This member is required. 56 AccessPolicyCreationDate *time.Time 57 58 // The ID of the access policy. 59 // 60 // This member is required. 61 AccessPolicyId *string 62 63 // The identity (Amazon Web Services SSO user, Amazon Web Services SSO group, or 64 // IAM user) to which this access policy applies. 65 // 66 // This member is required. 67 AccessPolicyIdentity *types.Identity 68 69 // The date the access policy was last updated, in Unix epoch time. 70 // 71 // This member is required. 72 AccessPolicyLastUpdateDate *time.Time 73 74 // The access policy permission. Note that a project ADMINISTRATOR is also known as 75 // a project owner. 76 // 77 // This member is required. 78 AccessPolicyPermission types.Permission 79 80 // The IoT SiteWise Monitor resource (portal or project) to which this access 81 // policy provides access. 82 // 83 // This member is required. 84 AccessPolicyResource *types.Resource 85 86 // Metadata pertaining to the operation's result. 87 ResultMetadata middleware.Metadata 88 89 noSmithyDocumentSerde 90} 91 92func (c *Client) addOperationDescribeAccessPolicyMiddlewares(stack *middleware.Stack, options Options) (err error) { 93 err = stack.Serialize.Add(&awsRestjson1_serializeOpDescribeAccessPolicy{}, middleware.After) 94 if err != nil { 95 return err 96 } 97 err = stack.Deserialize.Add(&awsRestjson1_deserializeOpDescribeAccessPolicy{}, middleware.After) 98 if err != nil { 99 return err 100 } 101 if err = addSetLoggerMiddleware(stack, options); err != nil { 102 return err 103 } 104 if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { 105 return err 106 } 107 if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { 108 return err 109 } 110 if err = addResolveEndpointMiddleware(stack, options); err != nil { 111 return err 112 } 113 if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { 114 return err 115 } 116 if err = addRetryMiddlewares(stack, options); err != nil { 117 return err 118 } 119 if err = addHTTPSignerV4Middleware(stack, options); err != nil { 120 return err 121 } 122 if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { 123 return err 124 } 125 if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { 126 return err 127 } 128 if err = addClientUserAgent(stack); err != nil { 129 return err 130 } 131 if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { 132 return err 133 } 134 if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { 135 return err 136 } 137 if err = addEndpointPrefix_opDescribeAccessPolicyMiddleware(stack); err != nil { 138 return err 139 } 140 if err = addOpDescribeAccessPolicyValidationMiddleware(stack); err != nil { 141 return err 142 } 143 if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDescribeAccessPolicy(options.Region), middleware.Before); err != nil { 144 return err 145 } 146 if err = addRequestIDRetrieverMiddleware(stack); err != nil { 147 return err 148 } 149 if err = addResponseErrorMiddleware(stack); err != nil { 150 return err 151 } 152 if err = addRequestResponseLogging(stack, options); err != nil { 153 return err 154 } 155 return nil 156} 157 158type endpointPrefix_opDescribeAccessPolicyMiddleware struct { 159} 160 161func (*endpointPrefix_opDescribeAccessPolicyMiddleware) ID() string { 162 return "EndpointHostPrefix" 163} 164 165func (m *endpointPrefix_opDescribeAccessPolicyMiddleware) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( 166 out middleware.SerializeOutput, metadata middleware.Metadata, err error, 167) { 168 if smithyhttp.GetHostnameImmutable(ctx) || smithyhttp.IsEndpointHostPrefixDisabled(ctx) { 169 return next.HandleSerialize(ctx, in) 170 } 171 172 req, ok := in.Request.(*smithyhttp.Request) 173 if !ok { 174 return out, metadata, fmt.Errorf("unknown transport type %T", in.Request) 175 } 176 177 req.URL.Host = "monitor." + req.URL.Host 178 179 return next.HandleSerialize(ctx, in) 180} 181func addEndpointPrefix_opDescribeAccessPolicyMiddleware(stack *middleware.Stack) error { 182 return stack.Serialize.Insert(&endpointPrefix_opDescribeAccessPolicyMiddleware{}, `OperationSerializer`, middleware.After) 183} 184 185func newServiceMetadataMiddleware_opDescribeAccessPolicy(region string) *awsmiddleware.RegisterServiceMetadata { 186 return &awsmiddleware.RegisterServiceMetadata{ 187 Region: region, 188 ServiceID: ServiceID, 189 SigningName: "iotsitewise", 190 OperationName: "DescribeAccessPolicy", 191 } 192} 193