Skip to content

Commit

Permalink
Merge pull request #20809 from DrFaust92/r/sagemaker_endpoint_config_…
Browse files Browse the repository at this point in the history
…async

r/sagemaker_endpoint_config - add support for `async_inference_config`
  • Loading branch information
ewbankkit authored Sep 13, 2021
2 parents 86670cf + 9e754bf commit 56b168c
Show file tree
Hide file tree
Showing 6 changed files with 566 additions and 74 deletions.
3 changes: 3 additions & 0 deletions .changelog/20809.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:enhancement
resource/aws_sagemaker_endpoint_configuration: Add `async_inference_config` argument
```
45 changes: 28 additions & 17 deletions aws/internal/service/sagemaker/finder/finder.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"github.com/aws/aws-sdk-go/service/sagemaker"
"github.com/hashicorp/aws-sdk-go-base/tfawserr"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
"github.com/terraform-providers/terraform-provider-aws/aws/internal/tfresource"
)

// CodeRepositoryByName returns the code repository corresponding to the specified name.
Expand Down Expand Up @@ -103,10 +104,7 @@ func DeviceFleetByName(conn *sagemaker.SageMaker, id string) (*sagemaker.Describ
}

if output == nil {
return nil, &resource.NotFoundError{
Message: "Empty result",
LastRequest: input,
}
return nil, tfresource.NewEmptyResultError(input)
}

return output, nil
Expand Down Expand Up @@ -150,10 +148,7 @@ func FeatureGroupByName(conn *sagemaker.SageMaker, name string) (*sagemaker.Desc
}

if output == nil {
return nil, &resource.NotFoundError{
Message: "Empty result",
LastRequest: input,
}
return nil, tfresource.NewEmptyResultError(input)
}

return output, nil
Expand Down Expand Up @@ -239,10 +234,7 @@ func WorkforceByName(conn *sagemaker.SageMaker, name string) (*sagemaker.Workfor
}

if output == nil || output.Workforce == nil {
return nil, &resource.NotFoundError{
Message: "Empty result",
LastRequest: input,
}
return nil, tfresource.NewEmptyResultError(input)
}

return output.Workforce, nil
Expand All @@ -267,10 +259,7 @@ func WorkteamByName(conn *sagemaker.SageMaker, name string) (*sagemaker.Workteam
}

if output == nil || output.Workteam == nil {
return nil, &resource.NotFoundError{
Message: "Empty result",
LastRequest: input,
}
return nil, tfresource.NewEmptyResultError(input)
}

return output.Workteam, nil
Expand All @@ -295,11 +284,33 @@ func HumanTaskUiByName(conn *sagemaker.SageMaker, name string) (*sagemaker.Descr
}

if output == nil {
return nil, tfresource.NewEmptyResultError(input)
}

return output, nil
}

func EndpointConfigByName(conn *sagemaker.SageMaker, name string) (*sagemaker.DescribeEndpointConfigOutput, error) {
input := &sagemaker.DescribeEndpointConfigInput{
EndpointConfigName: aws.String(name),
}

output, err := conn.DescribeEndpointConfig(input)

if tfawserr.ErrMessageContains(err, "ValidationException", "Could not find endpoint configuration") {
return nil, &resource.NotFoundError{
Message: "Empty result",
LastError: err,
LastRequest: input,
}
}

if err != nil {
return nil, err
}

if output == nil {
return nil, tfresource.NewEmptyResultError(input)
}

return output, nil
}
Loading

0 comments on commit 56b168c

Please sign in to comment.