1// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
2
3package sagemakeredgemanager
4
5import (
6	"fmt"
7	"time"
8
9	"github.com/aws/aws-sdk-go/aws"
10	"github.com/aws/aws-sdk-go/aws/awsutil"
11	"github.com/aws/aws-sdk-go/aws/request"
12	"github.com/aws/aws-sdk-go/private/protocol"
13	"github.com/aws/aws-sdk-go/private/protocol/restjson"
14)
15
16const opGetDeviceRegistration = "GetDeviceRegistration"
17
18// GetDeviceRegistrationRequest generates a "aws/request.Request" representing the
19// client's request for the GetDeviceRegistration operation. The "output" return
20// value will be populated with the request's response once the request completes
21// successfully.
22//
23// Use "Send" method on the returned Request to send the API call to the service.
24// the "output" return value is not valid until after Send returns without error.
25//
26// See GetDeviceRegistration for more information on using the GetDeviceRegistration
27// API call, and error handling.
28//
29// This method is useful when you want to inject custom logic or configuration
30// into the SDK's request lifecycle. Such as custom headers, or retry logic.
31//
32//
33//    // Example sending a request using the GetDeviceRegistrationRequest method.
34//    req, resp := client.GetDeviceRegistrationRequest(params)
35//
36//    err := req.Send()
37//    if err == nil { // resp is now filled
38//        fmt.Println(resp)
39//    }
40//
41// See also, https://docs.aws.amazon.com/goto/WebAPI/sagemaker-edge-2020-09-23/GetDeviceRegistration
42func (c *SagemakerEdgeManager) GetDeviceRegistrationRequest(input *GetDeviceRegistrationInput) (req *request.Request, output *GetDeviceRegistrationOutput) {
43	op := &request.Operation{
44		Name:       opGetDeviceRegistration,
45		HTTPMethod: "POST",
46		HTTPPath:   "/GetDeviceRegistration",
47	}
48
49	if input == nil {
50		input = &GetDeviceRegistrationInput{}
51	}
52
53	output = &GetDeviceRegistrationOutput{}
54	req = c.newRequest(op, input, output)
55	return
56}
57
58// GetDeviceRegistration API operation for Amazon Sagemaker Edge Manager.
59//
60// Use to check if a device is registered with SageMaker Edge Manager.
61//
62// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
63// with awserr.Error's Code and Message methods to get detailed information about
64// the error.
65//
66// See the AWS API reference guide for Amazon Sagemaker Edge Manager's
67// API operation GetDeviceRegistration for usage and error information.
68//
69// Returned Error Types:
70//   * InternalServiceException
71//   An internal failure occurred. Try your request again. If the problem persists,
72//   contact AWS customer support.
73//
74// See also, https://docs.aws.amazon.com/goto/WebAPI/sagemaker-edge-2020-09-23/GetDeviceRegistration
75func (c *SagemakerEdgeManager) GetDeviceRegistration(input *GetDeviceRegistrationInput) (*GetDeviceRegistrationOutput, error) {
76	req, out := c.GetDeviceRegistrationRequest(input)
77	return out, req.Send()
78}
79
80// GetDeviceRegistrationWithContext is the same as GetDeviceRegistration with the addition of
81// the ability to pass a context and additional request options.
82//
83// See GetDeviceRegistration for details on how to use this API operation.
84//
85// The context must be non-nil and will be used for request cancellation. If
86// the context is nil a panic will occur. In the future the SDK may create
87// sub-contexts for http.Requests. See https://golang.org/pkg/context/
88// for more information on using Contexts.
89func (c *SagemakerEdgeManager) GetDeviceRegistrationWithContext(ctx aws.Context, input *GetDeviceRegistrationInput, opts ...request.Option) (*GetDeviceRegistrationOutput, error) {
90	req, out := c.GetDeviceRegistrationRequest(input)
91	req.SetContext(ctx)
92	req.ApplyOptions(opts...)
93	return out, req.Send()
94}
95
96const opSendHeartbeat = "SendHeartbeat"
97
98// SendHeartbeatRequest generates a "aws/request.Request" representing the
99// client's request for the SendHeartbeat operation. The "output" return
100// value will be populated with the request's response once the request completes
101// successfully.
102//
103// Use "Send" method on the returned Request to send the API call to the service.
104// the "output" return value is not valid until after Send returns without error.
105//
106// See SendHeartbeat for more information on using the SendHeartbeat
107// API call, and error handling.
108//
109// This method is useful when you want to inject custom logic or configuration
110// into the SDK's request lifecycle. Such as custom headers, or retry logic.
111//
112//
113//    // Example sending a request using the SendHeartbeatRequest method.
114//    req, resp := client.SendHeartbeatRequest(params)
115//
116//    err := req.Send()
117//    if err == nil { // resp is now filled
118//        fmt.Println(resp)
119//    }
120//
121// See also, https://docs.aws.amazon.com/goto/WebAPI/sagemaker-edge-2020-09-23/SendHeartbeat
122func (c *SagemakerEdgeManager) SendHeartbeatRequest(input *SendHeartbeatInput) (req *request.Request, output *SendHeartbeatOutput) {
123	op := &request.Operation{
124		Name:       opSendHeartbeat,
125		HTTPMethod: "POST",
126		HTTPPath:   "/SendHeartbeat",
127	}
128
129	if input == nil {
130		input = &SendHeartbeatInput{}
131	}
132
133	output = &SendHeartbeatOutput{}
134	req = c.newRequest(op, input, output)
135	req.Handlers.Unmarshal.Swap(restjson.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler)
136	return
137}
138
139// SendHeartbeat API operation for Amazon Sagemaker Edge Manager.
140//
141// Use to get the current status of devices registered on SageMaker Edge Manager.
142//
143// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
144// with awserr.Error's Code and Message methods to get detailed information about
145// the error.
146//
147// See the AWS API reference guide for Amazon Sagemaker Edge Manager's
148// API operation SendHeartbeat for usage and error information.
149//
150// Returned Error Types:
151//   * InternalServiceException
152//   An internal failure occurred. Try your request again. If the problem persists,
153//   contact AWS customer support.
154//
155// See also, https://docs.aws.amazon.com/goto/WebAPI/sagemaker-edge-2020-09-23/SendHeartbeat
156func (c *SagemakerEdgeManager) SendHeartbeat(input *SendHeartbeatInput) (*SendHeartbeatOutput, error) {
157	req, out := c.SendHeartbeatRequest(input)
158	return out, req.Send()
159}
160
161// SendHeartbeatWithContext is the same as SendHeartbeat with the addition of
162// the ability to pass a context and additional request options.
163//
164// See SendHeartbeat for details on how to use this API operation.
165//
166// The context must be non-nil and will be used for request cancellation. If
167// the context is nil a panic will occur. In the future the SDK may create
168// sub-contexts for http.Requests. See https://golang.org/pkg/context/
169// for more information on using Contexts.
170func (c *SagemakerEdgeManager) SendHeartbeatWithContext(ctx aws.Context, input *SendHeartbeatInput, opts ...request.Option) (*SendHeartbeatOutput, error) {
171	req, out := c.SendHeartbeatRequest(input)
172	req.SetContext(ctx)
173	req.ApplyOptions(opts...)
174	return out, req.Send()
175}
176
177// Information required for edge device metrics.
178type EdgeMetric struct {
179	_ struct{} `type:"structure"`
180
181	// The dimension of metrics published.
182	Dimension *string `min:"1" type:"string"`
183
184	// Returns the name of the metric.
185	MetricName *string `min:"4" type:"string"`
186
187	// Timestamp of when the metric was requested.
188	Timestamp *time.Time `type:"timestamp"`
189
190	// Returns the value of the metric.
191	Value *float64 `type:"double"`
192}
193
194// String returns the string representation.
195//
196// API parameter values that are decorated as "sensitive" in the API will not
197// be included in the string output. The member name will be present, but the
198// value will be replaced with "sensitive".
199func (s EdgeMetric) String() string {
200	return awsutil.Prettify(s)
201}
202
203// GoString returns the string representation.
204//
205// API parameter values that are decorated as "sensitive" in the API will not
206// be included in the string output. The member name will be present, but the
207// value will be replaced with "sensitive".
208func (s EdgeMetric) GoString() string {
209	return s.String()
210}
211
212// Validate inspects the fields of the type to determine if they are valid.
213func (s *EdgeMetric) Validate() error {
214	invalidParams := request.ErrInvalidParams{Context: "EdgeMetric"}
215	if s.Dimension != nil && len(*s.Dimension) < 1 {
216		invalidParams.Add(request.NewErrParamMinLen("Dimension", 1))
217	}
218	if s.MetricName != nil && len(*s.MetricName) < 4 {
219		invalidParams.Add(request.NewErrParamMinLen("MetricName", 4))
220	}
221
222	if invalidParams.Len() > 0 {
223		return invalidParams
224	}
225	return nil
226}
227
228// SetDimension sets the Dimension field's value.
229func (s *EdgeMetric) SetDimension(v string) *EdgeMetric {
230	s.Dimension = &v
231	return s
232}
233
234// SetMetricName sets the MetricName field's value.
235func (s *EdgeMetric) SetMetricName(v string) *EdgeMetric {
236	s.MetricName = &v
237	return s
238}
239
240// SetTimestamp sets the Timestamp field's value.
241func (s *EdgeMetric) SetTimestamp(v time.Time) *EdgeMetric {
242	s.Timestamp = &v
243	return s
244}
245
246// SetValue sets the Value field's value.
247func (s *EdgeMetric) SetValue(v float64) *EdgeMetric {
248	s.Value = &v
249	return s
250}
251
252type GetDeviceRegistrationInput struct {
253	_ struct{} `type:"structure"`
254
255	// The name of the fleet that the device belongs to.
256	//
257	// DeviceFleetName is a required field
258	DeviceFleetName *string `min:"1" type:"string" required:"true"`
259
260	// The unique name of the device you want to get the registration status from.
261	//
262	// DeviceName is a required field
263	DeviceName *string `min:"1" type:"string" required:"true"`
264}
265
266// String returns the string representation.
267//
268// API parameter values that are decorated as "sensitive" in the API will not
269// be included in the string output. The member name will be present, but the
270// value will be replaced with "sensitive".
271func (s GetDeviceRegistrationInput) String() string {
272	return awsutil.Prettify(s)
273}
274
275// GoString returns the string representation.
276//
277// API parameter values that are decorated as "sensitive" in the API will not
278// be included in the string output. The member name will be present, but the
279// value will be replaced with "sensitive".
280func (s GetDeviceRegistrationInput) GoString() string {
281	return s.String()
282}
283
284// Validate inspects the fields of the type to determine if they are valid.
285func (s *GetDeviceRegistrationInput) Validate() error {
286	invalidParams := request.ErrInvalidParams{Context: "GetDeviceRegistrationInput"}
287	if s.DeviceFleetName == nil {
288		invalidParams.Add(request.NewErrParamRequired("DeviceFleetName"))
289	}
290	if s.DeviceFleetName != nil && len(*s.DeviceFleetName) < 1 {
291		invalidParams.Add(request.NewErrParamMinLen("DeviceFleetName", 1))
292	}
293	if s.DeviceName == nil {
294		invalidParams.Add(request.NewErrParamRequired("DeviceName"))
295	}
296	if s.DeviceName != nil && len(*s.DeviceName) < 1 {
297		invalidParams.Add(request.NewErrParamMinLen("DeviceName", 1))
298	}
299
300	if invalidParams.Len() > 0 {
301		return invalidParams
302	}
303	return nil
304}
305
306// SetDeviceFleetName sets the DeviceFleetName field's value.
307func (s *GetDeviceRegistrationInput) SetDeviceFleetName(v string) *GetDeviceRegistrationInput {
308	s.DeviceFleetName = &v
309	return s
310}
311
312// SetDeviceName sets the DeviceName field's value.
313func (s *GetDeviceRegistrationInput) SetDeviceName(v string) *GetDeviceRegistrationInput {
314	s.DeviceName = &v
315	return s
316}
317
318type GetDeviceRegistrationOutput struct {
319	_ struct{} `type:"structure"`
320
321	// The amount of time, in seconds, that the registration status is stored on
322	// the device’s cache before it is refreshed.
323	CacheTTL *string `min:"1" type:"string"`
324
325	// Describes if the device is currently registered with SageMaker Edge Manager.
326	DeviceRegistration *string `min:"1" type:"string"`
327}
328
329// String returns the string representation.
330//
331// API parameter values that are decorated as "sensitive" in the API will not
332// be included in the string output. The member name will be present, but the
333// value will be replaced with "sensitive".
334func (s GetDeviceRegistrationOutput) String() string {
335	return awsutil.Prettify(s)
336}
337
338// GoString returns the string representation.
339//
340// API parameter values that are decorated as "sensitive" in the API will not
341// be included in the string output. The member name will be present, but the
342// value will be replaced with "sensitive".
343func (s GetDeviceRegistrationOutput) GoString() string {
344	return s.String()
345}
346
347// SetCacheTTL sets the CacheTTL field's value.
348func (s *GetDeviceRegistrationOutput) SetCacheTTL(v string) *GetDeviceRegistrationOutput {
349	s.CacheTTL = &v
350	return s
351}
352
353// SetDeviceRegistration sets the DeviceRegistration field's value.
354func (s *GetDeviceRegistrationOutput) SetDeviceRegistration(v string) *GetDeviceRegistrationOutput {
355	s.DeviceRegistration = &v
356	return s
357}
358
359// An internal failure occurred. Try your request again. If the problem persists,
360// contact AWS customer support.
361type InternalServiceException struct {
362	_            struct{}                  `type:"structure"`
363	RespMetadata protocol.ResponseMetadata `json:"-" xml:"-"`
364
365	Message_ *string `locationName:"Message" type:"string"`
366}
367
368// String returns the string representation.
369//
370// API parameter values that are decorated as "sensitive" in the API will not
371// be included in the string output. The member name will be present, but the
372// value will be replaced with "sensitive".
373func (s InternalServiceException) String() string {
374	return awsutil.Prettify(s)
375}
376
377// GoString returns the string representation.
378//
379// API parameter values that are decorated as "sensitive" in the API will not
380// be included in the string output. The member name will be present, but the
381// value will be replaced with "sensitive".
382func (s InternalServiceException) GoString() string {
383	return s.String()
384}
385
386func newErrorInternalServiceException(v protocol.ResponseMetadata) error {
387	return &InternalServiceException{
388		RespMetadata: v,
389	}
390}
391
392// Code returns the exception type name.
393func (s *InternalServiceException) Code() string {
394	return "InternalServiceException"
395}
396
397// Message returns the exception's message.
398func (s *InternalServiceException) Message() string {
399	if s.Message_ != nil {
400		return *s.Message_
401	}
402	return ""
403}
404
405// OrigErr always returns nil, satisfies awserr.Error interface.
406func (s *InternalServiceException) OrigErr() error {
407	return nil
408}
409
410func (s *InternalServiceException) Error() string {
411	return fmt.Sprintf("%s: %s", s.Code(), s.Message())
412}
413
414// Status code returns the HTTP status code for the request's response error.
415func (s *InternalServiceException) StatusCode() int {
416	return s.RespMetadata.StatusCode
417}
418
419// RequestID returns the service's response RequestID for request.
420func (s *InternalServiceException) RequestID() string {
421	return s.RespMetadata.RequestID
422}
423
424// Information about a model deployed on an edge device that is registered with
425// SageMaker Edge Manager.
426type Model struct {
427	_ struct{} `type:"structure"`
428
429	// The timestamp of the last inference that was made.
430	LatestInference *time.Time `type:"timestamp"`
431
432	// The timestamp of the last data sample taken.
433	LatestSampleTime *time.Time `type:"timestamp"`
434
435	// Information required for model metrics.
436	ModelMetrics []*EdgeMetric `type:"list"`
437
438	// The name of the model.
439	ModelName *string `min:"4" type:"string"`
440
441	// The version of the model.
442	ModelVersion *string `min:"1" type:"string"`
443}
444
445// String returns the string representation.
446//
447// API parameter values that are decorated as "sensitive" in the API will not
448// be included in the string output. The member name will be present, but the
449// value will be replaced with "sensitive".
450func (s Model) String() string {
451	return awsutil.Prettify(s)
452}
453
454// GoString returns the string representation.
455//
456// API parameter values that are decorated as "sensitive" in the API will not
457// be included in the string output. The member name will be present, but the
458// value will be replaced with "sensitive".
459func (s Model) GoString() string {
460	return s.String()
461}
462
463// Validate inspects the fields of the type to determine if they are valid.
464func (s *Model) Validate() error {
465	invalidParams := request.ErrInvalidParams{Context: "Model"}
466	if s.ModelName != nil && len(*s.ModelName) < 4 {
467		invalidParams.Add(request.NewErrParamMinLen("ModelName", 4))
468	}
469	if s.ModelVersion != nil && len(*s.ModelVersion) < 1 {
470		invalidParams.Add(request.NewErrParamMinLen("ModelVersion", 1))
471	}
472	if s.ModelMetrics != nil {
473		for i, v := range s.ModelMetrics {
474			if v == nil {
475				continue
476			}
477			if err := v.Validate(); err != nil {
478				invalidParams.AddNested(fmt.Sprintf("%s[%v]", "ModelMetrics", i), err.(request.ErrInvalidParams))
479			}
480		}
481	}
482
483	if invalidParams.Len() > 0 {
484		return invalidParams
485	}
486	return nil
487}
488
489// SetLatestInference sets the LatestInference field's value.
490func (s *Model) SetLatestInference(v time.Time) *Model {
491	s.LatestInference = &v
492	return s
493}
494
495// SetLatestSampleTime sets the LatestSampleTime field's value.
496func (s *Model) SetLatestSampleTime(v time.Time) *Model {
497	s.LatestSampleTime = &v
498	return s
499}
500
501// SetModelMetrics sets the ModelMetrics field's value.
502func (s *Model) SetModelMetrics(v []*EdgeMetric) *Model {
503	s.ModelMetrics = v
504	return s
505}
506
507// SetModelName sets the ModelName field's value.
508func (s *Model) SetModelName(v string) *Model {
509	s.ModelName = &v
510	return s
511}
512
513// SetModelVersion sets the ModelVersion field's value.
514func (s *Model) SetModelVersion(v string) *Model {
515	s.ModelVersion = &v
516	return s
517}
518
519type SendHeartbeatInput struct {
520	_ struct{} `type:"structure"`
521
522	// For internal use. Returns a list of SageMaker Edge Manager agent operating
523	// metrics.
524	AgentMetrics []*EdgeMetric `type:"list"`
525
526	// Returns the version of the agent.
527	//
528	// AgentVersion is a required field
529	AgentVersion *string `min:"1" type:"string" required:"true"`
530
531	// The name of the fleet that the device belongs to.
532	//
533	// DeviceFleetName is a required field
534	DeviceFleetName *string `min:"1" type:"string" required:"true"`
535
536	// The unique name of the device.
537	//
538	// DeviceName is a required field
539	DeviceName *string `min:"1" type:"string" required:"true"`
540
541	// Returns a list of models deployed on the the device.
542	Models []*Model `type:"list"`
543}
544
545// String returns the string representation.
546//
547// API parameter values that are decorated as "sensitive" in the API will not
548// be included in the string output. The member name will be present, but the
549// value will be replaced with "sensitive".
550func (s SendHeartbeatInput) String() string {
551	return awsutil.Prettify(s)
552}
553
554// GoString returns the string representation.
555//
556// API parameter values that are decorated as "sensitive" in the API will not
557// be included in the string output. The member name will be present, but the
558// value will be replaced with "sensitive".
559func (s SendHeartbeatInput) GoString() string {
560	return s.String()
561}
562
563// Validate inspects the fields of the type to determine if they are valid.
564func (s *SendHeartbeatInput) Validate() error {
565	invalidParams := request.ErrInvalidParams{Context: "SendHeartbeatInput"}
566	if s.AgentVersion == nil {
567		invalidParams.Add(request.NewErrParamRequired("AgentVersion"))
568	}
569	if s.AgentVersion != nil && len(*s.AgentVersion) < 1 {
570		invalidParams.Add(request.NewErrParamMinLen("AgentVersion", 1))
571	}
572	if s.DeviceFleetName == nil {
573		invalidParams.Add(request.NewErrParamRequired("DeviceFleetName"))
574	}
575	if s.DeviceFleetName != nil && len(*s.DeviceFleetName) < 1 {
576		invalidParams.Add(request.NewErrParamMinLen("DeviceFleetName", 1))
577	}
578	if s.DeviceName == nil {
579		invalidParams.Add(request.NewErrParamRequired("DeviceName"))
580	}
581	if s.DeviceName != nil && len(*s.DeviceName) < 1 {
582		invalidParams.Add(request.NewErrParamMinLen("DeviceName", 1))
583	}
584	if s.AgentMetrics != nil {
585		for i, v := range s.AgentMetrics {
586			if v == nil {
587				continue
588			}
589			if err := v.Validate(); err != nil {
590				invalidParams.AddNested(fmt.Sprintf("%s[%v]", "AgentMetrics", i), err.(request.ErrInvalidParams))
591			}
592		}
593	}
594	if s.Models != nil {
595		for i, v := range s.Models {
596			if v == nil {
597				continue
598			}
599			if err := v.Validate(); err != nil {
600				invalidParams.AddNested(fmt.Sprintf("%s[%v]", "Models", i), err.(request.ErrInvalidParams))
601			}
602		}
603	}
604
605	if invalidParams.Len() > 0 {
606		return invalidParams
607	}
608	return nil
609}
610
611// SetAgentMetrics sets the AgentMetrics field's value.
612func (s *SendHeartbeatInput) SetAgentMetrics(v []*EdgeMetric) *SendHeartbeatInput {
613	s.AgentMetrics = v
614	return s
615}
616
617// SetAgentVersion sets the AgentVersion field's value.
618func (s *SendHeartbeatInput) SetAgentVersion(v string) *SendHeartbeatInput {
619	s.AgentVersion = &v
620	return s
621}
622
623// SetDeviceFleetName sets the DeviceFleetName field's value.
624func (s *SendHeartbeatInput) SetDeviceFleetName(v string) *SendHeartbeatInput {
625	s.DeviceFleetName = &v
626	return s
627}
628
629// SetDeviceName sets the DeviceName field's value.
630func (s *SendHeartbeatInput) SetDeviceName(v string) *SendHeartbeatInput {
631	s.DeviceName = &v
632	return s
633}
634
635// SetModels sets the Models field's value.
636func (s *SendHeartbeatInput) SetModels(v []*Model) *SendHeartbeatInput {
637	s.Models = v
638	return s
639}
640
641type SendHeartbeatOutput struct {
642	_ struct{} `type:"structure"`
643}
644
645// String returns the string representation.
646//
647// API parameter values that are decorated as "sensitive" in the API will not
648// be included in the string output. The member name will be present, but the
649// value will be replaced with "sensitive".
650func (s SendHeartbeatOutput) String() string {
651	return awsutil.Prettify(s)
652}
653
654// GoString returns the string representation.
655//
656// API parameter values that are decorated as "sensitive" in the API will not
657// be included in the string output. The member name will be present, but the
658// value will be replaced with "sensitive".
659func (s SendHeartbeatOutput) GoString() string {
660	return s.String()
661}
662