@@ -483,14 +483,7 @@ func (e *EphemeralCurlResource) Open(ctx context.Context, req ephemeral.OpenRequ
483483 bodyString = "{}"
484484 }
485485
486- var responseCodes []string
487- for _ , v := range data .ResponseCodes .Elements () {
488- if strVal , ok := v .(types.String ); ok {
489- responseCodes = append (responseCodes , strVal .ValueString ())
490- }
491- }
492-
493- if responseCodeChecker (responseCodes , strconv .Itoa (statusCode )) {
486+ if responseCodeChecker (data .ResponseCodes , statusCode ) {
494487 break
495488 }
496489
@@ -1143,14 +1136,7 @@ func (e *EphemeralCurlResource) Renew(ctx context.Context, req ephemeral.RenewRe
11431136 bodyString = "{}"
11441137 }
11451138
1146- var responseCodes []string
1147- for _ , v := range privateData .RenewResponseCodes .Elements () {
1148- if strVal , ok := v .(types.String ); ok {
1149- responseCodes = append (responseCodes , strVal .ValueString ())
1150- }
1151- }
1152-
1153- if responseCodeChecker (responseCodes , strconv .Itoa (statusCode )) {
1139+ if responseCodeChecker (privateData .RenewResponseCodes , statusCode ) {
11541140 break
11551141 }
11561142
@@ -1497,19 +1483,10 @@ func (e *EphemeralCurlResource) Close(ctx context.Context, req ephemeral.CloseRe
14971483 return
14981484 }
14991485
1500- var expectedCodes []string
15011486 tflog .Debug (ctx , fmt .Sprintf ("private data response code list: %v" , privateData .CloseResponseCodes .Elements ()))
1502- for _ , v := range privateData .CloseResponseCodes .Elements () {
1503- if strVal , ok := v .(types.String ); ok {
1504- expectedCodes = append (expectedCodes , strVal .ValueString ())
1505- }
1506- }
1507-
1508- tflog .Debug (ctx , fmt .Sprintf ("response code received: %v" , statusCode ))
1509- tflog .Debug (ctx , fmt .Sprintf ("expected response code received: %v" , expectedCodes ))
15101487
15111488 // Validate Response Code
1512- if responseCodeChecker (expectedCodes , strconv . Itoa ( statusCode ) ) {
1489+ if responseCodeChecker (privateData . CloseResponseCodes , statusCode ) {
15131490 tflog .Debug (ctx , "Close request completed successfully" )
15141491 break
15151492 } else {
0 commit comments