|
| 1 | +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. |
| 2 | +// |
| 3 | +// Licensed under the Apache License, Version 2.0 (the "License"). You may |
| 4 | +// not use this file except in compliance with the License. A copy of the |
| 5 | +// License is located at |
| 6 | +// |
| 7 | +// http://aws.amazon.com/apache2.0/ |
| 8 | +// |
| 9 | +// or in the "license" file accompanying this file. This file is distributed |
| 10 | +// on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either |
| 11 | +// express or implied. See the License for the specific language governing |
| 12 | +// permissions and limitations under the License. |
| 13 | + |
| 14 | +package model_package |
| 15 | + |
| 16 | +import ( |
| 17 | + svcapitypes "github.com/aws-controllers-k8s/sagemaker-controller/apis/v1alpha1" |
| 18 | + svccommon "github.com/aws-controllers-k8s/sagemaker-controller/pkg/common" |
| 19 | + svcsdk "github.com/aws/aws-sdk-go/service/sagemaker" |
| 20 | +) |
| 21 | + |
| 22 | +// CustomUpdateConditions sets conditions (terminal) on supplied model package. |
| 23 | +// it examines supplied resource to determine conditions. |
| 24 | +// It returns true if conditions are updated. |
| 25 | +func (rm *resourceManager) CustomUpdateConditions( |
| 26 | + ko *svcapitypes.ModelPackage, |
| 27 | + r *resource, |
| 28 | + err error, |
| 29 | +) bool { |
| 30 | + latestStatus := r.ko.Status.ModelPackageStatus |
| 31 | + terminalStatus := svcsdk.ModelPackageStatusFailed |
| 32 | + conditionManager := &resource{ko} |
| 33 | + // If the latestStatus == terminalStatus we will set |
| 34 | + // the terminal condition and terminal message. |
| 35 | + return svccommon.SetTerminalState(conditionManager, latestStatus, &resourceName, terminalStatus) |
| 36 | +} |
0 commit comments