1// Code generated by smithy-go-codegen DO NOT EDIT.
2
3package quicksight
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// Generates a session URL and authorization code that you can use to embed the
14// Amazon QuickSight console in your web server code. Use GetSessionEmbedUrl where
15// you want to provide an authoring portal that allows users to create data
16// sources, datasets, analyses, and dashboards. The users who access an embedded
17// QuickSight console need belong to the author or admin security cohort. If you
18// want to restrict permissions to some of these features, add a custom permissions
19// profile to the user with the UpdateUser API operation. Use RegisterUser API
20// operation to add a new user with a custom permission profile attached. For more
21// information, see the following sections in the Amazon QuickSight User Guide:
22//
23// *
24// Embedding the Amazon QuickSight Console
25// (https://docs.aws.amazon.com/quicksight/latest/user/embedding-the-quicksight-console.html)
26//
27// *
28// Customizing Access to the Amazon QuickSight Console
29// (https://docs.aws.amazon.com/quicksight/latest/user/customizing-permissions-to-the-quicksight-console.html)
30func (c *Client) GetSessionEmbedUrl(ctx context.Context, params *GetSessionEmbedUrlInput, optFns ...func(*Options)) (*GetSessionEmbedUrlOutput, error) {
31	if params == nil {
32		params = &GetSessionEmbedUrlInput{}
33	}
34
35	result, metadata, err := c.invokeOperation(ctx, "GetSessionEmbedUrl", params, optFns, addOperationGetSessionEmbedUrlMiddlewares)
36	if err != nil {
37		return nil, err
38	}
39
40	out := result.(*GetSessionEmbedUrlOutput)
41	out.ResultMetadata = metadata
42	return out, nil
43}
44
45type GetSessionEmbedUrlInput struct {
46
47	// The ID for the AWS account associated with your QuickSight subscription.
48	//
49	// This member is required.
50	AwsAccountId *string
51
52	// The URL you use to access the embedded session. The entry point URL is
53	// constrained to the following paths:
54	//
55	// * /start
56	//
57	// * /start/analyses
58	//
59	// *
60	// /start/dashboards
61	//
62	// * /start/favorites
63	//
64	// * /dashboards/DashboardId  - where
65	// DashboardId is the actual ID key from the QuickSight console URL of the
66	// dashboard
67	//
68	// * /analyses/AnalysisId  - where AnalysisId is the actual ID key from
69	// the QuickSight console URL of the analysis
70	EntryPoint *string
71
72	// How many minutes the session is valid. The session lifetime must be 15-600
73	// minutes.
74	SessionLifetimeInMinutes *int64
75
76	// The Amazon QuickSight user's Amazon Resource Name (ARN), for use with QUICKSIGHT
77	// identity type. You can use this for any type of Amazon QuickSight users in your
78	// account (readers, authors, or admins). They need to be authenticated as one of
79	// the following:
80	//
81	// * Active Directory (AD) users or group members
82	//
83	// * Invited
84	// nonfederated users
85	//
86	// * AWS Identity and Access Management (IAM) users and IAM
87	// role-based sessions authenticated through Federated Single Sign-On using SAML,
88	// OpenID Connect, or IAM federation
89	//
90	// Omit this parameter for users in the third
91	// group, IAM users and IAM role-based sessions.
92	UserArn *string
93}
94
95type GetSessionEmbedUrlOutput struct {
96
97	// A single-use URL that you can put into your server-side web page to embed your
98	// QuickSight session. This URL is valid for 5 minutes. The API operation provides
99	// the URL with an auth_code value that enables one (and only one) sign-on to a
100	// user session that is valid for 10 hours.
101	EmbedUrl *string
102
103	// The AWS request ID for this operation.
104	RequestId *string
105
106	// The HTTP status of the request.
107	Status int32
108
109	// Metadata pertaining to the operation's result.
110	ResultMetadata middleware.Metadata
111}
112
113func addOperationGetSessionEmbedUrlMiddlewares(stack *middleware.Stack, options Options) (err error) {
114	err = stack.Serialize.Add(&awsRestjson1_serializeOpGetSessionEmbedUrl{}, middleware.After)
115	if err != nil {
116		return err
117	}
118	err = stack.Deserialize.Add(&awsRestjson1_deserializeOpGetSessionEmbedUrl{}, middleware.After)
119	if err != nil {
120		return err
121	}
122	if err = addSetLoggerMiddleware(stack, options); err != nil {
123		return err
124	}
125	if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
126		return err
127	}
128	if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
129		return err
130	}
131	if err = addResolveEndpointMiddleware(stack, options); err != nil {
132		return err
133	}
134	if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
135		return err
136	}
137	if err = addRetryMiddlewares(stack, options); err != nil {
138		return err
139	}
140	if err = addHTTPSignerV4Middleware(stack, options); err != nil {
141		return err
142	}
143	if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
144		return err
145	}
146	if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
147		return err
148	}
149	if err = addClientUserAgent(stack); err != nil {
150		return err
151	}
152	if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
153		return err
154	}
155	if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
156		return err
157	}
158	if err = addOpGetSessionEmbedUrlValidationMiddleware(stack); err != nil {
159		return err
160	}
161	if err = stack.Initialize.Add(newServiceMetadataMiddleware_opGetSessionEmbedUrl(options.Region), middleware.Before); err != nil {
162		return err
163	}
164	if err = addRequestIDRetrieverMiddleware(stack); err != nil {
165		return err
166	}
167	if err = addResponseErrorMiddleware(stack); err != nil {
168		return err
169	}
170	if err = addRequestResponseLogging(stack, options); err != nil {
171		return err
172	}
173	return nil
174}
175
176func newServiceMetadataMiddleware_opGetSessionEmbedUrl(region string) *awsmiddleware.RegisterServiceMetadata {
177	return &awsmiddleware.RegisterServiceMetadata{
178		Region:        region,
179		ServiceID:     ServiceID,
180		SigningName:   "quicksight",
181		OperationName: "GetSessionEmbedUrl",
182	}
183}
184