diff --git a/syntheticsclientv2/common_models.go b/syntheticsclientv2/common_models.go index c5feabf..f910cbc 100644 --- a/syntheticsclientv2/common_models.go +++ b/syntheticsclientv2/common_models.go @@ -740,6 +740,7 @@ type HttpCheckV2ResponseWithNullablePort struct { Authentication *Authentication `json:"authentication"` UserAgent *string `json:"userAgent"` Verifycertificates bool `json:"verifyCertificates"` + CertificateID *NullableInt `json:"certificateId,omitempty"` HttpHeaders []HttpHeaders `json:"headers,omitempty"` Validations []Validations `json:"validations"` Customproperties []CustomProperties `json:"customProperties"` @@ -766,6 +767,7 @@ type HttpCheckV2InputWithNullablePort struct { Authentication *Authentication `json:"authentication"` UserAgent *string `json:"userAgent"` Verifycertificates bool `json:"verifyCertificates"` + CertificateID *NullableInt `json:"certificateId,omitempty"` HttpHeaders []HttpHeaders `json:"headers,omitempty"` Validations []Validations `json:"validations"` Customproperties []CustomProperties `json:"customProperties"` diff --git a/syntheticsclientv2/httpcheckv2_nullable_port_test.go b/syntheticsclientv2/httpcheckv2_nullable_port_test.go index 0deec62..5ccef22 100644 --- a/syntheticsclientv2/httpcheckv2_nullable_port_test.go +++ b/syntheticsclientv2/httpcheckv2_nullable_port_test.go @@ -38,7 +38,14 @@ func TestCreateHttpCheckV2WithNullablePortSendsNullPort(t *testing.T) { if string(rawPort) != "null" { t.Fatalf("request body test.port = %s, want null", rawPort) } - _, err := w.Write([]byte(`{"test":{"id":11,"name":"nullable-port","type":"http","url":"https://example.com","requestMethod":"GET","port":null}}`)) + rawCertificateID, ok := fields["certificateId"] + if !ok { + t.Fatal("request body missing test.certificateId") + } + if string(rawCertificateID) != "123" { + t.Fatalf("request body test.certificateId = %s, want 123", rawCertificateID) + } + _, err := w.Write([]byte(`{"test":{"id":11,"name":"nullable-port","type":"http","url":"https://example.com","requestMethod":"GET","port":null,"certificateId":123}}`)) if err != nil { t.Fatal(err) } @@ -46,6 +53,7 @@ func TestCreateHttpCheckV2WithNullablePortSendsNullPort(t *testing.T) { input := minimalHttpCheckV2InputWithNullablePort() input.Test.Port = *NewNullInt() + input.Test.CertificateID = NewNullableInt(123) resp, _, err := testClient.CreateHttpCheckV2WithNullablePort(&input) if err != nil { @@ -54,6 +62,9 @@ func TestCreateHttpCheckV2WithNullablePortSendsNullPort(t *testing.T) { if resp.Test.Port.Value != nil { t.Fatalf("response port = %#v, want nil", resp.Test.Port.Value) } + if resp.Test.CertificateID == nil || resp.Test.CertificateID.Value == nil || *resp.Test.CertificateID.Value != 123 { + t.Fatalf("response certificate ID = %#v, want 123", resp.Test.CertificateID) + } } func TestUpdateHttpCheckV2WithNullablePortSendsZeroPort(t *testing.T) { @@ -70,6 +81,13 @@ func TestUpdateHttpCheckV2WithNullablePortSendsZeroPort(t *testing.T) { if string(rawPort) != "0" { t.Fatalf("request body test.port = %s, want 0", rawPort) } + rawCertificateID, ok := fields["certificateId"] + if !ok { + t.Fatal("request body missing test.certificateId") + } + if string(rawCertificateID) != "null" { + t.Fatalf("request body test.certificateId = %s, want null", rawCertificateID) + } _, err := w.Write([]byte(`{"test":{"id":12,"name":"nullable-port","type":"http","url":"https://example.com","requestMethod":"GET","port":0}}`)) if err != nil { t.Fatal(err) @@ -78,6 +96,7 @@ func TestUpdateHttpCheckV2WithNullablePortSendsZeroPort(t *testing.T) { input := minimalHttpCheckV2InputWithNullablePort() input.Test.Port = *NewNullableInt(0) + input.Test.CertificateID = NewNullInt() resp, _, err := testClient.UpdateHttpCheckV2WithNullablePort(12, &input) if err != nil { @@ -102,7 +121,7 @@ func TestGetHttpCheckV2WithNullablePortPreservesNullAndValue(t *testing.T) { }, { name: "value", - body: `{"test":{"id":13,"name":"nullable-port","type":"http","url":"https://example.com","requestMethod":"GET","port":443}}`, + body: `{"test":{"id":13,"name":"nullable-port","type":"http","url":"https://example.com","requestMethod":"GET","port":443,"certificateId":123}}`, wantValue: 443, }, } @@ -133,6 +152,9 @@ func TestGetHttpCheckV2WithNullablePortPreservesNullAndValue(t *testing.T) { if resp.Test.Port.Value == nil || *resp.Test.Port.Value != tt.wantValue { t.Fatalf("response port = %#v, want %d", resp.Test.Port.Value, tt.wantValue) } + if resp.Test.CertificateID == nil || resp.Test.CertificateID.Value == nil || *resp.Test.CertificateID.Value != 123 { + t.Fatalf("response certificate ID = %#v, want 123", resp.Test.CertificateID) + } }) } }