1// Code generated by smithy-go-codegen DO NOT EDIT.
2
3package machinelearning
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/machinelearning/types"
10	"github.com/aws/smithy-go/middleware"
11	smithyhttp "github.com/aws/smithy-go/transport/http"
12	"time"
13)
14
15// Returns a DataSource that includes metadata and data file information, as well
16// as the current status of the DataSource. GetDataSource provides results in
17// normal or verbose format. The verbose format adds the schema description and the
18// list of files pointed to by the DataSource to the normal format.
19func (c *Client) GetDataSource(ctx context.Context, params *GetDataSourceInput, optFns ...func(*Options)) (*GetDataSourceOutput, error) {
20	if params == nil {
21		params = &GetDataSourceInput{}
22	}
23
24	result, metadata, err := c.invokeOperation(ctx, "GetDataSource", params, optFns, addOperationGetDataSourceMiddlewares)
25	if err != nil {
26		return nil, err
27	}
28
29	out := result.(*GetDataSourceOutput)
30	out.ResultMetadata = metadata
31	return out, nil
32}
33
34type GetDataSourceInput struct {
35
36	// The ID assigned to the DataSource at creation.
37	//
38	// This member is required.
39	DataSourceId *string
40
41	// Specifies whether the GetDataSource operation should return DataSourceSchema. If
42	// true, DataSourceSchema is returned. If false, DataSourceSchema is not returned.
43	Verbose bool
44}
45
46// Represents the output of a GetDataSource operation and describes a DataSource.
47type GetDataSourceOutput struct {
48
49	// The parameter is true if statistics need to be generated from the observation
50	// data.
51	ComputeStatistics bool
52
53	// The approximate CPU time in milliseconds that Amazon Machine Learning spent
54	// processing the DataSource, normalized and scaled on computation resources.
55	// ComputeTime is only available if the DataSource is in the COMPLETED state and
56	// the ComputeStatistics is set to true.
57	ComputeTime *int64
58
59	// The time that the DataSource was created. The time is expressed in epoch time.
60	CreatedAt *time.Time
61
62	// The AWS user account from which the DataSource was created. The account type can
63	// be either an AWS root account or an AWS Identity and Access Management (IAM)
64	// user account.
65	CreatedByIamUser *string
66
67	// The location of the data file or directory in Amazon Simple Storage Service
68	// (Amazon S3).
69	DataLocationS3 *string
70
71	// A JSON string that represents the splitting and rearrangement requirement used
72	// when this DataSource was created.
73	DataRearrangement *string
74
75	// The total size of observations in the data files.
76	DataSizeInBytes *int64
77
78	// The ID assigned to the DataSource at creation. This value should be identical to
79	// the value of the DataSourceId in the request.
80	DataSourceId *string
81
82	// The schema used by all of the data files of this DataSource. Note: This
83	// parameter is provided as part of the verbose format.
84	DataSourceSchema *string
85
86	// The epoch time when Amazon Machine Learning marked the DataSource as COMPLETED
87	// or FAILED. FinishedAt is only available when the DataSource is in the COMPLETED
88	// or FAILED state.
89	FinishedAt *time.Time
90
91	// The time of the most recent edit to the DataSource. The time is expressed in
92	// epoch time.
93	LastUpdatedAt *time.Time
94
95	// A link to the file containing logs of CreateDataSourceFrom* operations.
96	LogUri *string
97
98	// The user-supplied description of the most recent details about creating the
99	// DataSource.
100	Message *string
101
102	// A user-supplied name or description of the DataSource.
103	Name *string
104
105	// The number of data files referenced by the DataSource.
106	NumberOfFiles *int64
107
108	// The datasource details that are specific to Amazon RDS.
109	RDSMetadata *types.RDSMetadata
110
111	// Describes the DataSource details specific to Amazon Redshift.
112	RedshiftMetadata *types.RedshiftMetadata
113
114	// The Amazon Resource Name (ARN) of an AWS IAM Role
115	// (https://docs.aws.amazon.com/IAM/latest/UserGuide/roles-toplevel.html#roles-about-termsandconcepts),
116	// such as the following: arn:aws:iam::account:role/rolename.
117	RoleARN *string
118
119	// The epoch time when Amazon Machine Learning marked the DataSource as INPROGRESS.
120	// StartedAt isn't available if the DataSource is in the PENDING state.
121	StartedAt *time.Time
122
123	// The current status of the DataSource. This element can have one of the following
124	// values:
125	//
126	// * PENDING - Amazon ML submitted a request to create a DataSource.
127	//
128	// *
129	// INPROGRESS - The creation process is underway.
130	//
131	// * FAILED - The request to create
132	// a DataSource did not run to completion. It is not usable.
133	//
134	// * COMPLETED - The
135	// creation process completed successfully.
136	//
137	// * DELETED - The DataSource is marked
138	// as deleted. It is not usable.
139	Status types.EntityStatus
140
141	// Metadata pertaining to the operation's result.
142	ResultMetadata middleware.Metadata
143}
144
145func addOperationGetDataSourceMiddlewares(stack *middleware.Stack, options Options) (err error) {
146	err = stack.Serialize.Add(&awsAwsjson11_serializeOpGetDataSource{}, middleware.After)
147	if err != nil {
148		return err
149	}
150	err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpGetDataSource{}, middleware.After)
151	if err != nil {
152		return err
153	}
154	if err = addSetLoggerMiddleware(stack, options); err != nil {
155		return err
156	}
157	if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
158		return err
159	}
160	if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
161		return err
162	}
163	if err = addResolveEndpointMiddleware(stack, options); err != nil {
164		return err
165	}
166	if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
167		return err
168	}
169	if err = addRetryMiddlewares(stack, options); err != nil {
170		return err
171	}
172	if err = addHTTPSignerV4Middleware(stack, options); err != nil {
173		return err
174	}
175	if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
176		return err
177	}
178	if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
179		return err
180	}
181	if err = addClientUserAgent(stack); err != nil {
182		return err
183	}
184	if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
185		return err
186	}
187	if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
188		return err
189	}
190	if err = addOpGetDataSourceValidationMiddleware(stack); err != nil {
191		return err
192	}
193	if err = stack.Initialize.Add(newServiceMetadataMiddleware_opGetDataSource(options.Region), middleware.Before); err != nil {
194		return err
195	}
196	if err = addRequestIDRetrieverMiddleware(stack); err != nil {
197		return err
198	}
199	if err = addResponseErrorMiddleware(stack); err != nil {
200		return err
201	}
202	if err = addRequestResponseLogging(stack, options); err != nil {
203		return err
204	}
205	return nil
206}
207
208func newServiceMetadataMiddleware_opGetDataSource(region string) *awsmiddleware.RegisterServiceMetadata {
209	return &awsmiddleware.RegisterServiceMetadata{
210		Region:        region,
211		ServiceID:     ServiceID,
212		SigningName:   "machinelearning",
213		OperationName: "GetDataSource",
214	}
215}
216