Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add data capture config to Sagemaker endpoint configuration #11484

Conversation

SaiKiranBurle
Copy link
Contributor

Community Note

  • Please vote on this pull request by adding a 👍 reaction to the original pull request comment to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for pull request followers and do not help prioritize the request

Release note for CHANGELOG:

resource/aws_sagemaker_endpoint_configuration: Add `data_capture_config` argument.

Output from acceptance testing:

$ make testacc TEST=./aws TESTARGS='-run=TestAccAWSSagemakerEndpointConfiguration_DataCaptureConfig'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws -v -count 1 -parallel 20 -run=TestAccAWSSagemakerEndpointConfiguration_DataCaptureConfig -timeout 120m
=== RUN   TestAccAWSSagemakerEndpointConfiguration_DataCaptureConfig
=== PAUSE TestAccAWSSagemakerEndpointConfiguration_DataCaptureConfig
=== CONT  TestAccAWSSagemakerEndpointConfiguration_DataCaptureConfig
--- PASS: TestAccAWSSagemakerEndpointConfiguration_DataCaptureConfig (38.70s)
PASS
ok      github.com/terraform-providers/terraform-provider-aws/aws       38.749s

@SaiKiranBurle SaiKiranBurle requested a review from a team January 6, 2020 03:06
@ghost ghost added size/XL Managed by automation to categorize the size of a PR. needs-triage Waiting for first response or review from a maintainer. service/sagemaker Issues and PRs that pertain to the sagemaker service. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. documentation Introduces or discusses updates to documentation. labels Jan 6, 2020
@SaiKiranBurle
Copy link
Contributor Author

Just wondering what else needs to be done to get this merged.

Copy link
Collaborator

@DrFaust92 DrFaust92 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey, looks good! some comments on styling and simplifying handling of slices/lists

Type: schema.TypeString,
Required: true,
ForceNew: true,
ValidateFunc: validation.StringInSlice([]string{"Input", "Output"}, false),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lets change this to:
ValidateFunc: validation.StringInSlice(sagemaker.CaptureMode_Values(), false),

}

cfg := map[string]interface{}{
//"enable_capture": aws.BoolValue(dataCaptureConfig.EnableCapture),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let remove commented out code 😺

Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"csv_content_types": {
Type: schema.TypeList,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can similify this to look like this:

"csv_content_types": {
	Type:     schema.TypeSet,
	MinItems: 1,
	MaxItems: 10,
    Elem:     &schema.Schema{
      Type: schema.TypeString,
      ValidateFunc: validateSagemakerCsvContentType,                                         },
	Optional: true,
	ForceNew: true,
},

this will also look more similar to the API as it corresponds to slices CsvContentTypes []*string

ForceNew: true,
},

"json_content_types": {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as above

Comment on lines +454 to +463
if v, ok := m["csv_content_types"]; ok && len(v.([]interface{})) > 0 {
contentTypes := make([]*string, 0, len(v.([]interface{})))

for _, raw := range v.([]interface{}) {
sRaw := raw.(map[string]interface{})["content_type"]
contentTypes = append(contentTypes, aws.String(sRaw.(string)))
}

c.CsvContentTypes = contentTypes
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if the above changes to type are made this can be reduced to:

c.CsvContentTypes = expandStringSet(v.(*Schema.Set))

c.CsvContentTypes = contentTypes
}

if v, ok := m["json_content_types"]; ok && len(v.([]interface{})) > 0 {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as above

Comment on lines +486 to +497
if contentTypeHeader.CsvContentTypes != nil {
csvTypes := make([]map[string]interface{}, 0, len(contentTypeHeader.CsvContentTypes))

for _, csvType := range contentTypeHeader.CsvContentTypes {
m := map[string]interface{}{
"content_type": aws.StringValue(csvType),
}
csvTypes = append(csvTypes, m)
}

l["csv_content_types"] = csvTypes
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

again as above, this will reduced to:

l["csv_content_types"] = flattenStringSet(contentTypeHeader.CsvContentTypes)

Comment on lines +499 to +500
if contentTypeHeader.JsonContentTypes != nil {
jsonTypes := make([]map[string]interface{}, 0, len(contentTypeHeader.JsonContentTypes))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as above

@DrFaust92
Copy link
Collaborator

Hey @SaiKiranBurle, can you rebase and address comments? I can fork your repo and finish up the needed changes.

@bflad
Copy link
Contributor

bflad commented Oct 27, 2020

@DrFaust92 please feel free to submit new PR including this commit and we'll get it in. 👍

@bflad bflad added enhancement Requests to existing resources that expand the functionality or scope. waiting-response Maintainers are waiting on response from community or contributor. and removed needs-triage Waiting for first response or review from a maintainer. labels Oct 27, 2020
@DrFaust92 DrFaust92 self-assigned this Oct 28, 2020
@bflad
Copy link
Contributor

bflad commented Jan 22, 2021

It looks like this was covered by #15887, just that GitHub did not automatically close due to the rebased commit SHA.

@bflad bflad closed this Jan 22, 2021
@ghost
Copy link

ghost commented Feb 22, 2021

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks!

@ghost ghost locked as resolved and limited conversation to collaborators Feb 22, 2021
@breathingdust breathingdust removed the waiting-response Maintainers are waiting on response from community or contributor. label Sep 17, 2021
@DrFaust92 DrFaust92 removed their assignment Jun 6, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
documentation Introduces or discusses updates to documentation. enhancement Requests to existing resources that expand the functionality or scope. service/sagemaker Issues and PRs that pertain to the sagemaker service. size/XL Managed by automation to categorize the size of a PR. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants