From 0860545368c146fa65e21b53e7e0529775fecda8 Mon Sep 17 00:00:00 2001 From: Min Jiang Date: Thu, 1 Feb 2024 10:00:58 -0800 Subject: [PATCH 1/4] test runs, more fields needed to be test --- keys/api_tsig.go | 1 + keys/model_keys_tsig_key.go | 2 + keys/test/api_tsig_test.go | 88 +++++++++++++++++++++++------------- keys/test/api_upload_test.go | 11 ++--- 4 files changed, 65 insertions(+), 37 deletions(-) diff --git a/keys/api_tsig.go b/keys/api_tsig.go index 4386f89..327f290 100644 --- a/keys/api_tsig.go +++ b/keys/api_tsig.go @@ -13,6 +13,7 @@ package keys import ( "bytes" "context" + _ "github.com/infobloxopen/bloxone-go-client/dns_config" "io" "net/http" "net/url" diff --git a/keys/model_keys_tsig_key.go b/keys/model_keys_tsig_key.go index 9ebb444..12c1ea5 100644 --- a/keys/model_keys_tsig_key.go +++ b/keys/model_keys_tsig_key.go @@ -13,6 +13,7 @@ package keys import ( "encoding/json" "time" + ) // checks if the KeysTSIGKey type satisfies the MappedNullable interface at compile time @@ -38,6 +39,7 @@ type KeysTSIGKey struct { Tags map[string]interface{} `json:"tags,omitempty"` // Time when the object has been updated. Equals to _created_at_ if not updated after creation. UpdatedAt *time.Time `json:"updated_at,omitempty"` + res interface{} } // NewKeysTSIGKey instantiates a new KeysTSIGKey object diff --git a/keys/test/api_tsig_test.go b/keys/test/api_tsig_test.go index c11a32a..31eee82 100644 --- a/keys/test/api_tsig_test.go +++ b/keys/test/api_tsig_test.go @@ -7,54 +7,76 @@ Testing TsigAPIService // Code generated by OpenAPI Generator (https://openapi-generator.tech); -package keys +package keys_test import ( "context" - "testing" - + "github.com/infobloxopen/bloxone-go-client/client" + openapiclient "github.com/infobloxopen/bloxone-go-client/keys" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - - "github.com/infobloxopen/bloxone-go-client/internal" - openapiclient "github.com/infobloxopen/bloxone-go-client/keys" + "net/http" + "strings" + "testing" ) func Test_keys_TsigAPIService(t *testing.T) { - - configuration := internal.NewConfiguration() - apiClient := openapiclient.NewAPIClient(configuration) + rq := require.New(t) + c, err := client.NewAPIClient(client.Configuration{ClientName: "test"}) + rq.NoError(err) + apiClient := c.KeysAPI + dummyKey := openapiclient.KeysTSIGKey{ + Algorithm: openapiclient.PtrString("hmac_sha256"), + Comment: nil, // or use: String("This is a comment") + CreatedAt: nil, // or use: Time(time.Now()) + Id: nil, //openapiclient.PtrString("123"), + Name: "dummyKey36", + ProtocolName: nil, // or use: String("protocolName") + Secret: "XOJvQkcX6Og0CHFg+rQ27pqAB+EhSjVoI4Bs/JWegBc=", + Tags: nil, //make(map[string]interface{}), + UpdatedAt: nil, // or use: Time(time.Now()) + } + var createResp *openapiclient.KeysCreateTSIGKeyResponse // replace with the actual type of resp + var httpRes *http.Response t.Run("Test TsigAPIService TsigCreate", func(t *testing.T) { - t.Skip("skip test") // remove to run test - - resp, httpRes, err := apiClient.TsigAPI.TsigCreate(context.Background()).Execute() + //t.Skip("skip test") // remove to run test + ctx := context.Background() + req := apiClient.TsigAPI.TsigCreate(ctx) + req = req.Body(dummyKey) + createResp, httpRes, err = req.Execute() require.Nil(t, err) - require.NotNil(t, resp) + require.NotNil(t, createResp) assert.Equal(t, 200, httpRes.StatusCode) }) - t.Run("Test TsigAPIService TsigDelete", func(t *testing.T) { - - t.Skip("skip test") // remove to run test - - var id string + t.Run("Test TsigAPIService TsigList", func(t *testing.T) { - httpRes, err := apiClient.TsigAPI.TsigDelete(context.Background(), id).Execute() + //t.Skip("skip test") // remove to run test + req := apiClient.TsigAPI.TsigList(context.Background()).Fields("name") + resp, httpRes, err := req.Execute() require.Nil(t, err) + require.NotNil(t, resp) assert.Equal(t, 200, httpRes.StatusCode) }) - t.Run("Test TsigAPIService TsigList", func(t *testing.T) { + t.Run("Test TsigAPIService TsigRead", func(t *testing.T) { - t.Skip("skip test") // remove to run test + //t.Skip("skip test") // remove to run test - resp, httpRes, err := apiClient.TsigAPI.TsigList(context.Background()).Execute() + var id string + id = *createResp.GetResult().Id + lastSlash := strings.LastIndex(id, "/") + uuid := string(id[lastSlash+1:]) + + req := apiClient.TsigAPI.TsigRead(context.Background(), uuid) + req.Fields("name") + resp, httpRes, err := req.Execute() require.Nil(t, err) require.NotNil(t, resp) @@ -62,13 +84,17 @@ func Test_keys_TsigAPIService(t *testing.T) { }) - t.Run("Test TsigAPIService TsigRead", func(t *testing.T) { + t.Run("Test TsigAPIService TsigUpdate", func(t *testing.T) { - t.Skip("skip test") // remove to run test + //t.Skip("skip test") // remove to run test var id string + id = *createResp.GetResult().Id + lastSlash := strings.LastIndex(id, "/") + uuid := id[lastSlash+1:] + req := apiClient.TsigAPI.TsigUpdate(context.Background(), uuid).Body(dummyKey) - resp, httpRes, err := apiClient.TsigAPI.TsigRead(context.Background(), id).Execute() + resp, httpRes, err := req.Execute() require.Nil(t, err) require.NotNil(t, resp) @@ -76,16 +102,16 @@ func Test_keys_TsigAPIService(t *testing.T) { }) - t.Run("Test TsigAPIService TsigUpdate", func(t *testing.T) { - - t.Skip("skip test") // remove to run test + t.Run("Test TsigAPIService TsigDelete", func(t *testing.T) { - var id string + //t.Skip("skip test") // remove to run test - resp, httpRes, err := apiClient.TsigAPI.TsigUpdate(context.Background(), id).Execute() + var id = *createResp.GetResult().Id + lastSlash := strings.LastIndex(id, "/") + uuid := string(id[lastSlash+1:]) + httpRes, err := apiClient.TsigAPI.TsigDelete(context.Background(), uuid).Execute() require.Nil(t, err) - require.NotNil(t, resp) assert.Equal(t, 200, httpRes.StatusCode) }) diff --git a/keys/test/api_upload_test.go b/keys/test/api_upload_test.go index f2cd257..220be43 100644 --- a/keys/test/api_upload_test.go +++ b/keys/test/api_upload_test.go @@ -11,19 +11,18 @@ package keys import ( "context" + "github.com/infobloxopen/bloxone-go-client/client" "testing" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - - "github.com/infobloxopen/bloxone-go-client/internal" - openapiclient "github.com/infobloxopen/bloxone-go-client/keys" ) func Test_keys_UploadAPIService(t *testing.T) { - - configuration := internal.NewConfiguration() - apiClient := openapiclient.NewAPIClient(configuration) + rq := require.New(t) + c, err := client.NewAPIClient(client.Configuration{ClientName: "test"}) + rq.NoError(err) + apiClient := c.KeysAPI t.Run("Test UploadAPIService UploadUpload", func(t *testing.T) { From 698c3387a7620765b157d58b233ac3a8f93b41ea Mon Sep 17 00:00:00 2001 From: Min Jiang Date: Tue, 13 Feb 2024 09:52:59 -0800 Subject: [PATCH 2/4] tests done, except for kerberos --- keys/.openapi-generator/FILES | 2 + keys/.openapi-generator/VERSION | 2 +- keys/test/api_generate_tsig_test.go | 62 ++++++-- keys/test/api_kerberos_test.go | 206 ++++++++++++++++++++----- keys/test/api_tsig_test.go | 231 ++++++++++++++++++---------- keys/test/api_upload_test.go | 68 ++++++-- 6 files changed, 418 insertions(+), 153 deletions(-) diff --git a/keys/.openapi-generator/FILES b/keys/.openapi-generator/FILES index 619bfc0..a5d04a4 100644 --- a/keys/.openapi-generator/FILES +++ b/keys/.openapi-generator/FILES @@ -40,4 +40,6 @@ model_keys_update_tsig_key_response.go model_protobuf_field_mask.go model_upload_content_type.go model_upload_request.go +test/api_generate_tsig_test.go +test/api_upload_test.go utils.go diff --git a/keys/.openapi-generator/VERSION b/keys/.openapi-generator/VERSION index 9fe9ff9..4b49d9b 100644 --- a/keys/.openapi-generator/VERSION +++ b/keys/.openapi-generator/VERSION @@ -1 +1 @@ -7.0.1 +7.2.0 \ No newline at end of file diff --git a/keys/test/api_generate_tsig_test.go b/keys/test/api_generate_tsig_test.go index 3ea00f9..8f29e45 100644 --- a/keys/test/api_generate_tsig_test.go +++ b/keys/test/api_generate_tsig_test.go @@ -7,34 +7,62 @@ Testing GenerateTsigAPIService // Code generated by OpenAPI Generator (https://openapi-generator.tech); -package keys +package keys_test import ( + "bytes" "context" - "testing" - - "github.com/stretchr/testify/assert" + "encoding/json" "github.com/stretchr/testify/require" + "io" + "net/http" + "testing" "github.com/infobloxopen/bloxone-go-client/internal" openapiclient "github.com/infobloxopen/bloxone-go-client/keys" ) -func Test_keys_GenerateTsigAPIService(t *testing.T) { +//type RoundTripFunc func(req *http.Request) *http.Response +// +//func (f RoundTripFunc) RoundTrip(req *http.Request) (*http.Response, error) { +// return f(req), nil +//} +// +//func NewTestClient(fn RoundTripFunc) *http.Client { +// return &http.Client{ +// Transport: RoundTripFunc(fn), +// } +//} +func Test_keys_GenerateTsigAPIService(t *testing.T) { configuration := internal.NewConfiguration() - apiClient := openapiclient.NewAPIClient(configuration) - - t.Run("Test GenerateTsigAPIService GenerateTsigGenerateTSIG", func(t *testing.T) { - - t.Skip("skip test") // remove to run test - - resp, httpRes, err := apiClient.GenerateTsigAPI.GenerateTsigGenerateTSIG(context.Background()).Execute() - - require.Nil(t, err) - require.NotNil(t, resp) - assert.Equal(t, 200, httpRes.StatusCode) + dummyKey := openapiclient.KeysGenerateTSIGResult{ + Secret: openapiclient.PtrString("XOJvQkcX6Og0CHFg+rQ27pqAB+EhSjVoI4Bs/JWegBc="), + } + configuration.HTTPClient = NewTestClient(func(req *http.Request) *http.Response { + require.Equal(t, "GET", req.Method) + require.Equal(t, "/api/ddi/v1/keys/generate_tsig", req.URL.Path) + require.Equal(t, "application/json", req.Header.Get("Accept")) + require.Equal(t, "hmac_sha256", req.URL.Query().Get("algorithm")) + response := openapiclient.KeysGenerateTSIGResponse{ + Result: &dummyKey, + } + body, err := json.Marshal(response) + require.NoError(t, err) + return &http.Response{ + StatusCode: 200, + Body: io.NopCloser(bytes.NewReader(body)), + Header: map[string][]string{ + "Content-Type": {"application/json"}, + }, + } }) - + apiClient := openapiclient.NewAPIClient(configuration) + request := apiClient.GenerateTsigAPI.GenerateTsigGenerateTSIG(context.Background()).Algorithm("hmac_sha256") + response, httpRes, err := request.Execute() + require.Nil(t, err) + require.Equal(t, 200, httpRes.StatusCode) + require.NotNil(t, response) + require.Equal(t, "XOJvQkcX6Og0CHFg+rQ27pqAB+EhSjVoI4Bs/JWegBc=", *response.Result.Secret) } diff --git a/keys/test/api_kerberos_test.go b/keys/test/api_kerberos_test.go index 21283c8..6b54d87 100644 --- a/keys/test/api_kerberos_test.go +++ b/keys/test/api_kerberos_test.go @@ -7,75 +7,201 @@ Testing KerberosAPIService // Code generated by OpenAPI Generator (https://openapi-generator.tech); -package keys +package keys_test import ( + "bytes" "context" - "testing" - - "github.com/stretchr/testify/assert" + "encoding/json" "github.com/stretchr/testify/require" + "io" + "net/http" + "testing" "github.com/infobloxopen/bloxone-go-client/internal" openapiclient "github.com/infobloxopen/bloxone-go-client/keys" ) -func Test_keys_KerberosAPIService(t *testing.T) { - - configuration := internal.NewConfiguration() - apiClient := openapiclient.NewAPIClient(configuration) - - t.Run("Test KerberosAPIService KerberosDelete", func(t *testing.T) { +//type RoundTripFunc func(req *http.Request) *http.Response +// +//func (f RoundTripFunc) RoundTrip(req *http.Request) (*http.Response, error) { +// return f(req), nil +//} +// +//func NewTestClient(fn RoundTripFunc) *http.Client { +// return &http.Client{ +// Transport: RoundTripFunc(fn), +// } +//} - t.Skip("skip test") // remove to run test +func Test_keys_KerberosAPIService(t *testing.T) { - var id string + t.Run("Test KerberosAPIService KerberosRead", func(t *testing.T) { - httpRes, err := apiClient.KerberosAPI.KerberosDelete(context.Background(), id).Execute() + t.Skip("skip test") + + configuration := internal.NewConfiguration() + configuration.HTTPClient = NewTestClient(func(req *http.Request) *http.Response { + require.Equal(t, "GET", req.Method) + require.Equal(t, "/api/ddi/v1/keys/kerberos/dummyKey", req.URL.Path) + require.Equal(t, "application/json", req.Header.Get("Accept")) + + response := openapiclient.KeysReadKerberosKeyResponse{ + Result: &openapiclient.KerberosKey{ + Algorithm: openapiclient.PtrString("aes256-cts-hmac-sha1-96"), + Comment: openapiclient.PtrString("Test Kerberos Key"), + Id: nil, + }, + } + body, err := json.Marshal(response) + require.NoError(t, err) + return &http.Response{ + StatusCode: 200, + Body: io.NopCloser(bytes.NewReader(body)), + Header: map[string][]string{ + "Content-Type": {"application/json"}, + }, + } + }) + apiClient := openapiclient.NewAPIClient(configuration) + resp, httpRes, err := apiClient.KerberosAPI.KerberosRead(context.Background(), "dummyKey").Execute() require.Nil(t, err) - assert.Equal(t, 200, httpRes.StatusCode) - + require.NotNil(t, resp) + require.Equal(t, 200, httpRes.StatusCode) }) - t.Run("Test KerberosAPIService KerberosList", func(t *testing.T) { - - t.Skip("skip test") // remove to run test - + t.Run("Test KerberosAPIService KerberosKeyList", func(t *testing.T) { + + t.Skip("skip test") + + configuration := internal.NewConfiguration() + configuration.HTTPClient = NewTestClient(func(req *http.Request) *http.Response { + require.Equal(t, "GET", req.Method) + require.Equal(t, "/api/ddi/v1/keys/kerberos", req.URL.Path) + require.Equal(t, "application/json", req.Header.Get("Accept")) + + response := openapiclient.KeysListKerberosKeyResponse{ + Results: []openapiclient.KerberosKey{ + { + Algorithm: openapiclient.PtrString("aes256-cts-hmac-sha1-96"), + Comment: openapiclient.PtrString("Test Kerberos Key"), + Id: nil, + }, + }, + } + body, err := json.Marshal(response) + require.NoError(t, err) + return &http.Response{ + StatusCode: 200, + Body: io.NopCloser(bytes.NewReader(body)), + Header: map[string][]string{ + "Content-Type": {"application/json"}, + }, + } + }) + apiClient := openapiclient.NewAPIClient(configuration) resp, httpRes, err := apiClient.KerberosAPI.KerberosList(context.Background()).Execute() - require.Nil(t, err) require.NotNil(t, resp) - assert.Equal(t, 200, httpRes.StatusCode) - + require.Equal(t, 200, httpRes.StatusCode) + require.NotEmpty(t, resp.Results) }) - t.Run("Test KerberosAPIService KerberosRead", func(t *testing.T) { - - t.Skip("skip test") // remove to run test - - var id string - - resp, httpRes, err := apiClient.KerberosAPI.KerberosRead(context.Background(), id).Execute() + t.Run("Test KerberosAPIService KerberosUpdate", func(t *testing.T) { + t.Skip("skip test") + + dummyKey := openapiclient.KerberosKey{ + Algorithm: openapiclient.PtrString("RFC 3961"), + Comment: openapiclient.PtrString("Test Update Kerberos Key"), + Id: nil, + } + configuration := internal.NewConfiguration() + configuration.HTTPClient = NewTestClient(func(req *http.Request) *http.Response { + require.Equal(t, "PATCH", req.Method) + require.Equal(t, "/api/ddi/v1/keys/kerberos/dummyKey", req.URL.Path) + require.Equal(t, "application/json", req.Header.Get("Content-Type")) + var reqBody openapiclient.KerberosKey + require.NoError(t, json.NewDecoder(req.Body).Decode(&reqBody)) + require.Equal(t, dummyKey, reqBody) + + response := openapiclient.KeysUpdateKerberosKeyResponse{ + Result: &dummyKey, + } + body, err := json.Marshal(response) + require.NoError(t, err) + return &http.Response{ + StatusCode: 200, + Body: io.NopCloser(bytes.NewReader(body)), + Header: map[string][]string{ + "Content-Type": {"application/json"}, + }, + } + }) + apiClient := openapiclient.NewAPIClient(configuration) + updateRequest := apiClient.KerberosAPI.KerberosUpdate(context.Background(), "dummyKey").Body(dummyKey) + resp, httpRes, err := updateRequest.Execute() require.Nil(t, err) require.NotNil(t, resp) - assert.Equal(t, 200, httpRes.StatusCode) - + require.Equal(t, 200, httpRes.StatusCode) }) - t.Run("Test KerberosAPIService KerberosUpdate", func(t *testing.T) { - - t.Skip("skip test") // remove to run test - - var id string - - resp, httpRes, err := apiClient.KerberosAPI.KerberosUpdate(context.Background(), id).Execute() - + t.Run("Test TsigAPIService TsigUpdate", func(t *testing.T) { + + t.Skip("skip test") + + dummyKey := openapiclient.KeysTSIGKey{ + Algorithm: openapiclient.PtrString("hmac_sha256"), + Name: "dummyKey36", + Secret: "XOJvQkcX6Og0CHFg+rQ27pqAB+EhSjVoI4Bs/JWegBc=", + } + configuration := internal.NewConfiguration() + configuration.HTTPClient = NewTestClient(func(req *http.Request) *http.Response { + require.Equal(t, "PATCH", req.Method) + require.Equal(t, "/api/ddi/v1/keys/tsig/dummyKey36", req.URL.Path) + require.Equal(t, "application/json", req.Header.Get("Content-Type")) + var reqBody openapiclient.KeysTSIGKey + require.NoError(t, json.NewDecoder(req.Body).Decode(&reqBody)) + require.Equal(t, dummyKey, reqBody) + + response := openapiclient.KeysUpdateTSIGKeyResponse{ + Result: &dummyKey, + } + body, err := json.Marshal(response) + require.NoError(t, err) + return &http.Response{ + StatusCode: 200, + Body: io.NopCloser(bytes.NewReader(body)), + Header: map[string][]string{ + "Content-Type": {"application/json"}, + }, + } + }) + apiClient := openapiclient.NewAPIClient(configuration) + updateRequest := apiClient.TsigAPI.TsigUpdate(context.Background(), "dummyKey36").Body(dummyKey) + resp, httpRes, err := updateRequest.Execute() require.Nil(t, err) require.NotNil(t, resp) - assert.Equal(t, 200, httpRes.StatusCode) + require.Equal(t, 200, httpRes.StatusCode) + }) + t.Run("Test KerberosAPIService KerberosDelete", func(t *testing.T) { + t.Skip("skip test") + configuration := internal.NewConfiguration() + configuration.HTTPClient = NewTestClient(func(req *http.Request) *http.Response { + require.Equal(t, "DELETE", req.Method) + require.Equal(t, "/api/ddi/v1/keys/kerberos/dummyKey36", req.URL.Path) + return &http.Response{ + StatusCode: 204, + Body: io.NopCloser(bytes.NewReader([]byte{})), + Header: make(http.Header), + } + }) + apiClient := openapiclient.NewAPIClient(configuration) + httpRes, err := apiClient.KerberosAPI.KerberosDelete(context.Background(), "dummyKey36").Execute() + require.Nil(t, err) + require.Equal(t, 204, httpRes.StatusCode) }) } diff --git a/keys/test/api_tsig_test.go b/keys/test/api_tsig_test.go index 31eee82..27e02c0 100644 --- a/keys/test/api_tsig_test.go +++ b/keys/test/api_tsig_test.go @@ -1,119 +1,182 @@ -/* -DDI Keys API - -Testing TsigAPIService - -*/ - -// Code generated by OpenAPI Generator (https://openapi-generator.tech); - package keys_test import ( + "bytes" "context" - "github.com/infobloxopen/bloxone-go-client/client" + "encoding/json" + "github.com/infobloxopen/bloxone-go-client/internal" openapiclient "github.com/infobloxopen/bloxone-go-client/keys" - "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + "io" "net/http" - "strings" "testing" ) -func Test_keys_TsigAPIService(t *testing.T) { - rq := require.New(t) - c, err := client.NewAPIClient(client.Configuration{ClientName: "test"}) - rq.NoError(err) - apiClient := c.KeysAPI - dummyKey := openapiclient.KeysTSIGKey{ - Algorithm: openapiclient.PtrString("hmac_sha256"), - Comment: nil, // or use: String("This is a comment") - CreatedAt: nil, // or use: Time(time.Now()) - Id: nil, //openapiclient.PtrString("123"), - Name: "dummyKey36", - ProtocolName: nil, // or use: String("protocolName") - Secret: "XOJvQkcX6Og0CHFg+rQ27pqAB+EhSjVoI4Bs/JWegBc=", - Tags: nil, //make(map[string]interface{}), - UpdatedAt: nil, // or use: Time(time.Now()) - } - var createResp *openapiclient.KeysCreateTSIGKeyResponse // replace with the actual type of resp - var httpRes *http.Response +type RoundTripFunc func(req *http.Request) *http.Response - t.Run("Test TsigAPIService TsigCreate", func(t *testing.T) { +func (f RoundTripFunc) RoundTrip(req *http.Request) (*http.Response, error) { + return f(req), nil +} - //t.Skip("skip test") // remove to run test +func NewTestClient(fn RoundTripFunc) *http.Client { + return &http.Client{ + Transport: RoundTripFunc(fn), + } +} - ctx := context.Background() - req := apiClient.TsigAPI.TsigCreate(ctx) - req = req.Body(dummyKey) - createResp, httpRes, err = req.Execute() +func Test_keys_TsigAPIService(t *testing.T) { + t.Run("Test TsigAPIService TsigCreate", func(t *testing.T) { + dummyKey := openapiclient.KeysTSIGKey{ + Algorithm: openapiclient.PtrString("hmac_sha256"), + Name: "dummyKey36", + Secret: "XOJvQkcX6Og0CHFg+rQ27pqAB+EhSjVoI4Bs/JWegBc=", + } + configuration := internal.NewConfiguration() + configuration.HTTPClient = NewTestClient(func(req *http.Request) *http.Response { + require.Equal(t, "POST", req.Method) + require.Equal(t, "/api/ddi/v1/keys/tsig", req.URL.Path) + require.Equal(t, "application/json", req.Header.Get("Content-Type")) + var reqBody openapiclient.KeysTSIGKey + require.NoError(t, json.NewDecoder(req.Body).Decode(&reqBody)) + require.Equal(t, dummyKey, reqBody) + + response := openapiclient.KeysCreateTSIGKeyResponse{ + Result: &dummyKey, + } + body, err := json.Marshal(response) + require.NoError(t, err) + return &http.Response{ + StatusCode: 200, + Body: io.NopCloser(bytes.NewReader(body)), + Header: map[string][]string{ + "Content-Type": {"application/json"}, + }, + } + }) + apiClient := openapiclient.NewAPIClient(configuration) + resp, httpRes, err := apiClient.TsigAPI.TsigCreate(context.Background()).Body(dummyKey).Execute() require.Nil(t, err) - require.NotNil(t, createResp) - assert.Equal(t, 200, httpRes.StatusCode) - + require.NotNil(t, resp) + require.Equal(t, 200, httpRes.StatusCode) }) t.Run("Test TsigAPIService TsigList", func(t *testing.T) { - - //t.Skip("skip test") // remove to run test - req := apiClient.TsigAPI.TsigList(context.Background()).Fields("name") - resp, httpRes, err := req.Execute() - + configuration := internal.NewConfiguration() + configuration.HTTPClient = NewTestClient(func(req *http.Request) *http.Response { + require.Equal(t, "GET", req.Method) + require.Equal(t, "/api/ddi/v1/keys/tsig", req.URL.Path) + require.Equal(t, "application/json", req.Header.Get("Accept")) + + response := openapiclient.KeysListTSIGKeyResponse{ + Results: []openapiclient.KeysTSIGKey{ + { + Algorithm: openapiclient.PtrString("hmac_sha256"), + Name: "dummyKey36", + Secret: "XOJvQkcX6Og0CHFg+rQ27pqAB+EhSjVoI4Bs/JWegBc=", + }, + }, + } + body, err := json.Marshal(response) + require.NoError(t, err) + return &http.Response{ + StatusCode: 200, + Body: io.NopCloser(bytes.NewReader(body)), + Header: map[string][]string{ + "Content-Type": {"application/json"}, + }, + } + }) + apiClient := openapiclient.NewAPIClient(configuration) + resp, httpRes, err := apiClient.TsigAPI.TsigList(context.Background()).Execute() require.Nil(t, err) require.NotNil(t, resp) - assert.Equal(t, 200, httpRes.StatusCode) - + require.Equal(t, 200, httpRes.StatusCode) + require.NotEmpty(t, resp.Results) }) t.Run("Test TsigAPIService TsigRead", func(t *testing.T) { - - //t.Skip("skip test") // remove to run test - - var id string - id = *createResp.GetResult().Id - lastSlash := strings.LastIndex(id, "/") - uuid := string(id[lastSlash+1:]) - - req := apiClient.TsigAPI.TsigRead(context.Background(), uuid) - req.Fields("name") - resp, httpRes, err := req.Execute() + configuration := internal.NewConfiguration() + configuration.HTTPClient = NewTestClient(func(req *http.Request) *http.Response { + require.Equal(t, "GET", req.Method) + require.Equal(t, "/api/ddi/v1/keys/tsig/dummyKey36", req.URL.Path) + require.Equal(t, "application/json", req.Header.Get("Accept")) + + response := openapiclient.KeysListTSIGKeyResponse{ + Results: []openapiclient.KeysTSIGKey{ + { + Algorithm: openapiclient.PtrString("hmac_sha256"), + Name: "dummyKey36", + Secret: "XOJvQkcX6Og0CHFg+rQ27pqAB+EhSjVoI4Bs/JWegBc=", + }, + }, + } + body, err := json.Marshal(response) + require.NoError(t, err) + return &http.Response{ + StatusCode: 200, + Body: io.NopCloser(bytes.NewReader(body)), + Header: map[string][]string{ + "Content-Type": {"application/json"}, + }, + } + }) + apiClient := openapiclient.NewAPIClient(configuration) + resp, httpRes, err := apiClient.TsigAPI.TsigRead(context.Background(), "dummyKey36").Execute() require.Nil(t, err) require.NotNil(t, resp) - assert.Equal(t, 200, httpRes.StatusCode) - + require.Equal(t, 200, httpRes.StatusCode) }) - t.Run("Test TsigAPIService TsigUpdate", func(t *testing.T) { - - //t.Skip("skip test") // remove to run test - - var id string - id = *createResp.GetResult().Id - lastSlash := strings.LastIndex(id, "/") - uuid := id[lastSlash+1:] - req := apiClient.TsigAPI.TsigUpdate(context.Background(), uuid).Body(dummyKey) - - resp, httpRes, err := req.Execute() - + dummyKey := openapiclient.KeysTSIGKey{ + Algorithm: openapiclient.PtrString("hmac_sha256"), + Name: "dummyKey36", + Secret: "XOJvQkcX6Og0CHFg+rQ27pqAB+EhSjVoI4Bs/JWegBc=", + } + configuration := internal.NewConfiguration() + configuration.HTTPClient = NewTestClient(func(req *http.Request) *http.Response { + require.Equal(t, "PATCH", req.Method) + require.Equal(t, "/api/ddi/v1/keys/tsig/dummyKey36", req.URL.Path) + require.Equal(t, "application/json", req.Header.Get("Content-Type")) + var reqBody openapiclient.KeysTSIGKey + require.NoError(t, json.NewDecoder(req.Body).Decode(&reqBody)) + require.Equal(t, dummyKey, reqBody) + + response := openapiclient.KeysUpdateTSIGKeyResponse{ + Result: &dummyKey, + } + body, err := json.Marshal(response) + require.NoError(t, err) + return &http.Response{ + StatusCode: 200, + Body: io.NopCloser(bytes.NewReader(body)), + Header: map[string][]string{ + "Content-Type": {"application/json"}, + }, + } + }) + apiClient := openapiclient.NewAPIClient(configuration) + updateRequest := apiClient.TsigAPI.TsigUpdate(context.Background(), "dummyKey36").Body(dummyKey) + resp, httpRes, err := updateRequest.Execute() require.Nil(t, err) require.NotNil(t, resp) - assert.Equal(t, 200, httpRes.StatusCode) - + require.Equal(t, 200, httpRes.StatusCode) }) t.Run("Test TsigAPIService TsigDelete", func(t *testing.T) { - - //t.Skip("skip test") // remove to run test - - var id = *createResp.GetResult().Id - lastSlash := strings.LastIndex(id, "/") - uuid := string(id[lastSlash+1:]) - httpRes, err := apiClient.TsigAPI.TsigDelete(context.Background(), uuid).Execute() - + configuration := internal.NewConfiguration() + configuration.HTTPClient = NewTestClient(func(req *http.Request) *http.Response { + require.Equal(t, "DELETE", req.Method) + require.Equal(t, "/api/ddi/v1/keys/tsig/dummyKey36", req.URL.Path) + return &http.Response{ + StatusCode: 204, + Body: io.NopCloser(bytes.NewReader([]byte{})), + Header: make(http.Header), + } + }) + apiClient := openapiclient.NewAPIClient(configuration) + httpRes, err := apiClient.TsigAPI.TsigDelete(context.Background(), "dummyKey36").Execute() require.Nil(t, err) - assert.Equal(t, 200, httpRes.StatusCode) - + require.Equal(t, 204, httpRes.StatusCode) }) - } diff --git a/keys/test/api_upload_test.go b/keys/test/api_upload_test.go index 220be43..65676c8 100644 --- a/keys/test/api_upload_test.go +++ b/keys/test/api_upload_test.go @@ -7,33 +7,79 @@ Testing UploadAPIService // Code generated by OpenAPI Generator (https://openapi-generator.tech); -package keys +package keys_test import ( + "bytes" "context" - "github.com/infobloxopen/bloxone-go-client/client" + "encoding/json" + "io" + "net/http" "testing" - "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + + "github.com/infobloxopen/bloxone-go-client/internal" + openapiclient "github.com/infobloxopen/bloxone-go-client/keys" ) func Test_keys_UploadAPIService(t *testing.T) { - rq := require.New(t) - c, err := client.NewAPIClient(client.Configuration{ClientName: "test"}) - rq.NoError(err) - apiClient := c.KeysAPI t.Run("Test UploadAPIService UploadUpload", func(t *testing.T) { + // Assuming that UploadRequest is the request body type for the UploadUpload API + dummyRequest := openapiclient.UploadRequest{ + Comment: openapiclient.PtrString("This is a test upload"), + Content: "SGVsbG8gd29ybGQ=", // "Hello world" in base64 + //Fields: &openapiclient.ProtobufFieldMask{}, // Fill this as per your requirements + //Tags: map[string]interface{}{ + // "tag1": "value1", + // "tag2": "value2", + //}, + Type: openapiclient.UPLOADCONTENTTYPE_KEYTAB, // Replace "your_content_type" with the actual content type + } - t.Skip("skip test") // remove to run test + configuration := internal.NewConfiguration() + configuration.HTTPClient = NewTestClient(func(req *http.Request) *http.Response { + require.Equal(t, "POST", req.Method) + require.Equal(t, "/api/ddi/v1/keys/upload", req.URL.Path) + require.Equal(t, "application/json", req.Header.Get("Accept")) + var reqBody openapiclient.UploadRequest + require.NoError(t, json.NewDecoder(req.Body).Decode(&reqBody)) + require.Equal(t, dummyRequest, reqBody) - resp, httpRes, err := apiClient.UploadAPI.UploadUpload(context.Background()).Execute() + response := openapiclient.DdiuploadResponse{ + KerberosKeys: &openapiclient.KerberosKeys{ + Items: []openapiclient.KerberosKey{ + { + Algorithm: openapiclient.PtrString("aes256-cts-hmac-sha1-96"), + Comment: openapiclient.PtrString("This is a test Kerberos key"), + Domain: openapiclient.PtrString("example.com"), + Id: openapiclient.PtrString("123"), + //Principal: openapiclient.PtrString("test_principal"), + //Tags: map[string]interface{}{"tag1": "value1", "tag2": "value2"}, + //UploadedAt: openapiclient.PtrString("2022-01-01T00:00:00Z"), + //Version: openapiclient.PtrInt64(1), + }, + }, + }, + Warning: openapiclient.PtrString("This is a test warning"), + } + body, err := json.Marshal(response) + require.NoError(t, err) + return &http.Response{ + StatusCode: 200, + Body: io.NopCloser(bytes.NewReader(body)), + Header: map[string][]string{ + "Content-Type": {"application/json"}, + }, + } + }) + apiClient := openapiclient.NewAPIClient(configuration) + resp, httpRes, err := apiClient.UploadAPI.UploadUpload(context.Background()).Body(dummyRequest).Execute() require.Nil(t, err) require.NotNil(t, resp) - assert.Equal(t, 200, httpRes.StatusCode) - + require.Equal(t, 200, httpRes.StatusCode) }) } From 36773af4ac045ea2b711f4d7b864a174911ee19b Mon Sep 17 00:00:00 2001 From: Min Jiang Date: Thu, 15 Feb 2024 09:41:49 -0800 Subject: [PATCH 3/4] keys done, dns waiting --- dns_config/test/api_acl_test.go | 237 +++++++++++++--- dns_config/test/api_auth_nsg_test.go | 228 +++++++++++++--- dns_config/test/api_auth_zone_test.go | 255 ++++++++++++++---- dns_config/test/api_cache_flush_test.go | 59 ++-- .../test/api_convert_domain_name_test.go | 61 +++-- dns_config/test/api_convert_rname_test.go | 54 +++- dns_config/test/api_host_test.go | 144 ++++++++-- 7 files changed, 840 insertions(+), 198 deletions(-) diff --git a/dns_config/test/api_acl_test.go b/dns_config/test/api_acl_test.go index 46d107e..847e155 100644 --- a/dns_config/test/api_acl_test.go +++ b/dns_config/test/api_acl_test.go @@ -7,87 +7,244 @@ Testing AclAPIService // Code generated by OpenAPI Generator (https://openapi-generator.tech); -package dns_config +package dns_config_test import ( + "bytes" "context" + "encoding/json" + "github.com/infobloxopen/bloxone-go-client/dns_config" + "github.com/infobloxopen/bloxone-go-client/internal" + openapiclient "github.com/infobloxopen/bloxone-go-client/keys" + "github.com/stretchr/testify/require" + "io" + "net/http" "testing" +) - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" +type RoundTripFunc func(req *http.Request) *http.Response - openapiclient "github.com/infobloxopen/bloxone-go-client/dns_config" - "github.com/infobloxopen/bloxone-go-client/internal" -) +func (f RoundTripFunc) RoundTrip(req *http.Request) (*http.Response, error) { + return f(req), nil +} -func Test_dns_config_AclAPIService(t *testing.T) { +func NewTestClient(fn RoundTripFunc) *http.Client { + return &http.Client{ + Transport: RoundTripFunc(fn), + } +} - configuration := internal.NewConfiguration() - apiClient := openapiclient.NewAPIClient(configuration) +func Test_dns_config_AclAPIService(t *testing.T) { t.Run("Test AclAPIService AclCreate", func(t *testing.T) { - t.Skip("skip test") // remove to run test + //t.Skip("skip test") // remove to run test - resp, httpRes, err := apiClient.AclAPI.AclCreate(context.Background()).Execute() + dummyAcl := dns_config.ConfigACL{ + Comment: openapiclient.PtrString("This is a dummy ACL for testing."), + Id: openapiclient.PtrString("dummyAclId"), + Name: "dummyAclName", + } - require.Nil(t, err) - require.NotNil(t, resp) - assert.Equal(t, 200, httpRes.StatusCode) + testClient := NewTestClient(func(req *http.Request) *http.Response { + require.Equal(t, "POST", req.Method) + require.Equal(t, "/api/ddi/v1/dns/acl", req.URL.Path) + require.Equal(t, "application/json", req.Header.Get("Content-Type")) - }) + var reqBody dns_config.ConfigACL + require.NoError(t, json.NewDecoder(req.Body).Decode(&reqBody)) + require.Equal(t, dummyAcl, reqBody) - t.Run("Test AclAPIService AclDelete", func(t *testing.T) { + response := dns_config.ConfigCreateACLResponse{ + Result: &dummyAcl, + } + body, err := json.Marshal(response) + require.NoError(t, err) - t.Skip("skip test") // remove to run test + return &http.Response{ + StatusCode: 200, + Body: io.NopCloser(bytes.NewReader(body)), + Header: map[string][]string{"Content-Type": {"application/json"}}, + } + }) - var id string + configuration := internal.NewConfiguration() + configuration.HTTPClient = testClient - httpRes, err := apiClient.AclAPI.AclDelete(context.Background(), id).Execute() + aclAPI := dns_config.NewAPIClient(configuration) + ctx := context.Background() + resp, httpRes, err := aclAPI.AclAPI.AclCreate(ctx).Body(dummyAcl).Execute() require.Nil(t, err) - assert.Equal(t, 200, httpRes.StatusCode) - + require.NotNil(t, resp) + require.Equal(t, 200, httpRes.StatusCode) }) - t.Run("Test AclAPIService AclList", func(t *testing.T) { + t.Run("Test AclAPIService AclRead", func(t *testing.T) { - t.Skip("skip test") // remove to run test + //t.Skip("skip test") // remove to run test - resp, httpRes, err := apiClient.AclAPI.AclList(context.Background()).Execute() + dummyAcl := dns_config.ConfigACL{ + Comment: openapiclient.PtrString("This is a dummy ACL for testing."), + Id: openapiclient.PtrString("dummyAclId"), + Name: "dummyAclName", + } - require.Nil(t, err) - require.NotNil(t, resp) - assert.Equal(t, 200, httpRes.StatusCode) + testClient := NewTestClient(func(req *http.Request) *http.Response { + require.Equal(t, "GET", req.Method) + require.Equal(t, "/api/ddi/v1/dns/acl/"+*dummyAcl.Id, req.URL.Path) - }) - - t.Run("Test AclAPIService AclRead", func(t *testing.T) { + response := dns_config.ConfigReadACLResponse{ + Result: &dummyAcl, + } + body, err := json.Marshal(response) + require.NoError(t, err) - t.Skip("skip test") // remove to run test + return &http.Response{ + StatusCode: 200, + Body: io.NopCloser(bytes.NewReader(body)), + Header: map[string][]string{"Content-Type": {"application/json"}}, + } + }) - var id string + configuration := internal.NewConfiguration() + configuration.HTTPClient = testClient - resp, httpRes, err := apiClient.AclAPI.AclRead(context.Background(), id).Execute() + aclAPI := dns_config.NewAPIClient(configuration) + ctx := context.Background() + readRequest := aclAPI.AclAPI.AclRead(ctx, *dummyAcl.Id) + resp, httpRes, err := aclAPI.AclAPI.AclReadExecute(readRequest) require.Nil(t, err) require.NotNil(t, resp) - assert.Equal(t, 200, httpRes.StatusCode) + require.Equal(t, 200, httpRes.StatusCode) + require.Equal(t, dummyAcl, *resp.Result) + }) + + t.Run("Test AclAPIService AclList", func(t *testing.T) { + //t.Skip("skip test") // remove to run test + + dummyAclList := []dns_config.ConfigACL{ + { + Comment: openapiclient.PtrString("This is a dummy ACL for testing."), + Id: openapiclient.PtrString("dummyAclId1"), + Name: "dummyAclName1", + }, + { + Comment: openapiclient.PtrString("This is another dummy ACL for testing."), + Id: openapiclient.PtrString("dummyAclId2"), + Name: "dummyAclName2", + }, + } + + testClient := NewTestClient(func(req *http.Request) *http.Response { + require.Equal(t, "GET", req.Method) + require.Equal(t, "/api/ddi/v1/dns/acl", req.URL.Path) + + response := dns_config.ConfigListACLResponse{ + Results: dummyAclList, + } + body, err := json.Marshal(response) + require.NoError(t, err) + + return &http.Response{ + StatusCode: 200, + Body: io.NopCloser(bytes.NewReader(body)), + Header: map[string][]string{"Content-Type": {"application/json"}}, + } + }) + + configuration := internal.NewConfiguration() + configuration.HTTPClient = testClient + + aclAPI := dns_config.NewAPIClient(configuration) + ctx := context.Background() + + resp, httpRes, err := aclAPI.AclAPI.AclList(ctx).Execute() + require.Nil(t, err) + require.NotNil(t, resp) + require.Equal(t, 200, httpRes.StatusCode) + require.Equal(t, dummyAclList, resp.Results) }) t.Run("Test AclAPIService AclUpdate", func(t *testing.T) { - t.Skip("skip test") // remove to run test + //t.Skip("skip test") // remove to run test + + dummyAcl := dns_config.ConfigACL{ + Comment: openapiclient.PtrString("This is a dummy ACL for testing."), + Id: openapiclient.PtrString("dummyAclId"), + Name: "dummyAclName", + } + + updatedAcl := dns_config.ConfigACL{ + Comment: openapiclient.PtrString("This is an updated dummy ACL for testing."), + Id: dummyAcl.Id, + Name: "updatedDummyAclName", + } + + testClient := NewTestClient(func(req *http.Request) *http.Response { + require.Equal(t, "PATCH", req.Method) + require.Equal(t, "/api/ddi/v1/dns/acl/"+*dummyAcl.Id, req.URL.Path) + + response := dns_config.ConfigUpdateACLResponse{ + Result: &updatedAcl, + } + body, err := json.Marshal(response) + require.NoError(t, err) + + return &http.Response{ + StatusCode: 200, + Body: io.NopCloser(bytes.NewReader(body)), + Header: map[string][]string{"Content-Type": {"application/json"}}, + } + }) + + configuration := internal.NewConfiguration() + configuration.HTTPClient = testClient + + aclAPI := dns_config.NewAPIClient(configuration) + ctx := context.Background() + + updateRequest := aclAPI.AclAPI.AclUpdate(ctx, *dummyAcl.Id).Body(updatedAcl) + resp, httpRes, err := updateRequest.Execute() + require.Nil(t, err) + require.NotNil(t, resp) + require.Equal(t, 200, httpRes.StatusCode) + require.Equal(t, updatedAcl, *resp.Result) + }) - var id string + t.Run("Test AclAPIService AclDelete", func(t *testing.T) { - resp, httpRes, err := apiClient.AclAPI.AclUpdate(context.Background(), id).Execute() + //t.Skip("skip test") // remove to run test - require.Nil(t, err) - require.NotNil(t, resp) - assert.Equal(t, 200, httpRes.StatusCode) + dummyAcl := dns_config.ConfigACL{ + Comment: openapiclient.PtrString("This is a dummy ACL for testing."), + Id: openapiclient.PtrString("dummyAclId"), + Name: "dummyAclName", + } + + testClient := NewTestClient(func(req *http.Request) *http.Response { + require.Equal(t, "DELETE", req.Method) + require.Equal(t, "/api/ddi/v1/dns/acl/"+*dummyAcl.Id, req.URL.Path) + return &http.Response{ + StatusCode: 200, + Body: io.NopCloser(bytes.NewReader([]byte{})), + Header: map[string][]string{"Content-Type": {"application/json"}}, + } + }) + + configuration := internal.NewConfiguration() + configuration.HTTPClient = testClient + + aclAPI := dns_config.NewAPIClient(configuration) + ctx := context.Background() + + httpRes, err := aclAPI.AclAPI.AclDelete(ctx, *dummyAcl.Id).Execute() + require.Nil(t, err) + require.Equal(t, 200, httpRes.StatusCode) }) } diff --git a/dns_config/test/api_auth_nsg_test.go b/dns_config/test/api_auth_nsg_test.go index 365aee3..97027a0 100644 --- a/dns_config/test/api_auth_nsg_test.go +++ b/dns_config/test/api_auth_nsg_test.go @@ -1,93 +1,237 @@ /* DNS Configuration API -Testing AuthNsgAPIService +Testing AclAPIService */ // Code generated by OpenAPI Generator (https://openapi-generator.tech); -package dns_config +package dns_config_test import ( + "bytes" "context" - "testing" - - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - - openapiclient "github.com/infobloxopen/bloxone-go-client/dns_config" + "encoding/json" + "github.com/infobloxopen/bloxone-go-client/dns_config" "github.com/infobloxopen/bloxone-go-client/internal" + openapiclient "github.com/infobloxopen/bloxone-go-client/keys" + "github.com/stretchr/testify/require" + "io" + "net/http" + "testing" ) func Test_dns_config_AuthNsgAPIService(t *testing.T) { - configuration := internal.NewConfiguration() - apiClient := openapiclient.NewAPIClient(configuration) + t.Run("Test AuthNesAPIService AuthNesCreate", func(t *testing.T) { + + //t.Skip("skip test") // remove to run test + + dummyAuthNsg := dns_config.ConfigAuthNSG{ + Comment: openapiclient.PtrString("This is a dummy AuthNes for testing."), + Id: openapiclient.PtrString("dummyAuthNesId"), + Name: "dummyAuthNesName", + } + + testClient := NewTestClient(func(req *http.Request) *http.Response { + require.Equal(t, "POST", req.Method) + require.Equal(t, "/api/ddi/v1/dns/auth_nsg", req.URL.Path) - t.Run("Test AuthNsgAPIService AuthNsgCreate", func(t *testing.T) { + response := dns_config.ConfigCreateAuthNSGResponse{ + Result: &dummyAuthNsg, + } + body, err := json.Marshal(response) + require.NoError(t, err) - t.Skip("skip test") // remove to run test + return &http.Response{ + StatusCode: 200, + Body: io.NopCloser(bytes.NewReader(body)), + Header: map[string][]string{"Content-Type": {"application/json"}}, + } + }) - resp, httpRes, err := apiClient.AuthNsgAPI.AuthNsgCreate(context.Background()).Execute() + configuration := internal.NewConfiguration() + configuration.HTTPClient = testClient + authNesAPI := dns_config.NewAPIClient(configuration) + ctx := context.Background() + + createRequest := authNesAPI.AuthNsgAPI.AuthNsgCreate(ctx).Body(dummyAuthNsg) + resp, httpRes, err := createRequest.Execute() require.Nil(t, err) require.NotNil(t, resp) - assert.Equal(t, 200, httpRes.StatusCode) - + require.Equal(t, 200, httpRes.StatusCode) + require.Equal(t, dummyAuthNsg, *resp.Result) }) - t.Run("Test AuthNsgAPIService AuthNsgDelete", func(t *testing.T) { - - t.Skip("skip test") // remove to run test + t.Run("Test AuthNsgAPIService AuthNsgRead", func(t *testing.T) { - var id string + //t.Skip("skip test") // remove to run test - httpRes, err := apiClient.AuthNsgAPI.AuthNsgDelete(context.Background(), id).Execute() + dummyAuthNsg := dns_config.ConfigAuthNSG{ + Comment: openapiclient.PtrString("This is a dummy AuthNsg for testing."), + Id: openapiclient.PtrString("dummyAuthNsgId"), + Name: "dummyAuthNsgName", + } - require.Nil(t, err) - assert.Equal(t, 200, httpRes.StatusCode) + testClient := NewTestClient(func(req *http.Request) *http.Response { + require.Equal(t, "GET", req.Method) + require.Equal(t, "/api/ddi/v1/dns/auth_nsg/"+*dummyAuthNsg.Id, req.URL.Path) - }) + response := dns_config.ConfigReadAuthNSGResponse{ + Result: &dummyAuthNsg, + } + body, err := json.Marshal(response) + require.NoError(t, err) - t.Run("Test AuthNsgAPIService AuthNsgList", func(t *testing.T) { + return &http.Response{ + StatusCode: 200, + Body: io.NopCloser(bytes.NewReader(body)), + Header: map[string][]string{"Content-Type": {"application/json"}}, + } + }) - t.Skip("skip test") // remove to run test + configuration := internal.NewConfiguration() + configuration.HTTPClient = testClient - resp, httpRes, err := apiClient.AuthNsgAPI.AuthNsgList(context.Background()).Execute() + authNsgAPI := dns_config.NewAPIClient(configuration) + ctx := context.Background() + readRequest := authNsgAPI.AuthNsgAPI.AuthNsgRead(ctx, *dummyAuthNsg.Id) + resp, httpRes, err := readRequest.Execute() require.Nil(t, err) require.NotNil(t, resp) - assert.Equal(t, 200, httpRes.StatusCode) - + require.Equal(t, 200, httpRes.StatusCode) + require.Equal(t, dummyAuthNsg, *resp.Result) }) - t.Run("Test AuthNsgAPIService AuthNsgRead", func(t *testing.T) { - - t.Skip("skip test") // remove to run test + t.Run("Test AuthNsgAPIService AuthNsgUpdate", func(t *testing.T) { - var id string + //t.Skip("skip test") // remove to run test + + dummyAuthNsg := dns_config.ConfigAuthNSG{ + Comment: openapiclient.PtrString("This is a dummy AuthNsg for testing."), + Id: openapiclient.PtrString("dummyAuthNsgId"), + Name: "dummyAuthNsgName", + } + + updatedAuthNsg := dns_config.ConfigAuthNSG{ + Comment: openapiclient.PtrString("This is an updated dummy AuthNsg for testing."), + Id: dummyAuthNsg.Id, + Name: "updatedDummyAuthNsgName", + } + + testClient := NewTestClient(func(req *http.Request) *http.Response { + require.Equal(t, "PATCH", req.Method) + require.Equal(t, "/api/ddi/v1/dns/auth_nsg/"+*dummyAuthNsg.Id, req.URL.Path) + + response := dns_config.ConfigUpdateAuthNSGResponse{ + Result: &updatedAuthNsg, + } + body, err := json.Marshal(response) + require.NoError(t, err) + + return &http.Response{ + StatusCode: 200, + Body: io.NopCloser(bytes.NewReader(body)), + Header: map[string][]string{"Content-Type": {"application/json"}}, + } + }) + + configuration := internal.NewConfiguration() + configuration.HTTPClient = testClient + + authNsgAPI := dns_config.NewAPIClient(configuration) + ctx := context.Background() + + updateRequest := authNsgAPI.AuthNsgAPI.AuthNsgUpdate(ctx, *dummyAuthNsg.Id).Body(updatedAuthNsg) + resp, httpRes, err := updateRequest.Execute() + require.Nil(t, err) + require.NotNil(t, resp) + require.Equal(t, 200, httpRes.StatusCode) + require.Equal(t, updatedAuthNsg, *resp.Result) + }) - resp, httpRes, err := apiClient.AuthNsgAPI.AuthNsgRead(context.Background(), id).Execute() + t.Run("Test AuthNsgAPIService AuthNsgList", func(t *testing.T) { + //t.Skip("skip test") // remove to run test + + dummyAuthNsgList := []dns_config.ConfigAuthNSG{ + { + Comment: openapiclient.PtrString("This is a dummy AuthNsg for testing."), + Id: openapiclient.PtrString("dummyAuthNsgId1"), + Name: "dummyAuthNsgName1", + }, + { + Comment: openapiclient.PtrString("This is another dummy AuthNsg for testing."), + Id: openapiclient.PtrString("dummyAuthNsgId2"), + Name: "dummyAuthNsgName2", + }, + } + + testClient := NewTestClient(func(req *http.Request) *http.Response { + require.Equal(t, "GET", req.Method) + require.Equal(t, "/api/ddi/v1/dns/auth_nsg", req.URL.Path) + + response := dns_config.ConfigListAuthNSGResponse{ + Results: dummyAuthNsgList, + } + body, err := json.Marshal(response) + require.NoError(t, err) + + return &http.Response{ + StatusCode: 200, + Body: io.NopCloser(bytes.NewReader(body)), + Header: map[string][]string{"Content-Type": {"application/json"}}, + } + }) + + configuration := internal.NewConfiguration() + configuration.HTTPClient = testClient + + authNsgAPI := dns_config.NewAPIClient(configuration) + ctx := context.Background() + + listRequest := authNsgAPI.AuthNsgAPI.AuthNsgList(ctx) + resp, httpRes, err := listRequest.Execute() require.Nil(t, err) require.NotNil(t, resp) - assert.Equal(t, 200, httpRes.StatusCode) - + require.Equal(t, 200, httpRes.StatusCode) + require.Equal(t, dummyAuthNsgList, resp.Results) }) - t.Run("Test AuthNsgAPIService AuthNsgUpdate", func(t *testing.T) { + t.Run("Test AuthNsgAPIService AuthNsgDelete", func(t *testing.T) { - t.Skip("skip test") // remove to run test + //t.Skip("skip test") // remove to run test - var id string + dummyAuthNsg := dns_config.ConfigAuthNSG{ + Comment: openapiclient.PtrString("This is a dummy AuthNsg for testing."), + Id: openapiclient.PtrString("dummyAuthNsgId"), + Name: "dummyAuthNsgName", + } - resp, httpRes, err := apiClient.AuthNsgAPI.AuthNsgUpdate(context.Background(), id).Execute() + testClient := NewTestClient(func(req *http.Request) *http.Response { + require.Equal(t, "DELETE", req.Method) + require.Equal(t, "/api/ddi/v1/dns/auth_nsg/"+*dummyAuthNsg.Id, req.URL.Path) - require.Nil(t, err) - require.NotNil(t, resp) - assert.Equal(t, 200, httpRes.StatusCode) + return &http.Response{ + StatusCode: 200, + Body: io.NopCloser(bytes.NewReader([]byte{})), + Header: map[string][]string{"Content-Type": {"application/json"}}, + } + }) + + configuration := internal.NewConfiguration() + configuration.HTTPClient = testClient + authNsgAPI := dns_config.NewAPIClient(configuration) + ctx := context.Background() + + deleteRequest := authNsgAPI.AuthNsgAPI.AuthNsgDelete(ctx, *dummyAuthNsg.Id) + httpRes, err := deleteRequest.Execute() + require.Nil(t, err) + require.Equal(t, 200, httpRes.StatusCode) }) } diff --git a/dns_config/test/api_auth_zone_test.go b/dns_config/test/api_auth_zone_test.go index bb3daaa..a03bc4c 100644 --- a/dns_config/test/api_auth_zone_test.go +++ b/dns_config/test/api_auth_zone_test.go @@ -1,105 +1,270 @@ /* DNS Configuration API -Testing AuthZoneAPIService +Testing AclAPIService */ // Code generated by OpenAPI Generator (https://openapi-generator.tech); -package dns_config +package dns_config_test import ( + "bytes" "context" - "testing" - - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - - openapiclient "github.com/infobloxopen/bloxone-go-client/dns_config" + "encoding/json" + "github.com/infobloxopen/bloxone-go-client/dns_config" "github.com/infobloxopen/bloxone-go-client/internal" + openapiclient "github.com/infobloxopen/bloxone-go-client/keys" + "github.com/stretchr/testify/require" + "io" + "net/http" + "testing" ) func Test_dns_config_AuthZoneAPIService(t *testing.T) { - configuration := internal.NewConfiguration() - apiClient := openapiclient.NewAPIClient(configuration) - - t.Run("Test AuthZoneAPIService AuthZoneCopy", func(t *testing.T) { + t.Run("Test AuthZoneAPIService AuthZoneCreate", func(t *testing.T) { - t.Skip("skip test") // remove to run test + //t.Skip("skip test") // remove to run test - resp, httpRes, err := apiClient.AuthZoneAPI.AuthZoneCopy(context.Background()).Execute() + dummyAuthZone := dns_config.ConfigAuthZone{ + Comment: openapiclient.PtrString("This is a dummy AuthZone for testing."), + Id: openapiclient.PtrString("dummyAuthZoneId"), + } - require.Nil(t, err) - require.NotNil(t, resp) - assert.Equal(t, 200, httpRes.StatusCode) + testClient := NewTestClient(func(req *http.Request) *http.Response { + require.Equal(t, "POST", req.Method) + require.Equal(t, "/api/ddi/v1/dns/auth_zone", req.URL.Path) - }) + response := dns_config.ConfigCreateAuthZoneResponse{ + Result: &dummyAuthZone, + } + body, err := json.Marshal(response) + require.NoError(t, err) - t.Run("Test AuthZoneAPIService AuthZoneCreate", func(t *testing.T) { + return &http.Response{ + StatusCode: 201, + Body: io.NopCloser(bytes.NewReader(body)), + Header: map[string][]string{"Content-Type": {"application/json"}}, + } + }) - t.Skip("skip test") // remove to run test + configuration := internal.NewConfiguration() + configuration.HTTPClient = testClient - resp, httpRes, err := apiClient.AuthZoneAPI.AuthZoneCreate(context.Background()).Execute() + authZoneAPI := dns_config.NewAPIClient(configuration) + ctx := context.Background() + createRequest := authZoneAPI.AuthZoneAPI.AuthZoneCreate(ctx).Body(dummyAuthZone) + resp, httpRes, err := createRequest.Execute() require.Nil(t, err) require.NotNil(t, resp) - assert.Equal(t, 200, httpRes.StatusCode) - + require.Equal(t, 201, httpRes.StatusCode) + require.Equal(t, dummyAuthZone, *resp.Result) }) - t.Run("Test AuthZoneAPIService AuthZoneDelete", func(t *testing.T) { + t.Run("Test AuthZoneAPIService AuthZoneCopy", func(t *testing.T) { + + //t.Skip("skip test") // remove to run test + + dummyAuthZone := dns_config.ConfigCopyAuthZone{ + Comment: openapiclient.PtrString("This is a dummy AuthZone for testing."), + Id: openapiclient.PtrString("dummyAuthZoneId"), + } + + dummyConfigCopyResponse := dns_config.ConfigCopyResponse{ + Description: openapiclient.PtrString("This is a copy of the dummy AuthZone for testing."), + Id: openapiclient.PtrString("dummyCopyId"), + JobId: openapiclient.PtrString("dummyJobId"), + } + + testClient := NewTestClient(func(req *http.Request) *http.Response { + require.Equal(t, "POST", req.Method) + require.Equal(t, "/api/ddi/v1/dns/auth_zone/copy", req.URL.Path) + //require.Equal(t, "/api/ddi/v1/dns/auth_zone/copy", req.URL.Path) + + response := dns_config.ConfigCopyAuthZoneResponse{ + Result: &dummyConfigCopyResponse, + } + body, err := json.Marshal(response) + require.NoError(t, err) + + return &http.Response{ + StatusCode: 201, + Body: io.NopCloser(bytes.NewReader(body)), + Header: map[string][]string{"Content-Type": {"application/json"}}, + } + }) + + configuration := internal.NewConfiguration() + configuration.HTTPClient = testClient + + authZoneAPI := dns_config.NewAPIClient(configuration) + ctx := context.Background() + + copyRequest := authZoneAPI.AuthZoneAPI.AuthZoneCopy(ctx).Body(dummyAuthZone) + resp, httpRes, err := copyRequest.Execute() + require.Nil(t, err) + require.NotNil(t, resp) + require.Equal(t, 201, httpRes.StatusCode) + require.Equal(t, dummyAuthZone, *resp.Result) + }) - t.Skip("skip test") // remove to run test + t.Run("Test AuthZoneAPIService AuthZoneRead", func(t *testing.T) { - var id string + //t.Skip("skip test") // remove to run test - httpRes, err := apiClient.AuthZoneAPI.AuthZoneDelete(context.Background(), id).Execute() + dummyAuthZone := dns_config.ConfigAuthZone{ + Comment: openapiclient.PtrString("This is a dummy AuthZone for testing."), + Id: openapiclient.PtrString("dummyAuthZoneId"), + } - require.Nil(t, err) - assert.Equal(t, 200, httpRes.StatusCode) + testClient := NewTestClient(func(req *http.Request) *http.Response { + require.Equal(t, "GET", req.Method) + require.Equal(t, "/api/ddi/v1/dns/auth_zone/"+*dummyAuthZone.Id, req.URL.Path) - }) + response := dns_config.ConfigReadAuthZoneResponse{ + Result: &dummyAuthZone, + } + body, err := json.Marshal(response) + require.NoError(t, err) - t.Run("Test AuthZoneAPIService AuthZoneList", func(t *testing.T) { + return &http.Response{ + StatusCode: 200, + Body: io.NopCloser(bytes.NewReader(body)), + Header: map[string][]string{"Content-Type": {"application/json"}}, + } + }) - t.Skip("skip test") // remove to run test + configuration := internal.NewConfiguration() + configuration.HTTPClient = testClient - resp, httpRes, err := apiClient.AuthZoneAPI.AuthZoneList(context.Background()).Execute() + authZoneAPI := dns_config.NewAPIClient(configuration) + ctx := context.Background() + readRequest := authZoneAPI.AuthZoneAPI.AuthZoneRead(ctx, *dummyAuthZone.Id) + resp, httpRes, err := readRequest.Execute() require.Nil(t, err) require.NotNil(t, resp) - assert.Equal(t, 200, httpRes.StatusCode) - + require.Equal(t, 200, httpRes.StatusCode) + require.Equal(t, dummyAuthZone, *resp.Result) }) - t.Run("Test AuthZoneAPIService AuthZoneRead", func(t *testing.T) { + t.Run("Test AuthZoneAPIService AuthZoneList", func(t *testing.T) { + + //t.Skip("skip test") // remove to run test + + dummyAuthZone := dns_config.ConfigAuthZone{ + Comment: openapiclient.PtrString("This is a dummy AuthZone for testing."), + Id: openapiclient.PtrString("dummyAuthZoneId"), + } + + testClient := NewTestClient(func(req *http.Request) *http.Response { + require.Equal(t, "GET", req.Method) + require.Equal(t, "/api/ddi/v1/dns/auth_zone", req.URL.Path) - t.Skip("skip test") // remove to run test + response := dns_config.ConfigListAuthZoneResponse{ + Results: []dns_config.ConfigAuthZone{dummyAuthZone}, + } + body, err := json.Marshal(response) + require.NoError(t, err) - var id string + return &http.Response{ + StatusCode: 200, + Body: io.NopCloser(bytes.NewReader(body)), + Header: map[string][]string{"Content-Type": {"application/json"}}, + } + }) - resp, httpRes, err := apiClient.AuthZoneAPI.AuthZoneRead(context.Background(), id).Execute() + configuration := internal.NewConfiguration() + configuration.HTTPClient = testClient + authZoneAPI := dns_config.NewAPIClient(configuration) + ctx := context.Background() + + listRequest := authZoneAPI.AuthZoneAPI.AuthZoneList(ctx) + resp, httpRes, err := listRequest.Execute() require.Nil(t, err) require.NotNil(t, resp) - assert.Equal(t, 200, httpRes.StatusCode) - + require.Equal(t, 200, httpRes.StatusCode) + require.Equal(t, dummyAuthZone, resp.Results[0]) }) t.Run("Test AuthZoneAPIService AuthZoneUpdate", func(t *testing.T) { - t.Skip("skip test") // remove to run test + //t.Skip("skip test") // remove to run test + + dummyAuthZone := dns_config.ConfigAuthZone{ + Comment: openapiclient.PtrString("This is a dummy AuthZone for testing."), + Id: openapiclient.PtrString("dummyAuthZoneId"), + } + + updatedAuthZone := dns_config.ConfigAuthZone{ + Comment: openapiclient.PtrString("This is an updated dummy AuthZone for testing."), + Id: dummyAuthZone.Id, + } + + testClient := NewTestClient(func(req *http.Request) *http.Response { + require.Equal(t, "PATCH", req.Method) + require.Equal(t, "/api/ddi/v1/dns/auth_zone/"+*dummyAuthZone.Id, req.URL.Path) + + response := dns_config.ConfigUpdateAuthZoneResponse{ + Result: &updatedAuthZone, + } + body, err := json.Marshal(response) + require.NoError(t, err) - var id string + return &http.Response{ + StatusCode: 200, + Body: io.NopCloser(bytes.NewReader(body)), + Header: map[string][]string{"Content-Type": {"application/json"}}, + } + }) - resp, httpRes, err := apiClient.AuthZoneAPI.AuthZoneUpdate(context.Background(), id).Execute() + configuration := internal.NewConfiguration() + configuration.HTTPClient = testClient + authZoneAPI := dns_config.NewAPIClient(configuration) + ctx := context.Background() + + updateRequest := authZoneAPI.AuthZoneAPI.AuthZoneUpdate(ctx, *dummyAuthZone.Id).Body(updatedAuthZone) + resp, httpRes, err := updateRequest.Execute() require.Nil(t, err) require.NotNil(t, resp) - assert.Equal(t, 200, httpRes.StatusCode) + require.Equal(t, 200, httpRes.StatusCode) + require.Equal(t, updatedAuthZone, *resp.Result) + }) + + t.Run("Test AuthZoneAPIService AuthZoneDelete", func(t *testing.T) { + + //t.Skip("skip test") // remove to run test + + dummyAuthZone := dns_config.ConfigAuthZone{ + Comment: openapiclient.PtrString("This is a dummy AuthZone for testing."), + Id: openapiclient.PtrString("dummyAuthZoneId"), + } + testClient := NewTestClient(func(req *http.Request) *http.Response { + require.Equal(t, "DELETE", req.Method) + require.Equal(t, "/api/ddi/v1/dns/auth_zone/"+*dummyAuthZone.Id, req.URL.Path) + + return &http.Response{ + StatusCode: 200, + Body: io.NopCloser(bytes.NewReader([]byte{})), + Header: map[string][]string{"Content-Type": {"application/json"}}, + } + }) + + configuration := internal.NewConfiguration() + configuration.HTTPClient = testClient + + authZoneAPI := dns_config.NewAPIClient(configuration) + ctx := context.Background() + + httpRes, err := authZoneAPI.AuthZoneAPI.AuthZoneDelete(ctx, *dummyAuthZone.Id).Execute() + require.Nil(t, err) + require.Equal(t, 200, httpRes.StatusCode) }) } diff --git a/dns_config/test/api_cache_flush_test.go b/dns_config/test/api_cache_flush_test.go index a7ee097..7558b84 100644 --- a/dns_config/test/api_cache_flush_test.go +++ b/dns_config/test/api_cache_flush_test.go @@ -1,40 +1,65 @@ /* DNS Configuration API -Testing CacheFlushAPIService +Testing AclAPIService */ // Code generated by OpenAPI Generator (https://openapi-generator.tech); -package dns_config +package dns_config_test import ( + "bytes" "context" - "testing" - - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - - openapiclient "github.com/infobloxopen/bloxone-go-client/dns_config" + "encoding/json" + "github.com/infobloxopen/bloxone-go-client/dns_config" "github.com/infobloxopen/bloxone-go-client/internal" + openapiclient "github.com/infobloxopen/bloxone-go-client/keys" + "github.com/stretchr/testify/require" + "io" + "net/http" + "testing" ) func Test_dns_config_CacheFlushAPIService(t *testing.T) { - configuration := internal.NewConfiguration() - apiClient := openapiclient.NewAPIClient(configuration) - t.Run("Test CacheFlushAPIService CacheFlushCreate", func(t *testing.T) { + // Create a dummy CacheFlush object + dummyCacheFlush := dns_config.ConfigCacheFlush{ + FlushSubdomains: openapiclient.PtrBool(true), + Fqdn: openapiclient.PtrString("dummyFqdn"), + Ophid: openapiclient.PtrString("dummyOphid"), + ServiceId: openapiclient.PtrString("dummyServiceId"), + Ttl: openapiclient.PtrInt64(120), + ViewName: openapiclient.PtrString("dummyViewName"), + } - t.Skip("skip test") // remove to run test + testClient := NewTestClient(func(req *http.Request) *http.Response { + require.Equal(t, "POST", req.Method) + require.Equal(t, "/api/ddi/v1/dns/cache_flush", req.URL.Path) + require.Equal(t, "application/json", req.Header.Get("Content-Type")) - resp, httpRes, err := apiClient.CacheFlushAPI.CacheFlushCreate(context.Background()).Execute() + var reqBody dns_config.ConfigCacheFlush + require.NoError(t, json.NewDecoder(req.Body).Decode(&reqBody)) + require.Equal(t, dummyCacheFlush, reqBody) - require.Nil(t, err) - require.NotNil(t, resp) - assert.Equal(t, 200, httpRes.StatusCode) + return &http.Response{ + StatusCode: 200, + Body: io.NopCloser(bytes.NewReader([]byte{})), + Header: map[string][]string{"Content-Type": {"application/json"}}, + } + }) - }) + configuration := internal.NewConfiguration() + configuration.HTTPClient = testClient + cacheFlushAPI := dns_config.NewAPIClient(configuration) + ctx := context.Background() + + _, httpRes, err := cacheFlushAPI.CacheFlushAPI.CacheFlushCreate(ctx).Body(dummyCacheFlush).Execute() + require.Nil(t, err) + //require.NotNil(t, resp) + require.Equal(t, 200, httpRes.StatusCode) + }) } diff --git a/dns_config/test/api_convert_domain_name_test.go b/dns_config/test/api_convert_domain_name_test.go index 108d68d..4d3b7ec 100644 --- a/dns_config/test/api_convert_domain_name_test.go +++ b/dns_config/test/api_convert_domain_name_test.go @@ -1,42 +1,63 @@ /* DNS Configuration API -Testing ConvertDomainNameAPIService +Testing AclAPIService */ // Code generated by OpenAPI Generator (https://openapi-generator.tech); -package dns_config +package dns_config_test import ( + "bytes" "context" - "testing" - - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - - openapiclient "github.com/infobloxopen/bloxone-go-client/dns_config" + "encoding/json" + "github.com/infobloxopen/bloxone-go-client/dns_config" "github.com/infobloxopen/bloxone-go-client/internal" + openapiclient "github.com/infobloxopen/bloxone-go-client/keys" + "github.com/stretchr/testify/require" + "io" + "net/http" + "testing" ) func Test_dns_config_ConvertDomainNameAPIService(t *testing.T) { - configuration := internal.NewConfiguration() - apiClient := openapiclient.NewAPIClient(configuration) - t.Run("Test ConvertDomainNameAPIService ConvertDomainNameConvert", func(t *testing.T) { - - t.Skip("skip test") // remove to run test - - var domainName string - - resp, httpRes, err := apiClient.ConvertDomainNameAPI.ConvertDomainNameConvert(context.Background(), domainName).Execute() - + // Create a dummy domain name + dummyDomainName := "example.com" + + testClient := NewTestClient(func(req *http.Request) *http.Response { + require.Equal(t, "GET", req.Method) + require.Equal(t, "/api/ddi/v1/dns/convert_domain_name/"+dummyDomainName, req.URL.Path) + require.Equal(t, "application/json", req.Header.Get("Accept")) + + response := dns_config.ConfigConvertDomainName{ + Idn: openapiclient.PtrString("example.com"), + Punycode: openapiclient.PtrString("xn--example-2ya.com"), + } + body, err := json.Marshal(response) + require.NoError(t, err) + + return &http.Response{ + StatusCode: 200, + Body: io.NopCloser(bytes.NewReader(body)), + Header: map[string][]string{"Content-Type": {"application/json"}}, + } + }) + + configuration := internal.NewConfiguration() + configuration.HTTPClient = testClient + + convertDomain := dns_config.NewAPIClient(configuration) + ctx := context.Background() + + resp, httpRes, err := convertDomain.ConvertDomainNameAPI.ConvertDomainNameConvert(ctx, dummyDomainName).Execute() require.Nil(t, err) require.NotNil(t, resp) - assert.Equal(t, 200, httpRes.StatusCode) - + require.Nil(t, resp.Result) + require.Equal(t, 200, httpRes.StatusCode) }) } diff --git a/dns_config/test/api_convert_rname_test.go b/dns_config/test/api_convert_rname_test.go index 23ddedf..7f166c6 100644 --- a/dns_config/test/api_convert_rname_test.go +++ b/dns_config/test/api_convert_rname_test.go @@ -1,41 +1,69 @@ /* DNS Configuration API -Testing ConvertRnameAPIService +Testing AclAPIService */ // Code generated by OpenAPI Generator (https://openapi-generator.tech); -package dns_config +package dns_config_test import ( + "bytes" "context" - "testing" - + "encoding/json" + "github.com/infobloxopen/bloxone-go-client/dns_config" + "github.com/infobloxopen/bloxone-go-client/internal" + openapiclient "github.com/infobloxopen/bloxone-go-client/keys" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - - openapiclient "github.com/infobloxopen/bloxone-go-client/dns_config" - "github.com/infobloxopen/bloxone-go-client/internal" + "io" + "net/http" + "testing" ) func Test_dns_config_ConvertRnameAPIService(t *testing.T) { - configuration := internal.NewConfiguration() - apiClient := openapiclient.NewAPIClient(configuration) - t.Run("Test ConvertRnameAPIService ConvertRnameConvertRName", func(t *testing.T) { - t.Skip("skip test") // remove to run test + // Define a dummy email address + emailAddress := "test@example.com" + + // Create a mock HTTP client + testClient := NewTestClient(func(req *http.Request) *http.Response { + // Check the request parameters + require.Equal(t, "GET", req.Method) + require.Equal(t, "/api/ddi/v1/dns/convert_rname/"+emailAddress, req.URL.Path) + require.Equal(t, "application/json", req.Header.Get("Accept")) + + // Create a dummy response + response := dns_config.ConfigConvertRNameResponse{ + Rname: openapiclient.PtrString("test.example.com."), + } + body, err := json.Marshal(response) + require.NoError(t, err) + + // Return the dummy response + return &http.Response{ + StatusCode: 200, + Body: io.NopCloser(bytes.NewReader(body)), + Header: map[string][]string{"Content-Type": {"application/json"}}, + } + }) + + configuration := internal.NewConfiguration() + configuration.HTTPClient = testClient - var emailAddress string + convertRename := dns_config.NewAPIClient(configuration) + ctx := context.Background() - resp, httpRes, err := apiClient.ConvertRnameAPI.ConvertRnameConvertRName(context.Background(), emailAddress).Execute() + resp, httpRes, err := convertRename.ConvertRnameAPI.ConvertRnameConvertRName(ctx, emailAddress).Execute() require.Nil(t, err) require.NotNil(t, resp) assert.Equal(t, 200, httpRes.StatusCode) + assert.Equal(t, "test.example.com.", *resp.Rname) }) diff --git a/dns_config/test/api_host_test.go b/dns_config/test/api_host_test.go index 8965b8e..2950634 100644 --- a/dns_config/test/api_host_test.go +++ b/dns_config/test/api_host_test.go @@ -1,67 +1,169 @@ /* DNS Configuration API -Testing HostAPIService +Testing AclAPIService */ // Code generated by OpenAPI Generator (https://openapi-generator.tech); -package dns_config +package dns_config_test import ( + "bytes" "context" - "testing" - + "encoding/json" + "github.com/infobloxopen/bloxone-go-client/dns_config" + "github.com/infobloxopen/bloxone-go-client/internal" + openapiclient "github.com/infobloxopen/bloxone-go-client/keys" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - - openapiclient "github.com/infobloxopen/bloxone-go-client/dns_config" - "github.com/infobloxopen/bloxone-go-client/internal" + "io" + "net/http" + "testing" ) func Test_dns_config_HostAPIService(t *testing.T) { - configuration := internal.NewConfiguration() - apiClient := openapiclient.NewAPIClient(configuration) - t.Run("Test HostAPIService HostList", func(t *testing.T) { - t.Skip("skip test") // remove to run test - + // Create a mock HTTP client + testClient := NewTestClient(func(req *http.Request) *http.Response { + // Check the request parameters + require.Equal(t, "GET", req.Method) + require.Equal(t, "/api/ddi/v1/dns/host", req.URL.Path) + require.Equal(t, "application/json", req.Header.Get("Accept")) + + // Create a dummy response + response := dns_config.ConfigListHostResponse{ + Results: []dns_config.ConfigHost{ + { + Id: openapiclient.PtrString("host1"), + AbsoluteName: openapiclient.PtrString("host1.example.com"), + }, + { + Id: openapiclient.PtrString("host2"), + AbsoluteName: openapiclient.PtrString("host2.example.com"), + }, + }, + } + body, err := json.Marshal(response) + require.NoError(t, err) + + // Return the dummy response + return &http.Response{ + StatusCode: 200, + Body: io.NopCloser(bytes.NewReader(body)), + Header: map[string][]string{"Content-Type": {"application/json"}}, + } + }) + + // Create a new API client with the mock HTTP client + configuration := internal.NewConfiguration() + configuration.HTTPClient = testClient + apiClient := dns_config.NewAPIClient(configuration) + + // Call the method and check the response resp, httpRes, err := apiClient.HostAPI.HostList(context.Background()).Execute() require.Nil(t, err) require.NotNil(t, resp) assert.Equal(t, 200, httpRes.StatusCode) + assert.Equal(t, "host1", *resp.Results[0].Id) + assert.Equal(t, "host1.example.com", *resp.Results[0].AbsoluteName) + assert.Equal(t, "host2", *resp.Results[1].Id) + assert.Equal(t, "host2.example.com", *resp.Results[1].AbsoluteName) }) t.Run("Test HostAPIService HostRead", func(t *testing.T) { - t.Skip("skip test") // remove to run test - - var id string - + // Create a mock HTTP client + testClient := NewTestClient(func(req *http.Request) *http.Response { + // Check the request parameters + require.Equal(t, "GET", req.Method) + require.Equal(t, "/api/ddi/v1/dns/host/host1", req.URL.Path) + require.Equal(t, "application/json", req.Header.Get("Accept")) + + // Create a dummy response + response := dns_config.ConfigReadHostResponse{ + Result: &dns_config.ConfigHost{ + Id: openapiclient.PtrString("host1"), + AbsoluteName: openapiclient.PtrString("host1.example.com"), + }, + } + body, err := json.Marshal(response) + require.NoError(t, err) + + // Return the dummy response + return &http.Response{ + StatusCode: 200, + Body: io.NopCloser(bytes.NewReader(body)), + Header: map[string][]string{"Content-Type": {"application/json"}}, + } + }) + + // Create a new API client with the mock HTTP client + configuration := internal.NewConfiguration() + configuration.HTTPClient = testClient + apiClient := dns_config.NewAPIClient(configuration) + + // Call the method and check the response + id := "host1" resp, httpRes, err := apiClient.HostAPI.HostRead(context.Background(), id).Execute() require.Nil(t, err) require.NotNil(t, resp) assert.Equal(t, 200, httpRes.StatusCode) + assert.Equal(t, "host1", *resp.Result.Id) + assert.Equal(t, "host1.example.com", *resp.Result.AbsoluteName) }) t.Run("Test HostAPIService HostUpdate", func(t *testing.T) { - t.Skip("skip test") // remove to run test - - var id string - - resp, httpRes, err := apiClient.HostAPI.HostUpdate(context.Background(), id).Execute() + // Create a mock HTTP client + testClient := NewTestClient(func(req *http.Request) *http.Response { + // Check the request parameters + require.Equal(t, "PATCH", req.Method) + require.Equal(t, "/api/ddi/v1/dns/host/host1", req.URL.Path) + require.Equal(t, "application/json", req.Header.Get("Accept")) + + // Create a dummy response + response := dns_config.ConfigReadHostResponse{ + Result: &dns_config.ConfigHost{ + Id: openapiclient.PtrString("host1"), + AbsoluteName: openapiclient.PtrString("host1.example.com"), + }, + } + body, err := json.Marshal(response) + require.NoError(t, err) + + // Return the dummy response + return &http.Response{ + StatusCode: 200, + Body: io.NopCloser(bytes.NewReader(body)), + Header: map[string][]string{"Content-Type": {"application/json"}}, + } + }) + + // Create a new API client with the mock HTTP client + configuration := internal.NewConfiguration() + configuration.HTTPClient = testClient + apiClient := dns_config.NewAPIClient(configuration) + + // Call the method and check the response + id := "host1" + hostUpdateInput := dns_config.ConfigHost{ + AbsoluteName: openapiclient.PtrString("host1.example.com"), + } + resp, httpRes, err := apiClient.HostAPI.HostUpdate(context.Background(), id).Body(hostUpdateInput).Execute() require.Nil(t, err) require.NotNil(t, resp) assert.Equal(t, 200, httpRes.StatusCode) + assert.Equal(t, "host1", *resp.Result.Id) + assert.Equal(t, "host1.example.com", *resp.Result.AbsoluteName) }) From 742121d18e577855f51a1fcbb6b3bcce7584f466 Mon Sep 17 00:00:00 2001 From: Min Jiang Date: Sun, 25 Feb 2024 20:43:11 -0800 Subject: [PATCH 4/4] Complete unit tests for dns_data, dns_config, and keys modules --- dns_config/.openapi-generator-ignore | 3 + dns_config/.openapi-generator/FILES | 126 -------- dns_config/.openapi-generator/VERSION | 2 +- dns_config/docs/AclAPI.md | 164 +++++----- dns_config/docs/AuthNsgAPI.md | 164 +++++----- dns_config/docs/AuthZoneAPI.md | 202 ++++++------ dns_config/docs/CacheFlushAPI.md | 30 +- dns_config/docs/ConvertDomainNameAPI.md | 30 +- dns_config/docs/ConvertRnameAPI.md | 30 +- dns_config/docs/DelegationAPI.md | 164 +++++----- dns_config/docs/ForwardNsgAPI.md | 164 +++++----- dns_config/docs/ForwardZoneAPI.md | 194 +++++------ dns_config/docs/GlobalAPI.md | 124 +++---- dns_config/docs/HostAPI.md | 114 +++---- dns_config/docs/LbdnAPI.md | 164 +++++----- dns_config/docs/ServerAPI.md | 172 +++++----- dns_config/docs/ViewAPI.md | 202 ++++++------ dns_config/test/api_acl_test.go | 220 ++++--------- dns_config/test/api_auth_nsg_test.go | 224 +++++-------- dns_config/test/api_auth_zone_test.go | 269 ++++++---------- dns_config/test/api_cache_flush_test.go | 55 ++-- .../test/api_convert_domain_name_test.go | 43 +-- dns_config/test/api_convert_rname_test.go | 48 +-- dns_config/test/api_delegation_test.go | 176 +++++++--- dns_config/test/api_forward_nsg_test.go | 170 +++++++--- dns_config/test/api_forward_zone_test.go | 236 ++++++++++---- dns_config/test/api_global_test.go | 131 +++++--- dns_config/test/api_host_test.go | 140 +++----- dns_config/test/api_lbdn_test.go | 154 ++++++--- dns_config/test/api_server_test.go | 154 ++++++--- dns_config/test/api_view_test.go | 193 ++++++++--- dns_data/.openapi-generator/FILES | 1 + dns_data/.openapi-generator/VERSION | 2 +- dns_data/README.md | 24 +- dns_data/api_record.go | 256 ++++++++------- dns_data/docs/RecordAPI.md | 204 ++++++------ dns_data/model_data_create_record_response.go | 6 +- dns_data/model_data_list_record_response.go | 6 +- dns_data/model_data_read_record_response.go | 6 +- dns_data/model_data_record.go | 49 ++- dns_data/model_data_record_inheritance.go | 6 +- ...model_data_soa_serial_increment_request.go | 6 +- ...odel_data_soa_serial_increment_response.go | 6 +- dns_data/model_data_update_record_response.go | 6 +- .../model_inheritance2_inherited_u_int32.go | 6 +- dns_data/model_protobuf_field_mask.go | 6 +- dns_data/test/api_record_test.go | 189 +++++++---- internal/utils.go | 14 + keys/.openapi-generator/FILES | 1 - keys/README.md | 25 +- keys/api_generate_tsig.go | 34 +- keys/api_kerberos.go | 302 +++++++++++++----- keys/api_tsig.go | 206 ++++++------ keys/api_upload.go | 34 +- keys/client.go | 14 +- keys/docs/GenerateTsigAPI.md | 30 +- keys/docs/KerberosAPI.md | 199 ++++++++---- keys/docs/TsigAPI.md | 164 +++++----- keys/docs/UploadAPI.md | 30 +- keys/model_ddiupload_response.go | 6 +- keys/model_kerberos_key.go | 6 +- keys/model_kerberos_keys.go | 6 +- keys/model_keys_create_tsig_key_response.go | 6 +- keys/model_keys_generate_tsig_response.go | 6 +- keys/model_keys_generate_tsig_result.go | 6 +- keys/model_keys_list_kerberos_key_response.go | 6 +- keys/model_keys_list_tsig_key_response.go | 6 +- keys/model_keys_read_kerberos_key_response.go | 6 +- keys/model_keys_read_tsig_key_response.go | 6 +- keys/model_keys_tsig_key.go | 50 ++- ...model_keys_update_kerberos_key_response.go | 6 +- keys/model_keys_update_tsig_key_response.go | 6 +- keys/model_protobuf_field_mask.go | 6 +- keys/model_upload_content_type.go | 5 +- keys/model_upload_request.go | 54 +++- keys/test/api_generate_tsig_test.go | 66 ++-- keys/test/api_kerberos_test.go | 188 ++++------- keys/test/api_tsig_test.go | 175 +++++----- keys/test/api_upload_test.go | 57 +--- keys/utils.go | 2 +- 80 files changed, 3606 insertions(+), 3163 deletions(-) diff --git a/dns_config/.openapi-generator-ignore b/dns_config/.openapi-generator-ignore index 7484ee5..9d89018 100644 --- a/dns_config/.openapi-generator-ignore +++ b/dns_config/.openapi-generator-ignore @@ -21,3 +21,6 @@ #docs/*.md # Then explicitly reverse the ignore rule for a single file: #!docs/README.md +*.go +*.md +!api*test.go diff --git a/dns_config/.openapi-generator/FILES b/dns_config/.openapi-generator/FILES index c1b1372..4279035 100644 --- a/dns_config/.openapi-generator/FILES +++ b/dns_config/.openapi-generator/FILES @@ -1,19 +1,3 @@ -README.md -api_acl.go -api_auth_nsg.go -api_auth_zone.go -api_cache_flush.go -api_convert_domain_name.go -api_convert_rname.go -api_delegation.go -api_forward_nsg.go -api_forward_zone.go -api_global.go -api_host.go -api_lbdn.go -api_server.go -api_view.go -client.go docs/AclAPI.md docs/AuthNsgAPI.md docs/AuthZoneAPI.md @@ -137,113 +121,3 @@ docs/Inheritance2InheritedUInt32.md docs/LbdnAPI.md docs/ServerAPI.md docs/ViewAPI.md -model_auth_zone_external_provider.go -model_config_acl.go -model_config_acl_item.go -model_config_auth_nsg.go -model_config_auth_zone.go -model_config_auth_zone_config.go -model_config_auth_zone_inheritance.go -model_config_bulk_copy_error.go -model_config_bulk_copy_response.go -model_config_bulk_copy_view.go -model_config_cache_flush.go -model_config_convert_domain_name.go -model_config_convert_domain_name_response.go -model_config_convert_r_name_response.go -model_config_copy_auth_zone.go -model_config_copy_auth_zone_response.go -model_config_copy_forward_zone.go -model_config_copy_forward_zone_response.go -model_config_copy_response.go -model_config_create_acl_response.go -model_config_create_auth_nsg_response.go -model_config_create_auth_zone_response.go -model_config_create_delegation_response.go -model_config_create_forward_nsg_response.go -model_config_create_forward_zone_response.go -model_config_create_lbdn_response.go -model_config_create_server_response.go -model_config_create_view_response.go -model_config_custom_root_ns_block.go -model_config_delegation.go -model_config_delegation_server.go -model_config_display_view.go -model_config_dnssec_validation_block.go -model_config_dtc_config.go -model_config_dtc_policy.go -model_config_ecs_block.go -model_config_ecs_zone.go -model_config_external_primary.go -model_config_external_secondary.go -model_config_forward_nsg.go -model_config_forward_zone.go -model_config_forward_zone_config.go -model_config_forwarder.go -model_config_forwarders_block.go -model_config_global.go -model_config_host.go -model_config_host_associated_server.go -model_config_host_inheritance.go -model_config_inherited_acl_items.go -model_config_inherited_custom_root_ns_block.go -model_config_inherited_dnssec_validation_block.go -model_config_inherited_dtc_config.go -model_config_inherited_ecs_block.go -model_config_inherited_forwarders_block.go -model_config_inherited_kerberos_keys.go -model_config_inherited_sort_list_items.go -model_config_inherited_zone_authority.go -model_config_inherited_zone_authority_m_name_block.go -model_config_internal_secondary.go -model_config_kerberos_key.go -model_config_lbdn.go -model_config_list_acl_response.go -model_config_list_auth_nsg_response.go -model_config_list_auth_zone_response.go -model_config_list_delegation_response.go -model_config_list_forward_nsg_response.go -model_config_list_forward_zone_response.go -model_config_list_host_response.go -model_config_list_lbdn_response.go -model_config_list_server_response.go -model_config_list_view_response.go -model_config_read_acl_response.go -model_config_read_auth_nsg_response.go -model_config_read_auth_zone_response.go -model_config_read_delegation_response.go -model_config_read_forward_nsg_response.go -model_config_read_forward_zone_response.go -model_config_read_global_response.go -model_config_read_host_response.go -model_config_read_lbdn_response.go -model_config_read_server_response.go -model_config_read_view_response.go -model_config_root_ns.go -model_config_server.go -model_config_server_inheritance.go -model_config_sort_list_item.go -model_config_trust_anchor.go -model_config_tsig_key.go -model_config_ttl_inheritance.go -model_config_update_acl_response.go -model_config_update_auth_nsg_response.go -model_config_update_auth_zone_response.go -model_config_update_delegation_response.go -model_config_update_forward_nsg_response.go -model_config_update_forward_zone_response.go -model_config_update_global_response.go -model_config_update_host_response.go -model_config_update_lbdn_response.go -model_config_update_server_response.go -model_config_update_view_response.go -model_config_view.go -model_config_view_inheritance.go -model_config_warning.go -model_config_zone_authority.go -model_config_zone_authority_m_name_block.go -model_inheritance2_assigned_host.go -model_inheritance2_inherited_bool.go -model_inheritance2_inherited_string.go -model_inheritance2_inherited_u_int32.go -utils.go diff --git a/dns_config/.openapi-generator/VERSION b/dns_config/.openapi-generator/VERSION index 73a86b1..4b49d9b 100644 --- a/dns_config/.openapi-generator/VERSION +++ b/dns_config/.openapi-generator/VERSION @@ -1 +1 @@ -7.0.1 \ No newline at end of file +7.2.0 \ No newline at end of file diff --git a/dns_config/docs/AclAPI.md b/dns_config/docs/AclAPI.md index cb8cd18..2186694 100644 --- a/dns_config/docs/AclAPI.md +++ b/dns_config/docs/AclAPI.md @@ -26,24 +26,24 @@ Create the ACL object. package main import ( - "context" - "fmt" - "os" - openapiclient "github.com/infobloxopen/bloxone-go-client" + "context" + "fmt" + "os" + openapiclient "github.com/infobloxopen/bloxone-go-client" ) func main() { - body := *openapiclient.NewConfigACL("Name_example") // ConfigACL | - - configuration := openapiclient.NewConfiguration() - apiClient := openapiclient.NewAPIClient(configuration) - resp, r, err := apiClient.AclAPI.AclCreate(context.Background()).Body(body).Execute() - if err != nil { - fmt.Fprintf(os.Stderr, "Error when calling `AclAPI.AclCreate``: %v\n", err) - fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) - } - // response from `AclCreate`: ConfigCreateACLResponse - fmt.Fprintf(os.Stdout, "Response from `AclAPI.AclCreate`: %v\n", resp) + body := *openapiclient.NewConfigACL("Name_example") // ConfigACL | + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.AclAPI.AclCreate(context.Background()).Body(body).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `AclAPI.AclCreate``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `AclCreate`: ConfigCreateACLResponse + fmt.Fprintf(os.Stdout, "Response from `AclAPI.AclCreate`: %v\n", resp) } ``` @@ -92,22 +92,22 @@ Move the ACL object to Recyclebin. package main import ( - "context" - "fmt" - "os" - openapiclient "github.com/infobloxopen/bloxone-go-client" + "context" + "fmt" + "os" + openapiclient "github.com/infobloxopen/bloxone-go-client" ) func main() { - id := "id_example" // string | An application specific resource identity of a resource - - configuration := openapiclient.NewConfiguration() - apiClient := openapiclient.NewAPIClient(configuration) - r, err := apiClient.AclAPI.AclDelete(context.Background(), id).Execute() - if err != nil { - fmt.Fprintf(os.Stderr, "Error when calling `AclAPI.AclDelete``: %v\n", err) - fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) - } + id := "id_example" // string | An application specific resource identity of a resource + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + r, err := apiClient.AclAPI.AclDelete(context.Background(), id).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `AclAPI.AclDelete``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } } ``` @@ -160,31 +160,31 @@ List ACL objects. package main import ( - "context" - "fmt" - "os" - openapiclient "github.com/infobloxopen/bloxone-go-client" + "context" + "fmt" + "os" + openapiclient "github.com/infobloxopen/bloxone-go-client" ) func main() { - fields := "fields_example" // string | A collection of response resources can be transformed by specifying a set of JSON tags to be returned. For a “flat” resource, the tag name is straightforward. If field selection is allowed on non-flat hierarchical resources, the service should implement a qualified naming scheme such as dot-qualification to reference data down the hierarchy. If a resource does not have the specified tag, the tag does not appear in the output resource. Specify this parameter as a comma-separated list of JSON tag names. (optional) - filter := "filter_example" // string | A collection of response resources can be filtered by a logical expression string that includes JSON tag references to values in each resource, literal values, and logical operators. If a resource does not have the specified tag, its value is assumed to be null. Literal values include numbers (integer and floating-point), and quoted (both single- or double-quoted) literal strings, and 'null'. The following operators are commonly used in filter expressions: | Op | Description | | -- | ----------- | | == | Equal | | != | Not Equal | | > | Greater Than | | >= | Greater Than or Equal To | | < | Less Than | | <= | Less Than or Equal To | | and | Logical AND | | ~ | Matches Regex | | !~ | Does Not Match Regex | | or | Logical OR | | not | Logical NOT | | () | Groupping Operators | (optional) - offset := int32(56) // int32 | The integer index (zero-origin) of the offset into a collection of resources. If omitted or null the value is assumed to be '0'. (optional) - limit := int32(56) // int32 | The integer number of resources to be returned in the response. The service may impose maximum value. If omitted the service may impose a default value. (optional) - pageToken := "pageToken_example" // string | The service-defined string used to identify a page of resources. A null value indicates the first page. (optional) - orderBy := "orderBy_example" // string | A collection of response resources can be sorted by their JSON tags. For a 'flat' resource, the tag name is straightforward. If sorting is allowed on non-flat hierarchical resources, the service should implement a qualified naming scheme such as dot-qualification to reference data down the hierarchy. If a resource does not have the specified tag, its value is assumed to be null.) Specify this parameter as a comma-separated list of JSON tag names. The sort direction can be specified by a suffix separated by whitespace before the tag name. The suffix 'asc' sorts the data in ascending order. The suffix 'desc' sorts the data in descending order. If no suffix is specified the data is sorted in ascending order. (optional) - tfilter := "tfilter_example" // string | This parameter is used for filtering by tags. (optional) - torderBy := "torderBy_example" // string | This parameter is used for sorting by tags. (optional) - - configuration := openapiclient.NewConfiguration() - apiClient := openapiclient.NewAPIClient(configuration) - resp, r, err := apiClient.AclAPI.AclList(context.Background()).Fields(fields).Filter(filter).Offset(offset).Limit(limit).PageToken(pageToken).OrderBy(orderBy).Tfilter(tfilter).TorderBy(torderBy).Execute() - if err != nil { - fmt.Fprintf(os.Stderr, "Error when calling `AclAPI.AclList``: %v\n", err) - fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) - } - // response from `AclList`: ConfigListACLResponse - fmt.Fprintf(os.Stdout, "Response from `AclAPI.AclList`: %v\n", resp) + fields := "fields_example" // string | A collection of response resources can be transformed by specifying a set of JSON tags to be returned. For a “flat” resource, the tag name is straightforward. If field selection is allowed on non-flat hierarchical resources, the service should implement a qualified naming scheme such as dot-qualification to reference data down the hierarchy. If a resource does not have the specified tag, the tag does not appear in the output resource. Specify this parameter as a comma-separated list of JSON tag names. (optional) + filter := "filter_example" // string | A collection of response resources can be filtered by a logical expression string that includes JSON tag references to values in each resource, literal values, and logical operators. If a resource does not have the specified tag, its value is assumed to be null. Literal values include numbers (integer and floating-point), and quoted (both single- or double-quoted) literal strings, and 'null'. The following operators are commonly used in filter expressions: | Op | Description | | -- | ----------- | | == | Equal | | != | Not Equal | | > | Greater Than | | >= | Greater Than or Equal To | | < | Less Than | | <= | Less Than or Equal To | | and | Logical AND | | ~ | Matches Regex | | !~ | Does Not Match Regex | | or | Logical OR | | not | Logical NOT | | () | Groupping Operators | (optional) + offset := int32(56) // int32 | The integer index (zero-origin) of the offset into a collection of resources. If omitted or null the value is assumed to be '0'. (optional) + limit := int32(56) // int32 | The integer number of resources to be returned in the response. The service may impose maximum value. If omitted the service may impose a default value. (optional) + pageToken := "pageToken_example" // string | The service-defined string used to identify a page of resources. A null value indicates the first page. (optional) + orderBy := "orderBy_example" // string | A collection of response resources can be sorted by their JSON tags. For a 'flat' resource, the tag name is straightforward. If sorting is allowed on non-flat hierarchical resources, the service should implement a qualified naming scheme such as dot-qualification to reference data down the hierarchy. If a resource does not have the specified tag, its value is assumed to be null.) Specify this parameter as a comma-separated list of JSON tag names. The sort direction can be specified by a suffix separated by whitespace before the tag name. The suffix 'asc' sorts the data in ascending order. The suffix 'desc' sorts the data in descending order. If no suffix is specified the data is sorted in ascending order. (optional) + tfilter := "tfilter_example" // string | This parameter is used for filtering by tags. (optional) + torderBy := "torderBy_example" // string | This parameter is used for sorting by tags. (optional) + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.AclAPI.AclList(context.Background()).Fields(fields).Filter(filter).Offset(offset).Limit(limit).PageToken(pageToken).OrderBy(orderBy).Tfilter(tfilter).TorderBy(torderBy).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `AclAPI.AclList``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `AclList`: ConfigListACLResponse + fmt.Fprintf(os.Stdout, "Response from `AclAPI.AclList`: %v\n", resp) } ``` @@ -240,25 +240,25 @@ Read the ACL object. package main import ( - "context" - "fmt" - "os" - openapiclient "github.com/infobloxopen/bloxone-go-client" + "context" + "fmt" + "os" + openapiclient "github.com/infobloxopen/bloxone-go-client" ) func main() { - id := "id_example" // string | An application specific resource identity of a resource - fields := "fields_example" // string | A collection of response resources can be transformed by specifying a set of JSON tags to be returned. For a “flat” resource, the tag name is straightforward. If field selection is allowed on non-flat hierarchical resources, the service should implement a qualified naming scheme such as dot-qualification to reference data down the hierarchy. If a resource does not have the specified tag, the tag does not appear in the output resource. Specify this parameter as a comma-separated list of JSON tag names. (optional) - - configuration := openapiclient.NewConfiguration() - apiClient := openapiclient.NewAPIClient(configuration) - resp, r, err := apiClient.AclAPI.AclRead(context.Background(), id).Fields(fields).Execute() - if err != nil { - fmt.Fprintf(os.Stderr, "Error when calling `AclAPI.AclRead``: %v\n", err) - fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) - } - // response from `AclRead`: ConfigReadACLResponse - fmt.Fprintf(os.Stdout, "Response from `AclAPI.AclRead`: %v\n", resp) + id := "id_example" // string | An application specific resource identity of a resource + fields := "fields_example" // string | A collection of response resources can be transformed by specifying a set of JSON tags to be returned. For a “flat” resource, the tag name is straightforward. If field selection is allowed on non-flat hierarchical resources, the service should implement a qualified naming scheme such as dot-qualification to reference data down the hierarchy. If a resource does not have the specified tag, the tag does not appear in the output resource. Specify this parameter as a comma-separated list of JSON tag names. (optional) + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.AclAPI.AclRead(context.Background(), id).Fields(fields).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `AclAPI.AclRead``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `AclRead`: ConfigReadACLResponse + fmt.Fprintf(os.Stdout, "Response from `AclAPI.AclRead`: %v\n", resp) } ``` @@ -312,25 +312,25 @@ Update the ACL object. package main import ( - "context" - "fmt" - "os" - openapiclient "github.com/infobloxopen/bloxone-go-client" + "context" + "fmt" + "os" + openapiclient "github.com/infobloxopen/bloxone-go-client" ) func main() { - id := "id_example" // string | An application specific resource identity of a resource - body := *openapiclient.NewConfigACL("Name_example") // ConfigACL | - - configuration := openapiclient.NewConfiguration() - apiClient := openapiclient.NewAPIClient(configuration) - resp, r, err := apiClient.AclAPI.AclUpdate(context.Background(), id).Body(body).Execute() - if err != nil { - fmt.Fprintf(os.Stderr, "Error when calling `AclAPI.AclUpdate``: %v\n", err) - fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) - } - // response from `AclUpdate`: ConfigUpdateACLResponse - fmt.Fprintf(os.Stdout, "Response from `AclAPI.AclUpdate`: %v\n", resp) + id := "id_example" // string | An application specific resource identity of a resource + body := *openapiclient.NewConfigACL("Name_example") // ConfigACL | + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.AclAPI.AclUpdate(context.Background(), id).Body(body).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `AclAPI.AclUpdate``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `AclUpdate`: ConfigUpdateACLResponse + fmt.Fprintf(os.Stdout, "Response from `AclAPI.AclUpdate`: %v\n", resp) } ``` diff --git a/dns_config/docs/AuthNsgAPI.md b/dns_config/docs/AuthNsgAPI.md index c121ebd..57a9e46 100644 --- a/dns_config/docs/AuthNsgAPI.md +++ b/dns_config/docs/AuthNsgAPI.md @@ -26,24 +26,24 @@ Create the AuthNSG object. package main import ( - "context" - "fmt" - "os" - openapiclient "github.com/infobloxopen/bloxone-go-client" + "context" + "fmt" + "os" + openapiclient "github.com/infobloxopen/bloxone-go-client" ) func main() { - body := *openapiclient.NewConfigAuthNSG("Name_example") // ConfigAuthNSG | - - configuration := openapiclient.NewConfiguration() - apiClient := openapiclient.NewAPIClient(configuration) - resp, r, err := apiClient.AuthNsgAPI.AuthNsgCreate(context.Background()).Body(body).Execute() - if err != nil { - fmt.Fprintf(os.Stderr, "Error when calling `AuthNsgAPI.AuthNsgCreate``: %v\n", err) - fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) - } - // response from `AuthNsgCreate`: ConfigCreateAuthNSGResponse - fmt.Fprintf(os.Stdout, "Response from `AuthNsgAPI.AuthNsgCreate`: %v\n", resp) + body := *openapiclient.NewConfigAuthNSG("Name_example") // ConfigAuthNSG | + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.AuthNsgAPI.AuthNsgCreate(context.Background()).Body(body).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `AuthNsgAPI.AuthNsgCreate``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `AuthNsgCreate`: ConfigCreateAuthNSGResponse + fmt.Fprintf(os.Stdout, "Response from `AuthNsgAPI.AuthNsgCreate`: %v\n", resp) } ``` @@ -92,22 +92,22 @@ Move the AuthNSG object to Recyclebin. package main import ( - "context" - "fmt" - "os" - openapiclient "github.com/infobloxopen/bloxone-go-client" + "context" + "fmt" + "os" + openapiclient "github.com/infobloxopen/bloxone-go-client" ) func main() { - id := "id_example" // string | An application specific resource identity of a resource - - configuration := openapiclient.NewConfiguration() - apiClient := openapiclient.NewAPIClient(configuration) - r, err := apiClient.AuthNsgAPI.AuthNsgDelete(context.Background(), id).Execute() - if err != nil { - fmt.Fprintf(os.Stderr, "Error when calling `AuthNsgAPI.AuthNsgDelete``: %v\n", err) - fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) - } + id := "id_example" // string | An application specific resource identity of a resource + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + r, err := apiClient.AuthNsgAPI.AuthNsgDelete(context.Background(), id).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `AuthNsgAPI.AuthNsgDelete``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } } ``` @@ -160,31 +160,31 @@ List AuthNSG objects. package main import ( - "context" - "fmt" - "os" - openapiclient "github.com/infobloxopen/bloxone-go-client" + "context" + "fmt" + "os" + openapiclient "github.com/infobloxopen/bloxone-go-client" ) func main() { - fields := "fields_example" // string | A collection of response resources can be transformed by specifying a set of JSON tags to be returned. For a “flat” resource, the tag name is straightforward. If field selection is allowed on non-flat hierarchical resources, the service should implement a qualified naming scheme such as dot-qualification to reference data down the hierarchy. If a resource does not have the specified tag, the tag does not appear in the output resource. Specify this parameter as a comma-separated list of JSON tag names. (optional) - filter := "filter_example" // string | A collection of response resources can be filtered by a logical expression string that includes JSON tag references to values in each resource, literal values, and logical operators. If a resource does not have the specified tag, its value is assumed to be null. Literal values include numbers (integer and floating-point), and quoted (both single- or double-quoted) literal strings, and 'null'. The following operators are commonly used in filter expressions: | Op | Description | | -- | ----------- | | == | Equal | | != | Not Equal | | > | Greater Than | | >= | Greater Than or Equal To | | < | Less Than | | <= | Less Than or Equal To | | and | Logical AND | | ~ | Matches Regex | | !~ | Does Not Match Regex | | or | Logical OR | | not | Logical NOT | | () | Groupping Operators | (optional) - offset := int32(56) // int32 | The integer index (zero-origin) of the offset into a collection of resources. If omitted or null the value is assumed to be '0'. (optional) - limit := int32(56) // int32 | The integer number of resources to be returned in the response. The service may impose maximum value. If omitted the service may impose a default value. (optional) - pageToken := "pageToken_example" // string | The service-defined string used to identify a page of resources. A null value indicates the first page. (optional) - orderBy := "orderBy_example" // string | A collection of response resources can be sorted by their JSON tags. For a 'flat' resource, the tag name is straightforward. If sorting is allowed on non-flat hierarchical resources, the service should implement a qualified naming scheme such as dot-qualification to reference data down the hierarchy. If a resource does not have the specified tag, its value is assumed to be null.) Specify this parameter as a comma-separated list of JSON tag names. The sort direction can be specified by a suffix separated by whitespace before the tag name. The suffix 'asc' sorts the data in ascending order. The suffix 'desc' sorts the data in descending order. If no suffix is specified the data is sorted in ascending order. (optional) - tfilter := "tfilter_example" // string | This parameter is used for filtering by tags. (optional) - torderBy := "torderBy_example" // string | This parameter is used for sorting by tags. (optional) - - configuration := openapiclient.NewConfiguration() - apiClient := openapiclient.NewAPIClient(configuration) - resp, r, err := apiClient.AuthNsgAPI.AuthNsgList(context.Background()).Fields(fields).Filter(filter).Offset(offset).Limit(limit).PageToken(pageToken).OrderBy(orderBy).Tfilter(tfilter).TorderBy(torderBy).Execute() - if err != nil { - fmt.Fprintf(os.Stderr, "Error when calling `AuthNsgAPI.AuthNsgList``: %v\n", err) - fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) - } - // response from `AuthNsgList`: ConfigListAuthNSGResponse - fmt.Fprintf(os.Stdout, "Response from `AuthNsgAPI.AuthNsgList`: %v\n", resp) + fields := "fields_example" // string | A collection of response resources can be transformed by specifying a set of JSON tags to be returned. For a “flat” resource, the tag name is straightforward. If field selection is allowed on non-flat hierarchical resources, the service should implement a qualified naming scheme such as dot-qualification to reference data down the hierarchy. If a resource does not have the specified tag, the tag does not appear in the output resource. Specify this parameter as a comma-separated list of JSON tag names. (optional) + filter := "filter_example" // string | A collection of response resources can be filtered by a logical expression string that includes JSON tag references to values in each resource, literal values, and logical operators. If a resource does not have the specified tag, its value is assumed to be null. Literal values include numbers (integer and floating-point), and quoted (both single- or double-quoted) literal strings, and 'null'. The following operators are commonly used in filter expressions: | Op | Description | | -- | ----------- | | == | Equal | | != | Not Equal | | > | Greater Than | | >= | Greater Than or Equal To | | < | Less Than | | <= | Less Than or Equal To | | and | Logical AND | | ~ | Matches Regex | | !~ | Does Not Match Regex | | or | Logical OR | | not | Logical NOT | | () | Groupping Operators | (optional) + offset := int32(56) // int32 | The integer index (zero-origin) of the offset into a collection of resources. If omitted or null the value is assumed to be '0'. (optional) + limit := int32(56) // int32 | The integer number of resources to be returned in the response. The service may impose maximum value. If omitted the service may impose a default value. (optional) + pageToken := "pageToken_example" // string | The service-defined string used to identify a page of resources. A null value indicates the first page. (optional) + orderBy := "orderBy_example" // string | A collection of response resources can be sorted by their JSON tags. For a 'flat' resource, the tag name is straightforward. If sorting is allowed on non-flat hierarchical resources, the service should implement a qualified naming scheme such as dot-qualification to reference data down the hierarchy. If a resource does not have the specified tag, its value is assumed to be null.) Specify this parameter as a comma-separated list of JSON tag names. The sort direction can be specified by a suffix separated by whitespace before the tag name. The suffix 'asc' sorts the data in ascending order. The suffix 'desc' sorts the data in descending order. If no suffix is specified the data is sorted in ascending order. (optional) + tfilter := "tfilter_example" // string | This parameter is used for filtering by tags. (optional) + torderBy := "torderBy_example" // string | This parameter is used for sorting by tags. (optional) + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.AuthNsgAPI.AuthNsgList(context.Background()).Fields(fields).Filter(filter).Offset(offset).Limit(limit).PageToken(pageToken).OrderBy(orderBy).Tfilter(tfilter).TorderBy(torderBy).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `AuthNsgAPI.AuthNsgList``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `AuthNsgList`: ConfigListAuthNSGResponse + fmt.Fprintf(os.Stdout, "Response from `AuthNsgAPI.AuthNsgList`: %v\n", resp) } ``` @@ -240,25 +240,25 @@ Read the AuthNSG object. package main import ( - "context" - "fmt" - "os" - openapiclient "github.com/infobloxopen/bloxone-go-client" + "context" + "fmt" + "os" + openapiclient "github.com/infobloxopen/bloxone-go-client" ) func main() { - id := "id_example" // string | An application specific resource identity of a resource - fields := "fields_example" // string | A collection of response resources can be transformed by specifying a set of JSON tags to be returned. For a “flat” resource, the tag name is straightforward. If field selection is allowed on non-flat hierarchical resources, the service should implement a qualified naming scheme such as dot-qualification to reference data down the hierarchy. If a resource does not have the specified tag, the tag does not appear in the output resource. Specify this parameter as a comma-separated list of JSON tag names. (optional) - - configuration := openapiclient.NewConfiguration() - apiClient := openapiclient.NewAPIClient(configuration) - resp, r, err := apiClient.AuthNsgAPI.AuthNsgRead(context.Background(), id).Fields(fields).Execute() - if err != nil { - fmt.Fprintf(os.Stderr, "Error when calling `AuthNsgAPI.AuthNsgRead``: %v\n", err) - fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) - } - // response from `AuthNsgRead`: ConfigReadAuthNSGResponse - fmt.Fprintf(os.Stdout, "Response from `AuthNsgAPI.AuthNsgRead`: %v\n", resp) + id := "id_example" // string | An application specific resource identity of a resource + fields := "fields_example" // string | A collection of response resources can be transformed by specifying a set of JSON tags to be returned. For a “flat” resource, the tag name is straightforward. If field selection is allowed on non-flat hierarchical resources, the service should implement a qualified naming scheme such as dot-qualification to reference data down the hierarchy. If a resource does not have the specified tag, the tag does not appear in the output resource. Specify this parameter as a comma-separated list of JSON tag names. (optional) + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.AuthNsgAPI.AuthNsgRead(context.Background(), id).Fields(fields).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `AuthNsgAPI.AuthNsgRead``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `AuthNsgRead`: ConfigReadAuthNSGResponse + fmt.Fprintf(os.Stdout, "Response from `AuthNsgAPI.AuthNsgRead`: %v\n", resp) } ``` @@ -312,25 +312,25 @@ Update the AuthNSG object. package main import ( - "context" - "fmt" - "os" - openapiclient "github.com/infobloxopen/bloxone-go-client" + "context" + "fmt" + "os" + openapiclient "github.com/infobloxopen/bloxone-go-client" ) func main() { - id := "id_example" // string | An application specific resource identity of a resource - body := *openapiclient.NewConfigAuthNSG("Name_example") // ConfigAuthNSG | - - configuration := openapiclient.NewConfiguration() - apiClient := openapiclient.NewAPIClient(configuration) - resp, r, err := apiClient.AuthNsgAPI.AuthNsgUpdate(context.Background(), id).Body(body).Execute() - if err != nil { - fmt.Fprintf(os.Stderr, "Error when calling `AuthNsgAPI.AuthNsgUpdate``: %v\n", err) - fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) - } - // response from `AuthNsgUpdate`: ConfigUpdateAuthNSGResponse - fmt.Fprintf(os.Stdout, "Response from `AuthNsgAPI.AuthNsgUpdate`: %v\n", resp) + id := "id_example" // string | An application specific resource identity of a resource + body := *openapiclient.NewConfigAuthNSG("Name_example") // ConfigAuthNSG | + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.AuthNsgAPI.AuthNsgUpdate(context.Background(), id).Body(body).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `AuthNsgAPI.AuthNsgUpdate``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `AuthNsgUpdate`: ConfigUpdateAuthNSGResponse + fmt.Fprintf(os.Stdout, "Response from `AuthNsgAPI.AuthNsgUpdate`: %v\n", resp) } ``` diff --git a/dns_config/docs/AuthZoneAPI.md b/dns_config/docs/AuthZoneAPI.md index 041d137..3191123 100644 --- a/dns_config/docs/AuthZoneAPI.md +++ b/dns_config/docs/AuthZoneAPI.md @@ -27,24 +27,24 @@ Copies the __AuthZone__ object. package main import ( - "context" - "fmt" - "os" - openapiclient "github.com/infobloxopen/bloxone-go-client" + "context" + "fmt" + "os" + openapiclient "github.com/infobloxopen/bloxone-go-client" ) func main() { - body := *openapiclient.NewConfigCopyAuthZone("TargetView_example") // ConfigCopyAuthZone | - - configuration := openapiclient.NewConfiguration() - apiClient := openapiclient.NewAPIClient(configuration) - resp, r, err := apiClient.AuthZoneAPI.AuthZoneCopy(context.Background()).Body(body).Execute() - if err != nil { - fmt.Fprintf(os.Stderr, "Error when calling `AuthZoneAPI.AuthZoneCopy``: %v\n", err) - fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) - } - // response from `AuthZoneCopy`: ConfigCopyAuthZoneResponse - fmt.Fprintf(os.Stdout, "Response from `AuthZoneAPI.AuthZoneCopy`: %v\n", resp) + body := *openapiclient.NewConfigCopyAuthZone("TargetView_example") // ConfigCopyAuthZone | + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.AuthZoneAPI.AuthZoneCopy(context.Background()).Body(body).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `AuthZoneAPI.AuthZoneCopy``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `AuthZoneCopy`: ConfigCopyAuthZoneResponse + fmt.Fprintf(os.Stdout, "Response from `AuthZoneAPI.AuthZoneCopy`: %v\n", resp) } ``` @@ -93,25 +93,25 @@ Create the AuthZone object. package main import ( - "context" - "fmt" - "os" - openapiclient "github.com/infobloxopen/bloxone-go-client" + "context" + "fmt" + "os" + openapiclient "github.com/infobloxopen/bloxone-go-client" ) func main() { - body := *openapiclient.NewConfigAuthZone() // ConfigAuthZone | - inherit := "inherit_example" // string | This parameter is used for getting inheritance_sources. Allowed values: * _none_, * _partial_, * _full_. Defaults to _none (optional) - - configuration := openapiclient.NewConfiguration() - apiClient := openapiclient.NewAPIClient(configuration) - resp, r, err := apiClient.AuthZoneAPI.AuthZoneCreate(context.Background()).Body(body).Inherit(inherit).Execute() - if err != nil { - fmt.Fprintf(os.Stderr, "Error when calling `AuthZoneAPI.AuthZoneCreate``: %v\n", err) - fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) - } - // response from `AuthZoneCreate`: ConfigCreateAuthZoneResponse - fmt.Fprintf(os.Stdout, "Response from `AuthZoneAPI.AuthZoneCreate`: %v\n", resp) + body := *openapiclient.NewConfigAuthZone() // ConfigAuthZone | + inherit := "inherit_example" // string | This parameter is used for getting inheritance_sources. Allowed values: * _none_, * _partial_, * _full_. Defaults to _none (optional) + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.AuthZoneAPI.AuthZoneCreate(context.Background()).Body(body).Inherit(inherit).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `AuthZoneAPI.AuthZoneCreate``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `AuthZoneCreate`: ConfigCreateAuthZoneResponse + fmt.Fprintf(os.Stdout, "Response from `AuthZoneAPI.AuthZoneCreate`: %v\n", resp) } ``` @@ -161,22 +161,22 @@ Moves the AuthZone object to Recyclebin. package main import ( - "context" - "fmt" - "os" - openapiclient "github.com/infobloxopen/bloxone-go-client" + "context" + "fmt" + "os" + openapiclient "github.com/infobloxopen/bloxone-go-client" ) func main() { - id := "id_example" // string | An application specific resource identity of a resource - - configuration := openapiclient.NewConfiguration() - apiClient := openapiclient.NewAPIClient(configuration) - r, err := apiClient.AuthZoneAPI.AuthZoneDelete(context.Background(), id).Execute() - if err != nil { - fmt.Fprintf(os.Stderr, "Error when calling `AuthZoneAPI.AuthZoneDelete``: %v\n", err) - fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) - } + id := "id_example" // string | An application specific resource identity of a resource + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + r, err := apiClient.AuthZoneAPI.AuthZoneDelete(context.Background(), id).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `AuthZoneAPI.AuthZoneDelete``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } } ``` @@ -229,32 +229,32 @@ List AuthZone objects. package main import ( - "context" - "fmt" - "os" - openapiclient "github.com/infobloxopen/bloxone-go-client" + "context" + "fmt" + "os" + openapiclient "github.com/infobloxopen/bloxone-go-client" ) func main() { - fields := "fields_example" // string | A collection of response resources can be transformed by specifying a set of JSON tags to be returned. For a “flat” resource, the tag name is straightforward. If field selection is allowed on non-flat hierarchical resources, the service should implement a qualified naming scheme such as dot-qualification to reference data down the hierarchy. If a resource does not have the specified tag, the tag does not appear in the output resource. Specify this parameter as a comma-separated list of JSON tag names. (optional) - filter := "filter_example" // string | A collection of response resources can be filtered by a logical expression string that includes JSON tag references to values in each resource, literal values, and logical operators. If a resource does not have the specified tag, its value is assumed to be null. Literal values include numbers (integer and floating-point), and quoted (both single- or double-quoted) literal strings, and 'null'. The following operators are commonly used in filter expressions: | Op | Description | | -- | ----------- | | == | Equal | | != | Not Equal | | > | Greater Than | | >= | Greater Than or Equal To | | < | Less Than | | <= | Less Than or Equal To | | and | Logical AND | | ~ | Matches Regex | | !~ | Does Not Match Regex | | or | Logical OR | | not | Logical NOT | | () | Groupping Operators | (optional) - offset := int32(56) // int32 | The integer index (zero-origin) of the offset into a collection of resources. If omitted or null the value is assumed to be '0'. (optional) - limit := int32(56) // int32 | The integer number of resources to be returned in the response. The service may impose maximum value. If omitted the service may impose a default value. (optional) - pageToken := "pageToken_example" // string | The service-defined string used to identify a page of resources. A null value indicates the first page. (optional) - orderBy := "orderBy_example" // string | A collection of response resources can be sorted by their JSON tags. For a 'flat' resource, the tag name is straightforward. If sorting is allowed on non-flat hierarchical resources, the service should implement a qualified naming scheme such as dot-qualification to reference data down the hierarchy. If a resource does not have the specified tag, its value is assumed to be null.) Specify this parameter as a comma-separated list of JSON tag names. The sort direction can be specified by a suffix separated by whitespace before the tag name. The suffix 'asc' sorts the data in ascending order. The suffix 'desc' sorts the data in descending order. If no suffix is specified the data is sorted in ascending order. (optional) - tfilter := "tfilter_example" // string | This parameter is used for filtering by tags. (optional) - torderBy := "torderBy_example" // string | This parameter is used for sorting by tags. (optional) - inherit := "inherit_example" // string | This parameter is used for getting inheritance_sources. Allowed values: * _none_, * _partial_, * _full_. Defaults to _none (optional) - - configuration := openapiclient.NewConfiguration() - apiClient := openapiclient.NewAPIClient(configuration) - resp, r, err := apiClient.AuthZoneAPI.AuthZoneList(context.Background()).Fields(fields).Filter(filter).Offset(offset).Limit(limit).PageToken(pageToken).OrderBy(orderBy).Tfilter(tfilter).TorderBy(torderBy).Inherit(inherit).Execute() - if err != nil { - fmt.Fprintf(os.Stderr, "Error when calling `AuthZoneAPI.AuthZoneList``: %v\n", err) - fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) - } - // response from `AuthZoneList`: ConfigListAuthZoneResponse - fmt.Fprintf(os.Stdout, "Response from `AuthZoneAPI.AuthZoneList`: %v\n", resp) + fields := "fields_example" // string | A collection of response resources can be transformed by specifying a set of JSON tags to be returned. For a “flat” resource, the tag name is straightforward. If field selection is allowed on non-flat hierarchical resources, the service should implement a qualified naming scheme such as dot-qualification to reference data down the hierarchy. If a resource does not have the specified tag, the tag does not appear in the output resource. Specify this parameter as a comma-separated list of JSON tag names. (optional) + filter := "filter_example" // string | A collection of response resources can be filtered by a logical expression string that includes JSON tag references to values in each resource, literal values, and logical operators. If a resource does not have the specified tag, its value is assumed to be null. Literal values include numbers (integer and floating-point), and quoted (both single- or double-quoted) literal strings, and 'null'. The following operators are commonly used in filter expressions: | Op | Description | | -- | ----------- | | == | Equal | | != | Not Equal | | > | Greater Than | | >= | Greater Than or Equal To | | < | Less Than | | <= | Less Than or Equal To | | and | Logical AND | | ~ | Matches Regex | | !~ | Does Not Match Regex | | or | Logical OR | | not | Logical NOT | | () | Groupping Operators | (optional) + offset := int32(56) // int32 | The integer index (zero-origin) of the offset into a collection of resources. If omitted or null the value is assumed to be '0'. (optional) + limit := int32(56) // int32 | The integer number of resources to be returned in the response. The service may impose maximum value. If omitted the service may impose a default value. (optional) + pageToken := "pageToken_example" // string | The service-defined string used to identify a page of resources. A null value indicates the first page. (optional) + orderBy := "orderBy_example" // string | A collection of response resources can be sorted by their JSON tags. For a 'flat' resource, the tag name is straightforward. If sorting is allowed on non-flat hierarchical resources, the service should implement a qualified naming scheme such as dot-qualification to reference data down the hierarchy. If a resource does not have the specified tag, its value is assumed to be null.) Specify this parameter as a comma-separated list of JSON tag names. The sort direction can be specified by a suffix separated by whitespace before the tag name. The suffix 'asc' sorts the data in ascending order. The suffix 'desc' sorts the data in descending order. If no suffix is specified the data is sorted in ascending order. (optional) + tfilter := "tfilter_example" // string | This parameter is used for filtering by tags. (optional) + torderBy := "torderBy_example" // string | This parameter is used for sorting by tags. (optional) + inherit := "inherit_example" // string | This parameter is used for getting inheritance_sources. Allowed values: * _none_, * _partial_, * _full_. Defaults to _none (optional) + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.AuthZoneAPI.AuthZoneList(context.Background()).Fields(fields).Filter(filter).Offset(offset).Limit(limit).PageToken(pageToken).OrderBy(orderBy).Tfilter(tfilter).TorderBy(torderBy).Inherit(inherit).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `AuthZoneAPI.AuthZoneList``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `AuthZoneList`: ConfigListAuthZoneResponse + fmt.Fprintf(os.Stdout, "Response from `AuthZoneAPI.AuthZoneList`: %v\n", resp) } ``` @@ -311,26 +311,26 @@ Read the AuthZone object. package main import ( - "context" - "fmt" - "os" - openapiclient "github.com/infobloxopen/bloxone-go-client" + "context" + "fmt" + "os" + openapiclient "github.com/infobloxopen/bloxone-go-client" ) func main() { - id := "id_example" // string | An application specific resource identity of a resource - fields := "fields_example" // string | A collection of response resources can be transformed by specifying a set of JSON tags to be returned. For a “flat” resource, the tag name is straightforward. If field selection is allowed on non-flat hierarchical resources, the service should implement a qualified naming scheme such as dot-qualification to reference data down the hierarchy. If a resource does not have the specified tag, the tag does not appear in the output resource. Specify this parameter as a comma-separated list of JSON tag names. (optional) - inherit := "inherit_example" // string | This parameter is used for getting inheritance_sources. Allowed values: * _none_, * _partial_, * _full_. Defaults to _none (optional) - - configuration := openapiclient.NewConfiguration() - apiClient := openapiclient.NewAPIClient(configuration) - resp, r, err := apiClient.AuthZoneAPI.AuthZoneRead(context.Background(), id).Fields(fields).Inherit(inherit).Execute() - if err != nil { - fmt.Fprintf(os.Stderr, "Error when calling `AuthZoneAPI.AuthZoneRead``: %v\n", err) - fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) - } - // response from `AuthZoneRead`: ConfigReadAuthZoneResponse - fmt.Fprintf(os.Stdout, "Response from `AuthZoneAPI.AuthZoneRead`: %v\n", resp) + id := "id_example" // string | An application specific resource identity of a resource + fields := "fields_example" // string | A collection of response resources can be transformed by specifying a set of JSON tags to be returned. For a “flat” resource, the tag name is straightforward. If field selection is allowed on non-flat hierarchical resources, the service should implement a qualified naming scheme such as dot-qualification to reference data down the hierarchy. If a resource does not have the specified tag, the tag does not appear in the output resource. Specify this parameter as a comma-separated list of JSON tag names. (optional) + inherit := "inherit_example" // string | This parameter is used for getting inheritance_sources. Allowed values: * _none_, * _partial_, * _full_. Defaults to _none (optional) + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.AuthZoneAPI.AuthZoneRead(context.Background(), id).Fields(fields).Inherit(inherit).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `AuthZoneAPI.AuthZoneRead``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `AuthZoneRead`: ConfigReadAuthZoneResponse + fmt.Fprintf(os.Stdout, "Response from `AuthZoneAPI.AuthZoneRead`: %v\n", resp) } ``` @@ -385,26 +385,26 @@ Update the AuthZone object. package main import ( - "context" - "fmt" - "os" - openapiclient "github.com/infobloxopen/bloxone-go-client" + "context" + "fmt" + "os" + openapiclient "github.com/infobloxopen/bloxone-go-client" ) func main() { - id := "id_example" // string | An application specific resource identity of a resource - body := *openapiclient.NewConfigAuthZone() // ConfigAuthZone | - inherit := "inherit_example" // string | This parameter is used for getting inheritance_sources. Allowed values: * _none_, * _partial_, * _full_. Defaults to _none (optional) - - configuration := openapiclient.NewConfiguration() - apiClient := openapiclient.NewAPIClient(configuration) - resp, r, err := apiClient.AuthZoneAPI.AuthZoneUpdate(context.Background(), id).Body(body).Inherit(inherit).Execute() - if err != nil { - fmt.Fprintf(os.Stderr, "Error when calling `AuthZoneAPI.AuthZoneUpdate``: %v\n", err) - fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) - } - // response from `AuthZoneUpdate`: ConfigUpdateAuthZoneResponse - fmt.Fprintf(os.Stdout, "Response from `AuthZoneAPI.AuthZoneUpdate`: %v\n", resp) + id := "id_example" // string | An application specific resource identity of a resource + body := *openapiclient.NewConfigAuthZone() // ConfigAuthZone | + inherit := "inherit_example" // string | This parameter is used for getting inheritance_sources. Allowed values: * _none_, * _partial_, * _full_. Defaults to _none (optional) + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.AuthZoneAPI.AuthZoneUpdate(context.Background(), id).Body(body).Inherit(inherit).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `AuthZoneAPI.AuthZoneUpdate``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `AuthZoneUpdate`: ConfigUpdateAuthZoneResponse + fmt.Fprintf(os.Stdout, "Response from `AuthZoneAPI.AuthZoneUpdate`: %v\n", resp) } ``` diff --git a/dns_config/docs/CacheFlushAPI.md b/dns_config/docs/CacheFlushAPI.md index 7bc0fa2..9354a5f 100644 --- a/dns_config/docs/CacheFlushAPI.md +++ b/dns_config/docs/CacheFlushAPI.md @@ -22,24 +22,24 @@ Create the Cache Flush object. package main import ( - "context" - "fmt" - "os" - openapiclient "github.com/infobloxopen/bloxone-go-client" + "context" + "fmt" + "os" + openapiclient "github.com/infobloxopen/bloxone-go-client" ) func main() { - body := *openapiclient.NewConfigCacheFlush() // ConfigCacheFlush | - - configuration := openapiclient.NewConfiguration() - apiClient := openapiclient.NewAPIClient(configuration) - resp, r, err := apiClient.CacheFlushAPI.CacheFlushCreate(context.Background()).Body(body).Execute() - if err != nil { - fmt.Fprintf(os.Stderr, "Error when calling `CacheFlushAPI.CacheFlushCreate``: %v\n", err) - fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) - } - // response from `CacheFlushCreate`: map[string]interface{} - fmt.Fprintf(os.Stdout, "Response from `CacheFlushAPI.CacheFlushCreate`: %v\n", resp) + body := *openapiclient.NewConfigCacheFlush() // ConfigCacheFlush | + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.CacheFlushAPI.CacheFlushCreate(context.Background()).Body(body).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `CacheFlushAPI.CacheFlushCreate``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `CacheFlushCreate`: map[string]interface{} + fmt.Fprintf(os.Stdout, "Response from `CacheFlushAPI.CacheFlushCreate`: %v\n", resp) } ``` diff --git a/dns_config/docs/ConvertDomainNameAPI.md b/dns_config/docs/ConvertDomainNameAPI.md index 9843f03..cb6e7c9 100644 --- a/dns_config/docs/ConvertDomainNameAPI.md +++ b/dns_config/docs/ConvertDomainNameAPI.md @@ -22,24 +22,24 @@ Convert the object. package main import ( - "context" - "fmt" - "os" - openapiclient "github.com/infobloxopen/bloxone-go-client" + "context" + "fmt" + "os" + openapiclient "github.com/infobloxopen/bloxone-go-client" ) func main() { - domainName := "domainName_example" // string | Input domain name in either of IDN or punycode representations. - - configuration := openapiclient.NewConfiguration() - apiClient := openapiclient.NewAPIClient(configuration) - resp, r, err := apiClient.ConvertDomainNameAPI.ConvertDomainNameConvert(context.Background(), domainName).Execute() - if err != nil { - fmt.Fprintf(os.Stderr, "Error when calling `ConvertDomainNameAPI.ConvertDomainNameConvert``: %v\n", err) - fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) - } - // response from `ConvertDomainNameConvert`: ConfigConvertDomainNameResponse - fmt.Fprintf(os.Stdout, "Response from `ConvertDomainNameAPI.ConvertDomainNameConvert`: %v\n", resp) + domainName := "domainName_example" // string | Input domain name in either of IDN or punycode representations. + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.ConvertDomainNameAPI.ConvertDomainNameConvert(context.Background(), domainName).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `ConvertDomainNameAPI.ConvertDomainNameConvert``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `ConvertDomainNameConvert`: ConfigConvertDomainNameResponse + fmt.Fprintf(os.Stdout, "Response from `ConvertDomainNameAPI.ConvertDomainNameConvert`: %v\n", resp) } ``` diff --git a/dns_config/docs/ConvertRnameAPI.md b/dns_config/docs/ConvertRnameAPI.md index a7f16be..226ce47 100644 --- a/dns_config/docs/ConvertRnameAPI.md +++ b/dns_config/docs/ConvertRnameAPI.md @@ -22,24 +22,24 @@ Convert the object. package main import ( - "context" - "fmt" - "os" - openapiclient "github.com/infobloxopen/bloxone-go-client" + "context" + "fmt" + "os" + openapiclient "github.com/infobloxopen/bloxone-go-client" ) func main() { - emailAddress := "emailAddress_example" // string | Input email address. - - configuration := openapiclient.NewConfiguration() - apiClient := openapiclient.NewAPIClient(configuration) - resp, r, err := apiClient.ConvertRnameAPI.ConvertRnameConvertRName(context.Background(), emailAddress).Execute() - if err != nil { - fmt.Fprintf(os.Stderr, "Error when calling `ConvertRnameAPI.ConvertRnameConvertRName``: %v\n", err) - fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) - } - // response from `ConvertRnameConvertRName`: ConfigConvertRNameResponse - fmt.Fprintf(os.Stdout, "Response from `ConvertRnameAPI.ConvertRnameConvertRName`: %v\n", resp) + emailAddress := "emailAddress_example" // string | Input email address. + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.ConvertRnameAPI.ConvertRnameConvertRName(context.Background(), emailAddress).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `ConvertRnameAPI.ConvertRnameConvertRName``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `ConvertRnameConvertRName`: ConfigConvertRNameResponse + fmt.Fprintf(os.Stdout, "Response from `ConvertRnameAPI.ConvertRnameConvertRName`: %v\n", resp) } ``` diff --git a/dns_config/docs/DelegationAPI.md b/dns_config/docs/DelegationAPI.md index 0139c9d..5921d77 100644 --- a/dns_config/docs/DelegationAPI.md +++ b/dns_config/docs/DelegationAPI.md @@ -26,24 +26,24 @@ Create the Delegation object. package main import ( - "context" - "fmt" - "os" - openapiclient "github.com/infobloxopen/bloxone-go-client" + "context" + "fmt" + "os" + openapiclient "github.com/infobloxopen/bloxone-go-client" ) func main() { - body := *openapiclient.NewConfigDelegation() // ConfigDelegation | - - configuration := openapiclient.NewConfiguration() - apiClient := openapiclient.NewAPIClient(configuration) - resp, r, err := apiClient.DelegationAPI.DelegationCreate(context.Background()).Body(body).Execute() - if err != nil { - fmt.Fprintf(os.Stderr, "Error when calling `DelegationAPI.DelegationCreate``: %v\n", err) - fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) - } - // response from `DelegationCreate`: ConfigCreateDelegationResponse - fmt.Fprintf(os.Stdout, "Response from `DelegationAPI.DelegationCreate`: %v\n", resp) + body := *openapiclient.NewConfigDelegation() // ConfigDelegation | + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.DelegationAPI.DelegationCreate(context.Background()).Body(body).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `DelegationAPI.DelegationCreate``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `DelegationCreate`: ConfigCreateDelegationResponse + fmt.Fprintf(os.Stdout, "Response from `DelegationAPI.DelegationCreate`: %v\n", resp) } ``` @@ -92,22 +92,22 @@ Moves the Delegation object to Recyclebin. package main import ( - "context" - "fmt" - "os" - openapiclient "github.com/infobloxopen/bloxone-go-client" + "context" + "fmt" + "os" + openapiclient "github.com/infobloxopen/bloxone-go-client" ) func main() { - id := "id_example" // string | An application specific resource identity of a resource - - configuration := openapiclient.NewConfiguration() - apiClient := openapiclient.NewAPIClient(configuration) - r, err := apiClient.DelegationAPI.DelegationDelete(context.Background(), id).Execute() - if err != nil { - fmt.Fprintf(os.Stderr, "Error when calling `DelegationAPI.DelegationDelete``: %v\n", err) - fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) - } + id := "id_example" // string | An application specific resource identity of a resource + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + r, err := apiClient.DelegationAPI.DelegationDelete(context.Background(), id).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `DelegationAPI.DelegationDelete``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } } ``` @@ -160,31 +160,31 @@ List Delegation objects. package main import ( - "context" - "fmt" - "os" - openapiclient "github.com/infobloxopen/bloxone-go-client" + "context" + "fmt" + "os" + openapiclient "github.com/infobloxopen/bloxone-go-client" ) func main() { - fields := "fields_example" // string | A collection of response resources can be transformed by specifying a set of JSON tags to be returned. For a “flat” resource, the tag name is straightforward. If field selection is allowed on non-flat hierarchical resources, the service should implement a qualified naming scheme such as dot-qualification to reference data down the hierarchy. If a resource does not have the specified tag, the tag does not appear in the output resource. Specify this parameter as a comma-separated list of JSON tag names. (optional) - filter := "filter_example" // string | A collection of response resources can be filtered by a logical expression string that includes JSON tag references to values in each resource, literal values, and logical operators. If a resource does not have the specified tag, its value is assumed to be null. Literal values include numbers (integer and floating-point), and quoted (both single- or double-quoted) literal strings, and 'null'. The following operators are commonly used in filter expressions: | Op | Description | | -- | ----------- | | == | Equal | | != | Not Equal | | > | Greater Than | | >= | Greater Than or Equal To | | < | Less Than | | <= | Less Than or Equal To | | and | Logical AND | | ~ | Matches Regex | | !~ | Does Not Match Regex | | or | Logical OR | | not | Logical NOT | | () | Groupping Operators | (optional) - offset := int32(56) // int32 | The integer index (zero-origin) of the offset into a collection of resources. If omitted or null the value is assumed to be '0'. (optional) - limit := int32(56) // int32 | The integer number of resources to be returned in the response. The service may impose maximum value. If omitted the service may impose a default value. (optional) - pageToken := "pageToken_example" // string | The service-defined string used to identify a page of resources. A null value indicates the first page. (optional) - orderBy := "orderBy_example" // string | A collection of response resources can be sorted by their JSON tags. For a 'flat' resource, the tag name is straightforward. If sorting is allowed on non-flat hierarchical resources, the service should implement a qualified naming scheme such as dot-qualification to reference data down the hierarchy. If a resource does not have the specified tag, its value is assumed to be null.) Specify this parameter as a comma-separated list of JSON tag names. The sort direction can be specified by a suffix separated by whitespace before the tag name. The suffix 'asc' sorts the data in ascending order. The suffix 'desc' sorts the data in descending order. If no suffix is specified the data is sorted in ascending order. (optional) - tfilter := "tfilter_example" // string | This parameter is used for filtering by tags. (optional) - torderBy := "torderBy_example" // string | This parameter is used for sorting by tags. (optional) - - configuration := openapiclient.NewConfiguration() - apiClient := openapiclient.NewAPIClient(configuration) - resp, r, err := apiClient.DelegationAPI.DelegationList(context.Background()).Fields(fields).Filter(filter).Offset(offset).Limit(limit).PageToken(pageToken).OrderBy(orderBy).Tfilter(tfilter).TorderBy(torderBy).Execute() - if err != nil { - fmt.Fprintf(os.Stderr, "Error when calling `DelegationAPI.DelegationList``: %v\n", err) - fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) - } - // response from `DelegationList`: ConfigListDelegationResponse - fmt.Fprintf(os.Stdout, "Response from `DelegationAPI.DelegationList`: %v\n", resp) + fields := "fields_example" // string | A collection of response resources can be transformed by specifying a set of JSON tags to be returned. For a “flat” resource, the tag name is straightforward. If field selection is allowed on non-flat hierarchical resources, the service should implement a qualified naming scheme such as dot-qualification to reference data down the hierarchy. If a resource does not have the specified tag, the tag does not appear in the output resource. Specify this parameter as a comma-separated list of JSON tag names. (optional) + filter := "filter_example" // string | A collection of response resources can be filtered by a logical expression string that includes JSON tag references to values in each resource, literal values, and logical operators. If a resource does not have the specified tag, its value is assumed to be null. Literal values include numbers (integer and floating-point), and quoted (both single- or double-quoted) literal strings, and 'null'. The following operators are commonly used in filter expressions: | Op | Description | | -- | ----------- | | == | Equal | | != | Not Equal | | > | Greater Than | | >= | Greater Than or Equal To | | < | Less Than | | <= | Less Than or Equal To | | and | Logical AND | | ~ | Matches Regex | | !~ | Does Not Match Regex | | or | Logical OR | | not | Logical NOT | | () | Groupping Operators | (optional) + offset := int32(56) // int32 | The integer index (zero-origin) of the offset into a collection of resources. If omitted or null the value is assumed to be '0'. (optional) + limit := int32(56) // int32 | The integer number of resources to be returned in the response. The service may impose maximum value. If omitted the service may impose a default value. (optional) + pageToken := "pageToken_example" // string | The service-defined string used to identify a page of resources. A null value indicates the first page. (optional) + orderBy := "orderBy_example" // string | A collection of response resources can be sorted by their JSON tags. For a 'flat' resource, the tag name is straightforward. If sorting is allowed on non-flat hierarchical resources, the service should implement a qualified naming scheme such as dot-qualification to reference data down the hierarchy. If a resource does not have the specified tag, its value is assumed to be null.) Specify this parameter as a comma-separated list of JSON tag names. The sort direction can be specified by a suffix separated by whitespace before the tag name. The suffix 'asc' sorts the data in ascending order. The suffix 'desc' sorts the data in descending order. If no suffix is specified the data is sorted in ascending order. (optional) + tfilter := "tfilter_example" // string | This parameter is used for filtering by tags. (optional) + torderBy := "torderBy_example" // string | This parameter is used for sorting by tags. (optional) + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.DelegationAPI.DelegationList(context.Background()).Fields(fields).Filter(filter).Offset(offset).Limit(limit).PageToken(pageToken).OrderBy(orderBy).Tfilter(tfilter).TorderBy(torderBy).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `DelegationAPI.DelegationList``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `DelegationList`: ConfigListDelegationResponse + fmt.Fprintf(os.Stdout, "Response from `DelegationAPI.DelegationList`: %v\n", resp) } ``` @@ -240,25 +240,25 @@ Read the Delegation object. package main import ( - "context" - "fmt" - "os" - openapiclient "github.com/infobloxopen/bloxone-go-client" + "context" + "fmt" + "os" + openapiclient "github.com/infobloxopen/bloxone-go-client" ) func main() { - id := "id_example" // string | An application specific resource identity of a resource - fields := "fields_example" // string | A collection of response resources can be transformed by specifying a set of JSON tags to be returned. For a “flat” resource, the tag name is straightforward. If field selection is allowed on non-flat hierarchical resources, the service should implement a qualified naming scheme such as dot-qualification to reference data down the hierarchy. If a resource does not have the specified tag, the tag does not appear in the output resource. Specify this parameter as a comma-separated list of JSON tag names. (optional) - - configuration := openapiclient.NewConfiguration() - apiClient := openapiclient.NewAPIClient(configuration) - resp, r, err := apiClient.DelegationAPI.DelegationRead(context.Background(), id).Fields(fields).Execute() - if err != nil { - fmt.Fprintf(os.Stderr, "Error when calling `DelegationAPI.DelegationRead``: %v\n", err) - fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) - } - // response from `DelegationRead`: ConfigReadDelegationResponse - fmt.Fprintf(os.Stdout, "Response from `DelegationAPI.DelegationRead`: %v\n", resp) + id := "id_example" // string | An application specific resource identity of a resource + fields := "fields_example" // string | A collection of response resources can be transformed by specifying a set of JSON tags to be returned. For a “flat” resource, the tag name is straightforward. If field selection is allowed on non-flat hierarchical resources, the service should implement a qualified naming scheme such as dot-qualification to reference data down the hierarchy. If a resource does not have the specified tag, the tag does not appear in the output resource. Specify this parameter as a comma-separated list of JSON tag names. (optional) + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.DelegationAPI.DelegationRead(context.Background(), id).Fields(fields).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `DelegationAPI.DelegationRead``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `DelegationRead`: ConfigReadDelegationResponse + fmt.Fprintf(os.Stdout, "Response from `DelegationAPI.DelegationRead`: %v\n", resp) } ``` @@ -312,25 +312,25 @@ Update the Delegation object. package main import ( - "context" - "fmt" - "os" - openapiclient "github.com/infobloxopen/bloxone-go-client" + "context" + "fmt" + "os" + openapiclient "github.com/infobloxopen/bloxone-go-client" ) func main() { - id := "id_example" // string | An application specific resource identity of a resource - body := *openapiclient.NewConfigDelegation() // ConfigDelegation | - - configuration := openapiclient.NewConfiguration() - apiClient := openapiclient.NewAPIClient(configuration) - resp, r, err := apiClient.DelegationAPI.DelegationUpdate(context.Background(), id).Body(body).Execute() - if err != nil { - fmt.Fprintf(os.Stderr, "Error when calling `DelegationAPI.DelegationUpdate``: %v\n", err) - fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) - } - // response from `DelegationUpdate`: ConfigUpdateDelegationResponse - fmt.Fprintf(os.Stdout, "Response from `DelegationAPI.DelegationUpdate`: %v\n", resp) + id := "id_example" // string | An application specific resource identity of a resource + body := *openapiclient.NewConfigDelegation() // ConfigDelegation | + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.DelegationAPI.DelegationUpdate(context.Background(), id).Body(body).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `DelegationAPI.DelegationUpdate``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `DelegationUpdate`: ConfigUpdateDelegationResponse + fmt.Fprintf(os.Stdout, "Response from `DelegationAPI.DelegationUpdate`: %v\n", resp) } ``` diff --git a/dns_config/docs/ForwardNsgAPI.md b/dns_config/docs/ForwardNsgAPI.md index ccf787f..a887b7e 100644 --- a/dns_config/docs/ForwardNsgAPI.md +++ b/dns_config/docs/ForwardNsgAPI.md @@ -26,24 +26,24 @@ Create the ForwardNSG object. package main import ( - "context" - "fmt" - "os" - openapiclient "github.com/infobloxopen/bloxone-go-client" + "context" + "fmt" + "os" + openapiclient "github.com/infobloxopen/bloxone-go-client" ) func main() { - body := *openapiclient.NewConfigForwardNSG("Name_example") // ConfigForwardNSG | - - configuration := openapiclient.NewConfiguration() - apiClient := openapiclient.NewAPIClient(configuration) - resp, r, err := apiClient.ForwardNsgAPI.ForwardNsgCreate(context.Background()).Body(body).Execute() - if err != nil { - fmt.Fprintf(os.Stderr, "Error when calling `ForwardNsgAPI.ForwardNsgCreate``: %v\n", err) - fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) - } - // response from `ForwardNsgCreate`: ConfigCreateForwardNSGResponse - fmt.Fprintf(os.Stdout, "Response from `ForwardNsgAPI.ForwardNsgCreate`: %v\n", resp) + body := *openapiclient.NewConfigForwardNSG("Name_example") // ConfigForwardNSG | + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.ForwardNsgAPI.ForwardNsgCreate(context.Background()).Body(body).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `ForwardNsgAPI.ForwardNsgCreate``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `ForwardNsgCreate`: ConfigCreateForwardNSGResponse + fmt.Fprintf(os.Stdout, "Response from `ForwardNsgAPI.ForwardNsgCreate`: %v\n", resp) } ``` @@ -92,22 +92,22 @@ Move the ForwardNSG object to Recyclebin. package main import ( - "context" - "fmt" - "os" - openapiclient "github.com/infobloxopen/bloxone-go-client" + "context" + "fmt" + "os" + openapiclient "github.com/infobloxopen/bloxone-go-client" ) func main() { - id := "id_example" // string | An application specific resource identity of a resource - - configuration := openapiclient.NewConfiguration() - apiClient := openapiclient.NewAPIClient(configuration) - r, err := apiClient.ForwardNsgAPI.ForwardNsgDelete(context.Background(), id).Execute() - if err != nil { - fmt.Fprintf(os.Stderr, "Error when calling `ForwardNsgAPI.ForwardNsgDelete``: %v\n", err) - fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) - } + id := "id_example" // string | An application specific resource identity of a resource + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + r, err := apiClient.ForwardNsgAPI.ForwardNsgDelete(context.Background(), id).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `ForwardNsgAPI.ForwardNsgDelete``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } } ``` @@ -160,31 +160,31 @@ List ForwardNSG objects. package main import ( - "context" - "fmt" - "os" - openapiclient "github.com/infobloxopen/bloxone-go-client" + "context" + "fmt" + "os" + openapiclient "github.com/infobloxopen/bloxone-go-client" ) func main() { - fields := "fields_example" // string | A collection of response resources can be transformed by specifying a set of JSON tags to be returned. For a “flat” resource, the tag name is straightforward. If field selection is allowed on non-flat hierarchical resources, the service should implement a qualified naming scheme such as dot-qualification to reference data down the hierarchy. If a resource does not have the specified tag, the tag does not appear in the output resource. Specify this parameter as a comma-separated list of JSON tag names. (optional) - filter := "filter_example" // string | A collection of response resources can be filtered by a logical expression string that includes JSON tag references to values in each resource, literal values, and logical operators. If a resource does not have the specified tag, its value is assumed to be null. Literal values include numbers (integer and floating-point), and quoted (both single- or double-quoted) literal strings, and 'null'. The following operators are commonly used in filter expressions: | Op | Description | | -- | ----------- | | == | Equal | | != | Not Equal | | > | Greater Than | | >= | Greater Than or Equal To | | < | Less Than | | <= | Less Than or Equal To | | and | Logical AND | | ~ | Matches Regex | | !~ | Does Not Match Regex | | or | Logical OR | | not | Logical NOT | | () | Groupping Operators | (optional) - offset := int32(56) // int32 | The integer index (zero-origin) of the offset into a collection of resources. If omitted or null the value is assumed to be '0'. (optional) - limit := int32(56) // int32 | The integer number of resources to be returned in the response. The service may impose maximum value. If omitted the service may impose a default value. (optional) - pageToken := "pageToken_example" // string | The service-defined string used to identify a page of resources. A null value indicates the first page. (optional) - orderBy := "orderBy_example" // string | A collection of response resources can be sorted by their JSON tags. For a 'flat' resource, the tag name is straightforward. If sorting is allowed on non-flat hierarchical resources, the service should implement a qualified naming scheme such as dot-qualification to reference data down the hierarchy. If a resource does not have the specified tag, its value is assumed to be null.) Specify this parameter as a comma-separated list of JSON tag names. The sort direction can be specified by a suffix separated by whitespace before the tag name. The suffix 'asc' sorts the data in ascending order. The suffix 'desc' sorts the data in descending order. If no suffix is specified the data is sorted in ascending order. (optional) - tfilter := "tfilter_example" // string | This parameter is used for filtering by tags. (optional) - torderBy := "torderBy_example" // string | This parameter is used for sorting by tags. (optional) - - configuration := openapiclient.NewConfiguration() - apiClient := openapiclient.NewAPIClient(configuration) - resp, r, err := apiClient.ForwardNsgAPI.ForwardNsgList(context.Background()).Fields(fields).Filter(filter).Offset(offset).Limit(limit).PageToken(pageToken).OrderBy(orderBy).Tfilter(tfilter).TorderBy(torderBy).Execute() - if err != nil { - fmt.Fprintf(os.Stderr, "Error when calling `ForwardNsgAPI.ForwardNsgList``: %v\n", err) - fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) - } - // response from `ForwardNsgList`: ConfigListForwardNSGResponse - fmt.Fprintf(os.Stdout, "Response from `ForwardNsgAPI.ForwardNsgList`: %v\n", resp) + fields := "fields_example" // string | A collection of response resources can be transformed by specifying a set of JSON tags to be returned. For a “flat” resource, the tag name is straightforward. If field selection is allowed on non-flat hierarchical resources, the service should implement a qualified naming scheme such as dot-qualification to reference data down the hierarchy. If a resource does not have the specified tag, the tag does not appear in the output resource. Specify this parameter as a comma-separated list of JSON tag names. (optional) + filter := "filter_example" // string | A collection of response resources can be filtered by a logical expression string that includes JSON tag references to values in each resource, literal values, and logical operators. If a resource does not have the specified tag, its value is assumed to be null. Literal values include numbers (integer and floating-point), and quoted (both single- or double-quoted) literal strings, and 'null'. The following operators are commonly used in filter expressions: | Op | Description | | -- | ----------- | | == | Equal | | != | Not Equal | | > | Greater Than | | >= | Greater Than or Equal To | | < | Less Than | | <= | Less Than or Equal To | | and | Logical AND | | ~ | Matches Regex | | !~ | Does Not Match Regex | | or | Logical OR | | not | Logical NOT | | () | Groupping Operators | (optional) + offset := int32(56) // int32 | The integer index (zero-origin) of the offset into a collection of resources. If omitted or null the value is assumed to be '0'. (optional) + limit := int32(56) // int32 | The integer number of resources to be returned in the response. The service may impose maximum value. If omitted the service may impose a default value. (optional) + pageToken := "pageToken_example" // string | The service-defined string used to identify a page of resources. A null value indicates the first page. (optional) + orderBy := "orderBy_example" // string | A collection of response resources can be sorted by their JSON tags. For a 'flat' resource, the tag name is straightforward. If sorting is allowed on non-flat hierarchical resources, the service should implement a qualified naming scheme such as dot-qualification to reference data down the hierarchy. If a resource does not have the specified tag, its value is assumed to be null.) Specify this parameter as a comma-separated list of JSON tag names. The sort direction can be specified by a suffix separated by whitespace before the tag name. The suffix 'asc' sorts the data in ascending order. The suffix 'desc' sorts the data in descending order. If no suffix is specified the data is sorted in ascending order. (optional) + tfilter := "tfilter_example" // string | This parameter is used for filtering by tags. (optional) + torderBy := "torderBy_example" // string | This parameter is used for sorting by tags. (optional) + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.ForwardNsgAPI.ForwardNsgList(context.Background()).Fields(fields).Filter(filter).Offset(offset).Limit(limit).PageToken(pageToken).OrderBy(orderBy).Tfilter(tfilter).TorderBy(torderBy).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `ForwardNsgAPI.ForwardNsgList``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `ForwardNsgList`: ConfigListForwardNSGResponse + fmt.Fprintf(os.Stdout, "Response from `ForwardNsgAPI.ForwardNsgList`: %v\n", resp) } ``` @@ -240,25 +240,25 @@ Read the ForwardNSG object. package main import ( - "context" - "fmt" - "os" - openapiclient "github.com/infobloxopen/bloxone-go-client" + "context" + "fmt" + "os" + openapiclient "github.com/infobloxopen/bloxone-go-client" ) func main() { - id := "id_example" // string | An application specific resource identity of a resource - fields := "fields_example" // string | A collection of response resources can be transformed by specifying a set of JSON tags to be returned. For a “flat” resource, the tag name is straightforward. If field selection is allowed on non-flat hierarchical resources, the service should implement a qualified naming scheme such as dot-qualification to reference data down the hierarchy. If a resource does not have the specified tag, the tag does not appear in the output resource. Specify this parameter as a comma-separated list of JSON tag names. (optional) - - configuration := openapiclient.NewConfiguration() - apiClient := openapiclient.NewAPIClient(configuration) - resp, r, err := apiClient.ForwardNsgAPI.ForwardNsgRead(context.Background(), id).Fields(fields).Execute() - if err != nil { - fmt.Fprintf(os.Stderr, "Error when calling `ForwardNsgAPI.ForwardNsgRead``: %v\n", err) - fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) - } - // response from `ForwardNsgRead`: ConfigReadForwardNSGResponse - fmt.Fprintf(os.Stdout, "Response from `ForwardNsgAPI.ForwardNsgRead`: %v\n", resp) + id := "id_example" // string | An application specific resource identity of a resource + fields := "fields_example" // string | A collection of response resources can be transformed by specifying a set of JSON tags to be returned. For a “flat” resource, the tag name is straightforward. If field selection is allowed on non-flat hierarchical resources, the service should implement a qualified naming scheme such as dot-qualification to reference data down the hierarchy. If a resource does not have the specified tag, the tag does not appear in the output resource. Specify this parameter as a comma-separated list of JSON tag names. (optional) + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.ForwardNsgAPI.ForwardNsgRead(context.Background(), id).Fields(fields).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `ForwardNsgAPI.ForwardNsgRead``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `ForwardNsgRead`: ConfigReadForwardNSGResponse + fmt.Fprintf(os.Stdout, "Response from `ForwardNsgAPI.ForwardNsgRead`: %v\n", resp) } ``` @@ -312,25 +312,25 @@ Update the ForwardNSG object. package main import ( - "context" - "fmt" - "os" - openapiclient "github.com/infobloxopen/bloxone-go-client" + "context" + "fmt" + "os" + openapiclient "github.com/infobloxopen/bloxone-go-client" ) func main() { - id := "id_example" // string | An application specific resource identity of a resource - body := *openapiclient.NewConfigForwardNSG("Name_example") // ConfigForwardNSG | - - configuration := openapiclient.NewConfiguration() - apiClient := openapiclient.NewAPIClient(configuration) - resp, r, err := apiClient.ForwardNsgAPI.ForwardNsgUpdate(context.Background(), id).Body(body).Execute() - if err != nil { - fmt.Fprintf(os.Stderr, "Error when calling `ForwardNsgAPI.ForwardNsgUpdate``: %v\n", err) - fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) - } - // response from `ForwardNsgUpdate`: ConfigUpdateForwardNSGResponse - fmt.Fprintf(os.Stdout, "Response from `ForwardNsgAPI.ForwardNsgUpdate`: %v\n", resp) + id := "id_example" // string | An application specific resource identity of a resource + body := *openapiclient.NewConfigForwardNSG("Name_example") // ConfigForwardNSG | + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.ForwardNsgAPI.ForwardNsgUpdate(context.Background(), id).Body(body).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `ForwardNsgAPI.ForwardNsgUpdate``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `ForwardNsgUpdate`: ConfigUpdateForwardNSGResponse + fmt.Fprintf(os.Stdout, "Response from `ForwardNsgAPI.ForwardNsgUpdate`: %v\n", resp) } ``` diff --git a/dns_config/docs/ForwardZoneAPI.md b/dns_config/docs/ForwardZoneAPI.md index ae7ff8b..746faaa 100644 --- a/dns_config/docs/ForwardZoneAPI.md +++ b/dns_config/docs/ForwardZoneAPI.md @@ -27,24 +27,24 @@ Copies the __ForwardZone__ object. package main import ( - "context" - "fmt" - "os" - openapiclient "github.com/infobloxopen/bloxone-go-client" + "context" + "fmt" + "os" + openapiclient "github.com/infobloxopen/bloxone-go-client" ) func main() { - body := *openapiclient.NewConfigCopyForwardZone("TargetView_example") // ConfigCopyForwardZone | - - configuration := openapiclient.NewConfiguration() - apiClient := openapiclient.NewAPIClient(configuration) - resp, r, err := apiClient.ForwardZoneAPI.ForwardZoneCopy(context.Background()).Body(body).Execute() - if err != nil { - fmt.Fprintf(os.Stderr, "Error when calling `ForwardZoneAPI.ForwardZoneCopy``: %v\n", err) - fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) - } - // response from `ForwardZoneCopy`: ConfigCopyForwardZoneResponse - fmt.Fprintf(os.Stdout, "Response from `ForwardZoneAPI.ForwardZoneCopy`: %v\n", resp) + body := *openapiclient.NewConfigCopyForwardZone("TargetView_example") // ConfigCopyForwardZone | + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.ForwardZoneAPI.ForwardZoneCopy(context.Background()).Body(body).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `ForwardZoneAPI.ForwardZoneCopy``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `ForwardZoneCopy`: ConfigCopyForwardZoneResponse + fmt.Fprintf(os.Stdout, "Response from `ForwardZoneAPI.ForwardZoneCopy`: %v\n", resp) } ``` @@ -93,24 +93,24 @@ Create the ForwardZone object. package main import ( - "context" - "fmt" - "os" - openapiclient "github.com/infobloxopen/bloxone-go-client" + "context" + "fmt" + "os" + openapiclient "github.com/infobloxopen/bloxone-go-client" ) func main() { - body := *openapiclient.NewConfigForwardZone() // ConfigForwardZone | - - configuration := openapiclient.NewConfiguration() - apiClient := openapiclient.NewAPIClient(configuration) - resp, r, err := apiClient.ForwardZoneAPI.ForwardZoneCreate(context.Background()).Body(body).Execute() - if err != nil { - fmt.Fprintf(os.Stderr, "Error when calling `ForwardZoneAPI.ForwardZoneCreate``: %v\n", err) - fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) - } - // response from `ForwardZoneCreate`: ConfigCreateForwardZoneResponse - fmt.Fprintf(os.Stdout, "Response from `ForwardZoneAPI.ForwardZoneCreate`: %v\n", resp) + body := *openapiclient.NewConfigForwardZone() // ConfigForwardZone | + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.ForwardZoneAPI.ForwardZoneCreate(context.Background()).Body(body).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `ForwardZoneAPI.ForwardZoneCreate``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `ForwardZoneCreate`: ConfigCreateForwardZoneResponse + fmt.Fprintf(os.Stdout, "Response from `ForwardZoneAPI.ForwardZoneCreate`: %v\n", resp) } ``` @@ -159,22 +159,22 @@ Move the Forward Zone object to Recyclebin. package main import ( - "context" - "fmt" - "os" - openapiclient "github.com/infobloxopen/bloxone-go-client" + "context" + "fmt" + "os" + openapiclient "github.com/infobloxopen/bloxone-go-client" ) func main() { - id := "id_example" // string | An application specific resource identity of a resource - - configuration := openapiclient.NewConfiguration() - apiClient := openapiclient.NewAPIClient(configuration) - r, err := apiClient.ForwardZoneAPI.ForwardZoneDelete(context.Background(), id).Execute() - if err != nil { - fmt.Fprintf(os.Stderr, "Error when calling `ForwardZoneAPI.ForwardZoneDelete``: %v\n", err) - fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) - } + id := "id_example" // string | An application specific resource identity of a resource + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + r, err := apiClient.ForwardZoneAPI.ForwardZoneDelete(context.Background(), id).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `ForwardZoneAPI.ForwardZoneDelete``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } } ``` @@ -227,31 +227,31 @@ List Forward Zone objects. package main import ( - "context" - "fmt" - "os" - openapiclient "github.com/infobloxopen/bloxone-go-client" + "context" + "fmt" + "os" + openapiclient "github.com/infobloxopen/bloxone-go-client" ) func main() { - fields := "fields_example" // string | A collection of response resources can be transformed by specifying a set of JSON tags to be returned. For a “flat” resource, the tag name is straightforward. If field selection is allowed on non-flat hierarchical resources, the service should implement a qualified naming scheme such as dot-qualification to reference data down the hierarchy. If a resource does not have the specified tag, the tag does not appear in the output resource. Specify this parameter as a comma-separated list of JSON tag names. (optional) - filter := "filter_example" // string | A collection of response resources can be filtered by a logical expression string that includes JSON tag references to values in each resource, literal values, and logical operators. If a resource does not have the specified tag, its value is assumed to be null. Literal values include numbers (integer and floating-point), and quoted (both single- or double-quoted) literal strings, and 'null'. The following operators are commonly used in filter expressions: | Op | Description | | -- | ----------- | | == | Equal | | != | Not Equal | | > | Greater Than | | >= | Greater Than or Equal To | | < | Less Than | | <= | Less Than or Equal To | | and | Logical AND | | ~ | Matches Regex | | !~ | Does Not Match Regex | | or | Logical OR | | not | Logical NOT | | () | Groupping Operators | (optional) - offset := int32(56) // int32 | The integer index (zero-origin) of the offset into a collection of resources. If omitted or null the value is assumed to be '0'. (optional) - limit := int32(56) // int32 | The integer number of resources to be returned in the response. The service may impose maximum value. If omitted the service may impose a default value. (optional) - pageToken := "pageToken_example" // string | The service-defined string used to identify a page of resources. A null value indicates the first page. (optional) - orderBy := "orderBy_example" // string | A collection of response resources can be sorted by their JSON tags. For a 'flat' resource, the tag name is straightforward. If sorting is allowed on non-flat hierarchical resources, the service should implement a qualified naming scheme such as dot-qualification to reference data down the hierarchy. If a resource does not have the specified tag, its value is assumed to be null.) Specify this parameter as a comma-separated list of JSON tag names. The sort direction can be specified by a suffix separated by whitespace before the tag name. The suffix 'asc' sorts the data in ascending order. The suffix 'desc' sorts the data in descending order. If no suffix is specified the data is sorted in ascending order. (optional) - tfilter := "tfilter_example" // string | This parameter is used for filtering by tags. (optional) - torderBy := "torderBy_example" // string | This parameter is used for sorting by tags. (optional) - - configuration := openapiclient.NewConfiguration() - apiClient := openapiclient.NewAPIClient(configuration) - resp, r, err := apiClient.ForwardZoneAPI.ForwardZoneList(context.Background()).Fields(fields).Filter(filter).Offset(offset).Limit(limit).PageToken(pageToken).OrderBy(orderBy).Tfilter(tfilter).TorderBy(torderBy).Execute() - if err != nil { - fmt.Fprintf(os.Stderr, "Error when calling `ForwardZoneAPI.ForwardZoneList``: %v\n", err) - fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) - } - // response from `ForwardZoneList`: ConfigListForwardZoneResponse - fmt.Fprintf(os.Stdout, "Response from `ForwardZoneAPI.ForwardZoneList`: %v\n", resp) + fields := "fields_example" // string | A collection of response resources can be transformed by specifying a set of JSON tags to be returned. For a “flat” resource, the tag name is straightforward. If field selection is allowed on non-flat hierarchical resources, the service should implement a qualified naming scheme such as dot-qualification to reference data down the hierarchy. If a resource does not have the specified tag, the tag does not appear in the output resource. Specify this parameter as a comma-separated list of JSON tag names. (optional) + filter := "filter_example" // string | A collection of response resources can be filtered by a logical expression string that includes JSON tag references to values in each resource, literal values, and logical operators. If a resource does not have the specified tag, its value is assumed to be null. Literal values include numbers (integer and floating-point), and quoted (both single- or double-quoted) literal strings, and 'null'. The following operators are commonly used in filter expressions: | Op | Description | | -- | ----------- | | == | Equal | | != | Not Equal | | > | Greater Than | | >= | Greater Than or Equal To | | < | Less Than | | <= | Less Than or Equal To | | and | Logical AND | | ~ | Matches Regex | | !~ | Does Not Match Regex | | or | Logical OR | | not | Logical NOT | | () | Groupping Operators | (optional) + offset := int32(56) // int32 | The integer index (zero-origin) of the offset into a collection of resources. If omitted or null the value is assumed to be '0'. (optional) + limit := int32(56) // int32 | The integer number of resources to be returned in the response. The service may impose maximum value. If omitted the service may impose a default value. (optional) + pageToken := "pageToken_example" // string | The service-defined string used to identify a page of resources. A null value indicates the first page. (optional) + orderBy := "orderBy_example" // string | A collection of response resources can be sorted by their JSON tags. For a 'flat' resource, the tag name is straightforward. If sorting is allowed on non-flat hierarchical resources, the service should implement a qualified naming scheme such as dot-qualification to reference data down the hierarchy. If a resource does not have the specified tag, its value is assumed to be null.) Specify this parameter as a comma-separated list of JSON tag names. The sort direction can be specified by a suffix separated by whitespace before the tag name. The suffix 'asc' sorts the data in ascending order. The suffix 'desc' sorts the data in descending order. If no suffix is specified the data is sorted in ascending order. (optional) + tfilter := "tfilter_example" // string | This parameter is used for filtering by tags. (optional) + torderBy := "torderBy_example" // string | This parameter is used for sorting by tags. (optional) + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.ForwardZoneAPI.ForwardZoneList(context.Background()).Fields(fields).Filter(filter).Offset(offset).Limit(limit).PageToken(pageToken).OrderBy(orderBy).Tfilter(tfilter).TorderBy(torderBy).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `ForwardZoneAPI.ForwardZoneList``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `ForwardZoneList`: ConfigListForwardZoneResponse + fmt.Fprintf(os.Stdout, "Response from `ForwardZoneAPI.ForwardZoneList`: %v\n", resp) } ``` @@ -307,25 +307,25 @@ Read the Forward Zone object. package main import ( - "context" - "fmt" - "os" - openapiclient "github.com/infobloxopen/bloxone-go-client" + "context" + "fmt" + "os" + openapiclient "github.com/infobloxopen/bloxone-go-client" ) func main() { - id := "id_example" // string | An application specific resource identity of a resource - fields := "fields_example" // string | A collection of response resources can be transformed by specifying a set of JSON tags to be returned. For a “flat” resource, the tag name is straightforward. If field selection is allowed on non-flat hierarchical resources, the service should implement a qualified naming scheme such as dot-qualification to reference data down the hierarchy. If a resource does not have the specified tag, the tag does not appear in the output resource. Specify this parameter as a comma-separated list of JSON tag names. (optional) - - configuration := openapiclient.NewConfiguration() - apiClient := openapiclient.NewAPIClient(configuration) - resp, r, err := apiClient.ForwardZoneAPI.ForwardZoneRead(context.Background(), id).Fields(fields).Execute() - if err != nil { - fmt.Fprintf(os.Stderr, "Error when calling `ForwardZoneAPI.ForwardZoneRead``: %v\n", err) - fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) - } - // response from `ForwardZoneRead`: ConfigReadForwardZoneResponse - fmt.Fprintf(os.Stdout, "Response from `ForwardZoneAPI.ForwardZoneRead`: %v\n", resp) + id := "id_example" // string | An application specific resource identity of a resource + fields := "fields_example" // string | A collection of response resources can be transformed by specifying a set of JSON tags to be returned. For a “flat” resource, the tag name is straightforward. If field selection is allowed on non-flat hierarchical resources, the service should implement a qualified naming scheme such as dot-qualification to reference data down the hierarchy. If a resource does not have the specified tag, the tag does not appear in the output resource. Specify this parameter as a comma-separated list of JSON tag names. (optional) + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.ForwardZoneAPI.ForwardZoneRead(context.Background(), id).Fields(fields).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `ForwardZoneAPI.ForwardZoneRead``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `ForwardZoneRead`: ConfigReadForwardZoneResponse + fmt.Fprintf(os.Stdout, "Response from `ForwardZoneAPI.ForwardZoneRead`: %v\n", resp) } ``` @@ -379,25 +379,25 @@ Update the Forward Zone object. package main import ( - "context" - "fmt" - "os" - openapiclient "github.com/infobloxopen/bloxone-go-client" + "context" + "fmt" + "os" + openapiclient "github.com/infobloxopen/bloxone-go-client" ) func main() { - id := "id_example" // string | An application specific resource identity of a resource - body := *openapiclient.NewConfigForwardZone() // ConfigForwardZone | - - configuration := openapiclient.NewConfiguration() - apiClient := openapiclient.NewAPIClient(configuration) - resp, r, err := apiClient.ForwardZoneAPI.ForwardZoneUpdate(context.Background(), id).Body(body).Execute() - if err != nil { - fmt.Fprintf(os.Stderr, "Error when calling `ForwardZoneAPI.ForwardZoneUpdate``: %v\n", err) - fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) - } - // response from `ForwardZoneUpdate`: ConfigUpdateForwardZoneResponse - fmt.Fprintf(os.Stdout, "Response from `ForwardZoneAPI.ForwardZoneUpdate`: %v\n", resp) + id := "id_example" // string | An application specific resource identity of a resource + body := *openapiclient.NewConfigForwardZone() // ConfigForwardZone | + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.ForwardZoneAPI.ForwardZoneUpdate(context.Background(), id).Body(body).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `ForwardZoneAPI.ForwardZoneUpdate``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `ForwardZoneUpdate`: ConfigUpdateForwardZoneResponse + fmt.Fprintf(os.Stdout, "Response from `ForwardZoneAPI.ForwardZoneUpdate`: %v\n", resp) } ``` diff --git a/dns_config/docs/GlobalAPI.md b/dns_config/docs/GlobalAPI.md index 6dd47b5..da7aac9 100644 --- a/dns_config/docs/GlobalAPI.md +++ b/dns_config/docs/GlobalAPI.md @@ -25,24 +25,24 @@ Read the Global configuration object. package main import ( - "context" - "fmt" - "os" - openapiclient "github.com/infobloxopen/bloxone-go-client" + "context" + "fmt" + "os" + openapiclient "github.com/infobloxopen/bloxone-go-client" ) func main() { - fields := "fields_example" // string | A collection of response resources can be transformed by specifying a set of JSON tags to be returned. For a “flat” resource, the tag name is straightforward. If field selection is allowed on non-flat hierarchical resources, the service should implement a qualified naming scheme such as dot-qualification to reference data down the hierarchy. If a resource does not have the specified tag, the tag does not appear in the output resource. Specify this parameter as a comma-separated list of JSON tag names. (optional) - - configuration := openapiclient.NewConfiguration() - apiClient := openapiclient.NewAPIClient(configuration) - resp, r, err := apiClient.GlobalAPI.GlobalRead(context.Background()).Fields(fields).Execute() - if err != nil { - fmt.Fprintf(os.Stderr, "Error when calling `GlobalAPI.GlobalRead``: %v\n", err) - fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) - } - // response from `GlobalRead`: ConfigReadGlobalResponse - fmt.Fprintf(os.Stdout, "Response from `GlobalAPI.GlobalRead`: %v\n", resp) + fields := "fields_example" // string | A collection of response resources can be transformed by specifying a set of JSON tags to be returned. For a “flat” resource, the tag name is straightforward. If field selection is allowed on non-flat hierarchical resources, the service should implement a qualified naming scheme such as dot-qualification to reference data down the hierarchy. If a resource does not have the specified tag, the tag does not appear in the output resource. Specify this parameter as a comma-separated list of JSON tag names. (optional) + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.GlobalAPI.GlobalRead(context.Background()).Fields(fields).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `GlobalAPI.GlobalRead``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `GlobalRead`: ConfigReadGlobalResponse + fmt.Fprintf(os.Stdout, "Response from `GlobalAPI.GlobalRead`: %v\n", resp) } ``` @@ -91,25 +91,25 @@ Read the Global configuration object. package main import ( - "context" - "fmt" - "os" - openapiclient "github.com/infobloxopen/bloxone-go-client" + "context" + "fmt" + "os" + openapiclient "github.com/infobloxopen/bloxone-go-client" ) func main() { - id := "id_example" // string | An application specific resource identity of a resource - fields := "fields_example" // string | A collection of response resources can be transformed by specifying a set of JSON tags to be returned. For a “flat” resource, the tag name is straightforward. If field selection is allowed on non-flat hierarchical resources, the service should implement a qualified naming scheme such as dot-qualification to reference data down the hierarchy. If a resource does not have the specified tag, the tag does not appear in the output resource. Specify this parameter as a comma-separated list of JSON tag names. (optional) - - configuration := openapiclient.NewConfiguration() - apiClient := openapiclient.NewAPIClient(configuration) - resp, r, err := apiClient.GlobalAPI.GlobalRead2(context.Background(), id).Fields(fields).Execute() - if err != nil { - fmt.Fprintf(os.Stderr, "Error when calling `GlobalAPI.GlobalRead2``: %v\n", err) - fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) - } - // response from `GlobalRead2`: ConfigReadGlobalResponse - fmt.Fprintf(os.Stdout, "Response from `GlobalAPI.GlobalRead2`: %v\n", resp) + id := "id_example" // string | An application specific resource identity of a resource + fields := "fields_example" // string | A collection of response resources can be transformed by specifying a set of JSON tags to be returned. For a “flat” resource, the tag name is straightforward. If field selection is allowed on non-flat hierarchical resources, the service should implement a qualified naming scheme such as dot-qualification to reference data down the hierarchy. If a resource does not have the specified tag, the tag does not appear in the output resource. Specify this parameter as a comma-separated list of JSON tag names. (optional) + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.GlobalAPI.GlobalRead2(context.Background(), id).Fields(fields).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `GlobalAPI.GlobalRead2``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `GlobalRead2`: ConfigReadGlobalResponse + fmt.Fprintf(os.Stdout, "Response from `GlobalAPI.GlobalRead2`: %v\n", resp) } ``` @@ -163,24 +163,24 @@ Update the Global configuration object. package main import ( - "context" - "fmt" - "os" - openapiclient "github.com/infobloxopen/bloxone-go-client" + "context" + "fmt" + "os" + openapiclient "github.com/infobloxopen/bloxone-go-client" ) func main() { - body := *openapiclient.NewConfigGlobal("Id_example") // ConfigGlobal | - - configuration := openapiclient.NewConfiguration() - apiClient := openapiclient.NewAPIClient(configuration) - resp, r, err := apiClient.GlobalAPI.GlobalUpdate(context.Background()).Body(body).Execute() - if err != nil { - fmt.Fprintf(os.Stderr, "Error when calling `GlobalAPI.GlobalUpdate``: %v\n", err) - fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) - } - // response from `GlobalUpdate`: ConfigUpdateGlobalResponse - fmt.Fprintf(os.Stdout, "Response from `GlobalAPI.GlobalUpdate`: %v\n", resp) + body := *openapiclient.NewConfigGlobal("Id_example") // ConfigGlobal | + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.GlobalAPI.GlobalUpdate(context.Background()).Body(body).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `GlobalAPI.GlobalUpdate``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `GlobalUpdate`: ConfigUpdateGlobalResponse + fmt.Fprintf(os.Stdout, "Response from `GlobalAPI.GlobalUpdate`: %v\n", resp) } ``` @@ -229,25 +229,25 @@ Update the Global configuration object. package main import ( - "context" - "fmt" - "os" - openapiclient "github.com/infobloxopen/bloxone-go-client" + "context" + "fmt" + "os" + openapiclient "github.com/infobloxopen/bloxone-go-client" ) func main() { - id := "id_example" // string | An application specific resource identity of a resource - body := *openapiclient.NewConfigGlobal("Id_example") // ConfigGlobal | - - configuration := openapiclient.NewConfiguration() - apiClient := openapiclient.NewAPIClient(configuration) - resp, r, err := apiClient.GlobalAPI.GlobalUpdate2(context.Background(), id).Body(body).Execute() - if err != nil { - fmt.Fprintf(os.Stderr, "Error when calling `GlobalAPI.GlobalUpdate2``: %v\n", err) - fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) - } - // response from `GlobalUpdate2`: ConfigUpdateGlobalResponse - fmt.Fprintf(os.Stdout, "Response from `GlobalAPI.GlobalUpdate2`: %v\n", resp) + id := "id_example" // string | An application specific resource identity of a resource + body := *openapiclient.NewConfigGlobal("Id_example") // ConfigGlobal | + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.GlobalAPI.GlobalUpdate2(context.Background(), id).Body(body).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `GlobalAPI.GlobalUpdate2``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `GlobalUpdate2`: ConfigUpdateGlobalResponse + fmt.Fprintf(os.Stdout, "Response from `GlobalAPI.GlobalUpdate2`: %v\n", resp) } ``` diff --git a/dns_config/docs/HostAPI.md b/dns_config/docs/HostAPI.md index c6433fa..897dc01 100644 --- a/dns_config/docs/HostAPI.md +++ b/dns_config/docs/HostAPI.md @@ -24,32 +24,32 @@ List DNS Host objects. package main import ( - "context" - "fmt" - "os" - openapiclient "github.com/infobloxopen/bloxone-go-client" + "context" + "fmt" + "os" + openapiclient "github.com/infobloxopen/bloxone-go-client" ) func main() { - fields := "fields_example" // string | A collection of response resources can be transformed by specifying a set of JSON tags to be returned. For a “flat” resource, the tag name is straightforward. If field selection is allowed on non-flat hierarchical resources, the service should implement a qualified naming scheme such as dot-qualification to reference data down the hierarchy. If a resource does not have the specified tag, the tag does not appear in the output resource. Specify this parameter as a comma-separated list of JSON tag names. (optional) - filter := "filter_example" // string | A collection of response resources can be filtered by a logical expression string that includes JSON tag references to values in each resource, literal values, and logical operators. If a resource does not have the specified tag, its value is assumed to be null. Literal values include numbers (integer and floating-point), and quoted (both single- or double-quoted) literal strings, and 'null'. The following operators are commonly used in filter expressions: | Op | Description | | -- | ----------- | | == | Equal | | != | Not Equal | | > | Greater Than | | >= | Greater Than or Equal To | | < | Less Than | | <= | Less Than or Equal To | | and | Logical AND | | ~ | Matches Regex | | !~ | Does Not Match Regex | | or | Logical OR | | not | Logical NOT | | () | Groupping Operators | (optional) - offset := int32(56) // int32 | The integer index (zero-origin) of the offset into a collection of resources. If omitted or null the value is assumed to be '0'. (optional) - limit := int32(56) // int32 | The integer number of resources to be returned in the response. The service may impose maximum value. If omitted the service may impose a default value. (optional) - pageToken := "pageToken_example" // string | The service-defined string used to identify a page of resources. A null value indicates the first page. (optional) - orderBy := "orderBy_example" // string | A collection of response resources can be sorted by their JSON tags. For a 'flat' resource, the tag name is straightforward. If sorting is allowed on non-flat hierarchical resources, the service should implement a qualified naming scheme such as dot-qualification to reference data down the hierarchy. If a resource does not have the specified tag, its value is assumed to be null.) Specify this parameter as a comma-separated list of JSON tag names. The sort direction can be specified by a suffix separated by whitespace before the tag name. The suffix 'asc' sorts the data in ascending order. The suffix 'desc' sorts the data in descending order. If no suffix is specified the data is sorted in ascending order. (optional) - tfilter := "tfilter_example" // string | This parameter is used for filtering by tags. (optional) - torderBy := "torderBy_example" // string | This parameter is used for sorting by tags. (optional) - inherit := "inherit_example" // string | This parameter is used for getting inheritance_sources. Allowed values: * _none_, * _partial_, * _full_. Defaults to _none (optional) - - configuration := openapiclient.NewConfiguration() - apiClient := openapiclient.NewAPIClient(configuration) - resp, r, err := apiClient.HostAPI.HostList(context.Background()).Fields(fields).Filter(filter).Offset(offset).Limit(limit).PageToken(pageToken).OrderBy(orderBy).Tfilter(tfilter).TorderBy(torderBy).Inherit(inherit).Execute() - if err != nil { - fmt.Fprintf(os.Stderr, "Error when calling `HostAPI.HostList``: %v\n", err) - fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) - } - // response from `HostList`: ConfigListHostResponse - fmt.Fprintf(os.Stdout, "Response from `HostAPI.HostList`: %v\n", resp) + fields := "fields_example" // string | A collection of response resources can be transformed by specifying a set of JSON tags to be returned. For a “flat” resource, the tag name is straightforward. If field selection is allowed on non-flat hierarchical resources, the service should implement a qualified naming scheme such as dot-qualification to reference data down the hierarchy. If a resource does not have the specified tag, the tag does not appear in the output resource. Specify this parameter as a comma-separated list of JSON tag names. (optional) + filter := "filter_example" // string | A collection of response resources can be filtered by a logical expression string that includes JSON tag references to values in each resource, literal values, and logical operators. If a resource does not have the specified tag, its value is assumed to be null. Literal values include numbers (integer and floating-point), and quoted (both single- or double-quoted) literal strings, and 'null'. The following operators are commonly used in filter expressions: | Op | Description | | -- | ----------- | | == | Equal | | != | Not Equal | | > | Greater Than | | >= | Greater Than or Equal To | | < | Less Than | | <= | Less Than or Equal To | | and | Logical AND | | ~ | Matches Regex | | !~ | Does Not Match Regex | | or | Logical OR | | not | Logical NOT | | () | Groupping Operators | (optional) + offset := int32(56) // int32 | The integer index (zero-origin) of the offset into a collection of resources. If omitted or null the value is assumed to be '0'. (optional) + limit := int32(56) // int32 | The integer number of resources to be returned in the response. The service may impose maximum value. If omitted the service may impose a default value. (optional) + pageToken := "pageToken_example" // string | The service-defined string used to identify a page of resources. A null value indicates the first page. (optional) + orderBy := "orderBy_example" // string | A collection of response resources can be sorted by their JSON tags. For a 'flat' resource, the tag name is straightforward. If sorting is allowed on non-flat hierarchical resources, the service should implement a qualified naming scheme such as dot-qualification to reference data down the hierarchy. If a resource does not have the specified tag, its value is assumed to be null.) Specify this parameter as a comma-separated list of JSON tag names. The sort direction can be specified by a suffix separated by whitespace before the tag name. The suffix 'asc' sorts the data in ascending order. The suffix 'desc' sorts the data in descending order. If no suffix is specified the data is sorted in ascending order. (optional) + tfilter := "tfilter_example" // string | This parameter is used for filtering by tags. (optional) + torderBy := "torderBy_example" // string | This parameter is used for sorting by tags. (optional) + inherit := "inherit_example" // string | This parameter is used for getting inheritance_sources. Allowed values: * _none_, * _partial_, * _full_. Defaults to _none (optional) + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.HostAPI.HostList(context.Background()).Fields(fields).Filter(filter).Offset(offset).Limit(limit).PageToken(pageToken).OrderBy(orderBy).Tfilter(tfilter).TorderBy(torderBy).Inherit(inherit).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `HostAPI.HostList``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `HostList`: ConfigListHostResponse + fmt.Fprintf(os.Stdout, "Response from `HostAPI.HostList`: %v\n", resp) } ``` @@ -106,26 +106,26 @@ Read the DNS Host object. package main import ( - "context" - "fmt" - "os" - openapiclient "github.com/infobloxopen/bloxone-go-client" + "context" + "fmt" + "os" + openapiclient "github.com/infobloxopen/bloxone-go-client" ) func main() { - id := "id_example" // string | An application specific resource identity of a resource - fields := "fields_example" // string | A collection of response resources can be transformed by specifying a set of JSON tags to be returned. For a “flat” resource, the tag name is straightforward. If field selection is allowed on non-flat hierarchical resources, the service should implement a qualified naming scheme such as dot-qualification to reference data down the hierarchy. If a resource does not have the specified tag, the tag does not appear in the output resource. Specify this parameter as a comma-separated list of JSON tag names. (optional) - inherit := "inherit_example" // string | This parameter is used for getting inheritance_sources. Allowed values: * _none_, * _partial_, * _full_. Defaults to _none (optional) - - configuration := openapiclient.NewConfiguration() - apiClient := openapiclient.NewAPIClient(configuration) - resp, r, err := apiClient.HostAPI.HostRead(context.Background(), id).Fields(fields).Inherit(inherit).Execute() - if err != nil { - fmt.Fprintf(os.Stderr, "Error when calling `HostAPI.HostRead``: %v\n", err) - fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) - } - // response from `HostRead`: ConfigReadHostResponse - fmt.Fprintf(os.Stdout, "Response from `HostAPI.HostRead`: %v\n", resp) + id := "id_example" // string | An application specific resource identity of a resource + fields := "fields_example" // string | A collection of response resources can be transformed by specifying a set of JSON tags to be returned. For a “flat” resource, the tag name is straightforward. If field selection is allowed on non-flat hierarchical resources, the service should implement a qualified naming scheme such as dot-qualification to reference data down the hierarchy. If a resource does not have the specified tag, the tag does not appear in the output resource. Specify this parameter as a comma-separated list of JSON tag names. (optional) + inherit := "inherit_example" // string | This parameter is used for getting inheritance_sources. Allowed values: * _none_, * _partial_, * _full_. Defaults to _none (optional) + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.HostAPI.HostRead(context.Background(), id).Fields(fields).Inherit(inherit).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `HostAPI.HostRead``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `HostRead`: ConfigReadHostResponse + fmt.Fprintf(os.Stdout, "Response from `HostAPI.HostRead`: %v\n", resp) } ``` @@ -180,26 +180,26 @@ Update the DNS Host object. package main import ( - "context" - "fmt" - "os" - openapiclient "github.com/infobloxopen/bloxone-go-client" + "context" + "fmt" + "os" + openapiclient "github.com/infobloxopen/bloxone-go-client" ) func main() { - id := "id_example" // string | An application specific resource identity of a resource - body := *openapiclient.NewConfigHost() // ConfigHost | - inherit := "inherit_example" // string | This parameter is used for getting inheritance_sources. Allowed values: * _none_, * _partial_, * _full_. Defaults to _none (optional) - - configuration := openapiclient.NewConfiguration() - apiClient := openapiclient.NewAPIClient(configuration) - resp, r, err := apiClient.HostAPI.HostUpdate(context.Background(), id).Body(body).Inherit(inherit).Execute() - if err != nil { - fmt.Fprintf(os.Stderr, "Error when calling `HostAPI.HostUpdate``: %v\n", err) - fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) - } - // response from `HostUpdate`: ConfigUpdateHostResponse - fmt.Fprintf(os.Stdout, "Response from `HostAPI.HostUpdate`: %v\n", resp) + id := "id_example" // string | An application specific resource identity of a resource + body := *openapiclient.NewConfigHost() // ConfigHost | + inherit := "inherit_example" // string | This parameter is used for getting inheritance_sources. Allowed values: * _none_, * _partial_, * _full_. Defaults to _none (optional) + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.HostAPI.HostUpdate(context.Background(), id).Body(body).Inherit(inherit).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `HostAPI.HostUpdate``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `HostUpdate`: ConfigUpdateHostResponse + fmt.Fprintf(os.Stdout, "Response from `HostAPI.HostUpdate`: %v\n", resp) } ``` diff --git a/dns_config/docs/LbdnAPI.md b/dns_config/docs/LbdnAPI.md index e21786e..cd45642 100644 --- a/dns_config/docs/LbdnAPI.md +++ b/dns_config/docs/LbdnAPI.md @@ -26,24 +26,24 @@ Create the __LBDN__ object. package main import ( - "context" - "fmt" - "os" - openapiclient "github.com/infobloxopen/bloxone-go-client" + "context" + "fmt" + "os" + openapiclient "github.com/infobloxopen/bloxone-go-client" ) func main() { - body := *openapiclient.NewConfigLBDN("Name_example", "View_example") // ConfigLBDN | - - configuration := openapiclient.NewConfiguration() - apiClient := openapiclient.NewAPIClient(configuration) - resp, r, err := apiClient.LbdnAPI.LbdnCreate(context.Background()).Body(body).Execute() - if err != nil { - fmt.Fprintf(os.Stderr, "Error when calling `LbdnAPI.LbdnCreate``: %v\n", err) - fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) - } - // response from `LbdnCreate`: ConfigCreateLBDNResponse - fmt.Fprintf(os.Stdout, "Response from `LbdnAPI.LbdnCreate`: %v\n", resp) + body := *openapiclient.NewConfigLBDN("Name_example", "View_example") // ConfigLBDN | + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.LbdnAPI.LbdnCreate(context.Background()).Body(body).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `LbdnAPI.LbdnCreate``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `LbdnCreate`: ConfigCreateLBDNResponse + fmt.Fprintf(os.Stdout, "Response from `LbdnAPI.LbdnCreate`: %v\n", resp) } ``` @@ -92,22 +92,22 @@ Delete the __LBDN__ object. package main import ( - "context" - "fmt" - "os" - openapiclient "github.com/infobloxopen/bloxone-go-client" + "context" + "fmt" + "os" + openapiclient "github.com/infobloxopen/bloxone-go-client" ) func main() { - id := "id_example" // string | An application specific resource identity of a resource - - configuration := openapiclient.NewConfiguration() - apiClient := openapiclient.NewAPIClient(configuration) - r, err := apiClient.LbdnAPI.LbdnDelete(context.Background(), id).Execute() - if err != nil { - fmt.Fprintf(os.Stderr, "Error when calling `LbdnAPI.LbdnDelete``: %v\n", err) - fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) - } + id := "id_example" // string | An application specific resource identity of a resource + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + r, err := apiClient.LbdnAPI.LbdnDelete(context.Background(), id).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `LbdnAPI.LbdnDelete``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } } ``` @@ -160,31 +160,31 @@ List __LBDN__ objects. package main import ( - "context" - "fmt" - "os" - openapiclient "github.com/infobloxopen/bloxone-go-client" + "context" + "fmt" + "os" + openapiclient "github.com/infobloxopen/bloxone-go-client" ) func main() { - fields := "fields_example" // string | A collection of response resources can be transformed by specifying a set of JSON tags to be returned. For a “flat” resource, the tag name is straightforward. If field selection is allowed on non-flat hierarchical resources, the service should implement a qualified naming scheme such as dot-qualification to reference data down the hierarchy. If a resource does not have the specified tag, the tag does not appear in the output resource. Specify this parameter as a comma-separated list of JSON tag names. (optional) - filter := "filter_example" // string | A collection of response resources can be filtered by a logical expression string that includes JSON tag references to values in each resource, literal values, and logical operators. If a resource does not have the specified tag, its value is assumed to be null. Literal values include numbers (integer and floating-point), and quoted (both single- or double-quoted) literal strings, and 'null'. The following operators are commonly used in filter expressions: | Op | Description | | -- | ----------- | | == | Equal | | != | Not Equal | | > | Greater Than | | >= | Greater Than or Equal To | | < | Less Than | | <= | Less Than or Equal To | | and | Logical AND | | ~ | Matches Regex | | !~ | Does Not Match Regex | | or | Logical OR | | not | Logical NOT | | () | Groupping Operators | (optional) - offset := int32(56) // int32 | The integer index (zero-origin) of the offset into a collection of resources. If omitted or null the value is assumed to be '0'. (optional) - limit := int32(56) // int32 | The integer number of resources to be returned in the response. The service may impose maximum value. If omitted the service may impose a default value. (optional) - pageToken := "pageToken_example" // string | The service-defined string used to identify a page of resources. A null value indicates the first page. (optional) - orderBy := "orderBy_example" // string | A collection of response resources can be sorted by their JSON tags. For a 'flat' resource, the tag name is straightforward. If sorting is allowed on non-flat hierarchical resources, the service should implement a qualified naming scheme such as dot-qualification to reference data down the hierarchy. If a resource does not have the specified tag, its value is assumed to be null.) Specify this parameter as a comma-separated list of JSON tag names. The sort direction can be specified by a suffix separated by whitespace before the tag name. The suffix 'asc' sorts the data in ascending order. The suffix 'desc' sorts the data in descending order. If no suffix is specified the data is sorted in ascending order. (optional) - tfilter := "tfilter_example" // string | This parameter is used for filtering by tags. (optional) - torderBy := "torderBy_example" // string | This parameter is used for sorting by tags. (optional) - - configuration := openapiclient.NewConfiguration() - apiClient := openapiclient.NewAPIClient(configuration) - resp, r, err := apiClient.LbdnAPI.LbdnList(context.Background()).Fields(fields).Filter(filter).Offset(offset).Limit(limit).PageToken(pageToken).OrderBy(orderBy).Tfilter(tfilter).TorderBy(torderBy).Execute() - if err != nil { - fmt.Fprintf(os.Stderr, "Error when calling `LbdnAPI.LbdnList``: %v\n", err) - fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) - } - // response from `LbdnList`: ConfigListLBDNResponse - fmt.Fprintf(os.Stdout, "Response from `LbdnAPI.LbdnList`: %v\n", resp) + fields := "fields_example" // string | A collection of response resources can be transformed by specifying a set of JSON tags to be returned. For a “flat” resource, the tag name is straightforward. If field selection is allowed on non-flat hierarchical resources, the service should implement a qualified naming scheme such as dot-qualification to reference data down the hierarchy. If a resource does not have the specified tag, the tag does not appear in the output resource. Specify this parameter as a comma-separated list of JSON tag names. (optional) + filter := "filter_example" // string | A collection of response resources can be filtered by a logical expression string that includes JSON tag references to values in each resource, literal values, and logical operators. If a resource does not have the specified tag, its value is assumed to be null. Literal values include numbers (integer and floating-point), and quoted (both single- or double-quoted) literal strings, and 'null'. The following operators are commonly used in filter expressions: | Op | Description | | -- | ----------- | | == | Equal | | != | Not Equal | | > | Greater Than | | >= | Greater Than or Equal To | | < | Less Than | | <= | Less Than or Equal To | | and | Logical AND | | ~ | Matches Regex | | !~ | Does Not Match Regex | | or | Logical OR | | not | Logical NOT | | () | Groupping Operators | (optional) + offset := int32(56) // int32 | The integer index (zero-origin) of the offset into a collection of resources. If omitted or null the value is assumed to be '0'. (optional) + limit := int32(56) // int32 | The integer number of resources to be returned in the response. The service may impose maximum value. If omitted the service may impose a default value. (optional) + pageToken := "pageToken_example" // string | The service-defined string used to identify a page of resources. A null value indicates the first page. (optional) + orderBy := "orderBy_example" // string | A collection of response resources can be sorted by their JSON tags. For a 'flat' resource, the tag name is straightforward. If sorting is allowed on non-flat hierarchical resources, the service should implement a qualified naming scheme such as dot-qualification to reference data down the hierarchy. If a resource does not have the specified tag, its value is assumed to be null.) Specify this parameter as a comma-separated list of JSON tag names. The sort direction can be specified by a suffix separated by whitespace before the tag name. The suffix 'asc' sorts the data in ascending order. The suffix 'desc' sorts the data in descending order. If no suffix is specified the data is sorted in ascending order. (optional) + tfilter := "tfilter_example" // string | This parameter is used for filtering by tags. (optional) + torderBy := "torderBy_example" // string | This parameter is used for sorting by tags. (optional) + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.LbdnAPI.LbdnList(context.Background()).Fields(fields).Filter(filter).Offset(offset).Limit(limit).PageToken(pageToken).OrderBy(orderBy).Tfilter(tfilter).TorderBy(torderBy).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `LbdnAPI.LbdnList``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `LbdnList`: ConfigListLBDNResponse + fmt.Fprintf(os.Stdout, "Response from `LbdnAPI.LbdnList`: %v\n", resp) } ``` @@ -240,25 +240,25 @@ Read the __LBDN__ object. package main import ( - "context" - "fmt" - "os" - openapiclient "github.com/infobloxopen/bloxone-go-client" + "context" + "fmt" + "os" + openapiclient "github.com/infobloxopen/bloxone-go-client" ) func main() { - id := "id_example" // string | An application specific resource identity of a resource - fields := "fields_example" // string | A collection of response resources can be transformed by specifying a set of JSON tags to be returned. For a “flat” resource, the tag name is straightforward. If field selection is allowed on non-flat hierarchical resources, the service should implement a qualified naming scheme such as dot-qualification to reference data down the hierarchy. If a resource does not have the specified tag, the tag does not appear in the output resource. Specify this parameter as a comma-separated list of JSON tag names. (optional) - - configuration := openapiclient.NewConfiguration() - apiClient := openapiclient.NewAPIClient(configuration) - resp, r, err := apiClient.LbdnAPI.LbdnRead(context.Background(), id).Fields(fields).Execute() - if err != nil { - fmt.Fprintf(os.Stderr, "Error when calling `LbdnAPI.LbdnRead``: %v\n", err) - fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) - } - // response from `LbdnRead`: ConfigReadLBDNResponse - fmt.Fprintf(os.Stdout, "Response from `LbdnAPI.LbdnRead`: %v\n", resp) + id := "id_example" // string | An application specific resource identity of a resource + fields := "fields_example" // string | A collection of response resources can be transformed by specifying a set of JSON tags to be returned. For a “flat” resource, the tag name is straightforward. If field selection is allowed on non-flat hierarchical resources, the service should implement a qualified naming scheme such as dot-qualification to reference data down the hierarchy. If a resource does not have the specified tag, the tag does not appear in the output resource. Specify this parameter as a comma-separated list of JSON tag names. (optional) + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.LbdnAPI.LbdnRead(context.Background(), id).Fields(fields).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `LbdnAPI.LbdnRead``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `LbdnRead`: ConfigReadLBDNResponse + fmt.Fprintf(os.Stdout, "Response from `LbdnAPI.LbdnRead`: %v\n", resp) } ``` @@ -312,25 +312,25 @@ Update the __LBDN__ object. package main import ( - "context" - "fmt" - "os" - openapiclient "github.com/infobloxopen/bloxone-go-client" + "context" + "fmt" + "os" + openapiclient "github.com/infobloxopen/bloxone-go-client" ) func main() { - id := "id_example" // string | An application specific resource identity of a resource - body := *openapiclient.NewConfigLBDN("Name_example", "View_example") // ConfigLBDN | - - configuration := openapiclient.NewConfiguration() - apiClient := openapiclient.NewAPIClient(configuration) - resp, r, err := apiClient.LbdnAPI.LbdnUpdate(context.Background(), id).Body(body).Execute() - if err != nil { - fmt.Fprintf(os.Stderr, "Error when calling `LbdnAPI.LbdnUpdate``: %v\n", err) - fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) - } - // response from `LbdnUpdate`: ConfigUpdateLBDNResponse - fmt.Fprintf(os.Stdout, "Response from `LbdnAPI.LbdnUpdate`: %v\n", resp) + id := "id_example" // string | An application specific resource identity of a resource + body := *openapiclient.NewConfigLBDN("Name_example", "View_example") // ConfigLBDN | + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.LbdnAPI.LbdnUpdate(context.Background(), id).Body(body).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `LbdnAPI.LbdnUpdate``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `LbdnUpdate`: ConfigUpdateLBDNResponse + fmt.Fprintf(os.Stdout, "Response from `LbdnAPI.LbdnUpdate`: %v\n", resp) } ``` diff --git a/dns_config/docs/ServerAPI.md b/dns_config/docs/ServerAPI.md index 3413e39..4b8e307 100644 --- a/dns_config/docs/ServerAPI.md +++ b/dns_config/docs/ServerAPI.md @@ -26,25 +26,25 @@ Create the Server object. package main import ( - "context" - "fmt" - "os" - openapiclient "github.com/infobloxopen/bloxone-go-client" + "context" + "fmt" + "os" + openapiclient "github.com/infobloxopen/bloxone-go-client" ) func main() { - body := *openapiclient.NewConfigServer("Name_example") // ConfigServer | - inherit := "inherit_example" // string | This parameter is used for getting inheritance_sources. Allowed values: * _none_, * _partial_, * _full_. Defaults to _none (optional) - - configuration := openapiclient.NewConfiguration() - apiClient := openapiclient.NewAPIClient(configuration) - resp, r, err := apiClient.ServerAPI.ServerCreate(context.Background()).Body(body).Inherit(inherit).Execute() - if err != nil { - fmt.Fprintf(os.Stderr, "Error when calling `ServerAPI.ServerCreate``: %v\n", err) - fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) - } - // response from `ServerCreate`: ConfigCreateServerResponse - fmt.Fprintf(os.Stdout, "Response from `ServerAPI.ServerCreate`: %v\n", resp) + body := *openapiclient.NewConfigServer("Name_example") // ConfigServer | + inherit := "inherit_example" // string | This parameter is used for getting inheritance_sources. Allowed values: * _none_, * _partial_, * _full_. Defaults to _none (optional) + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.ServerAPI.ServerCreate(context.Background()).Body(body).Inherit(inherit).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `ServerAPI.ServerCreate``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `ServerCreate`: ConfigCreateServerResponse + fmt.Fprintf(os.Stdout, "Response from `ServerAPI.ServerCreate`: %v\n", resp) } ``` @@ -94,22 +94,22 @@ Move the Server object to Recyclebin. package main import ( - "context" - "fmt" - "os" - openapiclient "github.com/infobloxopen/bloxone-go-client" + "context" + "fmt" + "os" + openapiclient "github.com/infobloxopen/bloxone-go-client" ) func main() { - id := "id_example" // string | An application specific resource identity of a resource - - configuration := openapiclient.NewConfiguration() - apiClient := openapiclient.NewAPIClient(configuration) - r, err := apiClient.ServerAPI.ServerDelete(context.Background(), id).Execute() - if err != nil { - fmt.Fprintf(os.Stderr, "Error when calling `ServerAPI.ServerDelete``: %v\n", err) - fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) - } + id := "id_example" // string | An application specific resource identity of a resource + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + r, err := apiClient.ServerAPI.ServerDelete(context.Background(), id).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `ServerAPI.ServerDelete``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } } ``` @@ -162,32 +162,32 @@ List Server objects. package main import ( - "context" - "fmt" - "os" - openapiclient "github.com/infobloxopen/bloxone-go-client" + "context" + "fmt" + "os" + openapiclient "github.com/infobloxopen/bloxone-go-client" ) func main() { - fields := "fields_example" // string | A collection of response resources can be transformed by specifying a set of JSON tags to be returned. For a “flat” resource, the tag name is straightforward. If field selection is allowed on non-flat hierarchical resources, the service should implement a qualified naming scheme such as dot-qualification to reference data down the hierarchy. If a resource does not have the specified tag, the tag does not appear in the output resource. Specify this parameter as a comma-separated list of JSON tag names. (optional) - filter := "filter_example" // string | A collection of response resources can be filtered by a logical expression string that includes JSON tag references to values in each resource, literal values, and logical operators. If a resource does not have the specified tag, its value is assumed to be null. Literal values include numbers (integer and floating-point), and quoted (both single- or double-quoted) literal strings, and 'null'. The following operators are commonly used in filter expressions: | Op | Description | | -- | ----------- | | == | Equal | | != | Not Equal | | > | Greater Than | | >= | Greater Than or Equal To | | < | Less Than | | <= | Less Than or Equal To | | and | Logical AND | | ~ | Matches Regex | | !~ | Does Not Match Regex | | or | Logical OR | | not | Logical NOT | | () | Groupping Operators | (optional) - offset := int32(56) // int32 | The integer index (zero-origin) of the offset into a collection of resources. If omitted or null the value is assumed to be '0'. (optional) - limit := int32(56) // int32 | The integer number of resources to be returned in the response. The service may impose maximum value. If omitted the service may impose a default value. (optional) - pageToken := "pageToken_example" // string | The service-defined string used to identify a page of resources. A null value indicates the first page. (optional) - orderBy := "orderBy_example" // string | A collection of response resources can be sorted by their JSON tags. For a 'flat' resource, the tag name is straightforward. If sorting is allowed on non-flat hierarchical resources, the service should implement a qualified naming scheme such as dot-qualification to reference data down the hierarchy. If a resource does not have the specified tag, its value is assumed to be null.) Specify this parameter as a comma-separated list of JSON tag names. The sort direction can be specified by a suffix separated by whitespace before the tag name. The suffix 'asc' sorts the data in ascending order. The suffix 'desc' sorts the data in descending order. If no suffix is specified the data is sorted in ascending order. (optional) - tfilter := "tfilter_example" // string | This parameter is used for filtering by tags. (optional) - torderBy := "torderBy_example" // string | This parameter is used for sorting by tags. (optional) - inherit := "inherit_example" // string | This parameter is used for getting inheritance_sources. Allowed values: * _none_, * _partial_, * _full_. Defaults to _none (optional) - - configuration := openapiclient.NewConfiguration() - apiClient := openapiclient.NewAPIClient(configuration) - resp, r, err := apiClient.ServerAPI.ServerList(context.Background()).Fields(fields).Filter(filter).Offset(offset).Limit(limit).PageToken(pageToken).OrderBy(orderBy).Tfilter(tfilter).TorderBy(torderBy).Inherit(inherit).Execute() - if err != nil { - fmt.Fprintf(os.Stderr, "Error when calling `ServerAPI.ServerList``: %v\n", err) - fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) - } - // response from `ServerList`: ConfigListServerResponse - fmt.Fprintf(os.Stdout, "Response from `ServerAPI.ServerList`: %v\n", resp) + fields := "fields_example" // string | A collection of response resources can be transformed by specifying a set of JSON tags to be returned. For a “flat” resource, the tag name is straightforward. If field selection is allowed on non-flat hierarchical resources, the service should implement a qualified naming scheme such as dot-qualification to reference data down the hierarchy. If a resource does not have the specified tag, the tag does not appear in the output resource. Specify this parameter as a comma-separated list of JSON tag names. (optional) + filter := "filter_example" // string | A collection of response resources can be filtered by a logical expression string that includes JSON tag references to values in each resource, literal values, and logical operators. If a resource does not have the specified tag, its value is assumed to be null. Literal values include numbers (integer and floating-point), and quoted (both single- or double-quoted) literal strings, and 'null'. The following operators are commonly used in filter expressions: | Op | Description | | -- | ----------- | | == | Equal | | != | Not Equal | | > | Greater Than | | >= | Greater Than or Equal To | | < | Less Than | | <= | Less Than or Equal To | | and | Logical AND | | ~ | Matches Regex | | !~ | Does Not Match Regex | | or | Logical OR | | not | Logical NOT | | () | Groupping Operators | (optional) + offset := int32(56) // int32 | The integer index (zero-origin) of the offset into a collection of resources. If omitted or null the value is assumed to be '0'. (optional) + limit := int32(56) // int32 | The integer number of resources to be returned in the response. The service may impose maximum value. If omitted the service may impose a default value. (optional) + pageToken := "pageToken_example" // string | The service-defined string used to identify a page of resources. A null value indicates the first page. (optional) + orderBy := "orderBy_example" // string | A collection of response resources can be sorted by their JSON tags. For a 'flat' resource, the tag name is straightforward. If sorting is allowed on non-flat hierarchical resources, the service should implement a qualified naming scheme such as dot-qualification to reference data down the hierarchy. If a resource does not have the specified tag, its value is assumed to be null.) Specify this parameter as a comma-separated list of JSON tag names. The sort direction can be specified by a suffix separated by whitespace before the tag name. The suffix 'asc' sorts the data in ascending order. The suffix 'desc' sorts the data in descending order. If no suffix is specified the data is sorted in ascending order. (optional) + tfilter := "tfilter_example" // string | This parameter is used for filtering by tags. (optional) + torderBy := "torderBy_example" // string | This parameter is used for sorting by tags. (optional) + inherit := "inherit_example" // string | This parameter is used for getting inheritance_sources. Allowed values: * _none_, * _partial_, * _full_. Defaults to _none (optional) + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.ServerAPI.ServerList(context.Background()).Fields(fields).Filter(filter).Offset(offset).Limit(limit).PageToken(pageToken).OrderBy(orderBy).Tfilter(tfilter).TorderBy(torderBy).Inherit(inherit).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `ServerAPI.ServerList``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `ServerList`: ConfigListServerResponse + fmt.Fprintf(os.Stdout, "Response from `ServerAPI.ServerList`: %v\n", resp) } ``` @@ -244,26 +244,26 @@ Read the Server object. package main import ( - "context" - "fmt" - "os" - openapiclient "github.com/infobloxopen/bloxone-go-client" + "context" + "fmt" + "os" + openapiclient "github.com/infobloxopen/bloxone-go-client" ) func main() { - id := "id_example" // string | An application specific resource identity of a resource - fields := "fields_example" // string | A collection of response resources can be transformed by specifying a set of JSON tags to be returned. For a “flat” resource, the tag name is straightforward. If field selection is allowed on non-flat hierarchical resources, the service should implement a qualified naming scheme such as dot-qualification to reference data down the hierarchy. If a resource does not have the specified tag, the tag does not appear in the output resource. Specify this parameter as a comma-separated list of JSON tag names. (optional) - inherit := "inherit_example" // string | This parameter is used for getting inheritance_sources. Allowed values: * _none_, * _partial_, * _full_. Defaults to _none (optional) - - configuration := openapiclient.NewConfiguration() - apiClient := openapiclient.NewAPIClient(configuration) - resp, r, err := apiClient.ServerAPI.ServerRead(context.Background(), id).Fields(fields).Inherit(inherit).Execute() - if err != nil { - fmt.Fprintf(os.Stderr, "Error when calling `ServerAPI.ServerRead``: %v\n", err) - fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) - } - // response from `ServerRead`: ConfigReadServerResponse - fmt.Fprintf(os.Stdout, "Response from `ServerAPI.ServerRead`: %v\n", resp) + id := "id_example" // string | An application specific resource identity of a resource + fields := "fields_example" // string | A collection of response resources can be transformed by specifying a set of JSON tags to be returned. For a “flat” resource, the tag name is straightforward. If field selection is allowed on non-flat hierarchical resources, the service should implement a qualified naming scheme such as dot-qualification to reference data down the hierarchy. If a resource does not have the specified tag, the tag does not appear in the output resource. Specify this parameter as a comma-separated list of JSON tag names. (optional) + inherit := "inherit_example" // string | This parameter is used for getting inheritance_sources. Allowed values: * _none_, * _partial_, * _full_. Defaults to _none (optional) + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.ServerAPI.ServerRead(context.Background(), id).Fields(fields).Inherit(inherit).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `ServerAPI.ServerRead``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `ServerRead`: ConfigReadServerResponse + fmt.Fprintf(os.Stdout, "Response from `ServerAPI.ServerRead`: %v\n", resp) } ``` @@ -318,26 +318,26 @@ Update the Server object. package main import ( - "context" - "fmt" - "os" - openapiclient "github.com/infobloxopen/bloxone-go-client" + "context" + "fmt" + "os" + openapiclient "github.com/infobloxopen/bloxone-go-client" ) func main() { - id := "id_example" // string | An application specific resource identity of a resource - body := *openapiclient.NewConfigServer("Name_example") // ConfigServer | - inherit := "inherit_example" // string | This parameter is used for getting inheritance_sources. Allowed values: * _none_, * _partial_, * _full_. Defaults to _none (optional) - - configuration := openapiclient.NewConfiguration() - apiClient := openapiclient.NewAPIClient(configuration) - resp, r, err := apiClient.ServerAPI.ServerUpdate(context.Background(), id).Body(body).Inherit(inherit).Execute() - if err != nil { - fmt.Fprintf(os.Stderr, "Error when calling `ServerAPI.ServerUpdate``: %v\n", err) - fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) - } - // response from `ServerUpdate`: ConfigUpdateServerResponse - fmt.Fprintf(os.Stdout, "Response from `ServerAPI.ServerUpdate`: %v\n", resp) + id := "id_example" // string | An application specific resource identity of a resource + body := *openapiclient.NewConfigServer("Name_example") // ConfigServer | + inherit := "inherit_example" // string | This parameter is used for getting inheritance_sources. Allowed values: * _none_, * _partial_, * _full_. Defaults to _none (optional) + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.ServerAPI.ServerUpdate(context.Background(), id).Body(body).Inherit(inherit).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `ServerAPI.ServerUpdate``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `ServerUpdate`: ConfigUpdateServerResponse + fmt.Fprintf(os.Stdout, "Response from `ServerAPI.ServerUpdate`: %v\n", resp) } ``` diff --git a/dns_config/docs/ViewAPI.md b/dns_config/docs/ViewAPI.md index 88cb110..c3106ba 100644 --- a/dns_config/docs/ViewAPI.md +++ b/dns_config/docs/ViewAPI.md @@ -27,24 +27,24 @@ Copies the specified __AuthZone__ and __ForwardZone__ objects in the __View__. package main import ( - "context" - "fmt" - "os" - openapiclient "github.com/infobloxopen/bloxone-go-client" + "context" + "fmt" + "os" + openapiclient "github.com/infobloxopen/bloxone-go-client" ) func main() { - body := *openapiclient.NewConfigBulkCopyView([]string{"Resources_example"}, "Target_example") // ConfigBulkCopyView | - - configuration := openapiclient.NewConfiguration() - apiClient := openapiclient.NewAPIClient(configuration) - resp, r, err := apiClient.ViewAPI.ViewBulkCopy(context.Background()).Body(body).Execute() - if err != nil { - fmt.Fprintf(os.Stderr, "Error when calling `ViewAPI.ViewBulkCopy``: %v\n", err) - fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) - } - // response from `ViewBulkCopy`: ConfigBulkCopyResponse - fmt.Fprintf(os.Stdout, "Response from `ViewAPI.ViewBulkCopy`: %v\n", resp) + body := *openapiclient.NewConfigBulkCopyView([]string{"Resources_example"}, "Target_example") // ConfigBulkCopyView | + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.ViewAPI.ViewBulkCopy(context.Background()).Body(body).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `ViewAPI.ViewBulkCopy``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `ViewBulkCopy`: ConfigBulkCopyResponse + fmt.Fprintf(os.Stdout, "Response from `ViewAPI.ViewBulkCopy`: %v\n", resp) } ``` @@ -93,25 +93,25 @@ Create the View object. package main import ( - "context" - "fmt" - "os" - openapiclient "github.com/infobloxopen/bloxone-go-client" + "context" + "fmt" + "os" + openapiclient "github.com/infobloxopen/bloxone-go-client" ) func main() { - body := *openapiclient.NewConfigView("Name_example") // ConfigView | - inherit := "inherit_example" // string | This parameter is used for getting inheritance_sources. Allowed values: * _none_, * _partial_, * _full_. Defaults to _none (optional) - - configuration := openapiclient.NewConfiguration() - apiClient := openapiclient.NewAPIClient(configuration) - resp, r, err := apiClient.ViewAPI.ViewCreate(context.Background()).Body(body).Inherit(inherit).Execute() - if err != nil { - fmt.Fprintf(os.Stderr, "Error when calling `ViewAPI.ViewCreate``: %v\n", err) - fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) - } - // response from `ViewCreate`: ConfigCreateViewResponse - fmt.Fprintf(os.Stdout, "Response from `ViewAPI.ViewCreate`: %v\n", resp) + body := *openapiclient.NewConfigView("Name_example") // ConfigView | + inherit := "inherit_example" // string | This parameter is used for getting inheritance_sources. Allowed values: * _none_, * _partial_, * _full_. Defaults to _none (optional) + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.ViewAPI.ViewCreate(context.Background()).Body(body).Inherit(inherit).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `ViewAPI.ViewCreate``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `ViewCreate`: ConfigCreateViewResponse + fmt.Fprintf(os.Stdout, "Response from `ViewAPI.ViewCreate`: %v\n", resp) } ``` @@ -161,22 +161,22 @@ Move the View object to Recyclebin. package main import ( - "context" - "fmt" - "os" - openapiclient "github.com/infobloxopen/bloxone-go-client" + "context" + "fmt" + "os" + openapiclient "github.com/infobloxopen/bloxone-go-client" ) func main() { - id := "id_example" // string | An application specific resource identity of a resource - - configuration := openapiclient.NewConfiguration() - apiClient := openapiclient.NewAPIClient(configuration) - r, err := apiClient.ViewAPI.ViewDelete(context.Background(), id).Execute() - if err != nil { - fmt.Fprintf(os.Stderr, "Error when calling `ViewAPI.ViewDelete``: %v\n", err) - fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) - } + id := "id_example" // string | An application specific resource identity of a resource + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + r, err := apiClient.ViewAPI.ViewDelete(context.Background(), id).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `ViewAPI.ViewDelete``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } } ``` @@ -229,32 +229,32 @@ List View objects. package main import ( - "context" - "fmt" - "os" - openapiclient "github.com/infobloxopen/bloxone-go-client" + "context" + "fmt" + "os" + openapiclient "github.com/infobloxopen/bloxone-go-client" ) func main() { - fields := "fields_example" // string | A collection of response resources can be transformed by specifying a set of JSON tags to be returned. For a “flat” resource, the tag name is straightforward. If field selection is allowed on non-flat hierarchical resources, the service should implement a qualified naming scheme such as dot-qualification to reference data down the hierarchy. If a resource does not have the specified tag, the tag does not appear in the output resource. Specify this parameter as a comma-separated list of JSON tag names. (optional) - filter := "filter_example" // string | A collection of response resources can be filtered by a logical expression string that includes JSON tag references to values in each resource, literal values, and logical operators. If a resource does not have the specified tag, its value is assumed to be null. Literal values include numbers (integer and floating-point), and quoted (both single- or double-quoted) literal strings, and 'null'. The following operators are commonly used in filter expressions: | Op | Description | | -- | ----------- | | == | Equal | | != | Not Equal | | > | Greater Than | | >= | Greater Than or Equal To | | < | Less Than | | <= | Less Than or Equal To | | and | Logical AND | | ~ | Matches Regex | | !~ | Does Not Match Regex | | or | Logical OR | | not | Logical NOT | | () | Groupping Operators | (optional) - offset := int32(56) // int32 | The integer index (zero-origin) of the offset into a collection of resources. If omitted or null the value is assumed to be '0'. (optional) - limit := int32(56) // int32 | The integer number of resources to be returned in the response. The service may impose maximum value. If omitted the service may impose a default value. (optional) - pageToken := "pageToken_example" // string | The service-defined string used to identify a page of resources. A null value indicates the first page. (optional) - orderBy := "orderBy_example" // string | A collection of response resources can be sorted by their JSON tags. For a 'flat' resource, the tag name is straightforward. If sorting is allowed on non-flat hierarchical resources, the service should implement a qualified naming scheme such as dot-qualification to reference data down the hierarchy. If a resource does not have the specified tag, its value is assumed to be null.) Specify this parameter as a comma-separated list of JSON tag names. The sort direction can be specified by a suffix separated by whitespace before the tag name. The suffix 'asc' sorts the data in ascending order. The suffix 'desc' sorts the data in descending order. If no suffix is specified the data is sorted in ascending order. (optional) - tfilter := "tfilter_example" // string | This parameter is used for filtering by tags. (optional) - torderBy := "torderBy_example" // string | This parameter is used for sorting by tags. (optional) - inherit := "inherit_example" // string | This parameter is used for getting inheritance_sources. Allowed values: * _none_, * _partial_, * _full_. Defaults to _none (optional) - - configuration := openapiclient.NewConfiguration() - apiClient := openapiclient.NewAPIClient(configuration) - resp, r, err := apiClient.ViewAPI.ViewList(context.Background()).Fields(fields).Filter(filter).Offset(offset).Limit(limit).PageToken(pageToken).OrderBy(orderBy).Tfilter(tfilter).TorderBy(torderBy).Inherit(inherit).Execute() - if err != nil { - fmt.Fprintf(os.Stderr, "Error when calling `ViewAPI.ViewList``: %v\n", err) - fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) - } - // response from `ViewList`: ConfigListViewResponse - fmt.Fprintf(os.Stdout, "Response from `ViewAPI.ViewList`: %v\n", resp) + fields := "fields_example" // string | A collection of response resources can be transformed by specifying a set of JSON tags to be returned. For a “flat” resource, the tag name is straightforward. If field selection is allowed on non-flat hierarchical resources, the service should implement a qualified naming scheme such as dot-qualification to reference data down the hierarchy. If a resource does not have the specified tag, the tag does not appear in the output resource. Specify this parameter as a comma-separated list of JSON tag names. (optional) + filter := "filter_example" // string | A collection of response resources can be filtered by a logical expression string that includes JSON tag references to values in each resource, literal values, and logical operators. If a resource does not have the specified tag, its value is assumed to be null. Literal values include numbers (integer and floating-point), and quoted (both single- or double-quoted) literal strings, and 'null'. The following operators are commonly used in filter expressions: | Op | Description | | -- | ----------- | | == | Equal | | != | Not Equal | | > | Greater Than | | >= | Greater Than or Equal To | | < | Less Than | | <= | Less Than or Equal To | | and | Logical AND | | ~ | Matches Regex | | !~ | Does Not Match Regex | | or | Logical OR | | not | Logical NOT | | () | Groupping Operators | (optional) + offset := int32(56) // int32 | The integer index (zero-origin) of the offset into a collection of resources. If omitted or null the value is assumed to be '0'. (optional) + limit := int32(56) // int32 | The integer number of resources to be returned in the response. The service may impose maximum value. If omitted the service may impose a default value. (optional) + pageToken := "pageToken_example" // string | The service-defined string used to identify a page of resources. A null value indicates the first page. (optional) + orderBy := "orderBy_example" // string | A collection of response resources can be sorted by their JSON tags. For a 'flat' resource, the tag name is straightforward. If sorting is allowed on non-flat hierarchical resources, the service should implement a qualified naming scheme such as dot-qualification to reference data down the hierarchy. If a resource does not have the specified tag, its value is assumed to be null.) Specify this parameter as a comma-separated list of JSON tag names. The sort direction can be specified by a suffix separated by whitespace before the tag name. The suffix 'asc' sorts the data in ascending order. The suffix 'desc' sorts the data in descending order. If no suffix is specified the data is sorted in ascending order. (optional) + tfilter := "tfilter_example" // string | This parameter is used for filtering by tags. (optional) + torderBy := "torderBy_example" // string | This parameter is used for sorting by tags. (optional) + inherit := "inherit_example" // string | This parameter is used for getting inheritance_sources. Allowed values: * _none_, * _partial_, * _full_. Defaults to _none (optional) + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.ViewAPI.ViewList(context.Background()).Fields(fields).Filter(filter).Offset(offset).Limit(limit).PageToken(pageToken).OrderBy(orderBy).Tfilter(tfilter).TorderBy(torderBy).Inherit(inherit).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `ViewAPI.ViewList``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `ViewList`: ConfigListViewResponse + fmt.Fprintf(os.Stdout, "Response from `ViewAPI.ViewList`: %v\n", resp) } ``` @@ -311,26 +311,26 @@ Read the View object. package main import ( - "context" - "fmt" - "os" - openapiclient "github.com/infobloxopen/bloxone-go-client" + "context" + "fmt" + "os" + openapiclient "github.com/infobloxopen/bloxone-go-client" ) func main() { - id := "id_example" // string | An application specific resource identity of a resource - fields := "fields_example" // string | A collection of response resources can be transformed by specifying a set of JSON tags to be returned. For a “flat” resource, the tag name is straightforward. If field selection is allowed on non-flat hierarchical resources, the service should implement a qualified naming scheme such as dot-qualification to reference data down the hierarchy. If a resource does not have the specified tag, the tag does not appear in the output resource. Specify this parameter as a comma-separated list of JSON tag names. (optional) - inherit := "inherit_example" // string | This parameter is used for getting inheritance_sources. Allowed values: * _none_, * _partial_, * _full_. Defaults to _none (optional) - - configuration := openapiclient.NewConfiguration() - apiClient := openapiclient.NewAPIClient(configuration) - resp, r, err := apiClient.ViewAPI.ViewRead(context.Background(), id).Fields(fields).Inherit(inherit).Execute() - if err != nil { - fmt.Fprintf(os.Stderr, "Error when calling `ViewAPI.ViewRead``: %v\n", err) - fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) - } - // response from `ViewRead`: ConfigReadViewResponse - fmt.Fprintf(os.Stdout, "Response from `ViewAPI.ViewRead`: %v\n", resp) + id := "id_example" // string | An application specific resource identity of a resource + fields := "fields_example" // string | A collection of response resources can be transformed by specifying a set of JSON tags to be returned. For a “flat” resource, the tag name is straightforward. If field selection is allowed on non-flat hierarchical resources, the service should implement a qualified naming scheme such as dot-qualification to reference data down the hierarchy. If a resource does not have the specified tag, the tag does not appear in the output resource. Specify this parameter as a comma-separated list of JSON tag names. (optional) + inherit := "inherit_example" // string | This parameter is used for getting inheritance_sources. Allowed values: * _none_, * _partial_, * _full_. Defaults to _none (optional) + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.ViewAPI.ViewRead(context.Background(), id).Fields(fields).Inherit(inherit).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `ViewAPI.ViewRead``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `ViewRead`: ConfigReadViewResponse + fmt.Fprintf(os.Stdout, "Response from `ViewAPI.ViewRead`: %v\n", resp) } ``` @@ -385,26 +385,26 @@ Update the View object. package main import ( - "context" - "fmt" - "os" - openapiclient "github.com/infobloxopen/bloxone-go-client" + "context" + "fmt" + "os" + openapiclient "github.com/infobloxopen/bloxone-go-client" ) func main() { - id := "id_example" // string | An application specific resource identity of a resource - body := *openapiclient.NewConfigView("Name_example") // ConfigView | - inherit := "inherit_example" // string | This parameter is used for getting inheritance_sources. Allowed values: * _none_, * _partial_, * _full_. Defaults to _none (optional) - - configuration := openapiclient.NewConfiguration() - apiClient := openapiclient.NewAPIClient(configuration) - resp, r, err := apiClient.ViewAPI.ViewUpdate(context.Background(), id).Body(body).Inherit(inherit).Execute() - if err != nil { - fmt.Fprintf(os.Stderr, "Error when calling `ViewAPI.ViewUpdate``: %v\n", err) - fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) - } - // response from `ViewUpdate`: ConfigUpdateViewResponse - fmt.Fprintf(os.Stdout, "Response from `ViewAPI.ViewUpdate`: %v\n", resp) + id := "id_example" // string | An application specific resource identity of a resource + body := *openapiclient.NewConfigView("Name_example") // ConfigView | + inherit := "inherit_example" // string | This parameter is used for getting inheritance_sources. Allowed values: * _none_, * _partial_, * _full_. Defaults to _none (optional) + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.ViewAPI.ViewUpdate(context.Background(), id).Body(body).Inherit(inherit).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `ViewAPI.ViewUpdate``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `ViewUpdate`: ConfigUpdateViewResponse + fmt.Fprintf(os.Stdout, "Response from `ViewAPI.ViewUpdate`: %v\n", resp) } ``` diff --git a/dns_config/test/api_acl_test.go b/dns_config/test/api_acl_test.go index 847e155..1ff4711 100644 --- a/dns_config/test/api_acl_test.go +++ b/dns_config/test/api_acl_test.go @@ -13,238 +13,150 @@ import ( "bytes" "context" "encoding/json" - "github.com/infobloxopen/bloxone-go-client/dns_config" - "github.com/infobloxopen/bloxone-go-client/internal" - openapiclient "github.com/infobloxopen/bloxone-go-client/keys" - "github.com/stretchr/testify/require" "io" "net/http" "testing" -) -type RoundTripFunc func(req *http.Request) *http.Response + "github.com/stretchr/testify/require" + + openapiclient "github.com/infobloxopen/bloxone-go-client/dns_config" + "github.com/infobloxopen/bloxone-go-client/internal" +) -func (f RoundTripFunc) RoundTrip(req *http.Request) (*http.Response, error) { - return f(req), nil +var dns_config_Post = openapiclient.ConfigACL{ + Comment: openapiclient.PtrString("This is a dummy ACL for testing."), + Id: openapiclient.PtrString("dummyAclId"), + Name: "dummyAclName", } -func NewTestClient(fn RoundTripFunc) *http.Client { - return &http.Client{ - Transport: RoundTripFunc(fn), - } +var dns_config_Patch = openapiclient.ConfigACL{ + Comment: openapiclient.PtrString("This is an updated dummy ACL for testing."), + Id: dns_config_Post.Id, + Name: "updatedDummyAclName", } func Test_dns_config_AclAPIService(t *testing.T) { t.Run("Test AclAPIService AclCreate", func(t *testing.T) { - - //t.Skip("skip test") // remove to run test - - dummyAcl := dns_config.ConfigACL{ - Comment: openapiclient.PtrString("This is a dummy ACL for testing."), - Id: openapiclient.PtrString("dummyAclId"), - Name: "dummyAclName", - } - - testClient := NewTestClient(func(req *http.Request) *http.Response { - require.Equal(t, "POST", req.Method) + configuration := internal.NewConfiguration() + configuration.HTTPClient = internal.NewTestClient(func(req *http.Request) *http.Response { + require.Equal(t, http.MethodPost, req.Method) require.Equal(t, "/api/ddi/v1/dns/acl", req.URL.Path) require.Equal(t, "application/json", req.Header.Get("Content-Type")) - var reqBody dns_config.ConfigACL + var reqBody openapiclient.ConfigACL require.NoError(t, json.NewDecoder(req.Body).Decode(&reqBody)) - require.Equal(t, dummyAcl, reqBody) + require.Equal(t, dns_config_Post, reqBody) - response := dns_config.ConfigCreateACLResponse{ - Result: &dummyAcl, - } + response := openapiclient.ConfigCreateACLResponse{} body, err := json.Marshal(response) require.NoError(t, err) return &http.Response{ - StatusCode: 200, + StatusCode: http.StatusOK, Body: io.NopCloser(bytes.NewReader(body)), Header: map[string][]string{"Content-Type": {"application/json"}}, } }) - - configuration := internal.NewConfiguration() - configuration.HTTPClient = testClient - - aclAPI := dns_config.NewAPIClient(configuration) - ctx := context.Background() - - resp, httpRes, err := aclAPI.AclAPI.AclCreate(ctx).Body(dummyAcl).Execute() + apiClient := openapiclient.NewAPIClient(configuration) + resp, httpRes, err := apiClient.AclAPI.AclCreate(context.Background()).Body(dns_config_Post).Execute() require.Nil(t, err) require.NotNil(t, resp) - require.Equal(t, 200, httpRes.StatusCode) + require.Equal(t, http.StatusOK, httpRes.StatusCode) }) - t.Run("Test AclAPIService AclRead", func(t *testing.T) { - - //t.Skip("skip test") // remove to run test - - dummyAcl := dns_config.ConfigACL{ - Comment: openapiclient.PtrString("This is a dummy ACL for testing."), - Id: openapiclient.PtrString("dummyAclId"), - Name: "dummyAclName", - } - - testClient := NewTestClient(func(req *http.Request) *http.Response { - require.Equal(t, "GET", req.Method) - require.Equal(t, "/api/ddi/v1/dns/acl/"+*dummyAcl.Id, req.URL.Path) + t.Run("Test AclAPIService AclList", func(t *testing.T) { + configuration := internal.NewConfiguration() + configuration.HTTPClient = internal.NewTestClient(func(req *http.Request) *http.Response { + require.Equal(t, http.MethodGet, req.Method) + require.Equal(t, "/api/ddi/v1/dns/acl", req.URL.Path) + require.Equal(t, "application/json", req.Header.Get("Accept")) - response := dns_config.ConfigReadACLResponse{ - Result: &dummyAcl, - } + response := openapiclient.ConfigListACLResponse{} body, err := json.Marshal(response) require.NoError(t, err) return &http.Response{ - StatusCode: 200, + StatusCode: http.StatusOK, Body: io.NopCloser(bytes.NewReader(body)), Header: map[string][]string{"Content-Type": {"application/json"}}, } }) - - configuration := internal.NewConfiguration() - configuration.HTTPClient = testClient - - aclAPI := dns_config.NewAPIClient(configuration) - ctx := context.Background() - - readRequest := aclAPI.AclAPI.AclRead(ctx, *dummyAcl.Id) - resp, httpRes, err := aclAPI.AclAPI.AclReadExecute(readRequest) + apiClient := openapiclient.NewAPIClient(configuration) + resp, httpRes, err := apiClient.AclAPI.AclList(context.Background()).Execute() require.Nil(t, err) require.NotNil(t, resp) - require.Equal(t, 200, httpRes.StatusCode) - require.Equal(t, dummyAcl, *resp.Result) + require.Equal(t, http.StatusOK, httpRes.StatusCode) }) - t.Run("Test AclAPIService AclList", func(t *testing.T) { - - //t.Skip("skip test") // remove to run test - - dummyAclList := []dns_config.ConfigACL{ - { - Comment: openapiclient.PtrString("This is a dummy ACL for testing."), - Id: openapiclient.PtrString("dummyAclId1"), - Name: "dummyAclName1", - }, - { - Comment: openapiclient.PtrString("This is another dummy ACL for testing."), - Id: openapiclient.PtrString("dummyAclId2"), - Name: "dummyAclName2", - }, - } - - testClient := NewTestClient(func(req *http.Request) *http.Response { - require.Equal(t, "GET", req.Method) - require.Equal(t, "/api/ddi/v1/dns/acl", req.URL.Path) + t.Run("Test AclAPIService AclRead", func(t *testing.T) { + configuration := internal.NewConfiguration() + configuration.HTTPClient = internal.NewTestClient(func(req *http.Request) *http.Response { + require.Equal(t, http.MethodGet, req.Method) + require.Equal(t, "/api/ddi/v1/dns/acl/"+*dns_config_Post.Id, req.URL.Path) + require.Equal(t, "application/json", req.Header.Get("Accept")) - response := dns_config.ConfigListACLResponse{ - Results: dummyAclList, - } + response := openapiclient.ConfigReadACLResponse{} body, err := json.Marshal(response) require.NoError(t, err) return &http.Response{ - StatusCode: 200, + StatusCode: http.StatusOK, Body: io.NopCloser(bytes.NewReader(body)), Header: map[string][]string{"Content-Type": {"application/json"}}, } }) - - configuration := internal.NewConfiguration() - configuration.HTTPClient = testClient - - aclAPI := dns_config.NewAPIClient(configuration) - ctx := context.Background() - - resp, httpRes, err := aclAPI.AclAPI.AclList(ctx).Execute() + apiClient := openapiclient.NewAPIClient(configuration) + resp, httpRes, err := apiClient.AclAPI.AclRead(context.Background(), *dns_config_Post.Id).Execute() require.Nil(t, err) require.NotNil(t, resp) - require.Equal(t, 200, httpRes.StatusCode) - require.Equal(t, dummyAclList, resp.Results) + require.Equal(t, http.StatusOK, httpRes.StatusCode) }) t.Run("Test AclAPIService AclUpdate", func(t *testing.T) { + configuration := internal.NewConfiguration() + configuration.HTTPClient = internal.NewTestClient(func(req *http.Request) *http.Response { + require.Equal(t, http.MethodPatch, req.Method) + require.Equal(t, "/api/ddi/v1/dns/acl/"+*dns_config_Post.Id, req.URL.Path) + require.Equal(t, "application/json", req.Header.Get("Content-Type")) - //t.Skip("skip test") // remove to run test - - dummyAcl := dns_config.ConfigACL{ - Comment: openapiclient.PtrString("This is a dummy ACL for testing."), - Id: openapiclient.PtrString("dummyAclId"), - Name: "dummyAclName", - } - - updatedAcl := dns_config.ConfigACL{ - Comment: openapiclient.PtrString("This is an updated dummy ACL for testing."), - Id: dummyAcl.Id, - Name: "updatedDummyAclName", - } - - testClient := NewTestClient(func(req *http.Request) *http.Response { - require.Equal(t, "PATCH", req.Method) - require.Equal(t, "/api/ddi/v1/dns/acl/"+*dummyAcl.Id, req.URL.Path) + var reqBody openapiclient.ConfigACL + require.NoError(t, json.NewDecoder(req.Body).Decode(&reqBody)) + require.Equal(t, dns_config_Patch, reqBody) - response := dns_config.ConfigUpdateACLResponse{ - Result: &updatedAcl, - } + response := openapiclient.ConfigUpdateACLResponse{} body, err := json.Marshal(response) require.NoError(t, err) return &http.Response{ - StatusCode: 200, + StatusCode: http.StatusOK, Body: io.NopCloser(bytes.NewReader(body)), Header: map[string][]string{"Content-Type": {"application/json"}}, } }) - - configuration := internal.NewConfiguration() - configuration.HTTPClient = testClient - - aclAPI := dns_config.NewAPIClient(configuration) - ctx := context.Background() - - updateRequest := aclAPI.AclAPI.AclUpdate(ctx, *dummyAcl.Id).Body(updatedAcl) - resp, httpRes, err := updateRequest.Execute() + apiClient := openapiclient.NewAPIClient(configuration) + resp, httpRes, err := apiClient.AclAPI.AclUpdate(context.Background(), *dns_config_Patch.Id).Body(dns_config_Patch).Execute() require.Nil(t, err) require.NotNil(t, resp) - require.Equal(t, 200, httpRes.StatusCode) - require.Equal(t, updatedAcl, *resp.Result) + require.Equal(t, http.StatusOK, httpRes.StatusCode) }) t.Run("Test AclAPIService AclDelete", func(t *testing.T) { - - //t.Skip("skip test") // remove to run test - - dummyAcl := dns_config.ConfigACL{ - Comment: openapiclient.PtrString("This is a dummy ACL for testing."), - Id: openapiclient.PtrString("dummyAclId"), - Name: "dummyAclName", - } - - testClient := NewTestClient(func(req *http.Request) *http.Response { - require.Equal(t, "DELETE", req.Method) - require.Equal(t, "/api/ddi/v1/dns/acl/"+*dummyAcl.Id, req.URL.Path) + configuration := internal.NewConfiguration() + configuration.HTTPClient = internal.NewTestClient(func(req *http.Request) *http.Response { + require.Equal(t, http.MethodDelete, req.Method) + require.Equal(t, "/api/ddi/v1/dns/acl/"+*dns_config_Post.Id, req.URL.Path) return &http.Response{ - StatusCode: 200, + StatusCode: http.StatusOK, Body: io.NopCloser(bytes.NewReader([]byte{})), Header: map[string][]string{"Content-Type": {"application/json"}}, } }) - - configuration := internal.NewConfiguration() - configuration.HTTPClient = testClient - - aclAPI := dns_config.NewAPIClient(configuration) - ctx := context.Background() - - httpRes, err := aclAPI.AclAPI.AclDelete(ctx, *dummyAcl.Id).Execute() + apiClient := openapiclient.NewAPIClient(configuration) + httpRes, err := apiClient.AclAPI.AclDelete(context.Background(), *dns_config_Post.Id).Execute() require.Nil(t, err) - require.Equal(t, 200, httpRes.StatusCode) + require.Equal(t, http.StatusOK, httpRes.StatusCode) }) } diff --git a/dns_config/test/api_auth_nsg_test.go b/dns_config/test/api_auth_nsg_test.go index 97027a0..621306d 100644 --- a/dns_config/test/api_auth_nsg_test.go +++ b/dns_config/test/api_auth_nsg_test.go @@ -1,7 +1,7 @@ /* DNS Configuration API -Testing AclAPIService +Testing AuthNsgAPIService */ @@ -13,225 +13,149 @@ import ( "bytes" "context" "encoding/json" - "github.com/infobloxopen/bloxone-go-client/dns_config" - "github.com/infobloxopen/bloxone-go-client/internal" - openapiclient "github.com/infobloxopen/bloxone-go-client/keys" - "github.com/stretchr/testify/require" "io" "net/http" "testing" -) -func Test_dns_config_AuthNsgAPIService(t *testing.T) { + "github.com/stretchr/testify/require" - t.Run("Test AuthNesAPIService AuthNesCreate", func(t *testing.T) { + openapiclient "github.com/infobloxopen/bloxone-go-client/dns_config" + "github.com/infobloxopen/bloxone-go-client/internal" +) - //t.Skip("skip test") // remove to run test +var ConfigAuthNSG_Post = openapiclient.ConfigAuthNSG{ + Comment: openapiclient.PtrString("This is a dummy AuthNes for testing."), + Id: openapiclient.PtrString("dummyAuthNesId"), + Name: "dummyAuthNesName", +} +var ConfigAuthNSG_Patch = openapiclient.ConfigAuthNSG{ + Comment: openapiclient.PtrString("This is an updated dummy AuthNsg for testing."), + Id: ConfigAuthNSG_Post.Id, + Name: "updatedDummyAuthNsgName", +} - dummyAuthNsg := dns_config.ConfigAuthNSG{ - Comment: openapiclient.PtrString("This is a dummy AuthNes for testing."), - Id: openapiclient.PtrString("dummyAuthNesId"), - Name: "dummyAuthNesName", - } +func Test_dns_config_AuthNsgAPIService(t *testing.T) { - testClient := NewTestClient(func(req *http.Request) *http.Response { - require.Equal(t, "POST", req.Method) + t.Run("Test AuthNsgAPIService AuthNsgCreate", func(t *testing.T) { + configuration := internal.NewConfiguration() + configuration.HTTPClient = internal.NewTestClient(func(req *http.Request) *http.Response { + require.Equal(t, http.MethodPost, req.Method) require.Equal(t, "/api/ddi/v1/dns/auth_nsg", req.URL.Path) + require.Equal(t, "application/json", req.Header.Get("Content-Type")) - response := dns_config.ConfigCreateAuthNSGResponse{ - Result: &dummyAuthNsg, - } + var reqBody openapiclient.ConfigAuthNSG + require.NoError(t, json.NewDecoder(req.Body).Decode(&reqBody)) + require.Equal(t, ConfigAuthNSG_Post, reqBody) + + response := openapiclient.ConfigCreateAuthNSGResponse{} body, err := json.Marshal(response) require.NoError(t, err) return &http.Response{ - StatusCode: 200, + StatusCode: http.StatusOK, Body: io.NopCloser(bytes.NewReader(body)), Header: map[string][]string{"Content-Type": {"application/json"}}, } }) - - configuration := internal.NewConfiguration() - configuration.HTTPClient = testClient - - authNesAPI := dns_config.NewAPIClient(configuration) - ctx := context.Background() - - createRequest := authNesAPI.AuthNsgAPI.AuthNsgCreate(ctx).Body(dummyAuthNsg) - resp, httpRes, err := createRequest.Execute() + apiClient := openapiclient.NewAPIClient(configuration) + resp, httpRes, err := apiClient.AuthNsgAPI.AuthNsgCreate(context.Background()).Body(ConfigAuthNSG_Post).Execute() require.Nil(t, err) require.NotNil(t, resp) - require.Equal(t, 200, httpRes.StatusCode) - require.Equal(t, dummyAuthNsg, *resp.Result) + require.Equal(t, http.StatusOK, httpRes.StatusCode) }) - t.Run("Test AuthNsgAPIService AuthNsgRead", func(t *testing.T) { - - //t.Skip("skip test") // remove to run test - - dummyAuthNsg := dns_config.ConfigAuthNSG{ - Comment: openapiclient.PtrString("This is a dummy AuthNsg for testing."), - Id: openapiclient.PtrString("dummyAuthNsgId"), - Name: "dummyAuthNsgName", - } - - testClient := NewTestClient(func(req *http.Request) *http.Response { - require.Equal(t, "GET", req.Method) - require.Equal(t, "/api/ddi/v1/dns/auth_nsg/"+*dummyAuthNsg.Id, req.URL.Path) + t.Run("Test AuthNsgAPIService AuthNsgList", func(t *testing.T) { + configuration := internal.NewConfiguration() + configuration.HTTPClient = internal.NewTestClient(func(req *http.Request) *http.Response { + require.Equal(t, http.MethodGet, req.Method) + require.Equal(t, "/api/ddi/v1/dns/auth_nsg", req.URL.Path) + require.Equal(t, "application/json", req.Header.Get("Accept")) - response := dns_config.ConfigReadAuthNSGResponse{ - Result: &dummyAuthNsg, - } + response := openapiclient.ConfigListAuthNSGResponse{} body, err := json.Marshal(response) require.NoError(t, err) return &http.Response{ - StatusCode: 200, + StatusCode: http.StatusOK, Body: io.NopCloser(bytes.NewReader(body)), Header: map[string][]string{"Content-Type": {"application/json"}}, } }) - - configuration := internal.NewConfiguration() - configuration.HTTPClient = testClient - - authNsgAPI := dns_config.NewAPIClient(configuration) - ctx := context.Background() - - readRequest := authNsgAPI.AuthNsgAPI.AuthNsgRead(ctx, *dummyAuthNsg.Id) - resp, httpRes, err := readRequest.Execute() + apiClient := openapiclient.NewAPIClient(configuration) + resp, httpRes, err := apiClient.AuthNsgAPI.AuthNsgList(context.Background()).Execute() require.Nil(t, err) require.NotNil(t, resp) - require.Equal(t, 200, httpRes.StatusCode) - require.Equal(t, dummyAuthNsg, *resp.Result) + require.Equal(t, http.StatusOK, httpRes.StatusCode) }) - t.Run("Test AuthNsgAPIService AuthNsgUpdate", func(t *testing.T) { - - //t.Skip("skip test") // remove to run test - - dummyAuthNsg := dns_config.ConfigAuthNSG{ - Comment: openapiclient.PtrString("This is a dummy AuthNsg for testing."), - Id: openapiclient.PtrString("dummyAuthNsgId"), - Name: "dummyAuthNsgName", - } - - updatedAuthNsg := dns_config.ConfigAuthNSG{ - Comment: openapiclient.PtrString("This is an updated dummy AuthNsg for testing."), - Id: dummyAuthNsg.Id, - Name: "updatedDummyAuthNsgName", - } - - testClient := NewTestClient(func(req *http.Request) *http.Response { - require.Equal(t, "PATCH", req.Method) - require.Equal(t, "/api/ddi/v1/dns/auth_nsg/"+*dummyAuthNsg.Id, req.URL.Path) + t.Run("Test AuthNsgAPIService AuthNsgRead", func(t *testing.T) { + configuration := internal.NewConfiguration() + configuration.HTTPClient = internal.NewTestClient(func(req *http.Request) *http.Response { + require.Equal(t, http.MethodGet, req.Method) + require.Equal(t, "/api/ddi/v1/dns/auth_nsg/"+*ConfigAuthNSG_Post.Id, req.URL.Path) + require.Equal(t, "application/json", req.Header.Get("Accept")) - response := dns_config.ConfigUpdateAuthNSGResponse{ - Result: &updatedAuthNsg, - } + response := openapiclient.ConfigReadAuthNSGResponse{} body, err := json.Marshal(response) require.NoError(t, err) return &http.Response{ - StatusCode: 200, + StatusCode: http.StatusOK, Body: io.NopCloser(bytes.NewReader(body)), Header: map[string][]string{"Content-Type": {"application/json"}}, } }) - - configuration := internal.NewConfiguration() - configuration.HTTPClient = testClient - - authNsgAPI := dns_config.NewAPIClient(configuration) - ctx := context.Background() - - updateRequest := authNsgAPI.AuthNsgAPI.AuthNsgUpdate(ctx, *dummyAuthNsg.Id).Body(updatedAuthNsg) - resp, httpRes, err := updateRequest.Execute() + apiClient := openapiclient.NewAPIClient(configuration) + resp, httpRes, err := apiClient.AuthNsgAPI.AuthNsgRead(context.Background(), *ConfigAuthNSG_Post.Id).Execute() require.Nil(t, err) require.NotNil(t, resp) - require.Equal(t, 200, httpRes.StatusCode) - require.Equal(t, updatedAuthNsg, *resp.Result) + require.Equal(t, http.StatusOK, httpRes.StatusCode) }) - t.Run("Test AuthNsgAPIService AuthNsgList", func(t *testing.T) { + t.Run("Test AuthNsgAPIService AuthNsgUpdate", func(t *testing.T) { + configuration := internal.NewConfiguration() + configuration.HTTPClient = internal.NewTestClient(func(req *http.Request) *http.Response { + require.Equal(t, http.MethodPatch, req.Method) + require.Equal(t, "/api/ddi/v1/dns/auth_nsg/"+*ConfigAuthNSG_Post.Id, req.URL.Path) + require.Equal(t, "application/json", req.Header.Get("Content-Type")) - //t.Skip("skip test") // remove to run test - - dummyAuthNsgList := []dns_config.ConfigAuthNSG{ - { - Comment: openapiclient.PtrString("This is a dummy AuthNsg for testing."), - Id: openapiclient.PtrString("dummyAuthNsgId1"), - Name: "dummyAuthNsgName1", - }, - { - Comment: openapiclient.PtrString("This is another dummy AuthNsg for testing."), - Id: openapiclient.PtrString("dummyAuthNsgId2"), - Name: "dummyAuthNsgName2", - }, - } - - testClient := NewTestClient(func(req *http.Request) *http.Response { - require.Equal(t, "GET", req.Method) - require.Equal(t, "/api/ddi/v1/dns/auth_nsg", req.URL.Path) + var reqBody openapiclient.ConfigAuthNSG + require.NoError(t, json.NewDecoder(req.Body).Decode(&reqBody)) + require.Equal(t, ConfigAuthNSG_Patch, reqBody) - response := dns_config.ConfigListAuthNSGResponse{ - Results: dummyAuthNsgList, - } + response := openapiclient.ConfigUpdateAuthNSGResponse{} body, err := json.Marshal(response) require.NoError(t, err) return &http.Response{ - StatusCode: 200, + StatusCode: http.StatusOK, Body: io.NopCloser(bytes.NewReader(body)), Header: map[string][]string{"Content-Type": {"application/json"}}, } }) - - configuration := internal.NewConfiguration() - configuration.HTTPClient = testClient - - authNsgAPI := dns_config.NewAPIClient(configuration) - ctx := context.Background() - - listRequest := authNsgAPI.AuthNsgAPI.AuthNsgList(ctx) - resp, httpRes, err := listRequest.Execute() + apiClient := openapiclient.NewAPIClient(configuration) + resp, httpRes, err := apiClient.AuthNsgAPI.AuthNsgUpdate(context.Background(), *ConfigAuthNSG_Patch.Id).Body(ConfigAuthNSG_Patch).Execute() require.Nil(t, err) require.NotNil(t, resp) - require.Equal(t, 200, httpRes.StatusCode) - require.Equal(t, dummyAuthNsgList, resp.Results) + require.Equal(t, http.StatusOK, httpRes.StatusCode) }) t.Run("Test AuthNsgAPIService AuthNsgDelete", func(t *testing.T) { - - //t.Skip("skip test") // remove to run test - - dummyAuthNsg := dns_config.ConfigAuthNSG{ - Comment: openapiclient.PtrString("This is a dummy AuthNsg for testing."), - Id: openapiclient.PtrString("dummyAuthNsgId"), - Name: "dummyAuthNsgName", - } - - testClient := NewTestClient(func(req *http.Request) *http.Response { - require.Equal(t, "DELETE", req.Method) - require.Equal(t, "/api/ddi/v1/dns/auth_nsg/"+*dummyAuthNsg.Id, req.URL.Path) + configuration := internal.NewConfiguration() + configuration.HTTPClient = internal.NewTestClient(func(req *http.Request) *http.Response { + require.Equal(t, http.MethodDelete, req.Method) + require.Equal(t, "/api/ddi/v1/dns/auth_nsg/"+*ConfigAuthNSG_Post.Id, req.URL.Path) return &http.Response{ - StatusCode: 200, + StatusCode: http.StatusOK, Body: io.NopCloser(bytes.NewReader([]byte{})), Header: map[string][]string{"Content-Type": {"application/json"}}, } }) - - configuration := internal.NewConfiguration() - configuration.HTTPClient = testClient - - authNsgAPI := dns_config.NewAPIClient(configuration) - ctx := context.Background() - - deleteRequest := authNsgAPI.AuthNsgAPI.AuthNsgDelete(ctx, *dummyAuthNsg.Id) - httpRes, err := deleteRequest.Execute() + apiClient := openapiclient.NewAPIClient(configuration) + httpRes, err := apiClient.AuthNsgAPI.AuthNsgDelete(context.Background(), *ConfigAuthNSG_Post.Id).Execute() require.Nil(t, err) - require.Equal(t, 200, httpRes.StatusCode) + require.Equal(t, http.StatusOK, httpRes.StatusCode) }) } diff --git a/dns_config/test/api_auth_zone_test.go b/dns_config/test/api_auth_zone_test.go index a03bc4c..5c83e21 100644 --- a/dns_config/test/api_auth_zone_test.go +++ b/dns_config/test/api_auth_zone_test.go @@ -1,7 +1,7 @@ /* DNS Configuration API -Testing AclAPIService +Testing AuthZoneAPIService */ @@ -13,258 +13,179 @@ import ( "bytes" "context" "encoding/json" - "github.com/infobloxopen/bloxone-go-client/dns_config" - "github.com/infobloxopen/bloxone-go-client/internal" - openapiclient "github.com/infobloxopen/bloxone-go-client/keys" - "github.com/stretchr/testify/require" "io" "net/http" "testing" -) -func Test_dns_config_AuthZoneAPIService(t *testing.T) { + "github.com/stretchr/testify/require" - t.Run("Test AuthZoneAPIService AuthZoneCreate", func(t *testing.T) { + openapiclient "github.com/infobloxopen/bloxone-go-client/dns_config" + "github.com/infobloxopen/bloxone-go-client/internal" +) + +var ConfigCopyAuthZone_Post = openapiclient.ConfigCopyAuthZone{ + Comment: openapiclient.PtrString("This is a copyping AuthZone for testing."), + Id: openapiclient.PtrString("dummyAuthZoneId"), +} +var ConfigAuthZone_Post = openapiclient.ConfigAuthZone{ + Comment: openapiclient.PtrString("This is a dummy AuthZone for testing."), + Id: openapiclient.PtrString("dummyAuthZoneId"), +} +var ConfigAuthZone_Patch = openapiclient.ConfigAuthZone{ + Comment: openapiclient.PtrString("This is an updated dummy AuthZone for testing."), + Id: ConfigAuthZone_Post.Id, +} - //t.Skip("skip test") // remove to run test +func Test_dns_config_AuthZoneAPIService(t *testing.T) { - dummyAuthZone := dns_config.ConfigAuthZone{ - Comment: openapiclient.PtrString("This is a dummy AuthZone for testing."), - Id: openapiclient.PtrString("dummyAuthZoneId"), - } + t.Run("Test AuthZoneAPIService AuthZoneCopy", func(t *testing.T) { + configuration := internal.NewConfiguration() + configuration.HTTPClient = internal.NewTestClient(func(req *http.Request) *http.Response { + require.Equal(t, http.MethodPost, req.Method) + require.Equal(t, "/api/ddi/v1/dns/auth_zone/copy", req.URL.Path) + require.Equal(t, "application/json", req.Header.Get("Content-Type")) - testClient := NewTestClient(func(req *http.Request) *http.Response { - require.Equal(t, "POST", req.Method) - require.Equal(t, "/api/ddi/v1/dns/auth_zone", req.URL.Path) + var reqBody openapiclient.ConfigCopyAuthZone + require.NoError(t, json.NewDecoder(req.Body).Decode(&reqBody)) + require.Equal(t, ConfigCopyAuthZone_Post, reqBody) - response := dns_config.ConfigCreateAuthZoneResponse{ - Result: &dummyAuthZone, - } + response := openapiclient.ConfigCopyAuthZoneResponse{} body, err := json.Marshal(response) require.NoError(t, err) return &http.Response{ - StatusCode: 201, + StatusCode: http.StatusOK, Body: io.NopCloser(bytes.NewReader(body)), Header: map[string][]string{"Content-Type": {"application/json"}}, } }) - - configuration := internal.NewConfiguration() - configuration.HTTPClient = testClient - - authZoneAPI := dns_config.NewAPIClient(configuration) - ctx := context.Background() - - createRequest := authZoneAPI.AuthZoneAPI.AuthZoneCreate(ctx).Body(dummyAuthZone) - resp, httpRes, err := createRequest.Execute() + apiClient := openapiclient.NewAPIClient(configuration) + resp, httpRes, err := apiClient.AuthZoneAPI.AuthZoneCopy(context.Background()).Body(ConfigCopyAuthZone_Post).Execute() require.Nil(t, err) require.NotNil(t, resp) - require.Equal(t, 201, httpRes.StatusCode) - require.Equal(t, dummyAuthZone, *resp.Result) + require.Equal(t, http.StatusOK, httpRes.StatusCode) }) - t.Run("Test AuthZoneAPIService AuthZoneCopy", func(t *testing.T) { - - //t.Skip("skip test") // remove to run test - - dummyAuthZone := dns_config.ConfigCopyAuthZone{ - Comment: openapiclient.PtrString("This is a dummy AuthZone for testing."), - Id: openapiclient.PtrString("dummyAuthZoneId"), - } - - dummyConfigCopyResponse := dns_config.ConfigCopyResponse{ - Description: openapiclient.PtrString("This is a copy of the dummy AuthZone for testing."), - Id: openapiclient.PtrString("dummyCopyId"), - JobId: openapiclient.PtrString("dummyJobId"), - } + t.Run("Test AuthZoneAPIService AuthZoneCreate", func(t *testing.T) { + configuration := internal.NewConfiguration() + configuration.HTTPClient = internal.NewTestClient(func(req *http.Request) *http.Response { + require.Equal(t, http.MethodPost, req.Method) + require.Equal(t, "/api/ddi/v1/dns/auth_zone", req.URL.Path) + require.Equal(t, "application/json", req.Header.Get("Content-Type")) - testClient := NewTestClient(func(req *http.Request) *http.Response { - require.Equal(t, "POST", req.Method) - require.Equal(t, "/api/ddi/v1/dns/auth_zone/copy", req.URL.Path) - //require.Equal(t, "/api/ddi/v1/dns/auth_zone/copy", req.URL.Path) + var reqBody openapiclient.ConfigAuthZone + require.NoError(t, json.NewDecoder(req.Body).Decode(&reqBody)) + require.Equal(t, ConfigAuthZone_Post, reqBody) - response := dns_config.ConfigCopyAuthZoneResponse{ - Result: &dummyConfigCopyResponse, - } + response := openapiclient.ConfigCreateAuthZoneResponse{} body, err := json.Marshal(response) require.NoError(t, err) return &http.Response{ - StatusCode: 201, + StatusCode: http.StatusOK, Body: io.NopCloser(bytes.NewReader(body)), Header: map[string][]string{"Content-Type": {"application/json"}}, } }) - - configuration := internal.NewConfiguration() - configuration.HTTPClient = testClient - - authZoneAPI := dns_config.NewAPIClient(configuration) - ctx := context.Background() - - copyRequest := authZoneAPI.AuthZoneAPI.AuthZoneCopy(ctx).Body(dummyAuthZone) - resp, httpRes, err := copyRequest.Execute() + apiClient := openapiclient.NewAPIClient(configuration) + resp, httpRes, err := apiClient.AuthZoneAPI.AuthZoneCreate(context.Background()).Body(ConfigAuthZone_Post).Execute() require.Nil(t, err) require.NotNil(t, resp) - require.Equal(t, 201, httpRes.StatusCode) - require.Equal(t, dummyAuthZone, *resp.Result) + require.Equal(t, http.StatusOK, httpRes.StatusCode) }) - t.Run("Test AuthZoneAPIService AuthZoneRead", func(t *testing.T) { - - //t.Skip("skip test") // remove to run test - - dummyAuthZone := dns_config.ConfigAuthZone{ - Comment: openapiclient.PtrString("This is a dummy AuthZone for testing."), - Id: openapiclient.PtrString("dummyAuthZoneId"), - } - - testClient := NewTestClient(func(req *http.Request) *http.Response { - require.Equal(t, "GET", req.Method) - require.Equal(t, "/api/ddi/v1/dns/auth_zone/"+*dummyAuthZone.Id, req.URL.Path) - - response := dns_config.ConfigReadAuthZoneResponse{ - Result: &dummyAuthZone, - } - body, err := json.Marshal(response) - require.NoError(t, err) + t.Run("Test AuthZoneAPIService AuthZoneDelete", func(t *testing.T) { + configuration := internal.NewConfiguration() + configuration.HTTPClient = internal.NewTestClient(func(req *http.Request) *http.Response { + require.Equal(t, http.MethodDelete, req.Method) + require.Equal(t, "/api/ddi/v1/dns/auth_zone/"+*ConfigAuthZone_Post.Id, req.URL.Path) return &http.Response{ - StatusCode: 200, - Body: io.NopCloser(bytes.NewReader(body)), + StatusCode: http.StatusOK, + Body: io.NopCloser(bytes.NewReader([]byte{})), Header: map[string][]string{"Content-Type": {"application/json"}}, } }) - - configuration := internal.NewConfiguration() - configuration.HTTPClient = testClient - - authZoneAPI := dns_config.NewAPIClient(configuration) - ctx := context.Background() - - readRequest := authZoneAPI.AuthZoneAPI.AuthZoneRead(ctx, *dummyAuthZone.Id) - resp, httpRes, err := readRequest.Execute() + apiClient := openapiclient.NewAPIClient(configuration) + httpRes, err := apiClient.AuthZoneAPI.AuthZoneDelete(context.Background(), *ConfigAuthZone_Post.Id).Execute() require.Nil(t, err) - require.NotNil(t, resp) - require.Equal(t, 200, httpRes.StatusCode) - require.Equal(t, dummyAuthZone, *resp.Result) + require.Equal(t, http.StatusOK, httpRes.StatusCode) }) t.Run("Test AuthZoneAPIService AuthZoneList", func(t *testing.T) { - - //t.Skip("skip test") // remove to run test - - dummyAuthZone := dns_config.ConfigAuthZone{ - Comment: openapiclient.PtrString("This is a dummy AuthZone for testing."), - Id: openapiclient.PtrString("dummyAuthZoneId"), - } - - testClient := NewTestClient(func(req *http.Request) *http.Response { - require.Equal(t, "GET", req.Method) + configuration := internal.NewConfiguration() + configuration.HTTPClient = internal.NewTestClient(func(req *http.Request) *http.Response { + require.Equal(t, http.MethodGet, req.Method) require.Equal(t, "/api/ddi/v1/dns/auth_zone", req.URL.Path) + require.Equal(t, "application/json", req.Header.Get("Accept")) - response := dns_config.ConfigListAuthZoneResponse{ - Results: []dns_config.ConfigAuthZone{dummyAuthZone}, - } + response := openapiclient.ConfigListAuthZoneResponse{} body, err := json.Marshal(response) require.NoError(t, err) return &http.Response{ - StatusCode: 200, + StatusCode: http.StatusOK, Body: io.NopCloser(bytes.NewReader(body)), Header: map[string][]string{"Content-Type": {"application/json"}}, } }) - - configuration := internal.NewConfiguration() - configuration.HTTPClient = testClient - - authZoneAPI := dns_config.NewAPIClient(configuration) - ctx := context.Background() - - listRequest := authZoneAPI.AuthZoneAPI.AuthZoneList(ctx) - resp, httpRes, err := listRequest.Execute() + apiClient := openapiclient.NewAPIClient(configuration) + resp, httpRes, err := apiClient.AuthZoneAPI.AuthZoneList(context.Background()).Execute() require.Nil(t, err) require.NotNil(t, resp) - require.Equal(t, 200, httpRes.StatusCode) - require.Equal(t, dummyAuthZone, resp.Results[0]) + require.Equal(t, http.StatusOK, httpRes.StatusCode) }) - t.Run("Test AuthZoneAPIService AuthZoneUpdate", func(t *testing.T) { - - //t.Skip("skip test") // remove to run test - - dummyAuthZone := dns_config.ConfigAuthZone{ - Comment: openapiclient.PtrString("This is a dummy AuthZone for testing."), - Id: openapiclient.PtrString("dummyAuthZoneId"), - } - - updatedAuthZone := dns_config.ConfigAuthZone{ - Comment: openapiclient.PtrString("This is an updated dummy AuthZone for testing."), - Id: dummyAuthZone.Id, - } - - testClient := NewTestClient(func(req *http.Request) *http.Response { - require.Equal(t, "PATCH", req.Method) - require.Equal(t, "/api/ddi/v1/dns/auth_zone/"+*dummyAuthZone.Id, req.URL.Path) + t.Run("Test AuthZoneAPIService AuthZoneRead", func(t *testing.T) { + configuration := internal.NewConfiguration() + configuration.HTTPClient = internal.NewTestClient(func(req *http.Request) *http.Response { + require.Equal(t, http.MethodGet, req.Method) + require.Equal(t, "/api/ddi/v1/dns/auth_zone/"+*ConfigAuthZone_Post.Id, req.URL.Path) + require.Equal(t, "application/json", req.Header.Get("Accept")) - response := dns_config.ConfigUpdateAuthZoneResponse{ - Result: &updatedAuthZone, - } + response := openapiclient.ConfigReadAuthZoneResponse{} body, err := json.Marshal(response) require.NoError(t, err) return &http.Response{ - StatusCode: 200, + StatusCode: http.StatusOK, Body: io.NopCloser(bytes.NewReader(body)), Header: map[string][]string{"Content-Type": {"application/json"}}, } }) - - configuration := internal.NewConfiguration() - configuration.HTTPClient = testClient - - authZoneAPI := dns_config.NewAPIClient(configuration) - ctx := context.Background() - - updateRequest := authZoneAPI.AuthZoneAPI.AuthZoneUpdate(ctx, *dummyAuthZone.Id).Body(updatedAuthZone) - resp, httpRes, err := updateRequest.Execute() + apiClient := openapiclient.NewAPIClient(configuration) + resp, httpRes, err := apiClient.AuthZoneAPI.AuthZoneRead(context.Background(), *ConfigAuthZone_Post.Id).Execute() require.Nil(t, err) require.NotNil(t, resp) - require.Equal(t, 200, httpRes.StatusCode) - require.Equal(t, updatedAuthZone, *resp.Result) + require.Equal(t, http.StatusOK, httpRes.StatusCode) }) - t.Run("Test AuthZoneAPIService AuthZoneDelete", func(t *testing.T) { - - //t.Skip("skip test") // remove to run test + t.Run("Test AuthZoneAPIService AuthZoneUpdate", func(t *testing.T) { + configuration := internal.NewConfiguration() + configuration.HTTPClient = internal.NewTestClient(func(req *http.Request) *http.Response { + require.Equal(t, http.MethodPatch, req.Method) + require.Equal(t, "/api/ddi/v1/dns/auth_zone/"+*ConfigAuthZone_Post.Id, req.URL.Path) + require.Equal(t, "application/json", req.Header.Get("Content-Type")) - dummyAuthZone := dns_config.ConfigAuthZone{ - Comment: openapiclient.PtrString("This is a dummy AuthZone for testing."), - Id: openapiclient.PtrString("dummyAuthZoneId"), - } + var reqBody openapiclient.ConfigAuthZone + require.NoError(t, json.NewDecoder(req.Body).Decode(&reqBody)) + require.Equal(t, ConfigAuthZone_Patch, reqBody) - testClient := NewTestClient(func(req *http.Request) *http.Response { - require.Equal(t, "DELETE", req.Method) - require.Equal(t, "/api/ddi/v1/dns/auth_zone/"+*dummyAuthZone.Id, req.URL.Path) + response := openapiclient.ConfigUpdateAuthZoneResponse{} + body, err := json.Marshal(response) + require.NoError(t, err) return &http.Response{ - StatusCode: 200, - Body: io.NopCloser(bytes.NewReader([]byte{})), + StatusCode: http.StatusOK, + Body: io.NopCloser(bytes.NewReader(body)), Header: map[string][]string{"Content-Type": {"application/json"}}, } }) - - configuration := internal.NewConfiguration() - configuration.HTTPClient = testClient - - authZoneAPI := dns_config.NewAPIClient(configuration) - ctx := context.Background() - - httpRes, err := authZoneAPI.AuthZoneAPI.AuthZoneDelete(ctx, *dummyAuthZone.Id).Execute() + apiClient := openapiclient.NewAPIClient(configuration) + resp, httpRes, err := apiClient.AuthZoneAPI.AuthZoneUpdate(context.Background(), *ConfigAuthZone_Patch.Id).Body(ConfigAuthZone_Patch).Execute() require.Nil(t, err) - require.Equal(t, 200, httpRes.StatusCode) + require.NotNil(t, resp) + require.Equal(t, http.StatusOK, httpRes.StatusCode) }) } diff --git a/dns_config/test/api_cache_flush_test.go b/dns_config/test/api_cache_flush_test.go index 7558b84..58a35a0 100644 --- a/dns_config/test/api_cache_flush_test.go +++ b/dns_config/test/api_cache_flush_test.go @@ -1,7 +1,7 @@ /* DNS Configuration API -Testing AclAPIService +Testing CacheFlushAPIService */ @@ -13,53 +13,48 @@ import ( "bytes" "context" "encoding/json" - "github.com/infobloxopen/bloxone-go-client/dns_config" - "github.com/infobloxopen/bloxone-go-client/internal" - openapiclient "github.com/infobloxopen/bloxone-go-client/keys" - "github.com/stretchr/testify/require" "io" "net/http" "testing" + + "github.com/stretchr/testify/require" + + openapiclient "github.com/infobloxopen/bloxone-go-client/dns_config" + "github.com/infobloxopen/bloxone-go-client/internal" ) +var ConfigCacheFlush_Post = openapiclient.ConfigCacheFlush{ + FlushSubdomains: openapiclient.PtrBool(true), + Fqdn: openapiclient.PtrString("dummyFqdn"), + Ophid: openapiclient.PtrString("dummyOphid"), + ServiceId: openapiclient.PtrString("dummyServiceId"), + Ttl: openapiclient.PtrInt64(120), + ViewName: openapiclient.PtrString("dummyViewName"), +} + func Test_dns_config_CacheFlushAPIService(t *testing.T) { t.Run("Test CacheFlushAPIService CacheFlushCreate", func(t *testing.T) { - // Create a dummy CacheFlush object - dummyCacheFlush := dns_config.ConfigCacheFlush{ - FlushSubdomains: openapiclient.PtrBool(true), - Fqdn: openapiclient.PtrString("dummyFqdn"), - Ophid: openapiclient.PtrString("dummyOphid"), - ServiceId: openapiclient.PtrString("dummyServiceId"), - Ttl: openapiclient.PtrInt64(120), - ViewName: openapiclient.PtrString("dummyViewName"), - } - - testClient := NewTestClient(func(req *http.Request) *http.Response { - require.Equal(t, "POST", req.Method) + configuration := internal.NewConfiguration() + configuration.HTTPClient = internal.NewTestClient(func(req *http.Request) *http.Response { + require.Equal(t, http.MethodPost, req.Method) require.Equal(t, "/api/ddi/v1/dns/cache_flush", req.URL.Path) require.Equal(t, "application/json", req.Header.Get("Content-Type")) - var reqBody dns_config.ConfigCacheFlush + var reqBody openapiclient.ConfigCacheFlush require.NoError(t, json.NewDecoder(req.Body).Decode(&reqBody)) - require.Equal(t, dummyCacheFlush, reqBody) + require.Equal(t, ConfigCacheFlush_Post, reqBody) return &http.Response{ - StatusCode: 200, + StatusCode: http.StatusOK, Body: io.NopCloser(bytes.NewReader([]byte{})), Header: map[string][]string{"Content-Type": {"application/json"}}, } }) - - configuration := internal.NewConfiguration() - configuration.HTTPClient = testClient - - cacheFlushAPI := dns_config.NewAPIClient(configuration) - ctx := context.Background() - - _, httpRes, err := cacheFlushAPI.CacheFlushAPI.CacheFlushCreate(ctx).Body(dummyCacheFlush).Execute() + apiClient := openapiclient.NewAPIClient(configuration) + _, httpRes, err := apiClient.CacheFlushAPI.CacheFlushCreate(context.Background()).Body(ConfigCacheFlush_Post).Execute() require.Nil(t, err) - //require.NotNil(t, resp) - require.Equal(t, 200, httpRes.StatusCode) + require.Equal(t, http.StatusOK, httpRes.StatusCode) }) + } diff --git a/dns_config/test/api_convert_domain_name_test.go b/dns_config/test/api_convert_domain_name_test.go index 4d3b7ec..5df948e 100644 --- a/dns_config/test/api_convert_domain_name_test.go +++ b/dns_config/test/api_convert_domain_name_test.go @@ -1,7 +1,7 @@ /* DNS Configuration API -Testing AclAPIService +Testing ConvertDomainNameAPIService */ @@ -13,51 +13,42 @@ import ( "bytes" "context" "encoding/json" - "github.com/infobloxopen/bloxone-go-client/dns_config" - "github.com/infobloxopen/bloxone-go-client/internal" - openapiclient "github.com/infobloxopen/bloxone-go-client/keys" - "github.com/stretchr/testify/require" "io" "net/http" "testing" + + "github.com/stretchr/testify/require" + + openapiclient "github.com/infobloxopen/bloxone-go-client/dns_config" + "github.com/infobloxopen/bloxone-go-client/internal" ) +var domainName = "example.com" + func Test_dns_config_ConvertDomainNameAPIService(t *testing.T) { t.Run("Test ConvertDomainNameAPIService ConvertDomainNameConvert", func(t *testing.T) { - // Create a dummy domain name - dummyDomainName := "example.com" - - testClient := NewTestClient(func(req *http.Request) *http.Response { - require.Equal(t, "GET", req.Method) - require.Equal(t, "/api/ddi/v1/dns/convert_domain_name/"+dummyDomainName, req.URL.Path) + configuration := internal.NewConfiguration() + configuration.HTTPClient = internal.NewTestClient(func(req *http.Request) *http.Response { + require.Equal(t, http.MethodGet, req.Method) + require.Equal(t, "/api/ddi/v1/dns/convert_domain_name/"+domainName, req.URL.Path) require.Equal(t, "application/json", req.Header.Get("Accept")) - response := dns_config.ConfigConvertDomainName{ - Idn: openapiclient.PtrString("example.com"), - Punycode: openapiclient.PtrString("xn--example-2ya.com"), - } + response := openapiclient.ConfigConvertDomainNameResponse{} body, err := json.Marshal(response) require.NoError(t, err) return &http.Response{ - StatusCode: 200, + StatusCode: http.StatusOK, Body: io.NopCloser(bytes.NewReader(body)), Header: map[string][]string{"Content-Type": {"application/json"}}, } }) - - configuration := internal.NewConfiguration() - configuration.HTTPClient = testClient - - convertDomain := dns_config.NewAPIClient(configuration) - ctx := context.Background() - - resp, httpRes, err := convertDomain.ConvertDomainNameAPI.ConvertDomainNameConvert(ctx, dummyDomainName).Execute() + apiClient := openapiclient.NewAPIClient(configuration) + resp, httpRes, err := apiClient.ConvertDomainNameAPI.ConvertDomainNameConvert(context.Background(), domainName).Execute() require.Nil(t, err) require.NotNil(t, resp) - require.Nil(t, resp.Result) - require.Equal(t, 200, httpRes.StatusCode) + require.Equal(t, http.StatusOK, httpRes.StatusCode) }) } diff --git a/dns_config/test/api_convert_rname_test.go b/dns_config/test/api_convert_rname_test.go index 7f166c6..630f4a2 100644 --- a/dns_config/test/api_convert_rname_test.go +++ b/dns_config/test/api_convert_rname_test.go @@ -1,7 +1,7 @@ /* DNS Configuration API -Testing AclAPIService +Testing ConvertRnameAPIService */ @@ -13,58 +13,42 @@ import ( "bytes" "context" "encoding/json" - "github.com/infobloxopen/bloxone-go-client/dns_config" - "github.com/infobloxopen/bloxone-go-client/internal" - openapiclient "github.com/infobloxopen/bloxone-go-client/keys" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" "io" "net/http" "testing" + + "github.com/stretchr/testify/require" + + openapiclient "github.com/infobloxopen/bloxone-go-client/dns_config" + "github.com/infobloxopen/bloxone-go-client/internal" ) +var emailAddress = "test@example.com" + func Test_dns_config_ConvertRnameAPIService(t *testing.T) { t.Run("Test ConvertRnameAPIService ConvertRnameConvertRName", func(t *testing.T) { - - // Define a dummy email address - emailAddress := "test@example.com" - - // Create a mock HTTP client - testClient := NewTestClient(func(req *http.Request) *http.Response { - // Check the request parameters - require.Equal(t, "GET", req.Method) + configuration := internal.NewConfiguration() + configuration.HTTPClient = internal.NewTestClient(func(req *http.Request) *http.Response { + require.Equal(t, http.MethodGet, req.Method) require.Equal(t, "/api/ddi/v1/dns/convert_rname/"+emailAddress, req.URL.Path) require.Equal(t, "application/json", req.Header.Get("Accept")) - // Create a dummy response - response := dns_config.ConfigConvertRNameResponse{ - Rname: openapiclient.PtrString("test.example.com."), - } + response := openapiclient.ConfigConvertRNameResponse{} body, err := json.Marshal(response) require.NoError(t, err) - // Return the dummy response return &http.Response{ - StatusCode: 200, + StatusCode: http.StatusOK, Body: io.NopCloser(bytes.NewReader(body)), Header: map[string][]string{"Content-Type": {"application/json"}}, } }) - - configuration := internal.NewConfiguration() - configuration.HTTPClient = testClient - - convertRename := dns_config.NewAPIClient(configuration) - ctx := context.Background() - - resp, httpRes, err := convertRename.ConvertRnameAPI.ConvertRnameConvertRName(ctx, emailAddress).Execute() - + apiClient := openapiclient.NewAPIClient(configuration) + resp, httpRes, err := apiClient.ConvertRnameAPI.ConvertRnameConvertRName(context.Background(), emailAddress).Execute() require.Nil(t, err) require.NotNil(t, resp) - assert.Equal(t, 200, httpRes.StatusCode) - assert.Equal(t, "test.example.com.", *resp.Rname) - + require.Equal(t, http.StatusOK, httpRes.StatusCode) }) } diff --git a/dns_config/test/api_delegation_test.go b/dns_config/test/api_delegation_test.go index 9833d9f..13d19bd 100644 --- a/dns_config/test/api_delegation_test.go +++ b/dns_config/test/api_delegation_test.go @@ -7,87 +7,167 @@ Testing DelegationAPIService // Code generated by OpenAPI Generator (https://openapi-generator.tech); -package dns_config +package dns_config_test import ( + "bytes" "context" + "encoding/json" + "io" + "net/http" "testing" - "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" openapiclient "github.com/infobloxopen/bloxone-go-client/dns_config" "github.com/infobloxopen/bloxone-go-client/internal" ) -func Test_dns_config_DelegationAPIService(t *testing.T) { +var ConfigDelegation_Post = openapiclient.ConfigDelegation{ + Id: openapiclient.PtrString("ConfigDelegationPost"), + Comment: nil, + DelegationServers: nil, + Disabled: nil, + Fqdn: nil, + Parent: nil, + ProtocolFqdn: nil, + Tags: nil, + View: nil, +} +var ConfigDelegation_Patch = openapiclient.ConfigDelegation{ + Id: openapiclient.PtrString("ConfigDelegationPatch"), + Comment: nil, + DelegationServers: nil, + Disabled: nil, + Fqdn: nil, + Parent: nil, + ProtocolFqdn: nil, + Tags: nil, + View: nil, +} - configuration := internal.NewConfiguration() - apiClient := openapiclient.NewAPIClient(configuration) +func Test_dns_config_DelegationAPIService(t *testing.T) { t.Run("Test DelegationAPIService DelegationCreate", func(t *testing.T) { - - t.Skip("skip test") // remove to run test - - resp, httpRes, err := apiClient.DelegationAPI.DelegationCreate(context.Background()).Execute() - + configuration := internal.NewConfiguration() + configuration.HTTPClient = internal.NewTestClient(func(req *http.Request) *http.Response { + require.Equal(t, http.MethodPost, req.Method) + require.Equal(t, "/api/ddi/v1/dns/delegation", req.URL.Path) + require.Equal(t, "application/json", req.Header.Get("Content-Type")) + + var reqBody openapiclient.ConfigDelegation + require.NoError(t, json.NewDecoder(req.Body).Decode(&reqBody)) + require.Equal(t, ConfigDelegation_Post, reqBody) + + response := openapiclient.ConfigCreateDelegationResponse{} + body, err := json.Marshal(response) + require.NoError(t, err) + + return &http.Response{ + StatusCode: http.StatusOK, + Body: io.NopCloser(bytes.NewReader(body)), + Header: map[string][]string{"Content-Type": {"application/json"}}, + } + }) + apiClient := openapiclient.NewAPIClient(configuration) + resp, httpRes, err := apiClient.DelegationAPI.DelegationCreate(context.Background()).Body(ConfigDelegation_Post).Execute() require.Nil(t, err) require.NotNil(t, resp) - assert.Equal(t, 200, httpRes.StatusCode) - - }) - - t.Run("Test DelegationAPIService DelegationDelete", func(t *testing.T) { - - t.Skip("skip test") // remove to run test - - var id string - - httpRes, err := apiClient.DelegationAPI.DelegationDelete(context.Background(), id).Execute() - - require.Nil(t, err) - assert.Equal(t, 200, httpRes.StatusCode) - + require.Equal(t, http.StatusOK, httpRes.StatusCode) }) t.Run("Test DelegationAPIService DelegationList", func(t *testing.T) { - - t.Skip("skip test") // remove to run test - + configuration := internal.NewConfiguration() + configuration.HTTPClient = internal.NewTestClient(func(req *http.Request) *http.Response { + require.Equal(t, http.MethodGet, req.Method) + require.Equal(t, "/api/ddi/v1/dns/delegation", req.URL.Path) + require.Equal(t, "application/json", req.Header.Get("Accept")) + + response := openapiclient.ConfigListDelegationResponse{} + body, err := json.Marshal(response) + require.NoError(t, err) + + return &http.Response{ + StatusCode: http.StatusOK, + Body: io.NopCloser(bytes.NewReader(body)), + Header: map[string][]string{"Content-Type": {"application/json"}}, + } + }) + apiClient := openapiclient.NewAPIClient(configuration) resp, httpRes, err := apiClient.DelegationAPI.DelegationList(context.Background()).Execute() - require.Nil(t, err) require.NotNil(t, resp) - assert.Equal(t, 200, httpRes.StatusCode) - + require.Equal(t, http.StatusOK, httpRes.StatusCode) }) t.Run("Test DelegationAPIService DelegationRead", func(t *testing.T) { - - t.Skip("skip test") // remove to run test - - var id string - - resp, httpRes, err := apiClient.DelegationAPI.DelegationRead(context.Background(), id).Execute() - + configuration := internal.NewConfiguration() + configuration.HTTPClient = internal.NewTestClient(func(req *http.Request) *http.Response { + require.Equal(t, http.MethodGet, req.Method) + require.Equal(t, "/api/ddi/v1/dns/delegation/"+*ConfigDelegation_Post.Id, req.URL.Path) + require.Equal(t, "application/json", req.Header.Get("Accept")) + + response := openapiclient.ConfigReadDelegationResponse{} + body, err := json.Marshal(response) + require.NoError(t, err) + + return &http.Response{ + StatusCode: http.StatusOK, + Body: io.NopCloser(bytes.NewReader(body)), + Header: map[string][]string{"Content-Type": {"application/json"}}, + } + }) + apiClient := openapiclient.NewAPIClient(configuration) + resp, httpRes, err := apiClient.DelegationAPI.DelegationRead(context.Background(), *ConfigDelegation_Post.Id).Execute() require.Nil(t, err) require.NotNil(t, resp) - assert.Equal(t, 200, httpRes.StatusCode) - + require.Equal(t, http.StatusOK, httpRes.StatusCode) }) t.Run("Test DelegationAPIService DelegationUpdate", func(t *testing.T) { - - t.Skip("skip test") // remove to run test - - var id string - - resp, httpRes, err := apiClient.DelegationAPI.DelegationUpdate(context.Background(), id).Execute() - + configuration := internal.NewConfiguration() + configuration.HTTPClient = internal.NewTestClient(func(req *http.Request) *http.Response { + require.Equal(t, http.MethodPatch, req.Method) + require.Equal(t, "/api/ddi/v1/dns/delegation/"+*ConfigDelegation_Patch.Id, req.URL.Path) + require.Equal(t, "application/json", req.Header.Get("Accept")) + + var reqBody openapiclient.ConfigDelegation + require.NoError(t, json.NewDecoder(req.Body).Decode(&reqBody)) + require.Equal(t, ConfigDelegation_Patch, reqBody) + + response := openapiclient.ConfigUpdateDelegationResponse{} + body, err := json.Marshal(response) + require.NoError(t, err) + + return &http.Response{ + StatusCode: http.StatusOK, + Body: io.NopCloser(bytes.NewReader(body)), + Header: map[string][]string{"Content-Type": {"application/json"}}, + } + }) + apiClient := openapiclient.NewAPIClient(configuration) + resp, httpRes, err := apiClient.DelegationAPI.DelegationUpdate(context.Background(), *ConfigDelegation_Patch.Id).Body(ConfigDelegation_Patch).Execute() require.Nil(t, err) require.NotNil(t, resp) - assert.Equal(t, 200, httpRes.StatusCode) + require.Equal(t, http.StatusOK, httpRes.StatusCode) + }) + t.Run("Test DelegationAPIService DelegationDelete", func(t *testing.T) { + configuration := internal.NewConfiguration() + configuration.HTTPClient = internal.NewTestClient(func(req *http.Request) *http.Response { + require.Equal(t, http.MethodDelete, req.Method) + require.Equal(t, "/api/ddi/v1/dns/delegation/"+*ConfigDelegation_Post.Id, req.URL.Path) + + return &http.Response{ + StatusCode: http.StatusOK, + Body: io.NopCloser(bytes.NewReader([]byte{})), + Header: map[string][]string{"Content-Type": {"application/json"}}, + } + }) + apiClient := openapiclient.NewAPIClient(configuration) + httpRes, err := apiClient.DelegationAPI.DelegationDelete(context.Background(), *ConfigDelegation_Post.Id).Execute() + require.Nil(t, err) + require.Equal(t, http.StatusOK, httpRes.StatusCode) }) } diff --git a/dns_config/test/api_forward_nsg_test.go b/dns_config/test/api_forward_nsg_test.go index 8d9ac14..26929e6 100644 --- a/dns_config/test/api_forward_nsg_test.go +++ b/dns_config/test/api_forward_nsg_test.go @@ -7,87 +7,167 @@ Testing ForwardNsgAPIService // Code generated by OpenAPI Generator (https://openapi-generator.tech); -package dns_config +package dns_config_test import ( + "bytes" "context" + "encoding/json" + "io" + "net/http" "testing" - "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" openapiclient "github.com/infobloxopen/bloxone-go-client/dns_config" "github.com/infobloxopen/bloxone-go-client/internal" ) -func Test_dns_config_ForwardNsgAPIService(t *testing.T) { +var ConfigForwardNSG_Post = openapiclient.ConfigForwardNSG{ + Id: openapiclient.PtrString("ConfigForwardNSGPost"), + Comment: nil, + ExternalForwarders: nil, + ForwardersOnly: nil, + Hosts: nil, + InternalForwarders: nil, + Name: "", + Nsgs: nil, + Tags: nil, +} +var ConfigForwardNSG_Patch = openapiclient.ConfigForwardNSG{ + Id: openapiclient.PtrString("ConfigForwardNSGPatch"), + Comment: nil, + ExternalForwarders: nil, + ForwardersOnly: nil, + Hosts: nil, + InternalForwarders: nil, + Name: "", + Nsgs: nil, + Tags: nil, +} - configuration := internal.NewConfiguration() - apiClient := openapiclient.NewAPIClient(configuration) +func Test_dns_config_ForwardNsgAPIService(t *testing.T) { t.Run("Test ForwardNsgAPIService ForwardNsgCreate", func(t *testing.T) { - - t.Skip("skip test") // remove to run test - - resp, httpRes, err := apiClient.ForwardNsgAPI.ForwardNsgCreate(context.Background()).Execute() - + configuration := internal.NewConfiguration() + configuration.HTTPClient = internal.NewTestClient(func(req *http.Request) *http.Response { + require.Equal(t, http.MethodPost, req.Method) + require.Equal(t, "/api/ddi/v1/dns/forward_nsg", req.URL.Path) + require.Equal(t, "application/json", req.Header.Get("Content-Type")) + + var reqBody openapiclient.ConfigForwardNSG + require.NoError(t, json.NewDecoder(req.Body).Decode(&reqBody)) + require.Equal(t, ConfigForwardNSG_Post, reqBody) + + response := openapiclient.ConfigCreateForwardNSGResponse{} + body, err := json.Marshal(response) + require.NoError(t, err) + + return &http.Response{ + StatusCode: http.StatusOK, + Body: io.NopCloser(bytes.NewReader(body)), + Header: map[string][]string{"Content-Type": {"application/json"}}, + } + }) + apiClient := openapiclient.NewAPIClient(configuration) + resp, httpRes, err := apiClient.ForwardNsgAPI.ForwardNsgCreate(context.Background()).Body(ConfigForwardNSG_Post).Execute() require.Nil(t, err) require.NotNil(t, resp) - assert.Equal(t, 200, httpRes.StatusCode) - + require.Equal(t, http.StatusOK, httpRes.StatusCode) }) t.Run("Test ForwardNsgAPIService ForwardNsgDelete", func(t *testing.T) { - - t.Skip("skip test") // remove to run test - - var id string - - httpRes, err := apiClient.ForwardNsgAPI.ForwardNsgDelete(context.Background(), id).Execute() - + configuration := internal.NewConfiguration() + configuration.HTTPClient = internal.NewTestClient(func(req *http.Request) *http.Response { + require.Equal(t, http.MethodDelete, req.Method) + require.Equal(t, "/api/ddi/v1/dns/forward_nsg/"+*ConfigForwardNSG_Post.Id, req.URL.Path) + + return &http.Response{ + StatusCode: http.StatusOK, + Body: io.NopCloser(bytes.NewReader([]byte{})), + Header: map[string][]string{"Content-Type": {"application/json"}}, + } + }) + apiClient := openapiclient.NewAPIClient(configuration) + httpRes, err := apiClient.ForwardNsgAPI.ForwardNsgDelete(context.Background(), *ConfigForwardNSG_Post.Id).Execute() require.Nil(t, err) - assert.Equal(t, 200, httpRes.StatusCode) - + require.Equal(t, http.StatusOK, httpRes.StatusCode) }) t.Run("Test ForwardNsgAPIService ForwardNsgList", func(t *testing.T) { - - t.Skip("skip test") // remove to run test - + configuration := internal.NewConfiguration() + configuration.HTTPClient = internal.NewTestClient(func(req *http.Request) *http.Response { + require.Equal(t, http.MethodGet, req.Method) + require.Equal(t, "/api/ddi/v1/dns/forward_nsg", req.URL.Path) + require.Equal(t, "application/json", req.Header.Get("Accept")) + + response := openapiclient.ConfigListForwardNSGResponse{} + body, err := json.Marshal(response) + require.NoError(t, err) + + return &http.Response{ + StatusCode: http.StatusOK, + Body: io.NopCloser(bytes.NewReader(body)), + Header: map[string][]string{"Content-Type": {"application/json"}}, + } + }) + apiClient := openapiclient.NewAPIClient(configuration) resp, httpRes, err := apiClient.ForwardNsgAPI.ForwardNsgList(context.Background()).Execute() - require.Nil(t, err) require.NotNil(t, resp) - assert.Equal(t, 200, httpRes.StatusCode) - + require.Equal(t, http.StatusOK, httpRes.StatusCode) }) t.Run("Test ForwardNsgAPIService ForwardNsgRead", func(t *testing.T) { - - t.Skip("skip test") // remove to run test - - var id string - - resp, httpRes, err := apiClient.ForwardNsgAPI.ForwardNsgRead(context.Background(), id).Execute() - + configuration := internal.NewConfiguration() + configuration.HTTPClient = internal.NewTestClient(func(req *http.Request) *http.Response { + require.Equal(t, http.MethodGet, req.Method) + require.Equal(t, "/api/ddi/v1/dns/forward_nsg/"+*ConfigForwardNSG_Post.Id, req.URL.Path) + require.Equal(t, "application/json", req.Header.Get("Accept")) + + response := openapiclient.ConfigReadForwardNSGResponse{} + body, err := json.Marshal(response) + require.NoError(t, err) + + return &http.Response{ + StatusCode: http.StatusOK, + Body: io.NopCloser(bytes.NewReader(body)), + Header: map[string][]string{"Content-Type": {"application/json"}}, + } + }) + apiClient := openapiclient.NewAPIClient(configuration) + resp, httpRes, err := apiClient.ForwardNsgAPI.ForwardNsgRead(context.Background(), *ConfigForwardNSG_Post.Id).Execute() require.Nil(t, err) require.NotNil(t, resp) - assert.Equal(t, 200, httpRes.StatusCode) - + require.Equal(t, http.StatusOK, httpRes.StatusCode) }) t.Run("Test ForwardNsgAPIService ForwardNsgUpdate", func(t *testing.T) { - - t.Skip("skip test") // remove to run test - - var id string - - resp, httpRes, err := apiClient.ForwardNsgAPI.ForwardNsgUpdate(context.Background(), id).Execute() - + configuration := internal.NewConfiguration() + configuration.HTTPClient = internal.NewTestClient(func(req *http.Request) *http.Response { + require.Equal(t, http.MethodPatch, req.Method) + require.Equal(t, "/api/ddi/v1/dns/forward_nsg/"+*ConfigForwardNSG_Patch.Id, req.URL.Path) + require.Equal(t, "application/json", req.Header.Get("Content-Type")) + + var reqBody openapiclient.ConfigForwardNSG + require.NoError(t, json.NewDecoder(req.Body).Decode(&reqBody)) + require.Equal(t, ConfigForwardNSG_Patch, reqBody) + + response := openapiclient.ConfigUpdateForwardNSGResponse{} + body, err := json.Marshal(response) + require.NoError(t, err) + + return &http.Response{ + StatusCode: http.StatusOK, + Body: io.NopCloser(bytes.NewReader(body)), + Header: map[string][]string{"Content-Type": {"application/json"}}, + } + }) + apiClient := openapiclient.NewAPIClient(configuration) + resp, httpRes, err := apiClient.ForwardNsgAPI.ForwardNsgUpdate(context.Background(), *ConfigForwardNSG_Patch.Id).Body(ConfigForwardNSG_Patch).Execute() require.Nil(t, err) require.NotNil(t, resp) - assert.Equal(t, 200, httpRes.StatusCode) - + require.Equal(t, http.StatusOK, httpRes.StatusCode) }) } diff --git a/dns_config/test/api_forward_zone_test.go b/dns_config/test/api_forward_zone_test.go index 683d1cd..43ad78d 100644 --- a/dns_config/test/api_forward_zone_test.go +++ b/dns_config/test/api_forward_zone_test.go @@ -7,99 +7,225 @@ Testing ForwardZoneAPIService // Code generated by OpenAPI Generator (https://openapi-generator.tech); -package dns_config +package dns_config_test import ( + "bytes" "context" + "encoding/json" + "io" + "net/http" "testing" - "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" openapiclient "github.com/infobloxopen/bloxone-go-client/dns_config" "github.com/infobloxopen/bloxone-go-client/internal" ) -func Test_dns_config_ForwardZoneAPIService(t *testing.T) { - - configuration := internal.NewConfiguration() - apiClient := openapiclient.NewAPIClient(configuration) - - t.Run("Test ForwardZoneAPIService ForwardZoneCopy", func(t *testing.T) { +var ConfigCopyForwardZone_Post = openapiclient.ConfigCopyForwardZone{ + Id: openapiclient.PtrString("ConfigCopyForwardZonePost"), + Comment: nil, + ExternalForwarders: nil, + Hosts: nil, + InternalForwarders: nil, + Nsgs: nil, + Recursive: nil, + SkipOnError: nil, + TargetView: "", +} +var ConfigForwardZone_Post = openapiclient.ConfigForwardZone{ + Id: openapiclient.PtrString("ConfigForwardZonePost"), + Comment: nil, + CreatedAt: nil, + Disabled: nil, + ExternalForwarders: nil, + ForwardOnly: nil, + Fqdn: nil, + Hosts: nil, + InternalForwarders: nil, + MappedSubnet: nil, + Mapping: nil, + Nsgs: nil, + Parent: nil, + ProtocolFqdn: nil, + Tags: nil, + UpdatedAt: nil, + View: nil, + Warnings: nil, +} - t.Skip("skip test") // remove to run test +var ConfigForwardZone_Patch = openapiclient.ConfigForwardZone{ + Id: openapiclient.PtrString("ConfigForwardZonePatch"), + Comment: nil, + CreatedAt: nil, + Disabled: nil, + ExternalForwarders: nil, + ForwardOnly: nil, + Fqdn: nil, + Hosts: nil, + InternalForwarders: nil, + MappedSubnet: nil, + Mapping: nil, + Nsgs: nil, + Parent: nil, + ProtocolFqdn: nil, + Tags: nil, + UpdatedAt: nil, + View: nil, + Warnings: nil, +} - resp, httpRes, err := apiClient.ForwardZoneAPI.ForwardZoneCopy(context.Background()).Execute() +func Test_dns_config_ForwardZoneAPIService(t *testing.T) { + t.Run("Test ForwardZoneAPIService ForwardZoneCopy", func(t *testing.T) { + configuration := internal.NewConfiguration() + configuration.HTTPClient = internal.NewTestClient(func(req *http.Request) *http.Response { + require.Equal(t, http.MethodPost, req.Method) + require.Equal(t, "/api/ddi/v1/dns/forward_zone/copy", req.URL.Path) + require.Equal(t, "application/json", req.Header.Get("Content-Type")) + + var reqBody openapiclient.ConfigCopyForwardZone + require.NoError(t, json.NewDecoder(req.Body).Decode(&reqBody)) + require.Equal(t, ConfigCopyForwardZone_Post, reqBody) + + response := openapiclient.ConfigCopyForwardZoneResponse{} + body, err := json.Marshal(response) + require.NoError(t, err) + + return &http.Response{ + StatusCode: http.StatusOK, + Body: io.NopCloser(bytes.NewReader(body)), + Header: map[string][]string{"Content-Type": {"application/json"}}, + } + }) + apiClient := openapiclient.NewAPIClient(configuration) + resp, httpRes, err := apiClient.ForwardZoneAPI.ForwardZoneCopy(context.Background()).Body(ConfigCopyForwardZone_Post).Execute() require.Nil(t, err) require.NotNil(t, resp) - assert.Equal(t, 200, httpRes.StatusCode) - + require.Equal(t, http.StatusOK, httpRes.StatusCode) }) t.Run("Test ForwardZoneAPIService ForwardZoneCreate", func(t *testing.T) { - - t.Skip("skip test") // remove to run test - - resp, httpRes, err := apiClient.ForwardZoneAPI.ForwardZoneCreate(context.Background()).Execute() - + configuration := internal.NewConfiguration() + configuration.HTTPClient = internal.NewTestClient(func(req *http.Request) *http.Response { + require.Equal(t, http.MethodPost, req.Method) + require.Equal(t, "/api/ddi/v1/dns/forward_zone", req.URL.Path) + require.Equal(t, "application/json", req.Header.Get("Content-Type")) + + var reqBody openapiclient.ConfigForwardZone + require.NoError(t, json.NewDecoder(req.Body).Decode(&reqBody)) + require.Equal(t, ConfigForwardZone_Post, reqBody) + + response := openapiclient.ConfigCreateForwardZoneResponse{} + body, err := json.Marshal(response) + require.NoError(t, err) + + return &http.Response{ + StatusCode: http.StatusOK, + Body: io.NopCloser(bytes.NewReader(body)), + Header: map[string][]string{"Content-Type": {"application/json"}}, + } + }) + apiClient := openapiclient.NewAPIClient(configuration) + resp, httpRes, err := apiClient.ForwardZoneAPI.ForwardZoneCreate(context.Background()).Body(ConfigForwardZone_Post).Execute() require.Nil(t, err) require.NotNil(t, resp) - assert.Equal(t, 200, httpRes.StatusCode) - - }) - - t.Run("Test ForwardZoneAPIService ForwardZoneDelete", func(t *testing.T) { - - t.Skip("skip test") // remove to run test - - var id string - - httpRes, err := apiClient.ForwardZoneAPI.ForwardZoneDelete(context.Background(), id).Execute() - - require.Nil(t, err) - assert.Equal(t, 200, httpRes.StatusCode) - + require.Equal(t, http.StatusOK, httpRes.StatusCode) }) t.Run("Test ForwardZoneAPIService ForwardZoneList", func(t *testing.T) { - - t.Skip("skip test") // remove to run test - + configuration := internal.NewConfiguration() + configuration.HTTPClient = internal.NewTestClient(func(req *http.Request) *http.Response { + require.Equal(t, http.MethodGet, req.Method) + require.Equal(t, "/api/ddi/v1/dns/forward_zone", req.URL.Path) + require.Equal(t, "application/json", req.Header.Get("Accept")) + + response := openapiclient.ConfigListForwardZoneResponse{} + body, err := json.Marshal(response) + require.NoError(t, err) + + return &http.Response{ + StatusCode: http.StatusOK, + Body: io.NopCloser(bytes.NewReader(body)), + Header: map[string][]string{"Content-Type": {"application/json"}}, + } + }) + apiClient := openapiclient.NewAPIClient(configuration) resp, httpRes, err := apiClient.ForwardZoneAPI.ForwardZoneList(context.Background()).Execute() - require.Nil(t, err) require.NotNil(t, resp) - assert.Equal(t, 200, httpRes.StatusCode) - + require.Equal(t, http.StatusOK, httpRes.StatusCode) }) t.Run("Test ForwardZoneAPIService ForwardZoneRead", func(t *testing.T) { - - t.Skip("skip test") // remove to run test - - var id string - - resp, httpRes, err := apiClient.ForwardZoneAPI.ForwardZoneRead(context.Background(), id).Execute() - + configuration := internal.NewConfiguration() + configuration.HTTPClient = internal.NewTestClient(func(req *http.Request) *http.Response { + require.Equal(t, http.MethodGet, req.Method) + require.Equal(t, "/api/ddi/v1/dns/forward_zone/"+*ConfigForwardZone_Post.Id, req.URL.Path) + require.Equal(t, "application/json", req.Header.Get("Accept")) + + response := openapiclient.ConfigReadForwardZoneResponse{} + body, err := json.Marshal(response) + require.NoError(t, err) + + return &http.Response{ + StatusCode: http.StatusOK, + Body: io.NopCloser(bytes.NewReader(body)), + Header: map[string][]string{"Content-Type": {"application/json"}}, + } + }) + apiClient := openapiclient.NewAPIClient(configuration) + resp, httpRes, err := apiClient.ForwardZoneAPI.ForwardZoneRead(context.Background(), *ConfigForwardZone_Post.Id).Execute() require.Nil(t, err) require.NotNil(t, resp) - assert.Equal(t, 200, httpRes.StatusCode) - + require.Equal(t, http.StatusOK, httpRes.StatusCode) }) t.Run("Test ForwardZoneAPIService ForwardZoneUpdate", func(t *testing.T) { - - t.Skip("skip test") // remove to run test - - var id string - - resp, httpRes, err := apiClient.ForwardZoneAPI.ForwardZoneUpdate(context.Background(), id).Execute() - + configuration := internal.NewConfiguration() + configuration.HTTPClient = internal.NewTestClient(func(req *http.Request) *http.Response { + require.Equal(t, http.MethodPatch, req.Method) + require.Equal(t, "/api/ddi/v1/dns/forward_zone/"+*ConfigForwardZone_Patch.Id, req.URL.Path) + require.Equal(t, "application/json", req.Header.Get("Accept")) + + var reqBody openapiclient.ConfigForwardZone + require.NoError(t, json.NewDecoder(req.Body).Decode(&reqBody)) + require.Equal(t, ConfigForwardZone_Patch, reqBody) + + response := openapiclient.ConfigUpdateForwardZoneResponse{} + body, err := json.Marshal(response) + require.NoError(t, err) + + return &http.Response{ + StatusCode: http.StatusOK, + Body: io.NopCloser(bytes.NewReader(body)), + Header: map[string][]string{"Content-Type": {"application/json"}}, + } + }) + apiClient := openapiclient.NewAPIClient(configuration) + resp, httpRes, err := apiClient.ForwardZoneAPI.ForwardZoneUpdate(context.Background(), *ConfigForwardZone_Patch.Id).Body(ConfigForwardZone_Patch).Execute() require.Nil(t, err) require.NotNil(t, resp) - assert.Equal(t, 200, httpRes.StatusCode) + require.Equal(t, http.StatusOK, httpRes.StatusCode) + }) + t.Run("Test ForwardZoneAPIService ForwardZoneDelete", func(t *testing.T) { + configuration := internal.NewConfiguration() + configuration.HTTPClient = internal.NewTestClient(func(req *http.Request) *http.Response { + require.Equal(t, http.MethodDelete, req.Method) + require.Equal(t, "/api/ddi/v1/dns/forward_zone/"+*ConfigForwardZone_Post.Id, req.URL.Path) + + return &http.Response{ + StatusCode: http.StatusOK, + Body: io.NopCloser(bytes.NewReader([]byte{})), + Header: map[string][]string{"Content-Type": {"application/json"}}, + } + }) + apiClient := openapiclient.NewAPIClient(configuration) + httpRes, err := apiClient.ForwardZoneAPI.ForwardZoneDelete(context.Background(), *ConfigForwardZone_Post.Id).Execute() + require.Nil(t, err) + require.Equal(t, http.StatusOK, httpRes.StatusCode) }) } diff --git a/dns_config/test/api_global_test.go b/dns_config/test/api_global_test.go index e114660..ec0001f 100644 --- a/dns_config/test/api_global_test.go +++ b/dns_config/test/api_global_test.go @@ -7,74 +7,133 @@ Testing GlobalAPIService // Code generated by OpenAPI Generator (https://openapi-generator.tech); -package dns_config +package dns_config_test import ( + "bytes" "context" + "encoding/json" + "io" + "net/http" "testing" - "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" openapiclient "github.com/infobloxopen/bloxone-go-client/dns_config" "github.com/infobloxopen/bloxone-go-client/internal" ) -func Test_dns_config_GlobalAPIService(t *testing.T) { +var ConfigGlobal_Patch = openapiclient.ConfigGlobal{ + Id: "Patch1", +} +var ConfigGlobal_Patch2 = openapiclient.ConfigGlobal{ + Id: "Patch2", +} - configuration := internal.NewConfiguration() - apiClient := openapiclient.NewAPIClient(configuration) +func Test_dns_config_GlobalAPIService(t *testing.T) { t.Run("Test GlobalAPIService GlobalRead", func(t *testing.T) { - - t.Skip("skip test") // remove to run test - + configuration := internal.NewConfiguration() + configuration.HTTPClient = internal.NewTestClient(func(req *http.Request) *http.Response { + require.Equal(t, http.MethodGet, req.Method) + require.Equal(t, "/api/ddi/v1/dns/global", req.URL.Path) + require.Equal(t, "application/json", req.Header.Get("Accept")) + + response := openapiclient.ConfigReadGlobalResponse{} + body, err := json.Marshal(response) + require.NoError(t, err) + + return &http.Response{ + StatusCode: http.StatusOK, + Body: io.NopCloser(bytes.NewReader(body)), + Header: map[string][]string{"Content-Type": {"application/json"}}, + } + }) + apiClient := openapiclient.NewAPIClient(configuration) resp, httpRes, err := apiClient.GlobalAPI.GlobalRead(context.Background()).Execute() - require.Nil(t, err) require.NotNil(t, resp) - assert.Equal(t, 200, httpRes.StatusCode) - + require.Equal(t, http.StatusOK, httpRes.StatusCode) }) t.Run("Test GlobalAPIService GlobalRead2", func(t *testing.T) { - - t.Skip("skip test") // remove to run test - - var id string - - resp, httpRes, err := apiClient.GlobalAPI.GlobalRead2(context.Background(), id).Execute() - + configuration := internal.NewConfiguration() + configuration.HTTPClient = internal.NewTestClient(func(req *http.Request) *http.Response { + require.Equal(t, http.MethodGet, req.Method) + require.Equal(t, "/api/ddi/v1/dns/global/"+ConfigGlobal_Patch.Id, req.URL.Path) + require.Equal(t, "application/json", req.Header.Get("Accept")) + + response := openapiclient.ConfigReadGlobalResponse{} + body, err := json.Marshal(response) + require.NoError(t, err) + + return &http.Response{ + StatusCode: http.StatusOK, + Body: io.NopCloser(bytes.NewReader(body)), + Header: map[string][]string{"Content-Type": {"application/json"}}, + } + }) + apiClient := openapiclient.NewAPIClient(configuration) + resp, httpRes, err := apiClient.GlobalAPI.GlobalRead2(context.Background(), ConfigGlobal_Patch.Id).Execute() require.Nil(t, err) require.NotNil(t, resp) - assert.Equal(t, 200, httpRes.StatusCode) - + require.Equal(t, http.StatusOK, httpRes.StatusCode) }) t.Run("Test GlobalAPIService GlobalUpdate", func(t *testing.T) { - - t.Skip("skip test") // remove to run test - - resp, httpRes, err := apiClient.GlobalAPI.GlobalUpdate(context.Background()).Execute() - + configuration := internal.NewConfiguration() + configuration.HTTPClient = internal.NewTestClient(func(req *http.Request) *http.Response { + require.Equal(t, http.MethodPatch, req.Method) + require.Equal(t, "/api/ddi/v1/dns/global", req.URL.Path) + require.Equal(t, "application/json", req.Header.Get("Content-Type")) + + var reqBody openapiclient.ConfigGlobal + require.NoError(t, json.NewDecoder(req.Body).Decode(&reqBody)) + require.Equal(t, ConfigGlobal_Patch, reqBody) + + response := openapiclient.ConfigUpdateGlobalResponse{} + body, err := json.Marshal(response) + require.NoError(t, err) + + return &http.Response{ + StatusCode: http.StatusOK, + Body: io.NopCloser(bytes.NewReader(body)), + Header: map[string][]string{"Content-Type": {"application/json"}}, + } + }) + apiClient := openapiclient.NewAPIClient(configuration) + resp, httpRes, err := apiClient.GlobalAPI.GlobalUpdate(context.Background()).Body(ConfigGlobal_Patch).Execute() require.Nil(t, err) require.NotNil(t, resp) - assert.Equal(t, 200, httpRes.StatusCode) - + require.Equal(t, http.StatusOK, httpRes.StatusCode) }) t.Run("Test GlobalAPIService GlobalUpdate2", func(t *testing.T) { - - t.Skip("skip test") // remove to run test - - var id string - - resp, httpRes, err := apiClient.GlobalAPI.GlobalUpdate2(context.Background(), id).Execute() - + configuration := internal.NewConfiguration() + configuration.HTTPClient = internal.NewTestClient(func(req *http.Request) *http.Response { + require.Equal(t, http.MethodPatch, req.Method) + require.Equal(t, "/api/ddi/v1/dns/global/"+ConfigGlobal_Patch.Id, req.URL.Path) + require.Equal(t, "application/json", req.Header.Get("Content-Type")) + + var reqBody openapiclient.ConfigGlobal + require.NoError(t, json.NewDecoder(req.Body).Decode(&reqBody)) + require.Equal(t, ConfigGlobal_Patch2, reqBody) + + response := openapiclient.ConfigUpdateGlobalResponse{} + body, err := json.Marshal(response) + require.NoError(t, err) + + return &http.Response{ + StatusCode: http.StatusOK, + Body: io.NopCloser(bytes.NewReader(body)), + Header: map[string][]string{"Content-Type": {"application/json"}}, + } + }) + apiClient := openapiclient.NewAPIClient(configuration) + resp, httpRes, err := apiClient.GlobalAPI.GlobalUpdate2(context.Background(), ConfigGlobal_Patch.Id).Body(ConfigGlobal_Patch2).Execute() require.Nil(t, err) require.NotNil(t, resp) - assert.Equal(t, 200, httpRes.StatusCode) - + require.Equal(t, http.StatusOK, httpRes.StatusCode) }) } diff --git a/dns_config/test/api_host_test.go b/dns_config/test/api_host_test.go index 2950634..cd3e2c9 100644 --- a/dns_config/test/api_host_test.go +++ b/dns_config/test/api_host_test.go @@ -1,7 +1,7 @@ /* DNS Configuration API -Testing AclAPIService +Testing HostAPIService */ @@ -13,158 +13,96 @@ import ( "bytes" "context" "encoding/json" - "github.com/infobloxopen/bloxone-go-client/dns_config" - "github.com/infobloxopen/bloxone-go-client/internal" - openapiclient "github.com/infobloxopen/bloxone-go-client/keys" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" "io" "net/http" "testing" + + "github.com/stretchr/testify/require" + + openapiclient "github.com/infobloxopen/bloxone-go-client/dns_config" + "github.com/infobloxopen/bloxone-go-client/internal" ) +var ConfigHost_Patch = openapiclient.ConfigHost{ + Id: openapiclient.PtrString("ConfigHostPatch"), +} + func Test_dns_config_HostAPIService(t *testing.T) { t.Run("Test HostAPIService HostList", func(t *testing.T) { - - // Create a mock HTTP client - testClient := NewTestClient(func(req *http.Request) *http.Response { - // Check the request parameters - require.Equal(t, "GET", req.Method) + configuration := internal.NewConfiguration() + configuration.HTTPClient = internal.NewTestClient(func(req *http.Request) *http.Response { + require.Equal(t, http.MethodGet, req.Method) require.Equal(t, "/api/ddi/v1/dns/host", req.URL.Path) require.Equal(t, "application/json", req.Header.Get("Accept")) - // Create a dummy response - response := dns_config.ConfigListHostResponse{ - Results: []dns_config.ConfigHost{ - { - Id: openapiclient.PtrString("host1"), - AbsoluteName: openapiclient.PtrString("host1.example.com"), - }, - { - Id: openapiclient.PtrString("host2"), - AbsoluteName: openapiclient.PtrString("host2.example.com"), - }, - }, - } + response := openapiclient.ConfigListHostResponse{} body, err := json.Marshal(response) require.NoError(t, err) - // Return the dummy response return &http.Response{ - StatusCode: 200, + StatusCode: http.StatusOK, Body: io.NopCloser(bytes.NewReader(body)), Header: map[string][]string{"Content-Type": {"application/json"}}, } }) - - // Create a new API client with the mock HTTP client - configuration := internal.NewConfiguration() - configuration.HTTPClient = testClient - apiClient := dns_config.NewAPIClient(configuration) - - // Call the method and check the response + apiClient := openapiclient.NewAPIClient(configuration) resp, httpRes, err := apiClient.HostAPI.HostList(context.Background()).Execute() - require.Nil(t, err) require.NotNil(t, resp) - assert.Equal(t, 200, httpRes.StatusCode) - assert.Equal(t, "host1", *resp.Results[0].Id) - assert.Equal(t, "host1.example.com", *resp.Results[0].AbsoluteName) - assert.Equal(t, "host2", *resp.Results[1].Id) - assert.Equal(t, "host2.example.com", *resp.Results[1].AbsoluteName) - + require.Equal(t, http.StatusOK, httpRes.StatusCode) }) t.Run("Test HostAPIService HostRead", func(t *testing.T) { - - // Create a mock HTTP client - testClient := NewTestClient(func(req *http.Request) *http.Response { - // Check the request parameters - require.Equal(t, "GET", req.Method) - require.Equal(t, "/api/ddi/v1/dns/host/host1", req.URL.Path) + configuration := internal.NewConfiguration() + configuration.HTTPClient = internal.NewTestClient(func(req *http.Request) *http.Response { + require.Equal(t, http.MethodGet, req.Method) + require.Equal(t, "/api/ddi/v1/dns/host/"+*ConfigHost_Patch.Id, req.URL.Path) require.Equal(t, "application/json", req.Header.Get("Accept")) - // Create a dummy response - response := dns_config.ConfigReadHostResponse{ - Result: &dns_config.ConfigHost{ - Id: openapiclient.PtrString("host1"), - AbsoluteName: openapiclient.PtrString("host1.example.com"), - }, - } + response := openapiclient.ConfigReadHostResponse{} body, err := json.Marshal(response) require.NoError(t, err) - // Return the dummy response return &http.Response{ - StatusCode: 200, + StatusCode: http.StatusOK, Body: io.NopCloser(bytes.NewReader(body)), Header: map[string][]string{"Content-Type": {"application/json"}}, } }) - - // Create a new API client with the mock HTTP client - configuration := internal.NewConfiguration() - configuration.HTTPClient = testClient - apiClient := dns_config.NewAPIClient(configuration) - - // Call the method and check the response - id := "host1" - resp, httpRes, err := apiClient.HostAPI.HostRead(context.Background(), id).Execute() - + apiClient := openapiclient.NewAPIClient(configuration) + resp, httpRes, err := apiClient.HostAPI.HostRead(context.Background(), *ConfigHost_Patch.Id).Execute() require.Nil(t, err) require.NotNil(t, resp) - assert.Equal(t, 200, httpRes.StatusCode) - assert.Equal(t, "host1", *resp.Result.Id) - assert.Equal(t, "host1.example.com", *resp.Result.AbsoluteName) - + require.Equal(t, http.StatusOK, httpRes.StatusCode) }) t.Run("Test HostAPIService HostUpdate", func(t *testing.T) { + configuration := internal.NewConfiguration() + configuration.HTTPClient = internal.NewTestClient(func(req *http.Request) *http.Response { + require.Equal(t, http.MethodPatch, req.Method) + require.Equal(t, "/api/ddi/v1/dns/host/"+*ConfigHost_Patch.Id, req.URL.Path) + require.Equal(t, "application/json", req.Header.Get("Content-Type")) - // Create a mock HTTP client - testClient := NewTestClient(func(req *http.Request) *http.Response { - // Check the request parameters - require.Equal(t, "PATCH", req.Method) - require.Equal(t, "/api/ddi/v1/dns/host/host1", req.URL.Path) - require.Equal(t, "application/json", req.Header.Get("Accept")) + var reqBody openapiclient.ConfigHost + require.NoError(t, json.NewDecoder(req.Body).Decode(&reqBody)) + require.Equal(t, ConfigHost_Patch, reqBody) - // Create a dummy response - response := dns_config.ConfigReadHostResponse{ - Result: &dns_config.ConfigHost{ - Id: openapiclient.PtrString("host1"), - AbsoluteName: openapiclient.PtrString("host1.example.com"), - }, - } + response := openapiclient.ConfigUpdateHostResponse{} body, err := json.Marshal(response) require.NoError(t, err) - // Return the dummy response return &http.Response{ - StatusCode: 200, + StatusCode: http.StatusOK, Body: io.NopCloser(bytes.NewReader(body)), Header: map[string][]string{"Content-Type": {"application/json"}}, } }) - - // Create a new API client with the mock HTTP client - configuration := internal.NewConfiguration() - configuration.HTTPClient = testClient - apiClient := dns_config.NewAPIClient(configuration) - - // Call the method and check the response - id := "host1" - hostUpdateInput := dns_config.ConfigHost{ - AbsoluteName: openapiclient.PtrString("host1.example.com"), - } - resp, httpRes, err := apiClient.HostAPI.HostUpdate(context.Background(), id).Body(hostUpdateInput).Execute() - + apiClient := openapiclient.NewAPIClient(configuration) + resp, httpRes, err := apiClient.HostAPI.HostUpdate(context.Background(), *ConfigHost_Patch.Id).Body(ConfigHost_Patch).Execute() require.Nil(t, err) require.NotNil(t, resp) - assert.Equal(t, 200, httpRes.StatusCode) - assert.Equal(t, "host1", *resp.Result.Id) - assert.Equal(t, "host1.example.com", *resp.Result.AbsoluteName) - + require.Equal(t, http.StatusOK, httpRes.StatusCode) }) } diff --git a/dns_config/test/api_lbdn_test.go b/dns_config/test/api_lbdn_test.go index 6433b4a..382ddb7 100644 --- a/dns_config/test/api_lbdn_test.go +++ b/dns_config/test/api_lbdn_test.go @@ -7,87 +7,151 @@ Testing LbdnAPIService // Code generated by OpenAPI Generator (https://openapi-generator.tech); -package dns_config +package dns_config_test import ( + "bytes" "context" + "encoding/json" + "io" + "net/http" "testing" - "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" openapiclient "github.com/infobloxopen/bloxone-go-client/dns_config" "github.com/infobloxopen/bloxone-go-client/internal" ) -func Test_dns_config_LbdnAPIService(t *testing.T) { +var ConfigLBDN_Post = openapiclient.ConfigLBDN{ + Id: openapiclient.PtrString("ConfigLBDNPost"), +} +var ConfigLBDN_Patch = openapiclient.ConfigLBDN{ + Id: openapiclient.PtrString("ConfigLBDNPatch"), +} - configuration := internal.NewConfiguration() - apiClient := openapiclient.NewAPIClient(configuration) +func Test_dns_config_LbdnAPIService(t *testing.T) { t.Run("Test LbdnAPIService LbdnCreate", func(t *testing.T) { - - t.Skip("skip test") // remove to run test - - resp, httpRes, err := apiClient.LbdnAPI.LbdnCreate(context.Background()).Execute() - + configuration := internal.NewConfiguration() + configuration.HTTPClient = internal.NewTestClient(func(req *http.Request) *http.Response { + require.Equal(t, http.MethodPost, req.Method) + require.Equal(t, "/api/ddi/v1/dtc/lbdn", req.URL.Path) + require.Equal(t, "application/json", req.Header.Get("Content-Type")) + + var reqBody openapiclient.ConfigLBDN + require.NoError(t, json.NewDecoder(req.Body).Decode(&reqBody)) + require.Equal(t, ConfigLBDN_Post, reqBody) + + response := openapiclient.ConfigCreateLBDNResponse{} + body, err := json.Marshal(response) + require.NoError(t, err) + + return &http.Response{ + StatusCode: http.StatusOK, + Body: io.NopCloser(bytes.NewReader(body)), + Header: map[string][]string{"Content-Type": {"application/json"}}, + } + }) + apiClient := openapiclient.NewAPIClient(configuration) + resp, httpRes, err := apiClient.LbdnAPI.LbdnCreate(context.Background()).Body(ConfigLBDN_Post).Execute() require.Nil(t, err) require.NotNil(t, resp) - assert.Equal(t, 200, httpRes.StatusCode) - + require.Equal(t, http.StatusOK, httpRes.StatusCode) }) t.Run("Test LbdnAPIService LbdnDelete", func(t *testing.T) { - - t.Skip("skip test") // remove to run test - - var id string - - httpRes, err := apiClient.LbdnAPI.LbdnDelete(context.Background(), id).Execute() - + configuration := internal.NewConfiguration() + configuration.HTTPClient = internal.NewTestClient(func(req *http.Request) *http.Response { + require.Equal(t, http.MethodDelete, req.Method) + require.Equal(t, "/api/ddi/v1/dtc/lbdn/"+*ConfigLBDN_Post.Id, req.URL.Path) + + return &http.Response{ + StatusCode: http.StatusOK, + Body: io.NopCloser(bytes.NewReader([]byte{})), + Header: map[string][]string{"Content-Type": {"application/json"}}, + } + }) + apiClient := openapiclient.NewAPIClient(configuration) + httpRes, err := apiClient.LbdnAPI.LbdnDelete(context.Background(), *ConfigLBDN_Post.Id).Execute() require.Nil(t, err) - assert.Equal(t, 200, httpRes.StatusCode) - + require.Equal(t, http.StatusOK, httpRes.StatusCode) }) t.Run("Test LbdnAPIService LbdnList", func(t *testing.T) { - - t.Skip("skip test") // remove to run test - + configuration := internal.NewConfiguration() + configuration.HTTPClient = internal.NewTestClient(func(req *http.Request) *http.Response { + require.Equal(t, http.MethodGet, req.Method) + require.Equal(t, "/api/ddi/v1/dtc/lbdn", req.URL.Path) + require.Equal(t, "application/json", req.Header.Get("Accept")) + + response := openapiclient.ConfigListLBDNResponse{} + body, err := json.Marshal(response) + require.NoError(t, err) + + return &http.Response{ + StatusCode: http.StatusOK, + Body: io.NopCloser(bytes.NewReader(body)), + Header: map[string][]string{"Content-Type": {"application/json"}}, + } + }) + apiClient := openapiclient.NewAPIClient(configuration) resp, httpRes, err := apiClient.LbdnAPI.LbdnList(context.Background()).Execute() - require.Nil(t, err) require.NotNil(t, resp) - assert.Equal(t, 200, httpRes.StatusCode) - + require.Equal(t, http.StatusOK, httpRes.StatusCode) }) t.Run("Test LbdnAPIService LbdnRead", func(t *testing.T) { - - t.Skip("skip test") // remove to run test - - var id string - - resp, httpRes, err := apiClient.LbdnAPI.LbdnRead(context.Background(), id).Execute() - + configuration := internal.NewConfiguration() + configuration.HTTPClient = internal.NewTestClient(func(req *http.Request) *http.Response { + require.Equal(t, http.MethodGet, req.Method) + require.Equal(t, "/api/ddi/v1/dtc/lbdn/"+*ConfigLBDN_Post.Id, req.URL.Path) + require.Equal(t, "application/json", req.Header.Get("Accept")) + + response := openapiclient.ConfigReadLBDNResponse{} + body, err := json.Marshal(response) + require.NoError(t, err) + + return &http.Response{ + StatusCode: http.StatusOK, + Body: io.NopCloser(bytes.NewReader(body)), + Header: map[string][]string{"Content-Type": {"application/json"}}, + } + }) + apiClient := openapiclient.NewAPIClient(configuration) + resp, httpRes, err := apiClient.LbdnAPI.LbdnRead(context.Background(), *ConfigLBDN_Post.Id).Execute() require.Nil(t, err) require.NotNil(t, resp) - assert.Equal(t, 200, httpRes.StatusCode) - + require.Equal(t, http.StatusOK, httpRes.StatusCode) }) t.Run("Test LbdnAPIService LbdnUpdate", func(t *testing.T) { - - t.Skip("skip test") // remove to run test - - var id string - - resp, httpRes, err := apiClient.LbdnAPI.LbdnUpdate(context.Background(), id).Execute() - + configuration := internal.NewConfiguration() + configuration.HTTPClient = internal.NewTestClient(func(req *http.Request) *http.Response { + require.Equal(t, http.MethodPatch, req.Method) + require.Equal(t, "/api/ddi/v1/dtc/lbdn/"+*ConfigLBDN_Patch.Id, req.URL.Path) + require.Equal(t, "application/json", req.Header.Get("Content-Type")) + + var reqBody openapiclient.ConfigLBDN + require.NoError(t, json.NewDecoder(req.Body).Decode(&reqBody)) + require.Equal(t, ConfigLBDN_Patch, reqBody) + + response := openapiclient.ConfigUpdateLBDNResponse{} + body, err := json.Marshal(response) + require.NoError(t, err) + + return &http.Response{ + StatusCode: http.StatusOK, + Body: io.NopCloser(bytes.NewReader(body)), + Header: map[string][]string{"Content-Type": {"application/json"}}, + } + }) + apiClient := openapiclient.NewAPIClient(configuration) + resp, httpRes, err := apiClient.LbdnAPI.LbdnUpdate(context.Background(), *ConfigLBDN_Patch.Id).Body(ConfigLBDN_Patch).Execute() require.Nil(t, err) require.NotNil(t, resp) - assert.Equal(t, 200, httpRes.StatusCode) - + require.Equal(t, http.StatusOK, httpRes.StatusCode) }) } diff --git a/dns_config/test/api_server_test.go b/dns_config/test/api_server_test.go index 485d79f..a2fb260 100644 --- a/dns_config/test/api_server_test.go +++ b/dns_config/test/api_server_test.go @@ -7,87 +7,151 @@ Testing ServerAPIService // Code generated by OpenAPI Generator (https://openapi-generator.tech); -package dns_config +package dns_config_test import ( + "bytes" "context" + "encoding/json" + "io" + "net/http" "testing" - "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" openapiclient "github.com/infobloxopen/bloxone-go-client/dns_config" "github.com/infobloxopen/bloxone-go-client/internal" ) -func Test_dns_config_ServerAPIService(t *testing.T) { +var ConfigServer_Post = openapiclient.ConfigServer{ + Id: openapiclient.PtrString("ConfigServerPost"), +} +var ConfigServer_Patch = openapiclient.ConfigServer{ + Id: openapiclient.PtrString("ConfigServerPatch"), +} - configuration := internal.NewConfiguration() - apiClient := openapiclient.NewAPIClient(configuration) +func Test_dns_config_ServerAPIService(t *testing.T) { t.Run("Test ServerAPIService ServerCreate", func(t *testing.T) { - - t.Skip("skip test") // remove to run test - - resp, httpRes, err := apiClient.ServerAPI.ServerCreate(context.Background()).Execute() - + configuration := internal.NewConfiguration() + configuration.HTTPClient = internal.NewTestClient(func(req *http.Request) *http.Response { + require.Equal(t, http.MethodPost, req.Method) + require.Equal(t, "/api/ddi/v1/dns/server", req.URL.Path) + require.Equal(t, "application/json", req.Header.Get("Content-Type")) + + var reqBody openapiclient.ConfigServer + require.NoError(t, json.NewDecoder(req.Body).Decode(&reqBody)) + require.Equal(t, ConfigServer_Post, reqBody) + + response := openapiclient.ConfigCreateServerResponse{} + body, err := json.Marshal(response) + require.NoError(t, err) + + return &http.Response{ + StatusCode: http.StatusOK, + Body: io.NopCloser(bytes.NewReader(body)), + Header: map[string][]string{"Content-Type": {"application/json"}}, + } + }) + apiClient := openapiclient.NewAPIClient(configuration) + resp, httpRes, err := apiClient.ServerAPI.ServerCreate(context.Background()).Body(ConfigServer_Post).Execute() require.Nil(t, err) require.NotNil(t, resp) - assert.Equal(t, 200, httpRes.StatusCode) - + require.Equal(t, http.StatusOK, httpRes.StatusCode) }) t.Run("Test ServerAPIService ServerDelete", func(t *testing.T) { - - t.Skip("skip test") // remove to run test - - var id string - - httpRes, err := apiClient.ServerAPI.ServerDelete(context.Background(), id).Execute() - + configuration := internal.NewConfiguration() + configuration.HTTPClient = internal.NewTestClient(func(req *http.Request) *http.Response { + require.Equal(t, http.MethodDelete, req.Method) + require.Equal(t, "/api/ddi/v1/dns/server/"+*ConfigServer_Post.Id, req.URL.Path) + + return &http.Response{ + StatusCode: http.StatusOK, + Body: io.NopCloser(bytes.NewReader([]byte{})), + Header: map[string][]string{"Content-Type": {"application/json"}}, + } + }) + apiClient := openapiclient.NewAPIClient(configuration) + httpRes, err := apiClient.ServerAPI.ServerDelete(context.Background(), *ConfigServer_Post.Id).Execute() require.Nil(t, err) - assert.Equal(t, 200, httpRes.StatusCode) - + require.Equal(t, http.StatusOK, httpRes.StatusCode) }) t.Run("Test ServerAPIService ServerList", func(t *testing.T) { - - t.Skip("skip test") // remove to run test - + configuration := internal.NewConfiguration() + configuration.HTTPClient = internal.NewTestClient(func(req *http.Request) *http.Response { + require.Equal(t, http.MethodGet, req.Method) + require.Equal(t, "/api/ddi/v1/dns/server", req.URL.Path) + require.Equal(t, "application/json", req.Header.Get("Accept")) + + response := openapiclient.ConfigListServerResponse{} + body, err := json.Marshal(response) + require.NoError(t, err) + + return &http.Response{ + StatusCode: http.StatusOK, + Body: io.NopCloser(bytes.NewReader(body)), + Header: map[string][]string{"Content-Type": {"application/json"}}, + } + }) + apiClient := openapiclient.NewAPIClient(configuration) resp, httpRes, err := apiClient.ServerAPI.ServerList(context.Background()).Execute() - require.Nil(t, err) require.NotNil(t, resp) - assert.Equal(t, 200, httpRes.StatusCode) - + require.Equal(t, http.StatusOK, httpRes.StatusCode) }) t.Run("Test ServerAPIService ServerRead", func(t *testing.T) { - - t.Skip("skip test") // remove to run test - - var id string - - resp, httpRes, err := apiClient.ServerAPI.ServerRead(context.Background(), id).Execute() - + configuration := internal.NewConfiguration() + configuration.HTTPClient = internal.NewTestClient(func(req *http.Request) *http.Response { + require.Equal(t, http.MethodGet, req.Method) + require.Equal(t, "/api/ddi/v1/dns/server/"+*ConfigServer_Post.Id, req.URL.Path) + require.Equal(t, "application/json", req.Header.Get("Accept")) + + response := openapiclient.ConfigReadServerResponse{} + body, err := json.Marshal(response) + require.NoError(t, err) + + return &http.Response{ + StatusCode: http.StatusOK, + Body: io.NopCloser(bytes.NewReader(body)), + Header: map[string][]string{"Content-Type": {"application/json"}}, + } + }) + apiClient := openapiclient.NewAPIClient(configuration) + resp, httpRes, err := apiClient.ServerAPI.ServerRead(context.Background(), *ConfigServer_Post.Id).Execute() require.Nil(t, err) require.NotNil(t, resp) - assert.Equal(t, 200, httpRes.StatusCode) - + require.Equal(t, http.StatusOK, httpRes.StatusCode) }) t.Run("Test ServerAPIService ServerUpdate", func(t *testing.T) { - - t.Skip("skip test") // remove to run test - - var id string - - resp, httpRes, err := apiClient.ServerAPI.ServerUpdate(context.Background(), id).Execute() - + configuration := internal.NewConfiguration() + configuration.HTTPClient = internal.NewTestClient(func(req *http.Request) *http.Response { + require.Equal(t, http.MethodPatch, req.Method) + require.Equal(t, "/api/ddi/v1/dns/server/"+*ConfigServer_Patch.Id, req.URL.Path) + require.Equal(t, "application/json", req.Header.Get("Content-Type")) + + var reqBody openapiclient.ConfigServer + require.NoError(t, json.NewDecoder(req.Body).Decode(&reqBody)) + require.Equal(t, ConfigServer_Patch, reqBody) + + response := openapiclient.ConfigUpdateServerResponse{} + body, err := json.Marshal(response) + require.NoError(t, err) + + return &http.Response{ + StatusCode: http.StatusOK, + Body: io.NopCloser(bytes.NewReader(body)), + Header: map[string][]string{"Content-Type": {"application/json"}}, + } + }) + apiClient := openapiclient.NewAPIClient(configuration) + resp, httpRes, err := apiClient.ServerAPI.ServerUpdate(context.Background(), *ConfigServer_Patch.Id).Body(ConfigServer_Patch).Execute() require.Nil(t, err) require.NotNil(t, resp) - assert.Equal(t, 200, httpRes.StatusCode) - + require.Equal(t, http.StatusOK, httpRes.StatusCode) }) } diff --git a/dns_config/test/api_view_test.go b/dns_config/test/api_view_test.go index 47b4c37..29e73bb 100644 --- a/dns_config/test/api_view_test.go +++ b/dns_config/test/api_view_test.go @@ -7,99 +7,188 @@ Testing ViewAPIService // Code generated by OpenAPI Generator (https://openapi-generator.tech); -package dns_config +package dns_config_test import ( + "bytes" "context" + "encoding/json" + "io" + "net/http" "testing" - "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" openapiclient "github.com/infobloxopen/bloxone-go-client/dns_config" "github.com/infobloxopen/bloxone-go-client/internal" ) -func Test_dns_config_ViewAPIService(t *testing.T) { +var ConfigBulkCopyView_Post = openapiclient.ConfigBulkCopyView{ + AuthZoneConfig: nil, + ForwardZoneConfig: nil, + Recursive: nil, + Resources: nil, + SecondaryZoneConfig: nil, + SkipOnError: nil, + Target: "TargetPost", +} +var ConfigView_Post = openapiclient.ConfigView{ + Id: openapiclient.PtrString("ConfigViewPost"), +} +var ConfigView_Patch = openapiclient.ConfigView{ + Id: openapiclient.PtrString("ConfigViewPatch"), +} - configuration := internal.NewConfiguration() - apiClient := openapiclient.NewAPIClient(configuration) +func Test_dns_config_ViewAPIService(t *testing.T) { t.Run("Test ViewAPIService ViewBulkCopy", func(t *testing.T) { - - t.Skip("skip test") // remove to run test - - resp, httpRes, err := apiClient.ViewAPI.ViewBulkCopy(context.Background()).Execute() - + configuration := internal.NewConfiguration() + configuration.HTTPClient = internal.NewTestClient(func(req *http.Request) *http.Response { + require.Equal(t, http.MethodPost, req.Method) + require.Equal(t, "/api/ddi/v1/dns/view/bulk_copy", req.URL.Path) + require.Equal(t, "application/json", req.Header.Get("Content-Type")) + + var reqBody openapiclient.ConfigBulkCopyView + require.NoError(t, json.NewDecoder(req.Body).Decode(&reqBody)) + require.Equal(t, ConfigBulkCopyView_Post, reqBody) + + response := openapiclient.ConfigBulkCopyResponse{} + body, err := json.Marshal(response) + require.NoError(t, err) + + return &http.Response{ + StatusCode: http.StatusOK, + Body: io.NopCloser(bytes.NewReader(body)), + Header: map[string][]string{"Content-Type": {"application/json"}}, + } + }) + apiClient := openapiclient.NewAPIClient(configuration) + resp, httpRes, err := apiClient.ViewAPI.ViewBulkCopy(context.Background()).Body(ConfigBulkCopyView_Post).Execute() require.Nil(t, err) require.NotNil(t, resp) - assert.Equal(t, 200, httpRes.StatusCode) - + require.Equal(t, http.StatusOK, httpRes.StatusCode) }) t.Run("Test ViewAPIService ViewCreate", func(t *testing.T) { - - t.Skip("skip test") // remove to run test - - resp, httpRes, err := apiClient.ViewAPI.ViewCreate(context.Background()).Execute() - + configuration := internal.NewConfiguration() + configuration.HTTPClient = internal.NewTestClient(func(req *http.Request) *http.Response { + require.Equal(t, http.MethodPost, req.Method) + require.Equal(t, "/api/ddi/v1/dns/view", req.URL.Path) + require.Equal(t, "application/json", req.Header.Get("Content-Type")) + + var reqBody openapiclient.ConfigView + require.NoError(t, json.NewDecoder(req.Body).Decode(&reqBody)) + require.Equal(t, ConfigView_Post, reqBody) + + response := openapiclient.ConfigCreateViewResponse{} + body, err := json.Marshal(response) + require.NoError(t, err) + + return &http.Response{ + StatusCode: http.StatusOK, + Body: io.NopCloser(bytes.NewReader(body)), + Header: map[string][]string{"Content-Type": {"application/json"}}, + } + }) + apiClient := openapiclient.NewAPIClient(configuration) + resp, httpRes, err := apiClient.ViewAPI.ViewCreate(context.Background()).Body(ConfigView_Post).Execute() require.Nil(t, err) require.NotNil(t, resp) - assert.Equal(t, 200, httpRes.StatusCode) - + require.Equal(t, http.StatusOK, httpRes.StatusCode) }) t.Run("Test ViewAPIService ViewDelete", func(t *testing.T) { - - t.Skip("skip test") // remove to run test - - var id string - - httpRes, err := apiClient.ViewAPI.ViewDelete(context.Background(), id).Execute() - + configuration := internal.NewConfiguration() + configuration.HTTPClient = internal.NewTestClient(func(req *http.Request) *http.Response { + require.Equal(t, http.MethodDelete, req.Method) + require.Equal(t, "/api/ddi/v1/dns/view/"+*ConfigView_Post.Id, req.URL.Path) + + return &http.Response{ + StatusCode: http.StatusOK, + Body: io.NopCloser(bytes.NewReader([]byte{})), + Header: map[string][]string{"Content-Type": {"application/json"}}, + } + }) + apiClient := openapiclient.NewAPIClient(configuration) + httpRes, err := apiClient.ViewAPI.ViewDelete(context.Background(), *ConfigView_Post.Id).Execute() require.Nil(t, err) - assert.Equal(t, 200, httpRes.StatusCode) - + require.Equal(t, http.StatusOK, httpRes.StatusCode) }) t.Run("Test ViewAPIService ViewList", func(t *testing.T) { - - t.Skip("skip test") // remove to run test - + configuration := internal.NewConfiguration() + configuration.HTTPClient = internal.NewTestClient(func(req *http.Request) *http.Response { + require.Equal(t, http.MethodGet, req.Method) + require.Equal(t, "/api/ddi/v1/dns/view", req.URL.Path) + require.Equal(t, "application/json", req.Header.Get("Accept")) + + response := openapiclient.ConfigListViewResponse{} + body, err := json.Marshal(response) + require.NoError(t, err) + + return &http.Response{ + StatusCode: http.StatusOK, + Body: io.NopCloser(bytes.NewReader(body)), + Header: map[string][]string{"Content-Type": {"application/json"}}, + } + }) + apiClient := openapiclient.NewAPIClient(configuration) resp, httpRes, err := apiClient.ViewAPI.ViewList(context.Background()).Execute() - require.Nil(t, err) require.NotNil(t, resp) - assert.Equal(t, 200, httpRes.StatusCode) - + require.Equal(t, http.StatusOK, httpRes.StatusCode) }) t.Run("Test ViewAPIService ViewRead", func(t *testing.T) { - - t.Skip("skip test") // remove to run test - - var id string - - resp, httpRes, err := apiClient.ViewAPI.ViewRead(context.Background(), id).Execute() - + configuration := internal.NewConfiguration() + configuration.HTTPClient = internal.NewTestClient(func(req *http.Request) *http.Response { + require.Equal(t, http.MethodGet, req.Method) + require.Equal(t, "/api/ddi/v1/dns/view/"+*ConfigView_Post.Id, req.URL.Path) + require.Equal(t, "application/json", req.Header.Get("Accept")) + + response := openapiclient.ConfigReadViewResponse{} + body, err := json.Marshal(response) + require.NoError(t, err) + + return &http.Response{ + StatusCode: http.StatusOK, + Body: io.NopCloser(bytes.NewReader(body)), + Header: map[string][]string{"Content-Type": {"application/json"}}, + } + }) + apiClient := openapiclient.NewAPIClient(configuration) + resp, httpRes, err := apiClient.ViewAPI.ViewRead(context.Background(), *ConfigView_Post.Id).Execute() require.Nil(t, err) require.NotNil(t, resp) - assert.Equal(t, 200, httpRes.StatusCode) - + require.Equal(t, http.StatusOK, httpRes.StatusCode) }) t.Run("Test ViewAPIService ViewUpdate", func(t *testing.T) { - - t.Skip("skip test") // remove to run test - - var id string - - resp, httpRes, err := apiClient.ViewAPI.ViewUpdate(context.Background(), id).Execute() - + configuration := internal.NewConfiguration() + configuration.HTTPClient = internal.NewTestClient(func(req *http.Request) *http.Response { + require.Equal(t, http.MethodPatch, req.Method) + require.Equal(t, "/api/ddi/v1/dns/view/"+*ConfigView_Patch.Id, req.URL.Path) + require.Equal(t, "application/json", req.Header.Get("Content-Type")) + + var reqBody openapiclient.ConfigView + require.NoError(t, json.NewDecoder(req.Body).Decode(&reqBody)) + require.Equal(t, ConfigView_Patch, reqBody) + + response := openapiclient.ConfigUpdateViewResponse{} + body, err := json.Marshal(response) + require.NoError(t, err) + + return &http.Response{ + StatusCode: http.StatusOK, + Body: io.NopCloser(bytes.NewReader(body)), + Header: map[string][]string{"Content-Type": {"application/json"}}, + } + }) + apiClient := openapiclient.NewAPIClient(configuration) + resp, httpRes, err := apiClient.ViewAPI.ViewUpdate(context.Background(), *ConfigView_Patch.Id).Body(ConfigView_Patch).Execute() require.Nil(t, err) require.NotNil(t, resp) - assert.Equal(t, 200, httpRes.StatusCode) - + require.Equal(t, http.StatusOK, httpRes.StatusCode) }) } diff --git a/dns_data/.openapi-generator/FILES b/dns_data/.openapi-generator/FILES index 606c946..0c87762 100644 --- a/dns_data/.openapi-generator/FILES +++ b/dns_data/.openapi-generator/FILES @@ -22,4 +22,5 @@ model_data_soa_serial_increment_response.go model_data_update_record_response.go model_inheritance2_inherited_u_int32.go model_protobuf_field_mask.go +test/api_record_test.go utils.go diff --git a/dns_data/.openapi-generator/VERSION b/dns_data/.openapi-generator/VERSION index 73a86b1..4b49d9b 100644 --- a/dns_data/.openapi-generator/VERSION +++ b/dns_data/.openapi-generator/VERSION @@ -1 +1 @@ -7.0.1 \ No newline at end of file +7.2.0 \ No newline at end of file diff --git a/dns_data/README.md b/dns_data/README.md index c915354..e1d4afb 100644 --- a/dns_data/README.md +++ b/dns_data/README.md @@ -15,20 +15,20 @@ This API client was generated by the [OpenAPI Generator](https://openapi-generat Install the following dependencies: -```shell +```sh go get github.com/stretchr/testify/assert go get golang.org/x/net/context ``` Put the package under your project folder and add the following in import: -```golang +```go import dns_data "github.com/infobloxopen/bloxone-go-client" ``` To use a proxy, set the environment variable `HTTP_PROXY`: -```golang +```go os.Setenv("HTTP_PROXY", "http://proxy_name:proxy_port") ``` @@ -38,17 +38,17 @@ Default configuration comes with `Servers` field that contains server objects as ### Select Server Configuration -For using other server than the one defined on index 0 set context value `sw.ContextServerIndex` of type `int`. +For using other server than the one defined on index 0 set context value `dns_data.ContextServerIndex` of type `int`. -```golang +```go ctx := context.WithValue(context.Background(), dns_data.ContextServerIndex, 1) ``` ### Templated Server URL -Templated server URL is formatted using default variables from configuration or from context value `sw.ContextServerVariables` of type `map[string]string`. +Templated server URL is formatted using default variables from configuration or from context value `dns_data.ContextServerVariables` of type `map[string]string`. -```golang +```go ctx := context.WithValue(context.Background(), dns_data.ContextServerVariables, map[string]string{ "basePath": "v2", }) @@ -60,9 +60,9 @@ Note, enum values are always validated and all unused variables are silently ign Each operation can use different server URL defined using `OperationServers` map in the `Configuration`. An operation is uniquely identified by `"{classname}Service.{nickname}"` string. -Similar rules for overriding default operation server index and variables applies by using `sw.ContextOperationServerIndices` and `sw.ContextOperationServerVariables` context maps. +Similar rules for overriding default operation server index and variables applies by using `dns_data.ContextOperationServerIndices` and `dns_data.ContextOperationServerVariables` context maps. -```golang +```go ctx := context.WithValue(context.Background(), dns_data.ContextOperationServerIndices, map[string]int{ "{classname}Service.{nickname}": 2, }) @@ -115,11 +115,11 @@ Note, each API key must be added to a map of `map[string]APIKey` where the key i Example -```golang +```go auth := context.WithValue( context.Background(), - sw.ContextAPIKeys, - map[string]sw.APIKey{ + dns_data.ContextAPIKeys, + map[string]dns_data.APIKey{ "Authorization": {Key: "API_KEY_STRING"}, }, ) diff --git a/dns_data/api_record.go b/dns_data/api_record.go index 844179e..d47f10e 100644 --- a/dns_data/api_record.go +++ b/dns_data/api_record.go @@ -1,7 +1,7 @@ /* DNS Data API -The DNS Data is a BloxOne DDI service providing primary authoritative zone support. DNS Data is authoritative for all DNS resource records and is acting as a primary DNS server. It is part of the full-featured, DDI cloud solution that enables customers to deploy large numbers of protocol servers to deliver DNS and DHCP throughout their enterprise network. +The DNS Data is a BloxOne DDI service providing primary authoritative zone support. DNS Data is authoritative for all DNS resource records and is acting as a primary DNS server. It is part of the full-featured, DDI cloud solution that enables customers to deploy large numbers of protocol servers to deliver DNS and DHCP throughout their enterprise network. API version: v1 */ @@ -18,19 +18,20 @@ import ( "net/url" "strings" - "github.com/infobloxopen/bloxone-go-client/internal" +"github.com/infobloxopen/bloxone-go-client/internal" ) + type RecordAPI interface { /* - RecordCreate Create the DNS resource record. + RecordCreate Create the DNS resource record. - Use this method to create a DNS __Record__ object. - A __Record__ object represents a DNS resource record in an authoritative zone. + Use this method to create a DNS __Record__ object. +A __Record__ object represents a DNS resource record in an authoritative zone. - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @return ApiRecordCreateRequest + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiRecordCreateRequest */ RecordCreate(ctx context.Context) ApiRecordCreateRequest @@ -39,14 +40,14 @@ type RecordAPI interface { RecordCreateExecute(r ApiRecordCreateRequest) (*DataCreateRecordResponse, *http.Response, error) /* - RecordDelete Move the DNS resource record to recycle bin. + RecordDelete Move the DNS resource record to recycle bin. - Use this method to move a DNS __Record__ object to the recycle bin. - A __Record__ object represents a DNS resource record in an authoritative zone. + Use this method to move a DNS __Record__ object to the recycle bin. +A __Record__ object represents a DNS resource record in an authoritative zone. - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @param id An application specific resource identity of a resource - @return ApiRecordDeleteRequest + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id An application specific resource identity of a resource + @return ApiRecordDeleteRequest */ RecordDelete(ctx context.Context, id string) ApiRecordDeleteRequest @@ -54,13 +55,13 @@ type RecordAPI interface { RecordDeleteExecute(r ApiRecordDeleteRequest) (*http.Response, error) /* - RecordList Retrieve DNS resource records. + RecordList Retrieve DNS resource records. - Use this method to retrieve DNS __Record__ objects. - A __Record__ object represents a DNS resource record in an authoritative zone. + Use this method to retrieve DNS __Record__ objects. +A __Record__ object represents a DNS resource record in an authoritative zone. - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @return ApiRecordListRequest + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiRecordListRequest */ RecordList(ctx context.Context) ApiRecordListRequest @@ -69,14 +70,14 @@ type RecordAPI interface { RecordListExecute(r ApiRecordListRequest) (*DataListRecordResponse, *http.Response, error) /* - RecordRead Retrieve the DNS resource record. + RecordRead Retrieve the DNS resource record. - Use this method to retrieve a DNS __Record__ object. - A __Record__ object represents a DNS resource record in an authoritative zone. + Use this method to retrieve a DNS __Record__ object. +A __Record__ object represents a DNS resource record in an authoritative zone. - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @param id An application specific resource identity of a resource - @return ApiRecordReadRequest + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id An application specific resource identity of a resource + @return ApiRecordReadRequest */ RecordRead(ctx context.Context, id string) ApiRecordReadRequest @@ -85,14 +86,14 @@ type RecordAPI interface { RecordReadExecute(r ApiRecordReadRequest) (*DataReadRecordResponse, *http.Response, error) /* - RecordSOASerialIncrement Increment serial number for the SOA record. + RecordSOASerialIncrement Increment serial number for the SOA record. - Use this method to increment the serial number for an SOA (Start of Authority) _Record_ object. - A __Record__ object represents a DNS resource record in an authoritative zone. + Use this method to increment the serial number for an SOA (Start of Authority) _Record_ object. +A __Record__ object represents a DNS resource record in an authoritative zone. - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @param id An application specific resource identity of a resource - @return ApiRecordSOASerialIncrementRequest + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id An application specific resource identity of a resource + @return ApiRecordSOASerialIncrementRequest */ RecordSOASerialIncrement(ctx context.Context, id string) ApiRecordSOASerialIncrementRequest @@ -101,14 +102,14 @@ type RecordAPI interface { RecordSOASerialIncrementExecute(r ApiRecordSOASerialIncrementRequest) (*DataSOASerialIncrementResponse, *http.Response, error) /* - RecordUpdate Update the DNS resource record. + RecordUpdate Update the DNS resource record. - Use this method to update a DNS __Record__ object. - A __Record__ object represents a DNS resource record in an authoritative zone. + Use this method to update a DNS __Record__ object. +A __Record__ object represents a DNS resource record in an authoritative zone. - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @param id An application specific resource identity of a resource - @return ApiRecordUpdateRequest + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id An application specific resource identity of a resource + @return ApiRecordUpdateRequest */ RecordUpdate(ctx context.Context, id string) ApiRecordUpdateRequest @@ -121,10 +122,10 @@ type RecordAPI interface { type RecordAPIService internal.Service type ApiRecordCreateRequest struct { - ctx context.Context + ctx context.Context ApiService RecordAPI - body *DataRecord - inherit *string + body *DataRecord + inherit *string } func (r ApiRecordCreateRequest) Body(body DataRecord) ApiRecordCreateRequest { @@ -148,25 +149,24 @@ RecordCreate Create the DNS resource record. Use this method to create a DNS __Record__ object. A __Record__ object represents a DNS resource record in an authoritative zone. - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @return ApiRecordCreateRequest + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiRecordCreateRequest */ func (a *RecordAPIService) RecordCreate(ctx context.Context) ApiRecordCreateRequest { return ApiRecordCreateRequest{ ApiService: a, - ctx: ctx, + ctx: ctx, } } // Execute executes the request -// -// @return DataCreateRecordResponse +// @return DataCreateRecordResponse func (a *RecordAPIService) RecordCreateExecute(r ApiRecordCreateRequest) (*DataCreateRecordResponse, *http.Response, error) { var ( - localVarHTTPMethod = http.MethodPost - localVarPostBody interface{} - formFiles []internal.FormFile - localVarReturnValue *DataCreateRecordResponse + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []internal.FormFile + localVarReturnValue *DataCreateRecordResponse ) localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "RecordAPIService.RecordCreate") @@ -251,9 +251,9 @@ func (a *RecordAPIService) RecordCreateExecute(r ApiRecordCreateRequest) (*DataC } type ApiRecordDeleteRequest struct { - ctx context.Context + ctx context.Context ApiService RecordAPI - id string + id string } func (r ApiRecordDeleteRequest) Execute() (*http.Response, error) { @@ -266,24 +266,24 @@ RecordDelete Move the DNS resource record to recycle bin. Use this method to move a DNS __Record__ object to the recycle bin. A __Record__ object represents a DNS resource record in an authoritative zone. - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @param id An application specific resource identity of a resource - @return ApiRecordDeleteRequest + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id An application specific resource identity of a resource + @return ApiRecordDeleteRequest */ func (a *RecordAPIService) RecordDelete(ctx context.Context, id string) ApiRecordDeleteRequest { return ApiRecordDeleteRequest{ ApiService: a, - ctx: ctx, - id: id, + ctx: ctx, + id: id, } } // Execute executes the request func (a *RecordAPIService) RecordDeleteExecute(r ApiRecordDeleteRequest) (*http.Response, error) { var ( - localVarHTTPMethod = http.MethodDelete - localVarPostBody interface{} - formFiles []internal.FormFile + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []internal.FormFile ) localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "RecordAPIService.RecordDelete") @@ -355,50 +355,50 @@ func (a *RecordAPIService) RecordDeleteExecute(r ApiRecordDeleteRequest) (*http. } type ApiRecordListRequest struct { - ctx context.Context + ctx context.Context ApiService RecordAPI - fields *string - filter *string - offset *int32 - limit *int32 - pageToken *string - orderBy *string - tfilter *string - torderBy *string - inherit *string -} - -// A collection of response resources can be transformed by specifying a set of JSON tags to be returned. For a “flat” resource, the tag name is straightforward. If field selection is allowed on non-flat hierarchical resources, the service should implement a qualified naming scheme such as dot-qualification to reference data down the hierarchy. If a resource does not have the specified tag, the tag does not appear in the output resource. Specify this parameter as a comma-separated list of JSON tag names. + fields *string + filter *string + offset *int32 + limit *int32 + pageToken *string + orderBy *string + tfilter *string + torderBy *string + inherit *string +} + +// A collection of response resources can be transformed by specifying a set of JSON tags to be returned. For a “flat” resource, the tag name is straightforward. If field selection is allowed on non-flat hierarchical resources, the service should implement a qualified naming scheme such as dot-qualification to reference data down the hierarchy. If a resource does not have the specified tag, the tag does not appear in the output resource. Specify this parameter as a comma-separated list of JSON tag names. func (r ApiRecordListRequest) Fields(fields string) ApiRecordListRequest { r.fields = &fields return r } -// A collection of response resources can be filtered by a logical expression string that includes JSON tag references to values in each resource, literal values, and logical operators. If a resource does not have the specified tag, its value is assumed to be null. Literal values include numbers (integer and floating-point), and quoted (both single- or double-quoted) literal strings, and 'null'. The following operators are commonly used in filter expressions: | Op | Description | | -- | ----------- | | == | Equal | | != | Not Equal | | > | Greater Than | | >= | Greater Than or Equal To | | < | Less Than | | <= | Less Than or Equal To | | and | Logical AND | | ~ | Matches Regex | | !~ | Does Not Match Regex | | or | Logical OR | | not | Logical NOT | | () | Groupping Operators | +// A collection of response resources can be filtered by a logical expression string that includes JSON tag references to values in each resource, literal values, and logical operators. If a resource does not have the specified tag, its value is assumed to be null. Literal values include numbers (integer and floating-point), and quoted (both single- or double-quoted) literal strings, and 'null'. The following operators are commonly used in filter expressions: | Op | Description | | -- | ----------- | | == | Equal | | != | Not Equal | | > | Greater Than | | >= | Greater Than or Equal To | | < | Less Than | | <= | Less Than or Equal To | | and | Logical AND | | ~ | Matches Regex | | !~ | Does Not Match Regex | | or | Logical OR | | not | Logical NOT | | () | Groupping Operators | func (r ApiRecordListRequest) Filter(filter string) ApiRecordListRequest { r.filter = &filter return r } -// The integer index (zero-origin) of the offset into a collection of resources. If omitted or null the value is assumed to be '0'. +// The integer index (zero-origin) of the offset into a collection of resources. If omitted or null the value is assumed to be '0'. func (r ApiRecordListRequest) Offset(offset int32) ApiRecordListRequest { r.offset = &offset return r } -// The integer number of resources to be returned in the response. The service may impose maximum value. If omitted the service may impose a default value. +// The integer number of resources to be returned in the response. The service may impose maximum value. If omitted the service may impose a default value. func (r ApiRecordListRequest) Limit(limit int32) ApiRecordListRequest { r.limit = &limit return r } -// The service-defined string used to identify a page of resources. A null value indicates the first page. +// The service-defined string used to identify a page of resources. A null value indicates the first page. func (r ApiRecordListRequest) PageToken(pageToken string) ApiRecordListRequest { r.pageToken = &pageToken return r } -// A collection of response resources can be sorted by their JSON tags. For a 'flat' resource, the tag name is straightforward. If sorting is allowed on non-flat hierarchical resources, the service should implement a qualified naming scheme such as dot-qualification to reference data down the hierarchy. If a resource does not have the specified tag, its value is assumed to be null.) Specify this parameter as a comma-separated list of JSON tag names. The sort direction can be specified by a suffix separated by whitespace before the tag name. The suffix 'asc' sorts the data in ascending order. The suffix 'desc' sorts the data in descending order. If no suffix is specified the data is sorted in ascending order. +// A collection of response resources can be sorted by their JSON tags. For a 'flat' resource, the tag name is straightforward. If sorting is allowed on non-flat hierarchical resources, the service should implement a qualified naming scheme such as dot-qualification to reference data down the hierarchy. If a resource does not have the specified tag, its value is assumed to be null.) Specify this parameter as a comma-separated list of JSON tag names. The sort direction can be specified by a suffix separated by whitespace before the tag name. The suffix 'asc' sorts the data in ascending order. The suffix 'desc' sorts the data in descending order. If no suffix is specified the data is sorted in ascending order. func (r ApiRecordListRequest) OrderBy(orderBy string) ApiRecordListRequest { r.orderBy = &orderBy return r @@ -432,25 +432,24 @@ RecordList Retrieve DNS resource records. Use this method to retrieve DNS __Record__ objects. A __Record__ object represents a DNS resource record in an authoritative zone. - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @return ApiRecordListRequest + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiRecordListRequest */ func (a *RecordAPIService) RecordList(ctx context.Context) ApiRecordListRequest { return ApiRecordListRequest{ ApiService: a, - ctx: ctx, + ctx: ctx, } } // Execute executes the request -// -// @return DataListRecordResponse +// @return DataListRecordResponse func (a *RecordAPIService) RecordListExecute(r ApiRecordListRequest) (*DataListRecordResponse, *http.Response, error) { var ( - localVarHTTPMethod = http.MethodGet - localVarPostBody interface{} - formFiles []internal.FormFile - localVarReturnValue *DataListRecordResponse + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []internal.FormFile + localVarReturnValue *DataListRecordResponse ) localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "RecordAPIService.RecordList") @@ -554,14 +553,14 @@ func (a *RecordAPIService) RecordListExecute(r ApiRecordListRequest) (*DataListR } type ApiRecordReadRequest struct { - ctx context.Context + ctx context.Context ApiService RecordAPI - id string - fields *string - inherit *string + id string + fields *string + inherit *string } -// A collection of response resources can be transformed by specifying a set of JSON tags to be returned. For a “flat” resource, the tag name is straightforward. If field selection is allowed on non-flat hierarchical resources, the service should implement a qualified naming scheme such as dot-qualification to reference data down the hierarchy. If a resource does not have the specified tag, the tag does not appear in the output resource. Specify this parameter as a comma-separated list of JSON tag names. +// A collection of response resources can be transformed by specifying a set of JSON tags to be returned. For a “flat” resource, the tag name is straightforward. If field selection is allowed on non-flat hierarchical resources, the service should implement a qualified naming scheme such as dot-qualification to reference data down the hierarchy. If a resource does not have the specified tag, the tag does not appear in the output resource. Specify this parameter as a comma-separated list of JSON tag names. func (r ApiRecordReadRequest) Fields(fields string) ApiRecordReadRequest { r.fields = &fields return r @@ -583,27 +582,26 @@ RecordRead Retrieve the DNS resource record. Use this method to retrieve a DNS __Record__ object. A __Record__ object represents a DNS resource record in an authoritative zone. - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @param id An application specific resource identity of a resource - @return ApiRecordReadRequest + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id An application specific resource identity of a resource + @return ApiRecordReadRequest */ func (a *RecordAPIService) RecordRead(ctx context.Context, id string) ApiRecordReadRequest { return ApiRecordReadRequest{ ApiService: a, - ctx: ctx, - id: id, + ctx: ctx, + id: id, } } // Execute executes the request -// -// @return DataReadRecordResponse +// @return DataReadRecordResponse func (a *RecordAPIService) RecordReadExecute(r ApiRecordReadRequest) (*DataReadRecordResponse, *http.Response, error) { var ( - localVarHTTPMethod = http.MethodGet - localVarPostBody interface{} - formFiles []internal.FormFile - localVarReturnValue *DataReadRecordResponse + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []internal.FormFile + localVarReturnValue *DataReadRecordResponse ) localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "RecordAPIService.RecordRead") @@ -687,10 +685,10 @@ func (a *RecordAPIService) RecordReadExecute(r ApiRecordReadRequest) (*DataReadR } type ApiRecordSOASerialIncrementRequest struct { - ctx context.Context + ctx context.Context ApiService RecordAPI - id string - body *DataSOASerialIncrementRequest + id string + body *DataSOASerialIncrementRequest } func (r ApiRecordSOASerialIncrementRequest) Body(body DataSOASerialIncrementRequest) ApiRecordSOASerialIncrementRequest { @@ -708,27 +706,26 @@ RecordSOASerialIncrement Increment serial number for the SOA record. Use this method to increment the serial number for an SOA (Start of Authority) _Record_ object. A __Record__ object represents a DNS resource record in an authoritative zone. - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @param id An application specific resource identity of a resource - @return ApiRecordSOASerialIncrementRequest + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id An application specific resource identity of a resource + @return ApiRecordSOASerialIncrementRequest */ func (a *RecordAPIService) RecordSOASerialIncrement(ctx context.Context, id string) ApiRecordSOASerialIncrementRequest { return ApiRecordSOASerialIncrementRequest{ ApiService: a, - ctx: ctx, - id: id, + ctx: ctx, + id: id, } } // Execute executes the request -// -// @return DataSOASerialIncrementResponse +// @return DataSOASerialIncrementResponse func (a *RecordAPIService) RecordSOASerialIncrementExecute(r ApiRecordSOASerialIncrementRequest) (*DataSOASerialIncrementResponse, *http.Response, error) { var ( - localVarHTTPMethod = http.MethodPost - localVarPostBody interface{} - formFiles []internal.FormFile - localVarReturnValue *DataSOASerialIncrementResponse + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []internal.FormFile + localVarReturnValue *DataSOASerialIncrementResponse ) localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "RecordAPIService.RecordSOASerialIncrement") @@ -811,11 +808,11 @@ func (a *RecordAPIService) RecordSOASerialIncrementExecute(r ApiRecordSOASerialI } type ApiRecordUpdateRequest struct { - ctx context.Context + ctx context.Context ApiService RecordAPI - id string - body *DataRecord - inherit *string + id string + body *DataRecord + inherit *string } func (r ApiRecordUpdateRequest) Body(body DataRecord) ApiRecordUpdateRequest { @@ -839,27 +836,26 @@ RecordUpdate Update the DNS resource record. Use this method to update a DNS __Record__ object. A __Record__ object represents a DNS resource record in an authoritative zone. - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @param id An application specific resource identity of a resource - @return ApiRecordUpdateRequest + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id An application specific resource identity of a resource + @return ApiRecordUpdateRequest */ func (a *RecordAPIService) RecordUpdate(ctx context.Context, id string) ApiRecordUpdateRequest { return ApiRecordUpdateRequest{ ApiService: a, - ctx: ctx, - id: id, + ctx: ctx, + id: id, } } // Execute executes the request -// -// @return DataUpdateRecordResponse +// @return DataUpdateRecordResponse func (a *RecordAPIService) RecordUpdateExecute(r ApiRecordUpdateRequest) (*DataUpdateRecordResponse, *http.Response, error) { var ( - localVarHTTPMethod = http.MethodPatch - localVarPostBody interface{} - formFiles []internal.FormFile - localVarReturnValue *DataUpdateRecordResponse + localVarHTTPMethod = http.MethodPatch + localVarPostBody interface{} + formFiles []internal.FormFile + localVarReturnValue *DataUpdateRecordResponse ) localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "RecordAPIService.RecordUpdate") diff --git a/dns_data/docs/RecordAPI.md b/dns_data/docs/RecordAPI.md index 9a09e0e..1b08a69 100644 --- a/dns_data/docs/RecordAPI.md +++ b/dns_data/docs/RecordAPI.md @@ -27,25 +27,25 @@ Create the DNS resource record. package main import ( - "context" - "fmt" - "os" - openapiclient "github.com/infobloxopen/bloxone-go-client" + "context" + "fmt" + "os" + openapiclient "github.com/infobloxopen/bloxone-go-client" ) func main() { - body := *openapiclient.NewDataRecord(map[string]interface{}(123)) // DataRecord | - inherit := "inherit_example" // string | This parameter is used for getting inheritance_sources. (optional) - - configuration := openapiclient.NewConfiguration() - apiClient := openapiclient.NewAPIClient(configuration) - resp, r, err := apiClient.RecordAPI.RecordCreate(context.Background()).Body(body).Inherit(inherit).Execute() - if err != nil { - fmt.Fprintf(os.Stderr, "Error when calling `RecordAPI.RecordCreate``: %v\n", err) - fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) - } - // response from `RecordCreate`: DataCreateRecordResponse - fmt.Fprintf(os.Stdout, "Response from `RecordAPI.RecordCreate`: %v\n", resp) + body := *openapiclient.NewDataRecord(map[string]interface{}(123)) // DataRecord | + inherit := "inherit_example" // string | This parameter is used for getting inheritance_sources. (optional) + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.RecordAPI.RecordCreate(context.Background()).Body(body).Inherit(inherit).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `RecordAPI.RecordCreate``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `RecordCreate`: DataCreateRecordResponse + fmt.Fprintf(os.Stdout, "Response from `RecordAPI.RecordCreate`: %v\n", resp) } ``` @@ -95,22 +95,22 @@ Move the DNS resource record to recycle bin. package main import ( - "context" - "fmt" - "os" - openapiclient "github.com/infobloxopen/bloxone-go-client" + "context" + "fmt" + "os" + openapiclient "github.com/infobloxopen/bloxone-go-client" ) func main() { - id := "id_example" // string | An application specific resource identity of a resource - - configuration := openapiclient.NewConfiguration() - apiClient := openapiclient.NewAPIClient(configuration) - r, err := apiClient.RecordAPI.RecordDelete(context.Background(), id).Execute() - if err != nil { - fmt.Fprintf(os.Stderr, "Error when calling `RecordAPI.RecordDelete``: %v\n", err) - fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) - } + id := "id_example" // string | An application specific resource identity of a resource + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + r, err := apiClient.RecordAPI.RecordDelete(context.Background(), id).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `RecordAPI.RecordDelete``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } } ``` @@ -163,32 +163,32 @@ Retrieve DNS resource records. package main import ( - "context" - "fmt" - "os" - openapiclient "github.com/infobloxopen/bloxone-go-client" + "context" + "fmt" + "os" + openapiclient "github.com/infobloxopen/bloxone-go-client" ) func main() { - fields := "fields_example" // string | A collection of response resources can be transformed by specifying a set of JSON tags to be returned. For a “flat” resource, the tag name is straightforward. If field selection is allowed on non-flat hierarchical resources, the service should implement a qualified naming scheme such as dot-qualification to reference data down the hierarchy. If a resource does not have the specified tag, the tag does not appear in the output resource. Specify this parameter as a comma-separated list of JSON tag names. (optional) - filter := "filter_example" // string | A collection of response resources can be filtered by a logical expression string that includes JSON tag references to values in each resource, literal values, and logical operators. If a resource does not have the specified tag, its value is assumed to be null. Literal values include numbers (integer and floating-point), and quoted (both single- or double-quoted) literal strings, and 'null'. The following operators are commonly used in filter expressions: | Op | Description | | -- | ----------- | | == | Equal | | != | Not Equal | | > | Greater Than | | >= | Greater Than or Equal To | | < | Less Than | | <= | Less Than or Equal To | | and | Logical AND | | ~ | Matches Regex | | !~ | Does Not Match Regex | | or | Logical OR | | not | Logical NOT | | () | Groupping Operators | (optional) - offset := int32(56) // int32 | The integer index (zero-origin) of the offset into a collection of resources. If omitted or null the value is assumed to be '0'. (optional) - limit := int32(56) // int32 | The integer number of resources to be returned in the response. The service may impose maximum value. If omitted the service may impose a default value. (optional) - pageToken := "pageToken_example" // string | The service-defined string used to identify a page of resources. A null value indicates the first page. (optional) - orderBy := "orderBy_example" // string | A collection of response resources can be sorted by their JSON tags. For a 'flat' resource, the tag name is straightforward. If sorting is allowed on non-flat hierarchical resources, the service should implement a qualified naming scheme such as dot-qualification to reference data down the hierarchy. If a resource does not have the specified tag, its value is assumed to be null.) Specify this parameter as a comma-separated list of JSON tag names. The sort direction can be specified by a suffix separated by whitespace before the tag name. The suffix 'asc' sorts the data in ascending order. The suffix 'desc' sorts the data in descending order. If no suffix is specified the data is sorted in ascending order. (optional) - tfilter := "tfilter_example" // string | This parameter is used for filtering by tags. (optional) - torderBy := "torderBy_example" // string | This parameter is used for sorting by tags. (optional) - inherit := "inherit_example" // string | This parameter is used for getting inheritance_sources. (optional) - - configuration := openapiclient.NewConfiguration() - apiClient := openapiclient.NewAPIClient(configuration) - resp, r, err := apiClient.RecordAPI.RecordList(context.Background()).Fields(fields).Filter(filter).Offset(offset).Limit(limit).PageToken(pageToken).OrderBy(orderBy).Tfilter(tfilter).TorderBy(torderBy).Inherit(inherit).Execute() - if err != nil { - fmt.Fprintf(os.Stderr, "Error when calling `RecordAPI.RecordList``: %v\n", err) - fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) - } - // response from `RecordList`: DataListRecordResponse - fmt.Fprintf(os.Stdout, "Response from `RecordAPI.RecordList`: %v\n", resp) + fields := "fields_example" // string | A collection of response resources can be transformed by specifying a set of JSON tags to be returned. For a “flat” resource, the tag name is straightforward. If field selection is allowed on non-flat hierarchical resources, the service should implement a qualified naming scheme such as dot-qualification to reference data down the hierarchy. If a resource does not have the specified tag, the tag does not appear in the output resource. Specify this parameter as a comma-separated list of JSON tag names. (optional) + filter := "filter_example" // string | A collection of response resources can be filtered by a logical expression string that includes JSON tag references to values in each resource, literal values, and logical operators. If a resource does not have the specified tag, its value is assumed to be null. Literal values include numbers (integer and floating-point), and quoted (both single- or double-quoted) literal strings, and 'null'. The following operators are commonly used in filter expressions: | Op | Description | | -- | ----------- | | == | Equal | | != | Not Equal | | > | Greater Than | | >= | Greater Than or Equal To | | < | Less Than | | <= | Less Than or Equal To | | and | Logical AND | | ~ | Matches Regex | | !~ | Does Not Match Regex | | or | Logical OR | | not | Logical NOT | | () | Groupping Operators | (optional) + offset := int32(56) // int32 | The integer index (zero-origin) of the offset into a collection of resources. If omitted or null the value is assumed to be '0'. (optional) + limit := int32(56) // int32 | The integer number of resources to be returned in the response. The service may impose maximum value. If omitted the service may impose a default value. (optional) + pageToken := "pageToken_example" // string | The service-defined string used to identify a page of resources. A null value indicates the first page. (optional) + orderBy := "orderBy_example" // string | A collection of response resources can be sorted by their JSON tags. For a 'flat' resource, the tag name is straightforward. If sorting is allowed on non-flat hierarchical resources, the service should implement a qualified naming scheme such as dot-qualification to reference data down the hierarchy. If a resource does not have the specified tag, its value is assumed to be null.) Specify this parameter as a comma-separated list of JSON tag names. The sort direction can be specified by a suffix separated by whitespace before the tag name. The suffix 'asc' sorts the data in ascending order. The suffix 'desc' sorts the data in descending order. If no suffix is specified the data is sorted in ascending order. (optional) + tfilter := "tfilter_example" // string | This parameter is used for filtering by tags. (optional) + torderBy := "torderBy_example" // string | This parameter is used for sorting by tags. (optional) + inherit := "inherit_example" // string | This parameter is used for getting inheritance_sources. (optional) + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.RecordAPI.RecordList(context.Background()).Fields(fields).Filter(filter).Offset(offset).Limit(limit).PageToken(pageToken).OrderBy(orderBy).Tfilter(tfilter).TorderBy(torderBy).Inherit(inherit).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `RecordAPI.RecordList``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `RecordList`: DataListRecordResponse + fmt.Fprintf(os.Stdout, "Response from `RecordAPI.RecordList`: %v\n", resp) } ``` @@ -245,26 +245,26 @@ Retrieve the DNS resource record. package main import ( - "context" - "fmt" - "os" - openapiclient "github.com/infobloxopen/bloxone-go-client" + "context" + "fmt" + "os" + openapiclient "github.com/infobloxopen/bloxone-go-client" ) func main() { - id := "id_example" // string | An application specific resource identity of a resource - fields := "fields_example" // string | A collection of response resources can be transformed by specifying a set of JSON tags to be returned. For a “flat” resource, the tag name is straightforward. If field selection is allowed on non-flat hierarchical resources, the service should implement a qualified naming scheme such as dot-qualification to reference data down the hierarchy. If a resource does not have the specified tag, the tag does not appear in the output resource. Specify this parameter as a comma-separated list of JSON tag names. (optional) - inherit := "inherit_example" // string | This parameter is used for getting inheritance_sources. (optional) - - configuration := openapiclient.NewConfiguration() - apiClient := openapiclient.NewAPIClient(configuration) - resp, r, err := apiClient.RecordAPI.RecordRead(context.Background(), id).Fields(fields).Inherit(inherit).Execute() - if err != nil { - fmt.Fprintf(os.Stderr, "Error when calling `RecordAPI.RecordRead``: %v\n", err) - fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) - } - // response from `RecordRead`: DataReadRecordResponse - fmt.Fprintf(os.Stdout, "Response from `RecordAPI.RecordRead`: %v\n", resp) + id := "id_example" // string | An application specific resource identity of a resource + fields := "fields_example" // string | A collection of response resources can be transformed by specifying a set of JSON tags to be returned. For a “flat” resource, the tag name is straightforward. If field selection is allowed on non-flat hierarchical resources, the service should implement a qualified naming scheme such as dot-qualification to reference data down the hierarchy. If a resource does not have the specified tag, the tag does not appear in the output resource. Specify this parameter as a comma-separated list of JSON tag names. (optional) + inherit := "inherit_example" // string | This parameter is used for getting inheritance_sources. (optional) + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.RecordAPI.RecordRead(context.Background(), id).Fields(fields).Inherit(inherit).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `RecordAPI.RecordRead``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `RecordRead`: DataReadRecordResponse + fmt.Fprintf(os.Stdout, "Response from `RecordAPI.RecordRead`: %v\n", resp) } ``` @@ -319,25 +319,25 @@ Increment serial number for the SOA record. package main import ( - "context" - "fmt" - "os" - openapiclient "github.com/infobloxopen/bloxone-go-client" + "context" + "fmt" + "os" + openapiclient "github.com/infobloxopen/bloxone-go-client" ) func main() { - id := "id_example" // string | An application specific resource identity of a resource - body := *openapiclient.NewDataSOASerialIncrementRequest() // DataSOASerialIncrementRequest | - - configuration := openapiclient.NewConfiguration() - apiClient := openapiclient.NewAPIClient(configuration) - resp, r, err := apiClient.RecordAPI.RecordSOASerialIncrement(context.Background(), id).Body(body).Execute() - if err != nil { - fmt.Fprintf(os.Stderr, "Error when calling `RecordAPI.RecordSOASerialIncrement``: %v\n", err) - fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) - } - // response from `RecordSOASerialIncrement`: DataSOASerialIncrementResponse - fmt.Fprintf(os.Stdout, "Response from `RecordAPI.RecordSOASerialIncrement`: %v\n", resp) + id := "id_example" // string | An application specific resource identity of a resource + body := *openapiclient.NewDataSOASerialIncrementRequest() // DataSOASerialIncrementRequest | + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.RecordAPI.RecordSOASerialIncrement(context.Background(), id).Body(body).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `RecordAPI.RecordSOASerialIncrement``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `RecordSOASerialIncrement`: DataSOASerialIncrementResponse + fmt.Fprintf(os.Stdout, "Response from `RecordAPI.RecordSOASerialIncrement`: %v\n", resp) } ``` @@ -391,26 +391,26 @@ Update the DNS resource record. package main import ( - "context" - "fmt" - "os" - openapiclient "github.com/infobloxopen/bloxone-go-client" + "context" + "fmt" + "os" + openapiclient "github.com/infobloxopen/bloxone-go-client" ) func main() { - id := "id_example" // string | An application specific resource identity of a resource - body := *openapiclient.NewDataRecord(map[string]interface{}(123)) // DataRecord | - inherit := "inherit_example" // string | This parameter is used for getting inheritance_sources. (optional) - - configuration := openapiclient.NewConfiguration() - apiClient := openapiclient.NewAPIClient(configuration) - resp, r, err := apiClient.RecordAPI.RecordUpdate(context.Background(), id).Body(body).Inherit(inherit).Execute() - if err != nil { - fmt.Fprintf(os.Stderr, "Error when calling `RecordAPI.RecordUpdate``: %v\n", err) - fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) - } - // response from `RecordUpdate`: DataUpdateRecordResponse - fmt.Fprintf(os.Stdout, "Response from `RecordAPI.RecordUpdate`: %v\n", resp) + id := "id_example" // string | An application specific resource identity of a resource + body := *openapiclient.NewDataRecord(map[string]interface{}(123)) // DataRecord | + inherit := "inherit_example" // string | This parameter is used for getting inheritance_sources. (optional) + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.RecordAPI.RecordUpdate(context.Background(), id).Body(body).Inherit(inherit).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `RecordAPI.RecordUpdate``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `RecordUpdate`: DataUpdateRecordResponse + fmt.Fprintf(os.Stdout, "Response from `RecordAPI.RecordUpdate`: %v\n", resp) } ``` diff --git a/dns_data/model_data_create_record_response.go b/dns_data/model_data_create_record_response.go index 870d899..2914142 100644 --- a/dns_data/model_data_create_record_response.go +++ b/dns_data/model_data_create_record_response.go @@ -1,7 +1,7 @@ /* DNS Data API -The DNS Data is a BloxOne DDI service providing primary authoritative zone support. DNS Data is authoritative for all DNS resource records and is acting as a primary DNS server. It is part of the full-featured, DDI cloud solution that enables customers to deploy large numbers of protocol servers to deliver DNS and DHCP throughout their enterprise network. +The DNS Data is a BloxOne DDI service providing primary authoritative zone support. DNS Data is authoritative for all DNS resource records and is acting as a primary DNS server. It is part of the full-featured, DDI cloud solution that enables customers to deploy large numbers of protocol servers to deliver DNS and DHCP throughout their enterprise network. API version: v1 */ @@ -72,7 +72,7 @@ func (o *DataCreateRecordResponse) SetResult(v DataRecord) { } func (o DataCreateRecordResponse) MarshalJSON() ([]byte, error) { - toSerialize, err := o.ToMap() + toSerialize,err := o.ToMap() if err != nil { return []byte{}, err } @@ -122,3 +122,5 @@ func (v *NullableDataCreateRecordResponse) UnmarshalJSON(src []byte) error { v.isSet = true return json.Unmarshal(src, &v.value) } + + diff --git a/dns_data/model_data_list_record_response.go b/dns_data/model_data_list_record_response.go index e633b11..8ce789e 100644 --- a/dns_data/model_data_list_record_response.go +++ b/dns_data/model_data_list_record_response.go @@ -1,7 +1,7 @@ /* DNS Data API -The DNS Data is a BloxOne DDI service providing primary authoritative zone support. DNS Data is authoritative for all DNS resource records and is acting as a primary DNS server. It is part of the full-featured, DDI cloud solution that enables customers to deploy large numbers of protocol servers to deliver DNS and DHCP throughout their enterprise network. +The DNS Data is a BloxOne DDI service providing primary authoritative zone support. DNS Data is authoritative for all DNS resource records and is acting as a primary DNS server. It is part of the full-featured, DDI cloud solution that enables customers to deploy large numbers of protocol servers to deliver DNS and DHCP throughout their enterprise network. API version: v1 */ @@ -73,7 +73,7 @@ func (o *DataListRecordResponse) SetResults(v []DataRecord) { } func (o DataListRecordResponse) MarshalJSON() ([]byte, error) { - toSerialize, err := o.ToMap() + toSerialize,err := o.ToMap() if err != nil { return []byte{}, err } @@ -123,3 +123,5 @@ func (v *NullableDataListRecordResponse) UnmarshalJSON(src []byte) error { v.isSet = true return json.Unmarshal(src, &v.value) } + + diff --git a/dns_data/model_data_read_record_response.go b/dns_data/model_data_read_record_response.go index 7541c04..57ccdab 100644 --- a/dns_data/model_data_read_record_response.go +++ b/dns_data/model_data_read_record_response.go @@ -1,7 +1,7 @@ /* DNS Data API -The DNS Data is a BloxOne DDI service providing primary authoritative zone support. DNS Data is authoritative for all DNS resource records and is acting as a primary DNS server. It is part of the full-featured, DDI cloud solution that enables customers to deploy large numbers of protocol servers to deliver DNS and DHCP throughout their enterprise network. +The DNS Data is a BloxOne DDI service providing primary authoritative zone support. DNS Data is authoritative for all DNS resource records and is acting as a primary DNS server. It is part of the full-featured, DDI cloud solution that enables customers to deploy large numbers of protocol servers to deliver DNS and DHCP throughout their enterprise network. API version: v1 */ @@ -72,7 +72,7 @@ func (o *DataReadRecordResponse) SetResult(v DataRecord) { } func (o DataReadRecordResponse) MarshalJSON() ([]byte, error) { - toSerialize, err := o.ToMap() + toSerialize,err := o.ToMap() if err != nil { return []byte{}, err } @@ -122,3 +122,5 @@ func (v *NullableDataReadRecordResponse) UnmarshalJSON(src []byte) error { v.isSet = true return json.Unmarshal(src, &v.value) } + + diff --git a/dns_data/model_data_record.go b/dns_data/model_data_record.go index 35e1911..19ea0bd 100644 --- a/dns_data/model_data_record.go +++ b/dns_data/model_data_record.go @@ -1,7 +1,7 @@ /* DNS Data API -The DNS Data is a BloxOne DDI service providing primary authoritative zone support. DNS Data is authoritative for all DNS resource records and is acting as a primary DNS server. It is part of the full-featured, DDI cloud solution that enables customers to deploy large numbers of protocol servers to deliver DNS and DHCP throughout their enterprise network. +The DNS Data is a BloxOne DDI service providing primary authoritative zone support. DNS Data is authoritative for all DNS resource records and is acting as a primary DNS server. It is part of the full-featured, DDI cloud solution that enables customers to deploy large numbers of protocol servers to deliver DNS and DHCP throughout their enterprise network. API version: v1 */ @@ -13,6 +13,8 @@ package dns_data import ( "encoding/json" "time" + "bytes" + "fmt" ) // checks if the DataRecord type satisfies the MappedNullable interface at compile time @@ -41,7 +43,7 @@ type DataRecord struct { // The DNS protocol textual representation of the DNS resource record data. DnsRdata *string `json:"dns_rdata,omitempty"` // The resource identifier. - Id *string `json:"id,omitempty"` + Id *string `json:"id,omitempty"` InheritanceSources *DataRecordInheritance `json:"inheritance_sources,omitempty"` // The resource identifier. IpamHost *string `json:"ipam_host,omitempty"` @@ -73,6 +75,8 @@ type DataRecord struct { Zone *string `json:"zone,omitempty"` } +type _DataRecord DataRecord + // NewDataRecord instantiates a new DataRecord object // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments @@ -916,7 +920,7 @@ func (o *DataRecord) SetZone(v string) { } func (o DataRecord) MarshalJSON() ([]byte, error) { - toSerialize, err := o.ToMap() + toSerialize,err := o.ToMap() if err != nil { return []byte{}, err } @@ -1004,6 +1008,43 @@ func (o DataRecord) ToMap() (map[string]interface{}, error) { return toSerialize, nil } +func (o *DataRecord) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "rdata", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err; + } + + for _, requiredProperty := range(requiredProperties) { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varDataRecord := _DataRecord{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varDataRecord) + + if err != nil { + return err + } + + *o = DataRecord(varDataRecord) + + return err +} + type NullableDataRecord struct { value *DataRecord isSet bool @@ -1039,3 +1080,5 @@ func (v *NullableDataRecord) UnmarshalJSON(src []byte) error { v.isSet = true return json.Unmarshal(src, &v.value) } + + diff --git a/dns_data/model_data_record_inheritance.go b/dns_data/model_data_record_inheritance.go index 55e5209..88f08ec 100644 --- a/dns_data/model_data_record_inheritance.go +++ b/dns_data/model_data_record_inheritance.go @@ -1,7 +1,7 @@ /* DNS Data API -The DNS Data is a BloxOne DDI service providing primary authoritative zone support. DNS Data is authoritative for all DNS resource records and is acting as a primary DNS server. It is part of the full-featured, DDI cloud solution that enables customers to deploy large numbers of protocol servers to deliver DNS and DHCP throughout their enterprise network. +The DNS Data is a BloxOne DDI service providing primary authoritative zone support. DNS Data is authoritative for all DNS resource records and is acting as a primary DNS server. It is part of the full-featured, DDI cloud solution that enables customers to deploy large numbers of protocol servers to deliver DNS and DHCP throughout their enterprise network. API version: v1 */ @@ -72,7 +72,7 @@ func (o *DataRecordInheritance) SetTtl(v Inheritance2InheritedUInt32) { } func (o DataRecordInheritance) MarshalJSON() ([]byte, error) { - toSerialize, err := o.ToMap() + toSerialize,err := o.ToMap() if err != nil { return []byte{}, err } @@ -122,3 +122,5 @@ func (v *NullableDataRecordInheritance) UnmarshalJSON(src []byte) error { v.isSet = true return json.Unmarshal(src, &v.value) } + + diff --git a/dns_data/model_data_soa_serial_increment_request.go b/dns_data/model_data_soa_serial_increment_request.go index ce4dabf..2ae5f8c 100644 --- a/dns_data/model_data_soa_serial_increment_request.go +++ b/dns_data/model_data_soa_serial_increment_request.go @@ -1,7 +1,7 @@ /* DNS Data API -The DNS Data is a BloxOne DDI service providing primary authoritative zone support. DNS Data is authoritative for all DNS resource records and is acting as a primary DNS server. It is part of the full-featured, DDI cloud solution that enables customers to deploy large numbers of protocol servers to deliver DNS and DHCP throughout their enterprise network. +The DNS Data is a BloxOne DDI service providing primary authoritative zone support. DNS Data is authoritative for all DNS resource records and is acting as a primary DNS server. It is part of the full-featured, DDI cloud solution that enables customers to deploy large numbers of protocol servers to deliver DNS and DHCP throughout their enterprise network. API version: v1 */ @@ -140,7 +140,7 @@ func (o *DataSOASerialIncrementRequest) SetSerialIncrement(v int64) { } func (o DataSOASerialIncrementRequest) MarshalJSON() ([]byte, error) { - toSerialize, err := o.ToMap() + toSerialize,err := o.ToMap() if err != nil { return []byte{}, err } @@ -196,3 +196,5 @@ func (v *NullableDataSOASerialIncrementRequest) UnmarshalJSON(src []byte) error v.isSet = true return json.Unmarshal(src, &v.value) } + + diff --git a/dns_data/model_data_soa_serial_increment_response.go b/dns_data/model_data_soa_serial_increment_response.go index 352d117..cc83af7 100644 --- a/dns_data/model_data_soa_serial_increment_response.go +++ b/dns_data/model_data_soa_serial_increment_response.go @@ -1,7 +1,7 @@ /* DNS Data API -The DNS Data is a BloxOne DDI service providing primary authoritative zone support. DNS Data is authoritative for all DNS resource records and is acting as a primary DNS server. It is part of the full-featured, DDI cloud solution that enables customers to deploy large numbers of protocol servers to deliver DNS and DHCP throughout their enterprise network. +The DNS Data is a BloxOne DDI service providing primary authoritative zone support. DNS Data is authoritative for all DNS resource records and is acting as a primary DNS server. It is part of the full-featured, DDI cloud solution that enables customers to deploy large numbers of protocol servers to deliver DNS and DHCP throughout their enterprise network. API version: v1 */ @@ -72,7 +72,7 @@ func (o *DataSOASerialIncrementResponse) SetResult(v DataRecord) { } func (o DataSOASerialIncrementResponse) MarshalJSON() ([]byte, error) { - toSerialize, err := o.ToMap() + toSerialize,err := o.ToMap() if err != nil { return []byte{}, err } @@ -122,3 +122,5 @@ func (v *NullableDataSOASerialIncrementResponse) UnmarshalJSON(src []byte) error v.isSet = true return json.Unmarshal(src, &v.value) } + + diff --git a/dns_data/model_data_update_record_response.go b/dns_data/model_data_update_record_response.go index aca7ee5..ac6d08d 100644 --- a/dns_data/model_data_update_record_response.go +++ b/dns_data/model_data_update_record_response.go @@ -1,7 +1,7 @@ /* DNS Data API -The DNS Data is a BloxOne DDI service providing primary authoritative zone support. DNS Data is authoritative for all DNS resource records and is acting as a primary DNS server. It is part of the full-featured, DDI cloud solution that enables customers to deploy large numbers of protocol servers to deliver DNS and DHCP throughout their enterprise network. +The DNS Data is a BloxOne DDI service providing primary authoritative zone support. DNS Data is authoritative for all DNS resource records and is acting as a primary DNS server. It is part of the full-featured, DDI cloud solution that enables customers to deploy large numbers of protocol servers to deliver DNS and DHCP throughout their enterprise network. API version: v1 */ @@ -72,7 +72,7 @@ func (o *DataUpdateRecordResponse) SetResult(v DataRecord) { } func (o DataUpdateRecordResponse) MarshalJSON() ([]byte, error) { - toSerialize, err := o.ToMap() + toSerialize,err := o.ToMap() if err != nil { return []byte{}, err } @@ -122,3 +122,5 @@ func (v *NullableDataUpdateRecordResponse) UnmarshalJSON(src []byte) error { v.isSet = true return json.Unmarshal(src, &v.value) } + + diff --git a/dns_data/model_inheritance2_inherited_u_int32.go b/dns_data/model_inheritance2_inherited_u_int32.go index c23f897..9d2885f 100644 --- a/dns_data/model_inheritance2_inherited_u_int32.go +++ b/dns_data/model_inheritance2_inherited_u_int32.go @@ -1,7 +1,7 @@ /* DNS Data API -The DNS Data is a BloxOne DDI service providing primary authoritative zone support. DNS Data is authoritative for all DNS resource records and is acting as a primary DNS server. It is part of the full-featured, DDI cloud solution that enables customers to deploy large numbers of protocol servers to deliver DNS and DHCP throughout their enterprise network. +The DNS Data is a BloxOne DDI service providing primary authoritative zone support. DNS Data is authoritative for all DNS resource records and is acting as a primary DNS server. It is part of the full-featured, DDI cloud solution that enables customers to deploy large numbers of protocol servers to deliver DNS and DHCP throughout their enterprise network. API version: v1 */ @@ -175,7 +175,7 @@ func (o *Inheritance2InheritedUInt32) SetValue(v int64) { } func (o Inheritance2InheritedUInt32) MarshalJSON() ([]byte, error) { - toSerialize, err := o.ToMap() + toSerialize,err := o.ToMap() if err != nil { return []byte{}, err } @@ -234,3 +234,5 @@ func (v *NullableInheritance2InheritedUInt32) UnmarshalJSON(src []byte) error { v.isSet = true return json.Unmarshal(src, &v.value) } + + diff --git a/dns_data/model_protobuf_field_mask.go b/dns_data/model_protobuf_field_mask.go index 17ded5d..21401df 100644 --- a/dns_data/model_protobuf_field_mask.go +++ b/dns_data/model_protobuf_field_mask.go @@ -1,7 +1,7 @@ /* DNS Data API -The DNS Data is a BloxOne DDI service providing primary authoritative zone support. DNS Data is authoritative for all DNS resource records and is acting as a primary DNS server. It is part of the full-featured, DDI cloud solution that enables customers to deploy large numbers of protocol servers to deliver DNS and DHCP throughout their enterprise network. +The DNS Data is a BloxOne DDI service providing primary authoritative zone support. DNS Data is authoritative for all DNS resource records and is acting as a primary DNS server. It is part of the full-featured, DDI cloud solution that enables customers to deploy large numbers of protocol servers to deliver DNS and DHCP throughout their enterprise network. API version: v1 */ @@ -73,7 +73,7 @@ func (o *ProtobufFieldMask) SetPaths(v []string) { } func (o ProtobufFieldMask) MarshalJSON() ([]byte, error) { - toSerialize, err := o.ToMap() + toSerialize,err := o.ToMap() if err != nil { return []byte{}, err } @@ -123,3 +123,5 @@ func (v *NullableProtobufFieldMask) UnmarshalJSON(src []byte) error { v.isSet = true return json.Unmarshal(src, &v.value) } + + diff --git a/dns_data/test/api_record_test.go b/dns_data/test/api_record_test.go index 8d3ff42..bc33028 100644 --- a/dns_data/test/api_record_test.go +++ b/dns_data/test/api_record_test.go @@ -7,101 +7,182 @@ Testing RecordAPIService // Code generated by OpenAPI Generator (https://openapi-generator.tech); -package dns_data +package dns_data_test import ( + "bytes" "context" + "encoding/json" + "io" + "net/http" "testing" - "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" openapiclient "github.com/infobloxopen/bloxone-go-client/dns_data" "github.com/infobloxopen/bloxone-go-client/internal" ) -func Test_dns_data_RecordAPIService(t *testing.T) { +var DataRecord_Post = openapiclient.DataRecord{ + Id: openapiclient.PtrString("DataRecordPost"), +} +var DataSOASerialIncrementRequest_Post = openapiclient.DataSOASerialIncrementRequest{ + Id: openapiclient.PtrString("IncrementRequest"), +} +var DataRecord_Patch = openapiclient.DataRecord{ + Id: openapiclient.PtrString("DataRecordPatch"), +} - configuration := internal.NewConfiguration() - apiClient := openapiclient.NewAPIClient(configuration) +func Test_dns_data_RecordAPIService(t *testing.T) { t.Run("Test RecordAPIService RecordCreate", func(t *testing.T) { - - t.Skip("skip test") // remove to run test - - resp, httpRes, err := apiClient.RecordAPI.RecordCreate(context.Background()).Execute() - + configuration := internal.NewConfiguration() + configuration.HTTPClient = internal.NewTestClient(func(req *http.Request) *http.Response { + require.Equal(t, http.MethodPost, req.Method) + require.Equal(t, "/api/ddi/v1/dns/record", req.URL.Path) + require.Equal(t, "application/json", req.Header.Get("Content-Type")) + + var reqBody openapiclient.DataRecord + require.NoError(t, json.NewDecoder(req.Body).Decode(&reqBody)) + require.Equal(t, DataRecord_Post, reqBody) + + response := openapiclient.DataCreateRecordResponse{} + body, err := json.Marshal(response) + require.NoError(t, err) + + return &http.Response{ + StatusCode: http.StatusOK, + Body: io.NopCloser(bytes.NewReader(body)), + Header: map[string][]string{"Content-Type": {"application/json"}}, + } + }) + apiClient := openapiclient.NewAPIClient(configuration) + resp, httpRes, err := apiClient.RecordAPI.RecordCreate(context.Background()).Body(DataRecord_Post).Execute() require.Nil(t, err) require.NotNil(t, resp) - assert.Equal(t, 200, httpRes.StatusCode) - + require.Equal(t, http.StatusOK, httpRes.StatusCode) }) t.Run("Test RecordAPIService RecordDelete", func(t *testing.T) { - - t.Skip("skip test") // remove to run test - - var id string - - httpRes, err := apiClient.RecordAPI.RecordDelete(context.Background(), id).Execute() - + configuration := internal.NewConfiguration() + configuration.HTTPClient = internal.NewTestClient(func(req *http.Request) *http.Response { + require.Equal(t, http.MethodDelete, req.Method) + require.Equal(t, "/api/ddi/v1/dns/record/"+*DataRecord_Post.Id, req.URL.Path) + + return &http.Response{ + StatusCode: http.StatusOK, + Body: io.NopCloser(bytes.NewReader([]byte{})), + Header: map[string][]string{"Content-Type": {"application/json"}}, + } + }) + apiClient := openapiclient.NewAPIClient(configuration) + httpRes, err := apiClient.RecordAPI.RecordDelete(context.Background(), *DataRecord_Post.Id).Execute() require.Nil(t, err) - assert.Equal(t, 200, httpRes.StatusCode) - + require.Equal(t, http.StatusOK, httpRes.StatusCode) }) t.Run("Test RecordAPIService RecordList", func(t *testing.T) { - - t.Skip("skip test") // remove to run test - + configuration := internal.NewConfiguration() + configuration.HTTPClient = internal.NewTestClient(func(req *http.Request) *http.Response { + require.Equal(t, http.MethodGet, req.Method) + require.Equal(t, "/api/ddi/v1/dns/record", req.URL.Path) + require.Equal(t, "application/json", req.Header.Get("Accept")) + + response := openapiclient.DataListRecordResponse{} + body, err := json.Marshal(response) + require.NoError(t, err) + + return &http.Response{ + StatusCode: http.StatusOK, + Body: io.NopCloser(bytes.NewReader(body)), + Header: map[string][]string{"Content-Type": {"application/json"}}, + } + }) + apiClient := openapiclient.NewAPIClient(configuration) resp, httpRes, err := apiClient.RecordAPI.RecordList(context.Background()).Execute() - require.Nil(t, err) require.NotNil(t, resp) - assert.Equal(t, 200, httpRes.StatusCode) - + require.Equal(t, http.StatusOK, httpRes.StatusCode) }) t.Run("Test RecordAPIService RecordRead", func(t *testing.T) { - - t.Skip("skip test") // remove to run test - - var id string - - resp, httpRes, err := apiClient.RecordAPI.RecordRead(context.Background(), id).Execute() - + configuration := internal.NewConfiguration() + configuration.HTTPClient = internal.NewTestClient(func(req *http.Request) *http.Response { + require.Equal(t, http.MethodGet, req.Method) + require.Equal(t, "/api/ddi/v1/dns/record/"+*DataRecord_Post.Id, req.URL.Path) + require.Equal(t, "application/json", req.Header.Get("Accept")) + + response := openapiclient.DataReadRecordResponse{} + body, err := json.Marshal(response) + require.NoError(t, err) + + return &http.Response{ + StatusCode: http.StatusOK, + Body: io.NopCloser(bytes.NewReader(body)), + Header: map[string][]string{"Content-Type": {"application/json"}}, + } + }) + apiClient := openapiclient.NewAPIClient(configuration) + resp, httpRes, err := apiClient.RecordAPI.RecordRead(context.Background(), *DataRecord_Post.Id).Execute() require.Nil(t, err) require.NotNil(t, resp) - assert.Equal(t, 200, httpRes.StatusCode) - + require.Equal(t, http.StatusOK, httpRes.StatusCode) }) t.Run("Test RecordAPIService RecordSOASerialIncrement", func(t *testing.T) { - - t.Skip("skip test") // remove to run test - - var id string - - resp, httpRes, err := apiClient.RecordAPI.RecordSOASerialIncrement(context.Background(), id).Execute() - + configuration := internal.NewConfiguration() + configuration.HTTPClient = internal.NewTestClient(func(req *http.Request) *http.Response { + require.Equal(t, http.MethodPost, req.Method) + require.Equal(t, "/api/ddi/v1/dns/record/"+*DataSOASerialIncrementRequest_Post.Id+"/serial_increment", req.URL.Path) + require.Equal(t, "application/json", req.Header.Get("Content-Type")) + + var reqBody openapiclient.DataSOASerialIncrementRequest + require.NoError(t, json.NewDecoder(req.Body).Decode(&reqBody)) + require.Equal(t, DataSOASerialIncrementRequest_Post, reqBody) + + response := openapiclient.DataSOASerialIncrementResponse{} + body, err := json.Marshal(response) + require.NoError(t, err) + + return &http.Response{ + StatusCode: http.StatusOK, + Body: io.NopCloser(bytes.NewReader(body)), + Header: map[string][]string{"Content-Type": {"application/json"}}, + } + }) + apiClient := openapiclient.NewAPIClient(configuration) + resp, httpRes, err := apiClient.RecordAPI.RecordSOASerialIncrement(context.Background(), *DataSOASerialIncrementRequest_Post.Id).Body(DataSOASerialIncrementRequest_Post).Execute() require.Nil(t, err) require.NotNil(t, resp) - assert.Equal(t, 200, httpRes.StatusCode) - + require.Equal(t, http.StatusOK, httpRes.StatusCode) }) t.Run("Test RecordAPIService RecordUpdate", func(t *testing.T) { - - t.Skip("skip test") // remove to run test - - var id string - - resp, httpRes, err := apiClient.RecordAPI.RecordUpdate(context.Background(), id).Execute() - + configuration := internal.NewConfiguration() + configuration.HTTPClient = internal.NewTestClient(func(req *http.Request) *http.Response { + require.Equal(t, http.MethodPatch, req.Method) + require.Equal(t, "/api/ddi/v1/dns/record/"+*DataRecord_Patch.Id, req.URL.Path) + require.Equal(t, "application/json", req.Header.Get("Content-Type")) + + var reqBody openapiclient.DataRecord + require.NoError(t, json.NewDecoder(req.Body).Decode(&reqBody)) + require.Equal(t, DataRecord_Patch, reqBody) + + response := openapiclient.DataUpdateRecordResponse{} + body, err := json.Marshal(response) + require.NoError(t, err) + + return &http.Response{ + StatusCode: http.StatusOK, + Body: io.NopCloser(bytes.NewReader(body)), + Header: map[string][]string{"Content-Type": {"application/json"}}, + } + }) + apiClient := openapiclient.NewAPIClient(configuration) + resp, httpRes, err := apiClient.RecordAPI.RecordUpdate(context.Background(), *DataRecord_Patch.Id).Body(DataRecord_Patch).Execute() require.Nil(t, err) require.NotNil(t, resp) - assert.Equal(t, 200, httpRes.StatusCode) - + require.Equal(t, http.StatusOK, httpRes.StatusCode) }) } diff --git a/internal/utils.go b/internal/utils.go index 3600f5b..da62760 100644 --- a/internal/utils.go +++ b/internal/utils.go @@ -1,5 +1,19 @@ package internal +import "net/http" + type MappedNullable interface { ToMap() (map[string]interface{}, error) } + +type RoundTripFunc func(req *http.Request) *http.Response + +func (f RoundTripFunc) RoundTrip(req *http.Request) (*http.Response, error) { + return f(req), nil +} + +func NewTestClient(testFn RoundTripFunc) *http.Client { + return &http.Client{ + Transport: RoundTripFunc(testFn), + } +} diff --git a/keys/.openapi-generator/FILES b/keys/.openapi-generator/FILES index a5d04a4..8cf4475 100644 --- a/keys/.openapi-generator/FILES +++ b/keys/.openapi-generator/FILES @@ -40,6 +40,5 @@ model_keys_update_tsig_key_response.go model_protobuf_field_mask.go model_upload_content_type.go model_upload_request.go -test/api_generate_tsig_test.go test/api_upload_test.go utils.go diff --git a/keys/README.md b/keys/README.md index 20dc152..7653042 100644 --- a/keys/README.md +++ b/keys/README.md @@ -15,20 +15,20 @@ This API client was generated by the [OpenAPI Generator](https://openapi-generat Install the following dependencies: -```shell +```sh go get github.com/stretchr/testify/assert go get golang.org/x/net/context ``` Put the package under your project folder and add the following in import: -```golang +```go import keys "github.com/infobloxopen/bloxone-go-client" ``` To use a proxy, set the environment variable `HTTP_PROXY`: -```golang +```go os.Setenv("HTTP_PROXY", "http://proxy_name:proxy_port") ``` @@ -38,17 +38,17 @@ Default configuration comes with `Servers` field that contains server objects as ### Select Server Configuration -For using other server than the one defined on index 0 set context value `sw.ContextServerIndex` of type `int`. +For using other server than the one defined on index 0 set context value `keys.ContextServerIndex` of type `int`. -```golang +```go ctx := context.WithValue(context.Background(), keys.ContextServerIndex, 1) ``` ### Templated Server URL -Templated server URL is formatted using default variables from configuration or from context value `sw.ContextServerVariables` of type `map[string]string`. +Templated server URL is formatted using default variables from configuration or from context value `keys.ContextServerVariables` of type `map[string]string`. -```golang +```go ctx := context.WithValue(context.Background(), keys.ContextServerVariables, map[string]string{ "basePath": "v2", }) @@ -60,9 +60,9 @@ Note, enum values are always validated and all unused variables are silently ign Each operation can use different server URL defined using `OperationServers` map in the `Configuration`. An operation is uniquely identified by `"{classname}Service.{nickname}"` string. -Similar rules for overriding default operation server index and variables applies by using `sw.ContextOperationServerIndices` and `sw.ContextOperationServerVariables` context maps. +Similar rules for overriding default operation server index and variables applies by using `keys.ContextOperationServerIndices` and `keys.ContextOperationServerVariables` context maps. -```golang +```go ctx := context.WithValue(context.Background(), keys.ContextOperationServerIndices, map[string]int{ "{classname}Service.{nickname}": 2, }) @@ -84,6 +84,7 @@ Class | Method | HTTP request | Description *KerberosAPI* | [**KerberosList**](docs/KerberosAPI.md#kerberoslist) | **Get** /keys/kerberos | Retrieve Kerberos keys. *KerberosAPI* | [**KerberosRead**](docs/KerberosAPI.md#kerberosread) | **Get** /keys/kerberos/{id} | Retrieve the Kerberos key. *KerberosAPI* | [**KerberosUpdate**](docs/KerberosAPI.md#kerberosupdate) | **Patch** /keys/kerberos/{id} | Update the Kerberos key. +*KerberosAPI* | [**KeysKerberosPost**](docs/KerberosAPI.md#keyskerberospost) | **Post** /keys/kerberos | *TsigAPI* | [**TsigCreate**](docs/TsigAPI.md#tsigcreate) | **Post** /keys/tsig | Create the TSIG key. *TsigAPI* | [**TsigDelete**](docs/TsigAPI.md#tsigdelete) | **Delete** /keys/tsig/{id} | Delete the TSIG key. *TsigAPI* | [**TsigList**](docs/TsigAPI.md#tsiglist) | **Get** /keys/tsig | Retrieve TSIG keys. @@ -126,11 +127,11 @@ Note, each API key must be added to a map of `map[string]APIKey` where the key i Example -```golang +```go auth := context.WithValue( context.Background(), - sw.ContextAPIKeys, - map[string]sw.APIKey{ + keys.ContextAPIKeys, + map[string]keys.APIKey{ "Authorization": {Key: "API_KEY_STRING"}, }, ) diff --git a/keys/api_generate_tsig.go b/keys/api_generate_tsig.go index d4e3ab8..62faecc 100644 --- a/keys/api_generate_tsig.go +++ b/keys/api_generate_tsig.go @@ -1,7 +1,7 @@ /* DDI Keys API -The DDI Keys application is a BloxOne DDI service for managing TSIG keys and GSS-TSIG (Kerberos) keys which are used by other BloxOne DDI applications. It is part of the full-featured, DDI cloud solution that enables customers to deploy large numbers of protocol servers to deliver DNS and DHCP throughout their enterprise network. +The DDI Keys application is a BloxOne DDI service for managing TSIG keys and GSS-TSIG (Kerberos) keys which are used by other BloxOne DDI applications. It is part of the full-featured, DDI cloud solution that enables customers to deploy large numbers of protocol servers to deliver DNS and DHCP throughout their enterprise network. API version: v1 */ @@ -17,18 +17,19 @@ import ( "net/http" "net/url" - "github.com/infobloxopen/bloxone-go-client/internal" +"github.com/infobloxopen/bloxone-go-client/internal" ) + type GenerateTsigAPI interface { /* - GenerateTsigGenerateTSIG Generate TSIG key with a random secret. + GenerateTsigGenerateTSIG Generate TSIG key with a random secret. - Use this method to generate a TSIG key with a random secret using the specified algorithm. + Use this method to generate a TSIG key with a random secret using the specified algorithm. - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @return ApiGenerateTsigGenerateTSIGRequest + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiGenerateTsigGenerateTSIGRequest */ GenerateTsigGenerateTSIG(ctx context.Context) ApiGenerateTsigGenerateTSIGRequest @@ -41,9 +42,9 @@ type GenerateTsigAPI interface { type GenerateTsigAPIService internal.Service type ApiGenerateTsigGenerateTSIGRequest struct { - ctx context.Context + ctx context.Context ApiService GenerateTsigAPI - algorithm *string + algorithm *string } // The TSIG key algorithm. Valid values are: * _hmac_sha256_ * _hmac_sha1_ * _hmac_sha224_ * _hmac_sha384_ * _hmac_sha512_ Defaults to _hmac_sha256_. @@ -61,25 +62,24 @@ GenerateTsigGenerateTSIG Generate TSIG key with a random secret. Use this method to generate a TSIG key with a random secret using the specified algorithm. - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @return ApiGenerateTsigGenerateTSIGRequest + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiGenerateTsigGenerateTSIGRequest */ func (a *GenerateTsigAPIService) GenerateTsigGenerateTSIG(ctx context.Context) ApiGenerateTsigGenerateTSIGRequest { return ApiGenerateTsigGenerateTSIGRequest{ ApiService: a, - ctx: ctx, + ctx: ctx, } } // Execute executes the request -// -// @return KeysGenerateTSIGResponse +// @return KeysGenerateTSIGResponse func (a *GenerateTsigAPIService) GenerateTsigGenerateTSIGExecute(r ApiGenerateTsigGenerateTSIGRequest) (*KeysGenerateTSIGResponse, *http.Response, error) { var ( - localVarHTTPMethod = http.MethodGet - localVarPostBody interface{} - formFiles []internal.FormFile - localVarReturnValue *KeysGenerateTSIGResponse + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []internal.FormFile + localVarReturnValue *KeysGenerateTSIGResponse ) localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "GenerateTsigAPIService.GenerateTsigGenerateTSIG") diff --git a/keys/api_kerberos.go b/keys/api_kerberos.go index df70288..08df4c6 100644 --- a/keys/api_kerberos.go +++ b/keys/api_kerberos.go @@ -1,7 +1,7 @@ /* DDI Keys API -The DDI Keys application is a BloxOne DDI service for managing TSIG keys and GSS-TSIG (Kerberos) keys which are used by other BloxOne DDI applications. It is part of the full-featured, DDI cloud solution that enables customers to deploy large numbers of protocol servers to deliver DNS and DHCP throughout their enterprise network. +The DDI Keys application is a BloxOne DDI service for managing TSIG keys and GSS-TSIG (Kerberos) keys which are used by other BloxOne DDI applications. It is part of the full-featured, DDI cloud solution that enables customers to deploy large numbers of protocol servers to deliver DNS and DHCP throughout their enterprise network. API version: v1 */ @@ -18,20 +18,21 @@ import ( "net/url" "strings" - "github.com/infobloxopen/bloxone-go-client/internal" +"github.com/infobloxopen/bloxone-go-client/internal" ) + type KerberosAPI interface { /* - KerberosDelete Delete the Kerberos key. + KerberosDelete Delete the Kerberos key. - Use this method to delete a __KerberosKey__ object. - A __KerberosKey__ object represents a Kerberos key. + Use this method to delete a __KerberosKey__ object. +A __KerberosKey__ object represents a Kerberos key. - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @param id An application specific resource identity of a resource - @return ApiKerberosDeleteRequest + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id An application specific resource identity of a resource + @return ApiKerberosDeleteRequest */ KerberosDelete(ctx context.Context, id string) ApiKerberosDeleteRequest @@ -39,13 +40,13 @@ type KerberosAPI interface { KerberosDeleteExecute(r ApiKerberosDeleteRequest) (*http.Response, error) /* - KerberosList Retrieve Kerberos keys. + KerberosList Retrieve Kerberos keys. - Use this method to retrieve __KerberosKey__ objects. - A __KerberosKey__ object represents a Kerberos key. + Use this method to retrieve __KerberosKey__ objects. +A __KerberosKey__ object represents a Kerberos key. - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @return ApiKerberosListRequest + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiKerberosListRequest */ KerberosList(ctx context.Context) ApiKerberosListRequest @@ -54,14 +55,14 @@ type KerberosAPI interface { KerberosListExecute(r ApiKerberosListRequest) (*KeysListKerberosKeyResponse, *http.Response, error) /* - KerberosRead Retrieve the Kerberos key. + KerberosRead Retrieve the Kerberos key. - Use this method to retrieve a __KerberosKey__ object. - A __KerberosKey__ object represents a Kerberos key. + Use this method to retrieve a __KerberosKey__ object. +A __KerberosKey__ object represents a Kerberos key. - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @param id An application specific resource identity of a resource - @return ApiKerberosReadRequest + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id An application specific resource identity of a resource + @return ApiKerberosReadRequest */ KerberosRead(ctx context.Context, id string) ApiKerberosReadRequest @@ -70,29 +71,41 @@ type KerberosAPI interface { KerberosReadExecute(r ApiKerberosReadRequest) (*KeysReadKerberosKeyResponse, *http.Response, error) /* - KerberosUpdate Update the Kerberos key. + KerberosUpdate Update the Kerberos key. - Use this method to update a __KerberosKey__ object. - A __KerberosKey__ object represents a Kerberos key. + Use this method to update a __KerberosKey__ object. +A __KerberosKey__ object represents a Kerberos key. - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @param id An application specific resource identity of a resource - @return ApiKerberosUpdateRequest + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id An application specific resource identity of a resource + @return ApiKerberosUpdateRequest */ KerberosUpdate(ctx context.Context, id string) ApiKerberosUpdateRequest // KerberosUpdateExecute executes the request // @return KeysUpdateKerberosKeyResponse KerberosUpdateExecute(r ApiKerberosUpdateRequest) (*KeysUpdateKerberosKeyResponse, *http.Response, error) + + /* + KeysKerberosPost Method for KeysKerberosPost + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiKeysKerberosPostRequest + */ + KeysKerberosPost(ctx context.Context) ApiKeysKerberosPostRequest + + // KeysKerberosPostExecute executes the request + // @return KeysListKerberosKeyResponse + KeysKerberosPostExecute(r ApiKeysKerberosPostRequest) (*KeysListKerberosKeyResponse, *http.Response, error) } // KerberosAPIService KerberosAPI service type KerberosAPIService internal.Service type ApiKerberosDeleteRequest struct { - ctx context.Context + ctx context.Context ApiService KerberosAPI - id string + id string } func (r ApiKerberosDeleteRequest) Execute() (*http.Response, error) { @@ -105,24 +118,24 @@ KerberosDelete Delete the Kerberos key. Use this method to delete a __KerberosKey__ object. A __KerberosKey__ object represents a Kerberos key. - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @param id An application specific resource identity of a resource - @return ApiKerberosDeleteRequest + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id An application specific resource identity of a resource + @return ApiKerberosDeleteRequest */ func (a *KerberosAPIService) KerberosDelete(ctx context.Context, id string) ApiKerberosDeleteRequest { return ApiKerberosDeleteRequest{ ApiService: a, - ctx: ctx, - id: id, + ctx: ctx, + id: id, } } // Execute executes the request func (a *KerberosAPIService) KerberosDeleteExecute(r ApiKerberosDeleteRequest) (*http.Response, error) { var ( - localVarHTTPMethod = http.MethodDelete - localVarPostBody interface{} - formFiles []internal.FormFile + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []internal.FormFile ) localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "KerberosAPIService.KerberosDelete") @@ -194,49 +207,49 @@ func (a *KerberosAPIService) KerberosDeleteExecute(r ApiKerberosDeleteRequest) ( } type ApiKerberosListRequest struct { - ctx context.Context + ctx context.Context ApiService KerberosAPI - fields *string - filter *string - offset *int32 - limit *int32 - pageToken *string - orderBy *string - tfilter *string - torderBy *string + fields *string + filter *string + offset *int32 + limit *int32 + pageToken *string + orderBy *string + tfilter *string + torderBy *string } -// A collection of response resources can be transformed by specifying a set of JSON tags to be returned. For a “flat” resource, the tag name is straightforward. If field selection is allowed on non-flat hierarchical resources, the service should implement a qualified naming scheme such as dot-qualification to reference data down the hierarchy. If a resource does not have the specified tag, the tag does not appear in the output resource. Specify this parameter as a comma-separated list of JSON tag names. +// A collection of response resources can be transformed by specifying a set of JSON tags to be returned. For a “flat” resource, the tag name is straightforward. If field selection is allowed on non-flat hierarchical resources, the service should implement a qualified naming scheme such as dot-qualification to reference data down the hierarchy. If a resource does not have the specified tag, the tag does not appear in the output resource. Specify this parameter as a comma-separated list of JSON tag names. func (r ApiKerberosListRequest) Fields(fields string) ApiKerberosListRequest { r.fields = &fields return r } -// A collection of response resources can be filtered by a logical expression string that includes JSON tag references to values in each resource, literal values, and logical operators. If a resource does not have the specified tag, its value is assumed to be null. Literal values include numbers (integer and floating-point), and quoted (both single- or double-quoted) literal strings, and 'null'. The following operators are commonly used in filter expressions: | Op | Description | | -- | ----------- | | == | Equal | | != | Not Equal | | > | Greater Than | | >= | Greater Than or Equal To | | < | Less Than | | <= | Less Than or Equal To | | and | Logical AND | | ~ | Matches Regex | | !~ | Does Not Match Regex | | or | Logical OR | | not | Logical NOT | | () | Groupping Operators | +// A collection of response resources can be filtered by a logical expression string that includes JSON tag references to values in each resource, literal values, and logical operators. If a resource does not have the specified tag, its value is assumed to be null. Literal values include numbers (integer and floating-point), and quoted (both single- or double-quoted) literal strings, and 'null'. The following operators are commonly used in filter expressions: | Op | Description | | -- | ----------- | | == | Equal | | != | Not Equal | | > | Greater Than | | >= | Greater Than or Equal To | | < | Less Than | | <= | Less Than or Equal To | | and | Logical AND | | ~ | Matches Regex | | !~ | Does Not Match Regex | | or | Logical OR | | not | Logical NOT | | () | Groupping Operators | func (r ApiKerberosListRequest) Filter(filter string) ApiKerberosListRequest { r.filter = &filter return r } -// The integer index (zero-origin) of the offset into a collection of resources. If omitted or null the value is assumed to be '0'. +// The integer index (zero-origin) of the offset into a collection of resources. If omitted or null the value is assumed to be '0'. func (r ApiKerberosListRequest) Offset(offset int32) ApiKerberosListRequest { r.offset = &offset return r } -// The integer number of resources to be returned in the response. The service may impose maximum value. If omitted the service may impose a default value. +// The integer number of resources to be returned in the response. The service may impose maximum value. If omitted the service may impose a default value. func (r ApiKerberosListRequest) Limit(limit int32) ApiKerberosListRequest { r.limit = &limit return r } -// The service-defined string used to identify a page of resources. A null value indicates the first page. +// The service-defined string used to identify a page of resources. A null value indicates the first page. func (r ApiKerberosListRequest) PageToken(pageToken string) ApiKerberosListRequest { r.pageToken = &pageToken return r } -// A collection of response resources can be sorted by their JSON tags. For a 'flat' resource, the tag name is straightforward. If sorting is allowed on non-flat hierarchical resources, the service should implement a qualified naming scheme such as dot-qualification to reference data down the hierarchy. If a resource does not have the specified tag, its value is assumed to be null.) Specify this parameter as a comma-separated list of JSON tag names. The sort direction can be specified by a suffix separated by whitespace before the tag name. The suffix 'asc' sorts the data in ascending order. The suffix 'desc' sorts the data in descending order. If no suffix is specified the data is sorted in ascending order. +// A collection of response resources can be sorted by their JSON tags. For a 'flat' resource, the tag name is straightforward. If sorting is allowed on non-flat hierarchical resources, the service should implement a qualified naming scheme such as dot-qualification to reference data down the hierarchy. If a resource does not have the specified tag, its value is assumed to be null.) Specify this parameter as a comma-separated list of JSON tag names. The sort direction can be specified by a suffix separated by whitespace before the tag name. The suffix 'asc' sorts the data in ascending order. The suffix 'desc' sorts the data in descending order. If no suffix is specified the data is sorted in ascending order. func (r ApiKerberosListRequest) OrderBy(orderBy string) ApiKerberosListRequest { r.orderBy = &orderBy return r @@ -264,25 +277,24 @@ KerberosList Retrieve Kerberos keys. Use this method to retrieve __KerberosKey__ objects. A __KerberosKey__ object represents a Kerberos key. - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @return ApiKerberosListRequest + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiKerberosListRequest */ func (a *KerberosAPIService) KerberosList(ctx context.Context) ApiKerberosListRequest { return ApiKerberosListRequest{ ApiService: a, - ctx: ctx, + ctx: ctx, } } // Execute executes the request -// -// @return KeysListKerberosKeyResponse +// @return KeysListKerberosKeyResponse func (a *KerberosAPIService) KerberosListExecute(r ApiKerberosListRequest) (*KeysListKerberosKeyResponse, *http.Response, error) { var ( - localVarHTTPMethod = http.MethodGet - localVarPostBody interface{} - formFiles []internal.FormFile - localVarReturnValue *KeysListKerberosKeyResponse + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []internal.FormFile + localVarReturnValue *KeysListKerberosKeyResponse ) localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "KerberosAPIService.KerberosList") @@ -383,13 +395,13 @@ func (a *KerberosAPIService) KerberosListExecute(r ApiKerberosListRequest) (*Key } type ApiKerberosReadRequest struct { - ctx context.Context + ctx context.Context ApiService KerberosAPI - id string - fields *string + id string + fields *string } -// A collection of response resources can be transformed by specifying a set of JSON tags to be returned. For a “flat” resource, the tag name is straightforward. If field selection is allowed on non-flat hierarchical resources, the service should implement a qualified naming scheme such as dot-qualification to reference data down the hierarchy. If a resource does not have the specified tag, the tag does not appear in the output resource. Specify this parameter as a comma-separated list of JSON tag names. +// A collection of response resources can be transformed by specifying a set of JSON tags to be returned. For a “flat” resource, the tag name is straightforward. If field selection is allowed on non-flat hierarchical resources, the service should implement a qualified naming scheme such as dot-qualification to reference data down the hierarchy. If a resource does not have the specified tag, the tag does not appear in the output resource. Specify this parameter as a comma-separated list of JSON tag names. func (r ApiKerberosReadRequest) Fields(fields string) ApiKerberosReadRequest { r.fields = &fields return r @@ -405,27 +417,26 @@ KerberosRead Retrieve the Kerberos key. Use this method to retrieve a __KerberosKey__ object. A __KerberosKey__ object represents a Kerberos key. - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @param id An application specific resource identity of a resource - @return ApiKerberosReadRequest + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id An application specific resource identity of a resource + @return ApiKerberosReadRequest */ func (a *KerberosAPIService) KerberosRead(ctx context.Context, id string) ApiKerberosReadRequest { return ApiKerberosReadRequest{ ApiService: a, - ctx: ctx, - id: id, + ctx: ctx, + id: id, } } // Execute executes the request -// -// @return KeysReadKerberosKeyResponse +// @return KeysReadKerberosKeyResponse func (a *KerberosAPIService) KerberosReadExecute(r ApiKerberosReadRequest) (*KeysReadKerberosKeyResponse, *http.Response, error) { var ( - localVarHTTPMethod = http.MethodGet - localVarPostBody interface{} - formFiles []internal.FormFile - localVarReturnValue *KeysReadKerberosKeyResponse + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []internal.FormFile + localVarReturnValue *KeysReadKerberosKeyResponse ) localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "KerberosAPIService.KerberosRead") @@ -506,10 +517,10 @@ func (a *KerberosAPIService) KerberosReadExecute(r ApiKerberosReadRequest) (*Key } type ApiKerberosUpdateRequest struct { - ctx context.Context + ctx context.Context ApiService KerberosAPI - id string - body *KerberosKey + id string + body *KerberosKey } func (r ApiKerberosUpdateRequest) Body(body KerberosKey) ApiKerberosUpdateRequest { @@ -527,27 +538,26 @@ KerberosUpdate Update the Kerberos key. Use this method to update a __KerberosKey__ object. A __KerberosKey__ object represents a Kerberos key. - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @param id An application specific resource identity of a resource - @return ApiKerberosUpdateRequest + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id An application specific resource identity of a resource + @return ApiKerberosUpdateRequest */ func (a *KerberosAPIService) KerberosUpdate(ctx context.Context, id string) ApiKerberosUpdateRequest { return ApiKerberosUpdateRequest{ ApiService: a, - ctx: ctx, - id: id, + ctx: ctx, + id: id, } } // Execute executes the request -// -// @return KeysUpdateKerberosKeyResponse +// @return KeysUpdateKerberosKeyResponse func (a *KerberosAPIService) KerberosUpdateExecute(r ApiKerberosUpdateRequest) (*KeysUpdateKerberosKeyResponse, *http.Response, error) { var ( - localVarHTTPMethod = http.MethodPatch - localVarPostBody interface{} - formFiles []internal.FormFile - localVarReturnValue *KeysUpdateKerberosKeyResponse + localVarHTTPMethod = http.MethodPatch + localVarPostBody interface{} + formFiles []internal.FormFile + localVarReturnValue *KeysUpdateKerberosKeyResponse ) localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "KerberosAPIService.KerberosUpdate") @@ -628,3 +638,119 @@ func (a *KerberosAPIService) KerberosUpdateExecute(r ApiKerberosUpdateRequest) ( return localVarReturnValue, localVarHTTPResponse, nil } + +type ApiKeysKerberosPostRequest struct { + ctx context.Context + ApiService KerberosAPI + body *KerberosKey +} + +func (r ApiKeysKerberosPostRequest) Body(body KerberosKey) ApiKeysKerberosPostRequest { + r.body = &body + return r +} + +func (r ApiKeysKerberosPostRequest) Execute() (*KeysListKerberosKeyResponse, *http.Response, error) { + return r.ApiService.KeysKerberosPostExecute(r) +} + +/* +KeysKerberosPost Method for KeysKerberosPost + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiKeysKerberosPostRequest +*/ +func (a *KerberosAPIService) KeysKerberosPost(ctx context.Context) ApiKeysKerberosPostRequest { + return ApiKeysKerberosPostRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// @return KeysListKerberosKeyResponse +func (a *KerberosAPIService) KeysKerberosPostExecute(r ApiKeysKerberosPostRequest) (*KeysListKerberosKeyResponse, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []internal.FormFile + localVarReturnValue *KeysListKerberosKeyResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "KerberosAPIService.KeysKerberosPost") + if err != nil { + return localVarReturnValue, nil, internal.NewGenericOpenAPIError(err.Error()) + } + + localVarPath := localBasePath + "/keys/kerberos" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.body == nil { + return localVarReturnValue, nil, internal.ReportError("body is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := internal.SelectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := internal.SelectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.body + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(internal.ContextAPIKeys).(map[string]internal.APIKey); ok { + if apiKey, ok := auth["ApiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.Client.PrepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.Client.CallAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := internal.NewGenericOpenAPIErrorWithBody(localVarHTTPResponse.Status, localVarBody) + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.Client.Decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := internal.NewGenericOpenAPIErrorWithBody(err.Error(), localVarBody) + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} diff --git a/keys/api_tsig.go b/keys/api_tsig.go index 327f290..59cb727 100644 --- a/keys/api_tsig.go +++ b/keys/api_tsig.go @@ -1,7 +1,7 @@ /* DDI Keys API -The DDI Keys application is a BloxOne DDI service for managing TSIG keys and GSS-TSIG (Kerberos) keys which are used by other BloxOne DDI applications. It is part of the full-featured, DDI cloud solution that enables customers to deploy large numbers of protocol servers to deliver DNS and DHCP throughout their enterprise network. +The DDI Keys application is a BloxOne DDI service for managing TSIG keys and GSS-TSIG (Kerberos) keys which are used by other BloxOne DDI applications. It is part of the full-featured, DDI cloud solution that enables customers to deploy large numbers of protocol servers to deliver DNS and DHCP throughout their enterprise network. API version: v1 */ @@ -13,25 +13,25 @@ package keys import ( "bytes" "context" - _ "github.com/infobloxopen/bloxone-go-client/dns_config" "io" "net/http" "net/url" "strings" - "github.com/infobloxopen/bloxone-go-client/internal" +"github.com/infobloxopen/bloxone-go-client/internal" ) + type TsigAPI interface { /* - TsigCreate Create the TSIG key. + TsigCreate Create the TSIG key. - Use this method to create a __TSIGKey__ object. - A __TSIGKey__ object represents a TSIG key. + Use this method to create a __TSIGKey__ object. +A __TSIGKey__ object represents a TSIG key. - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @return ApiTsigCreateRequest + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiTsigCreateRequest */ TsigCreate(ctx context.Context) ApiTsigCreateRequest @@ -40,14 +40,14 @@ type TsigAPI interface { TsigCreateExecute(r ApiTsigCreateRequest) (*KeysCreateTSIGKeyResponse, *http.Response, error) /* - TsigDelete Delete the TSIG key. + TsigDelete Delete the TSIG key. - Use this method to delete a __TSIGKey__ object. - A __TSIGKey__ object represents a TSIG key. + Use this method to delete a __TSIGKey__ object. +A __TSIGKey__ object represents a TSIG key. - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @param id An application specific resource identity of a resource - @return ApiTsigDeleteRequest + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id An application specific resource identity of a resource + @return ApiTsigDeleteRequest */ TsigDelete(ctx context.Context, id string) ApiTsigDeleteRequest @@ -55,13 +55,13 @@ type TsigAPI interface { TsigDeleteExecute(r ApiTsigDeleteRequest) (*http.Response, error) /* - TsigList Retrieve TSIG keys. + TsigList Retrieve TSIG keys. - Use this method to retrieve __TSIGKey__ objects. - A __TSIGKey__ object represents a TSIG key. + Use this method to retrieve __TSIGKey__ objects. +A __TSIGKey__ object represents a TSIG key. - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @return ApiTsigListRequest + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiTsigListRequest */ TsigList(ctx context.Context) ApiTsigListRequest @@ -70,14 +70,14 @@ type TsigAPI interface { TsigListExecute(r ApiTsigListRequest) (*KeysListTSIGKeyResponse, *http.Response, error) /* - TsigRead Retrieve the TSIG key. + TsigRead Retrieve the TSIG key. - Use this method to retrieve a __TSIGKey__ object. - A __TSIGKey__ object represents a TSIG key. + Use this method to retrieve a __TSIGKey__ object. +A __TSIGKey__ object represents a TSIG key. - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @param id An application specific resource identity of a resource - @return ApiTsigReadRequest + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id An application specific resource identity of a resource + @return ApiTsigReadRequest */ TsigRead(ctx context.Context, id string) ApiTsigReadRequest @@ -86,14 +86,14 @@ type TsigAPI interface { TsigReadExecute(r ApiTsigReadRequest) (*KeysReadTSIGKeyResponse, *http.Response, error) /* - TsigUpdate Update the TSIG key. + TsigUpdate Update the TSIG key. - Use this method to update a __TSIGKey__ object. - A __TSIGKey__ object represents a TSIG key. + Use this method to update a __TSIGKey__ object. +A __TSIGKey__ object represents a TSIG key. - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @param id An application specific resource identity of a resource - @return ApiTsigUpdateRequest + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id An application specific resource identity of a resource + @return ApiTsigUpdateRequest */ TsigUpdate(ctx context.Context, id string) ApiTsigUpdateRequest @@ -106,9 +106,9 @@ type TsigAPI interface { type TsigAPIService internal.Service type ApiTsigCreateRequest struct { - ctx context.Context + ctx context.Context ApiService TsigAPI - body *KeysTSIGKey + body *KeysTSIGKey } func (r ApiTsigCreateRequest) Body(body KeysTSIGKey) ApiTsigCreateRequest { @@ -126,25 +126,24 @@ TsigCreate Create the TSIG key. Use this method to create a __TSIGKey__ object. A __TSIGKey__ object represents a TSIG key. - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @return ApiTsigCreateRequest + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiTsigCreateRequest */ func (a *TsigAPIService) TsigCreate(ctx context.Context) ApiTsigCreateRequest { return ApiTsigCreateRequest{ ApiService: a, - ctx: ctx, + ctx: ctx, } } // Execute executes the request -// -// @return KeysCreateTSIGKeyResponse +// @return KeysCreateTSIGKeyResponse func (a *TsigAPIService) TsigCreateExecute(r ApiTsigCreateRequest) (*KeysCreateTSIGKeyResponse, *http.Response, error) { var ( - localVarHTTPMethod = http.MethodPost - localVarPostBody interface{} - formFiles []internal.FormFile - localVarReturnValue *KeysCreateTSIGKeyResponse + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []internal.FormFile + localVarReturnValue *KeysCreateTSIGKeyResponse ) localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "TsigAPIService.TsigCreate") @@ -226,9 +225,9 @@ func (a *TsigAPIService) TsigCreateExecute(r ApiTsigCreateRequest) (*KeysCreateT } type ApiTsigDeleteRequest struct { - ctx context.Context + ctx context.Context ApiService TsigAPI - id string + id string } func (r ApiTsigDeleteRequest) Execute() (*http.Response, error) { @@ -241,24 +240,24 @@ TsigDelete Delete the TSIG key. Use this method to delete a __TSIGKey__ object. A __TSIGKey__ object represents a TSIG key. - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @param id An application specific resource identity of a resource - @return ApiTsigDeleteRequest + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id An application specific resource identity of a resource + @return ApiTsigDeleteRequest */ func (a *TsigAPIService) TsigDelete(ctx context.Context, id string) ApiTsigDeleteRequest { return ApiTsigDeleteRequest{ ApiService: a, - ctx: ctx, - id: id, + ctx: ctx, + id: id, } } // Execute executes the request func (a *TsigAPIService) TsigDeleteExecute(r ApiTsigDeleteRequest) (*http.Response, error) { var ( - localVarHTTPMethod = http.MethodDelete - localVarPostBody interface{} - formFiles []internal.FormFile + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []internal.FormFile ) localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "TsigAPIService.TsigDelete") @@ -330,49 +329,49 @@ func (a *TsigAPIService) TsigDeleteExecute(r ApiTsigDeleteRequest) (*http.Respon } type ApiTsigListRequest struct { - ctx context.Context + ctx context.Context ApiService TsigAPI - fields *string - filter *string - offset *int32 - limit *int32 - pageToken *string - orderBy *string - tfilter *string - torderBy *string + fields *string + filter *string + offset *int32 + limit *int32 + pageToken *string + orderBy *string + tfilter *string + torderBy *string } -// A collection of response resources can be transformed by specifying a set of JSON tags to be returned. For a “flat” resource, the tag name is straightforward. If field selection is allowed on non-flat hierarchical resources, the service should implement a qualified naming scheme such as dot-qualification to reference data down the hierarchy. If a resource does not have the specified tag, the tag does not appear in the output resource. Specify this parameter as a comma-separated list of JSON tag names. +// A collection of response resources can be transformed by specifying a set of JSON tags to be returned. For a “flat” resource, the tag name is straightforward. If field selection is allowed on non-flat hierarchical resources, the service should implement a qualified naming scheme such as dot-qualification to reference data down the hierarchy. If a resource does not have the specified tag, the tag does not appear in the output resource. Specify this parameter as a comma-separated list of JSON tag names. func (r ApiTsigListRequest) Fields(fields string) ApiTsigListRequest { r.fields = &fields return r } -// A collection of response resources can be filtered by a logical expression string that includes JSON tag references to values in each resource, literal values, and logical operators. If a resource does not have the specified tag, its value is assumed to be null. Literal values include numbers (integer and floating-point), and quoted (both single- or double-quoted) literal strings, and 'null'. The following operators are commonly used in filter expressions: | Op | Description | | -- | ----------- | | == | Equal | | != | Not Equal | | > | Greater Than | | >= | Greater Than or Equal To | | < | Less Than | | <= | Less Than or Equal To | | and | Logical AND | | ~ | Matches Regex | | !~ | Does Not Match Regex | | or | Logical OR | | not | Logical NOT | | () | Groupping Operators | +// A collection of response resources can be filtered by a logical expression string that includes JSON tag references to values in each resource, literal values, and logical operators. If a resource does not have the specified tag, its value is assumed to be null. Literal values include numbers (integer and floating-point), and quoted (both single- or double-quoted) literal strings, and 'null'. The following operators are commonly used in filter expressions: | Op | Description | | -- | ----------- | | == | Equal | | != | Not Equal | | > | Greater Than | | >= | Greater Than or Equal To | | < | Less Than | | <= | Less Than or Equal To | | and | Logical AND | | ~ | Matches Regex | | !~ | Does Not Match Regex | | or | Logical OR | | not | Logical NOT | | () | Groupping Operators | func (r ApiTsigListRequest) Filter(filter string) ApiTsigListRequest { r.filter = &filter return r } -// The integer index (zero-origin) of the offset into a collection of resources. If omitted or null the value is assumed to be '0'. +// The integer index (zero-origin) of the offset into a collection of resources. If omitted or null the value is assumed to be '0'. func (r ApiTsigListRequest) Offset(offset int32) ApiTsigListRequest { r.offset = &offset return r } -// The integer number of resources to be returned in the response. The service may impose maximum value. If omitted the service may impose a default value. +// The integer number of resources to be returned in the response. The service may impose maximum value. If omitted the service may impose a default value. func (r ApiTsigListRequest) Limit(limit int32) ApiTsigListRequest { r.limit = &limit return r } -// The service-defined string used to identify a page of resources. A null value indicates the first page. +// The service-defined string used to identify a page of resources. A null value indicates the first page. func (r ApiTsigListRequest) PageToken(pageToken string) ApiTsigListRequest { r.pageToken = &pageToken return r } -// A collection of response resources can be sorted by their JSON tags. For a 'flat' resource, the tag name is straightforward. If sorting is allowed on non-flat hierarchical resources, the service should implement a qualified naming scheme such as dot-qualification to reference data down the hierarchy. If a resource does not have the specified tag, its value is assumed to be null.) Specify this parameter as a comma-separated list of JSON tag names. The sort direction can be specified by a suffix separated by whitespace before the tag name. The suffix 'asc' sorts the data in ascending order. The suffix 'desc' sorts the data in descending order. If no suffix is specified the data is sorted in ascending order. +// A collection of response resources can be sorted by their JSON tags. For a 'flat' resource, the tag name is straightforward. If sorting is allowed on non-flat hierarchical resources, the service should implement a qualified naming scheme such as dot-qualification to reference data down the hierarchy. If a resource does not have the specified tag, its value is assumed to be null.) Specify this parameter as a comma-separated list of JSON tag names. The sort direction can be specified by a suffix separated by whitespace before the tag name. The suffix 'asc' sorts the data in ascending order. The suffix 'desc' sorts the data in descending order. If no suffix is specified the data is sorted in ascending order. func (r ApiTsigListRequest) OrderBy(orderBy string) ApiTsigListRequest { r.orderBy = &orderBy return r @@ -400,25 +399,24 @@ TsigList Retrieve TSIG keys. Use this method to retrieve __TSIGKey__ objects. A __TSIGKey__ object represents a TSIG key. - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @return ApiTsigListRequest + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiTsigListRequest */ func (a *TsigAPIService) TsigList(ctx context.Context) ApiTsigListRequest { return ApiTsigListRequest{ ApiService: a, - ctx: ctx, + ctx: ctx, } } // Execute executes the request -// -// @return KeysListTSIGKeyResponse +// @return KeysListTSIGKeyResponse func (a *TsigAPIService) TsigListExecute(r ApiTsigListRequest) (*KeysListTSIGKeyResponse, *http.Response, error) { var ( - localVarHTTPMethod = http.MethodGet - localVarPostBody interface{} - formFiles []internal.FormFile - localVarReturnValue *KeysListTSIGKeyResponse + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []internal.FormFile + localVarReturnValue *KeysListTSIGKeyResponse ) localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "TsigAPIService.TsigList") @@ -519,13 +517,13 @@ func (a *TsigAPIService) TsigListExecute(r ApiTsigListRequest) (*KeysListTSIGKey } type ApiTsigReadRequest struct { - ctx context.Context + ctx context.Context ApiService TsigAPI - id string - fields *string + id string + fields *string } -// A collection of response resources can be transformed by specifying a set of JSON tags to be returned. For a “flat” resource, the tag name is straightforward. If field selection is allowed on non-flat hierarchical resources, the service should implement a qualified naming scheme such as dot-qualification to reference data down the hierarchy. If a resource does not have the specified tag, the tag does not appear in the output resource. Specify this parameter as a comma-separated list of JSON tag names. +// A collection of response resources can be transformed by specifying a set of JSON tags to be returned. For a “flat” resource, the tag name is straightforward. If field selection is allowed on non-flat hierarchical resources, the service should implement a qualified naming scheme such as dot-qualification to reference data down the hierarchy. If a resource does not have the specified tag, the tag does not appear in the output resource. Specify this parameter as a comma-separated list of JSON tag names. func (r ApiTsigReadRequest) Fields(fields string) ApiTsigReadRequest { r.fields = &fields return r @@ -541,27 +539,26 @@ TsigRead Retrieve the TSIG key. Use this method to retrieve a __TSIGKey__ object. A __TSIGKey__ object represents a TSIG key. - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @param id An application specific resource identity of a resource - @return ApiTsigReadRequest + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id An application specific resource identity of a resource + @return ApiTsigReadRequest */ func (a *TsigAPIService) TsigRead(ctx context.Context, id string) ApiTsigReadRequest { return ApiTsigReadRequest{ ApiService: a, - ctx: ctx, - id: id, + ctx: ctx, + id: id, } } // Execute executes the request -// -// @return KeysReadTSIGKeyResponse +// @return KeysReadTSIGKeyResponse func (a *TsigAPIService) TsigReadExecute(r ApiTsigReadRequest) (*KeysReadTSIGKeyResponse, *http.Response, error) { var ( - localVarHTTPMethod = http.MethodGet - localVarPostBody interface{} - formFiles []internal.FormFile - localVarReturnValue *KeysReadTSIGKeyResponse + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []internal.FormFile + localVarReturnValue *KeysReadTSIGKeyResponse ) localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "TsigAPIService.TsigRead") @@ -642,10 +639,10 @@ func (a *TsigAPIService) TsigReadExecute(r ApiTsigReadRequest) (*KeysReadTSIGKey } type ApiTsigUpdateRequest struct { - ctx context.Context + ctx context.Context ApiService TsigAPI - id string - body *KeysTSIGKey + id string + body *KeysTSIGKey } func (r ApiTsigUpdateRequest) Body(body KeysTSIGKey) ApiTsigUpdateRequest { @@ -663,27 +660,26 @@ TsigUpdate Update the TSIG key. Use this method to update a __TSIGKey__ object. A __TSIGKey__ object represents a TSIG key. - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @param id An application specific resource identity of a resource - @return ApiTsigUpdateRequest + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id An application specific resource identity of a resource + @return ApiTsigUpdateRequest */ func (a *TsigAPIService) TsigUpdate(ctx context.Context, id string) ApiTsigUpdateRequest { return ApiTsigUpdateRequest{ ApiService: a, - ctx: ctx, - id: id, + ctx: ctx, + id: id, } } // Execute executes the request -// -// @return KeysUpdateTSIGKeyResponse +// @return KeysUpdateTSIGKeyResponse func (a *TsigAPIService) TsigUpdateExecute(r ApiTsigUpdateRequest) (*KeysUpdateTSIGKeyResponse, *http.Response, error) { var ( - localVarHTTPMethod = http.MethodPatch - localVarPostBody interface{} - formFiles []internal.FormFile - localVarReturnValue *KeysUpdateTSIGKeyResponse + localVarHTTPMethod = http.MethodPatch + localVarPostBody interface{} + formFiles []internal.FormFile + localVarReturnValue *KeysUpdateTSIGKeyResponse ) localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "TsigAPIService.TsigUpdate") diff --git a/keys/api_upload.go b/keys/api_upload.go index 3d68206..8c6beb2 100644 --- a/keys/api_upload.go +++ b/keys/api_upload.go @@ -1,7 +1,7 @@ /* DDI Keys API -The DDI Keys application is a BloxOne DDI service for managing TSIG keys and GSS-TSIG (Kerberos) keys which are used by other BloxOne DDI applications. It is part of the full-featured, DDI cloud solution that enables customers to deploy large numbers of protocol servers to deliver DNS and DHCP throughout their enterprise network. +The DDI Keys application is a BloxOne DDI service for managing TSIG keys and GSS-TSIG (Kerberos) keys which are used by other BloxOne DDI applications. It is part of the full-featured, DDI cloud solution that enables customers to deploy large numbers of protocol servers to deliver DNS and DHCP throughout their enterprise network. API version: v1 */ @@ -17,18 +17,19 @@ import ( "net/http" "net/url" - "github.com/infobloxopen/bloxone-go-client/internal" +"github.com/infobloxopen/bloxone-go-client/internal" ) + type UploadAPI interface { /* - UploadUpload Upload content to the keys service. + UploadUpload Upload content to the keys service. - Use this method to upload specified content type to the keys service. + Use this method to upload specified content type to the keys service. - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @return ApiUploadUploadRequest + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiUploadUploadRequest */ UploadUpload(ctx context.Context) ApiUploadUploadRequest @@ -41,9 +42,9 @@ type UploadAPI interface { type UploadAPIService internal.Service type ApiUploadUploadRequest struct { - ctx context.Context + ctx context.Context ApiService UploadAPI - body *UploadRequest + body *UploadRequest } func (r ApiUploadUploadRequest) Body(body UploadRequest) ApiUploadUploadRequest { @@ -60,25 +61,24 @@ UploadUpload Upload content to the keys service. Use this method to upload specified content type to the keys service. - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @return ApiUploadUploadRequest + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiUploadUploadRequest */ func (a *UploadAPIService) UploadUpload(ctx context.Context) ApiUploadUploadRequest { return ApiUploadUploadRequest{ ApiService: a, - ctx: ctx, + ctx: ctx, } } // Execute executes the request -// -// @return DdiuploadResponse +// @return DdiuploadResponse func (a *UploadAPIService) UploadUploadExecute(r ApiUploadUploadRequest) (*DdiuploadResponse, *http.Response, error) { var ( - localVarHTTPMethod = http.MethodPost - localVarPostBody interface{} - formFiles []internal.FormFile - localVarReturnValue *DdiuploadResponse + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []internal.FormFile + localVarReturnValue *DdiuploadResponse ) localBasePath, err := a.Client.Cfg.ServerURLWithContext(r.ctx, "UploadAPIService.UploadUpload") diff --git a/keys/client.go b/keys/client.go index b3649a4..286dc91 100644 --- a/keys/client.go +++ b/keys/client.go @@ -1,7 +1,7 @@ /* DDI Keys API -The DDI Keys application is a BloxOne DDI service for managing TSIG keys and GSS-TSIG (Kerberos) keys which are used by other BloxOne DDI applications. It is part of the full-featured, DDI cloud solution that enables customers to deploy large numbers of protocol servers to deliver DNS and DHCP throughout their enterprise network. +The DDI Keys application is a BloxOne DDI service for managing TSIG keys and GSS-TSIG (Kerberos) keys which are used by other BloxOne DDI applications. It is part of the full-featured, DDI cloud solution that enables customers to deploy large numbers of protocol servers to deliver DNS and DHCP throughout their enterprise network. API version: v1 */ @@ -11,7 +11,7 @@ API version: v1 package keys import ( - "github.com/infobloxopen/bloxone-go-client/internal" + "github.com/infobloxopen/bloxone-go-client/internal" ) var ServiceBasePath = "/api/ddi/v1" @@ -19,20 +19,20 @@ var ServiceBasePath = "/api/ddi/v1" // APIClient manages communication with the DDI Keys API API vv1 // In most cases there should be only one, shared, APIClient. type APIClient struct { - *internal.APIClient + *internal.APIClient // API Services GenerateTsigAPI GenerateTsigAPI - KerberosAPI KerberosAPI - TsigAPI TsigAPI - UploadAPI UploadAPI + KerberosAPI KerberosAPI + TsigAPI TsigAPI + UploadAPI UploadAPI } // NewAPIClient creates a new API client. Requires a userAgent string describing your application. // optionally a custom http.Client to allow for advanced features such as caching. func NewAPIClient(cfg *internal.Configuration) *APIClient { c := &APIClient{} - c.APIClient = internal.NewAPIClient(cfg) + c.APIClient = internal.NewAPIClient(cfg) // API Services c.GenerateTsigAPI = (*GenerateTsigAPIService)(&c.Common) diff --git a/keys/docs/GenerateTsigAPI.md b/keys/docs/GenerateTsigAPI.md index 6f5663a..4293be1 100644 --- a/keys/docs/GenerateTsigAPI.md +++ b/keys/docs/GenerateTsigAPI.md @@ -22,24 +22,24 @@ Generate TSIG key with a random secret. package main import ( - "context" - "fmt" - "os" - openapiclient "github.com/infobloxopen/bloxone-go-client" + "context" + "fmt" + "os" + openapiclient "github.com/infobloxopen/bloxone-go-client" ) func main() { - algorithm := "algorithm_example" // string | The TSIG key algorithm. Valid values are: * _hmac_sha256_ * _hmac_sha1_ * _hmac_sha224_ * _hmac_sha384_ * _hmac_sha512_ Defaults to _hmac_sha256_. (optional) - - configuration := openapiclient.NewConfiguration() - apiClient := openapiclient.NewAPIClient(configuration) - resp, r, err := apiClient.GenerateTsigAPI.GenerateTsigGenerateTSIG(context.Background()).Algorithm(algorithm).Execute() - if err != nil { - fmt.Fprintf(os.Stderr, "Error when calling `GenerateTsigAPI.GenerateTsigGenerateTSIG``: %v\n", err) - fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) - } - // response from `GenerateTsigGenerateTSIG`: KeysGenerateTSIGResponse - fmt.Fprintf(os.Stdout, "Response from `GenerateTsigAPI.GenerateTsigGenerateTSIG`: %v\n", resp) + algorithm := "algorithm_example" // string | The TSIG key algorithm. Valid values are: * _hmac_sha256_ * _hmac_sha1_ * _hmac_sha224_ * _hmac_sha384_ * _hmac_sha512_ Defaults to _hmac_sha256_. (optional) + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.GenerateTsigAPI.GenerateTsigGenerateTSIG(context.Background()).Algorithm(algorithm).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `GenerateTsigAPI.GenerateTsigGenerateTSIG``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `GenerateTsigGenerateTSIG`: KeysGenerateTSIGResponse + fmt.Fprintf(os.Stdout, "Response from `GenerateTsigAPI.GenerateTsigGenerateTSIG`: %v\n", resp) } ``` diff --git a/keys/docs/KerberosAPI.md b/keys/docs/KerberosAPI.md index 01fc80b..0442efd 100644 --- a/keys/docs/KerberosAPI.md +++ b/keys/docs/KerberosAPI.md @@ -8,6 +8,7 @@ Method | HTTP request | Description [**KerberosList**](KerberosAPI.md#KerberosList) | **Get** /keys/kerberos | Retrieve Kerberos keys. [**KerberosRead**](KerberosAPI.md#KerberosRead) | **Get** /keys/kerberos/{id} | Retrieve the Kerberos key. [**KerberosUpdate**](KerberosAPI.md#KerberosUpdate) | **Patch** /keys/kerberos/{id} | Update the Kerberos key. +[**KeysKerberosPost**](KerberosAPI.md#KeysKerberosPost) | **Post** /keys/kerberos | @@ -25,22 +26,22 @@ Delete the Kerberos key. package main import ( - "context" - "fmt" - "os" - openapiclient "github.com/infobloxopen/bloxone-go-client" + "context" + "fmt" + "os" + openapiclient "github.com/infobloxopen/bloxone-go-client" ) func main() { - id := "id_example" // string | An application specific resource identity of a resource - - configuration := openapiclient.NewConfiguration() - apiClient := openapiclient.NewAPIClient(configuration) - r, err := apiClient.KerberosAPI.KerberosDelete(context.Background(), id).Execute() - if err != nil { - fmt.Fprintf(os.Stderr, "Error when calling `KerberosAPI.KerberosDelete``: %v\n", err) - fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) - } + id := "id_example" // string | An application specific resource identity of a resource + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + r, err := apiClient.KerberosAPI.KerberosDelete(context.Background(), id).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `KerberosAPI.KerberosDelete``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } } ``` @@ -93,31 +94,31 @@ Retrieve Kerberos keys. package main import ( - "context" - "fmt" - "os" - openapiclient "github.com/infobloxopen/bloxone-go-client" + "context" + "fmt" + "os" + openapiclient "github.com/infobloxopen/bloxone-go-client" ) func main() { - fields := "fields_example" // string | A collection of response resources can be transformed by specifying a set of JSON tags to be returned. For a “flat” resource, the tag name is straightforward. If field selection is allowed on non-flat hierarchical resources, the service should implement a qualified naming scheme such as dot-qualification to reference data down the hierarchy. If a resource does not have the specified tag, the tag does not appear in the output resource. Specify this parameter as a comma-separated list of JSON tag names. (optional) - filter := "filter_example" // string | A collection of response resources can be filtered by a logical expression string that includes JSON tag references to values in each resource, literal values, and logical operators. If a resource does not have the specified tag, its value is assumed to be null. Literal values include numbers (integer and floating-point), and quoted (both single- or double-quoted) literal strings, and 'null'. The following operators are commonly used in filter expressions: | Op | Description | | -- | ----------- | | == | Equal | | != | Not Equal | | > | Greater Than | | >= | Greater Than or Equal To | | < | Less Than | | <= | Less Than or Equal To | | and | Logical AND | | ~ | Matches Regex | | !~ | Does Not Match Regex | | or | Logical OR | | not | Logical NOT | | () | Groupping Operators | (optional) - offset := int32(56) // int32 | The integer index (zero-origin) of the offset into a collection of resources. If omitted or null the value is assumed to be '0'. (optional) - limit := int32(56) // int32 | The integer number of resources to be returned in the response. The service may impose maximum value. If omitted the service may impose a default value. (optional) - pageToken := "pageToken_example" // string | The service-defined string used to identify a page of resources. A null value indicates the first page. (optional) - orderBy := "orderBy_example" // string | A collection of response resources can be sorted by their JSON tags. For a 'flat' resource, the tag name is straightforward. If sorting is allowed on non-flat hierarchical resources, the service should implement a qualified naming scheme such as dot-qualification to reference data down the hierarchy. If a resource does not have the specified tag, its value is assumed to be null.) Specify this parameter as a comma-separated list of JSON tag names. The sort direction can be specified by a suffix separated by whitespace before the tag name. The suffix 'asc' sorts the data in ascending order. The suffix 'desc' sorts the data in descending order. If no suffix is specified the data is sorted in ascending order. (optional) - tfilter := "tfilter_example" // string | This parameter is used for filtering by tags. (optional) - torderBy := "torderBy_example" // string | This parameter is used for sorting by tags. (optional) - - configuration := openapiclient.NewConfiguration() - apiClient := openapiclient.NewAPIClient(configuration) - resp, r, err := apiClient.KerberosAPI.KerberosList(context.Background()).Fields(fields).Filter(filter).Offset(offset).Limit(limit).PageToken(pageToken).OrderBy(orderBy).Tfilter(tfilter).TorderBy(torderBy).Execute() - if err != nil { - fmt.Fprintf(os.Stderr, "Error when calling `KerberosAPI.KerberosList``: %v\n", err) - fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) - } - // response from `KerberosList`: KeysListKerberosKeyResponse - fmt.Fprintf(os.Stdout, "Response from `KerberosAPI.KerberosList`: %v\n", resp) + fields := "fields_example" // string | A collection of response resources can be transformed by specifying a set of JSON tags to be returned. For a “flat” resource, the tag name is straightforward. If field selection is allowed on non-flat hierarchical resources, the service should implement a qualified naming scheme such as dot-qualification to reference data down the hierarchy. If a resource does not have the specified tag, the tag does not appear in the output resource. Specify this parameter as a comma-separated list of JSON tag names. (optional) + filter := "filter_example" // string | A collection of response resources can be filtered by a logical expression string that includes JSON tag references to values in each resource, literal values, and logical operators. If a resource does not have the specified tag, its value is assumed to be null. Literal values include numbers (integer and floating-point), and quoted (both single- or double-quoted) literal strings, and 'null'. The following operators are commonly used in filter expressions: | Op | Description | | -- | ----------- | | == | Equal | | != | Not Equal | | > | Greater Than | | >= | Greater Than or Equal To | | < | Less Than | | <= | Less Than or Equal To | | and | Logical AND | | ~ | Matches Regex | | !~ | Does Not Match Regex | | or | Logical OR | | not | Logical NOT | | () | Groupping Operators | (optional) + offset := int32(56) // int32 | The integer index (zero-origin) of the offset into a collection of resources. If omitted or null the value is assumed to be '0'. (optional) + limit := int32(56) // int32 | The integer number of resources to be returned in the response. The service may impose maximum value. If omitted the service may impose a default value. (optional) + pageToken := "pageToken_example" // string | The service-defined string used to identify a page of resources. A null value indicates the first page. (optional) + orderBy := "orderBy_example" // string | A collection of response resources can be sorted by their JSON tags. For a 'flat' resource, the tag name is straightforward. If sorting is allowed on non-flat hierarchical resources, the service should implement a qualified naming scheme such as dot-qualification to reference data down the hierarchy. If a resource does not have the specified tag, its value is assumed to be null.) Specify this parameter as a comma-separated list of JSON tag names. The sort direction can be specified by a suffix separated by whitespace before the tag name. The suffix 'asc' sorts the data in ascending order. The suffix 'desc' sorts the data in descending order. If no suffix is specified the data is sorted in ascending order. (optional) + tfilter := "tfilter_example" // string | This parameter is used for filtering by tags. (optional) + torderBy := "torderBy_example" // string | This parameter is used for sorting by tags. (optional) + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.KerberosAPI.KerberosList(context.Background()).Fields(fields).Filter(filter).Offset(offset).Limit(limit).PageToken(pageToken).OrderBy(orderBy).Tfilter(tfilter).TorderBy(torderBy).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `KerberosAPI.KerberosList``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `KerberosList`: KeysListKerberosKeyResponse + fmt.Fprintf(os.Stdout, "Response from `KerberosAPI.KerberosList`: %v\n", resp) } ``` @@ -173,25 +174,25 @@ Retrieve the Kerberos key. package main import ( - "context" - "fmt" - "os" - openapiclient "github.com/infobloxopen/bloxone-go-client" + "context" + "fmt" + "os" + openapiclient "github.com/infobloxopen/bloxone-go-client" ) func main() { - id := "id_example" // string | An application specific resource identity of a resource - fields := "fields_example" // string | A collection of response resources can be transformed by specifying a set of JSON tags to be returned. For a “flat” resource, the tag name is straightforward. If field selection is allowed on non-flat hierarchical resources, the service should implement a qualified naming scheme such as dot-qualification to reference data down the hierarchy. If a resource does not have the specified tag, the tag does not appear in the output resource. Specify this parameter as a comma-separated list of JSON tag names. (optional) - - configuration := openapiclient.NewConfiguration() - apiClient := openapiclient.NewAPIClient(configuration) - resp, r, err := apiClient.KerberosAPI.KerberosRead(context.Background(), id).Fields(fields).Execute() - if err != nil { - fmt.Fprintf(os.Stderr, "Error when calling `KerberosAPI.KerberosRead``: %v\n", err) - fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) - } - // response from `KerberosRead`: KeysReadKerberosKeyResponse - fmt.Fprintf(os.Stdout, "Response from `KerberosAPI.KerberosRead`: %v\n", resp) + id := "id_example" // string | An application specific resource identity of a resource + fields := "fields_example" // string | A collection of response resources can be transformed by specifying a set of JSON tags to be returned. For a “flat” resource, the tag name is straightforward. If field selection is allowed on non-flat hierarchical resources, the service should implement a qualified naming scheme such as dot-qualification to reference data down the hierarchy. If a resource does not have the specified tag, the tag does not appear in the output resource. Specify this parameter as a comma-separated list of JSON tag names. (optional) + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.KerberosAPI.KerberosRead(context.Background(), id).Fields(fields).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `KerberosAPI.KerberosRead``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `KerberosRead`: KeysReadKerberosKeyResponse + fmt.Fprintf(os.Stdout, "Response from `KerberosAPI.KerberosRead`: %v\n", resp) } ``` @@ -245,25 +246,25 @@ Update the Kerberos key. package main import ( - "context" - "fmt" - "os" - openapiclient "github.com/infobloxopen/bloxone-go-client" + "context" + "fmt" + "os" + openapiclient "github.com/infobloxopen/bloxone-go-client" ) func main() { - id := "id_example" // string | An application specific resource identity of a resource - body := *openapiclient.NewKerberosKey() // KerberosKey | - - configuration := openapiclient.NewConfiguration() - apiClient := openapiclient.NewAPIClient(configuration) - resp, r, err := apiClient.KerberosAPI.KerberosUpdate(context.Background(), id).Body(body).Execute() - if err != nil { - fmt.Fprintf(os.Stderr, "Error when calling `KerberosAPI.KerberosUpdate``: %v\n", err) - fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) - } - // response from `KerberosUpdate`: KeysUpdateKerberosKeyResponse - fmt.Fprintf(os.Stdout, "Response from `KerberosAPI.KerberosUpdate`: %v\n", resp) + id := "id_example" // string | An application specific resource identity of a resource + body := *openapiclient.NewKerberosKey() // KerberosKey | + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.KerberosAPI.KerberosUpdate(context.Background(), id).Body(body).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `KerberosAPI.KerberosUpdate``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `KerberosUpdate`: KeysUpdateKerberosKeyResponse + fmt.Fprintf(os.Stdout, "Response from `KerberosAPI.KerberosUpdate`: %v\n", resp) } ``` @@ -302,3 +303,67 @@ Name | Type | Description | Notes [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +## KeysKerberosPost + +> KeysListKerberosKeyResponse KeysKerberosPost(ctx).Body(body).Execute() + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "github.com/infobloxopen/bloxone-go-client" +) + +func main() { + body := *openapiclient.NewKerberosKey() // KerberosKey | + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.KerberosAPI.KeysKerberosPost(context.Background()).Body(body).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `KerberosAPI.KeysKerberosPost``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `KeysKerberosPost`: KeysListKerberosKeyResponse + fmt.Fprintf(os.Stdout, "Response from `KerberosAPI.KeysKerberosPost`: %v\n", resp) +} +``` + +### Path Parameters + + + +### Other Parameters + +Other parameters are passed through a pointer to a apiKeysKerberosPostRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**KerberosKey**](KerberosKey.md) | | + +### Return type + +[**KeysListKerberosKeyResponse**](KeysListKerberosKeyResponse.md) + +### Authorization + +[ApiKeyAuth](../README.md#ApiKeyAuth) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + diff --git a/keys/docs/TsigAPI.md b/keys/docs/TsigAPI.md index 447b8d2..d3d6540 100644 --- a/keys/docs/TsigAPI.md +++ b/keys/docs/TsigAPI.md @@ -26,24 +26,24 @@ Create the TSIG key. package main import ( - "context" - "fmt" - "os" - openapiclient "github.com/infobloxopen/bloxone-go-client" + "context" + "fmt" + "os" + openapiclient "github.com/infobloxopen/bloxone-go-client" ) func main() { - body := *openapiclient.NewKeysTSIGKey("Name_example", "Secret_example") // KeysTSIGKey | - - configuration := openapiclient.NewConfiguration() - apiClient := openapiclient.NewAPIClient(configuration) - resp, r, err := apiClient.TsigAPI.TsigCreate(context.Background()).Body(body).Execute() - if err != nil { - fmt.Fprintf(os.Stderr, "Error when calling `TsigAPI.TsigCreate``: %v\n", err) - fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) - } - // response from `TsigCreate`: KeysCreateTSIGKeyResponse - fmt.Fprintf(os.Stdout, "Response from `TsigAPI.TsigCreate`: %v\n", resp) + body := *openapiclient.NewKeysTSIGKey("Name_example", "Secret_example") // KeysTSIGKey | + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.TsigAPI.TsigCreate(context.Background()).Body(body).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `TsigAPI.TsigCreate``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `TsigCreate`: KeysCreateTSIGKeyResponse + fmt.Fprintf(os.Stdout, "Response from `TsigAPI.TsigCreate`: %v\n", resp) } ``` @@ -92,22 +92,22 @@ Delete the TSIG key. package main import ( - "context" - "fmt" - "os" - openapiclient "github.com/infobloxopen/bloxone-go-client" + "context" + "fmt" + "os" + openapiclient "github.com/infobloxopen/bloxone-go-client" ) func main() { - id := "id_example" // string | An application specific resource identity of a resource - - configuration := openapiclient.NewConfiguration() - apiClient := openapiclient.NewAPIClient(configuration) - r, err := apiClient.TsigAPI.TsigDelete(context.Background(), id).Execute() - if err != nil { - fmt.Fprintf(os.Stderr, "Error when calling `TsigAPI.TsigDelete``: %v\n", err) - fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) - } + id := "id_example" // string | An application specific resource identity of a resource + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + r, err := apiClient.TsigAPI.TsigDelete(context.Background(), id).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `TsigAPI.TsigDelete``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } } ``` @@ -160,31 +160,31 @@ Retrieve TSIG keys. package main import ( - "context" - "fmt" - "os" - openapiclient "github.com/infobloxopen/bloxone-go-client" + "context" + "fmt" + "os" + openapiclient "github.com/infobloxopen/bloxone-go-client" ) func main() { - fields := "fields_example" // string | A collection of response resources can be transformed by specifying a set of JSON tags to be returned. For a “flat” resource, the tag name is straightforward. If field selection is allowed on non-flat hierarchical resources, the service should implement a qualified naming scheme such as dot-qualification to reference data down the hierarchy. If a resource does not have the specified tag, the tag does not appear in the output resource. Specify this parameter as a comma-separated list of JSON tag names. (optional) - filter := "filter_example" // string | A collection of response resources can be filtered by a logical expression string that includes JSON tag references to values in each resource, literal values, and logical operators. If a resource does not have the specified tag, its value is assumed to be null. Literal values include numbers (integer and floating-point), and quoted (both single- or double-quoted) literal strings, and 'null'. The following operators are commonly used in filter expressions: | Op | Description | | -- | ----------- | | == | Equal | | != | Not Equal | | > | Greater Than | | >= | Greater Than or Equal To | | < | Less Than | | <= | Less Than or Equal To | | and | Logical AND | | ~ | Matches Regex | | !~ | Does Not Match Regex | | or | Logical OR | | not | Logical NOT | | () | Groupping Operators | (optional) - offset := int32(56) // int32 | The integer index (zero-origin) of the offset into a collection of resources. If omitted or null the value is assumed to be '0'. (optional) - limit := int32(56) // int32 | The integer number of resources to be returned in the response. The service may impose maximum value. If omitted the service may impose a default value. (optional) - pageToken := "pageToken_example" // string | The service-defined string used to identify a page of resources. A null value indicates the first page. (optional) - orderBy := "orderBy_example" // string | A collection of response resources can be sorted by their JSON tags. For a 'flat' resource, the tag name is straightforward. If sorting is allowed on non-flat hierarchical resources, the service should implement a qualified naming scheme such as dot-qualification to reference data down the hierarchy. If a resource does not have the specified tag, its value is assumed to be null.) Specify this parameter as a comma-separated list of JSON tag names. The sort direction can be specified by a suffix separated by whitespace before the tag name. The suffix 'asc' sorts the data in ascending order. The suffix 'desc' sorts the data in descending order. If no suffix is specified the data is sorted in ascending order. (optional) - tfilter := "tfilter_example" // string | This parameter is used for filtering by tags. (optional) - torderBy := "torderBy_example" // string | This parameter is used for sorting by tags. (optional) - - configuration := openapiclient.NewConfiguration() - apiClient := openapiclient.NewAPIClient(configuration) - resp, r, err := apiClient.TsigAPI.TsigList(context.Background()).Fields(fields).Filter(filter).Offset(offset).Limit(limit).PageToken(pageToken).OrderBy(orderBy).Tfilter(tfilter).TorderBy(torderBy).Execute() - if err != nil { - fmt.Fprintf(os.Stderr, "Error when calling `TsigAPI.TsigList``: %v\n", err) - fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) - } - // response from `TsigList`: KeysListTSIGKeyResponse - fmt.Fprintf(os.Stdout, "Response from `TsigAPI.TsigList`: %v\n", resp) + fields := "fields_example" // string | A collection of response resources can be transformed by specifying a set of JSON tags to be returned. For a “flat” resource, the tag name is straightforward. If field selection is allowed on non-flat hierarchical resources, the service should implement a qualified naming scheme such as dot-qualification to reference data down the hierarchy. If a resource does not have the specified tag, the tag does not appear in the output resource. Specify this parameter as a comma-separated list of JSON tag names. (optional) + filter := "filter_example" // string | A collection of response resources can be filtered by a logical expression string that includes JSON tag references to values in each resource, literal values, and logical operators. If a resource does not have the specified tag, its value is assumed to be null. Literal values include numbers (integer and floating-point), and quoted (both single- or double-quoted) literal strings, and 'null'. The following operators are commonly used in filter expressions: | Op | Description | | -- | ----------- | | == | Equal | | != | Not Equal | | > | Greater Than | | >= | Greater Than or Equal To | | < | Less Than | | <= | Less Than or Equal To | | and | Logical AND | | ~ | Matches Regex | | !~ | Does Not Match Regex | | or | Logical OR | | not | Logical NOT | | () | Groupping Operators | (optional) + offset := int32(56) // int32 | The integer index (zero-origin) of the offset into a collection of resources. If omitted or null the value is assumed to be '0'. (optional) + limit := int32(56) // int32 | The integer number of resources to be returned in the response. The service may impose maximum value. If omitted the service may impose a default value. (optional) + pageToken := "pageToken_example" // string | The service-defined string used to identify a page of resources. A null value indicates the first page. (optional) + orderBy := "orderBy_example" // string | A collection of response resources can be sorted by their JSON tags. For a 'flat' resource, the tag name is straightforward. If sorting is allowed on non-flat hierarchical resources, the service should implement a qualified naming scheme such as dot-qualification to reference data down the hierarchy. If a resource does not have the specified tag, its value is assumed to be null.) Specify this parameter as a comma-separated list of JSON tag names. The sort direction can be specified by a suffix separated by whitespace before the tag name. The suffix 'asc' sorts the data in ascending order. The suffix 'desc' sorts the data in descending order. If no suffix is specified the data is sorted in ascending order. (optional) + tfilter := "tfilter_example" // string | This parameter is used for filtering by tags. (optional) + torderBy := "torderBy_example" // string | This parameter is used for sorting by tags. (optional) + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.TsigAPI.TsigList(context.Background()).Fields(fields).Filter(filter).Offset(offset).Limit(limit).PageToken(pageToken).OrderBy(orderBy).Tfilter(tfilter).TorderBy(torderBy).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `TsigAPI.TsigList``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `TsigList`: KeysListTSIGKeyResponse + fmt.Fprintf(os.Stdout, "Response from `TsigAPI.TsigList`: %v\n", resp) } ``` @@ -240,25 +240,25 @@ Retrieve the TSIG key. package main import ( - "context" - "fmt" - "os" - openapiclient "github.com/infobloxopen/bloxone-go-client" + "context" + "fmt" + "os" + openapiclient "github.com/infobloxopen/bloxone-go-client" ) func main() { - id := "id_example" // string | An application specific resource identity of a resource - fields := "fields_example" // string | A collection of response resources can be transformed by specifying a set of JSON tags to be returned. For a “flat” resource, the tag name is straightforward. If field selection is allowed on non-flat hierarchical resources, the service should implement a qualified naming scheme such as dot-qualification to reference data down the hierarchy. If a resource does not have the specified tag, the tag does not appear in the output resource. Specify this parameter as a comma-separated list of JSON tag names. (optional) - - configuration := openapiclient.NewConfiguration() - apiClient := openapiclient.NewAPIClient(configuration) - resp, r, err := apiClient.TsigAPI.TsigRead(context.Background(), id).Fields(fields).Execute() - if err != nil { - fmt.Fprintf(os.Stderr, "Error when calling `TsigAPI.TsigRead``: %v\n", err) - fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) - } - // response from `TsigRead`: KeysReadTSIGKeyResponse - fmt.Fprintf(os.Stdout, "Response from `TsigAPI.TsigRead`: %v\n", resp) + id := "id_example" // string | An application specific resource identity of a resource + fields := "fields_example" // string | A collection of response resources can be transformed by specifying a set of JSON tags to be returned. For a “flat” resource, the tag name is straightforward. If field selection is allowed on non-flat hierarchical resources, the service should implement a qualified naming scheme such as dot-qualification to reference data down the hierarchy. If a resource does not have the specified tag, the tag does not appear in the output resource. Specify this parameter as a comma-separated list of JSON tag names. (optional) + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.TsigAPI.TsigRead(context.Background(), id).Fields(fields).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `TsigAPI.TsigRead``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `TsigRead`: KeysReadTSIGKeyResponse + fmt.Fprintf(os.Stdout, "Response from `TsigAPI.TsigRead`: %v\n", resp) } ``` @@ -312,25 +312,25 @@ Update the TSIG key. package main import ( - "context" - "fmt" - "os" - openapiclient "github.com/infobloxopen/bloxone-go-client" + "context" + "fmt" + "os" + openapiclient "github.com/infobloxopen/bloxone-go-client" ) func main() { - id := "id_example" // string | An application specific resource identity of a resource - body := *openapiclient.NewKeysTSIGKey("Name_example", "Secret_example") // KeysTSIGKey | - - configuration := openapiclient.NewConfiguration() - apiClient := openapiclient.NewAPIClient(configuration) - resp, r, err := apiClient.TsigAPI.TsigUpdate(context.Background(), id).Body(body).Execute() - if err != nil { - fmt.Fprintf(os.Stderr, "Error when calling `TsigAPI.TsigUpdate``: %v\n", err) - fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) - } - // response from `TsigUpdate`: KeysUpdateTSIGKeyResponse - fmt.Fprintf(os.Stdout, "Response from `TsigAPI.TsigUpdate`: %v\n", resp) + id := "id_example" // string | An application specific resource identity of a resource + body := *openapiclient.NewKeysTSIGKey("Name_example", "Secret_example") // KeysTSIGKey | + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.TsigAPI.TsigUpdate(context.Background(), id).Body(body).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `TsigAPI.TsigUpdate``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `TsigUpdate`: KeysUpdateTSIGKeyResponse + fmt.Fprintf(os.Stdout, "Response from `TsigAPI.TsigUpdate`: %v\n", resp) } ``` diff --git a/keys/docs/UploadAPI.md b/keys/docs/UploadAPI.md index 00cc161..0170ee0 100644 --- a/keys/docs/UploadAPI.md +++ b/keys/docs/UploadAPI.md @@ -22,24 +22,24 @@ Upload content to the keys service. package main import ( - "context" - "fmt" - "os" - openapiclient "github.com/infobloxopen/bloxone-go-client" + "context" + "fmt" + "os" + openapiclient "github.com/infobloxopen/bloxone-go-client" ) func main() { - body := *openapiclient.NewUploadRequest("Content_example", openapiclient.uploadContentType("UNKNOWN")) // UploadRequest | - - configuration := openapiclient.NewConfiguration() - apiClient := openapiclient.NewAPIClient(configuration) - resp, r, err := apiClient.UploadAPI.UploadUpload(context.Background()).Body(body).Execute() - if err != nil { - fmt.Fprintf(os.Stderr, "Error when calling `UploadAPI.UploadUpload``: %v\n", err) - fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) - } - // response from `UploadUpload`: DdiuploadResponse - fmt.Fprintf(os.Stdout, "Response from `UploadAPI.UploadUpload`: %v\n", resp) + body := *openapiclient.NewUploadRequest("Content_example", openapiclient.uploadContentType("UNKNOWN")) // UploadRequest | + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.UploadAPI.UploadUpload(context.Background()).Body(body).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `UploadAPI.UploadUpload``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `UploadUpload`: DdiuploadResponse + fmt.Fprintf(os.Stdout, "Response from `UploadAPI.UploadUpload`: %v\n", resp) } ``` diff --git a/keys/model_ddiupload_response.go b/keys/model_ddiupload_response.go index a58ddfb..e220432 100644 --- a/keys/model_ddiupload_response.go +++ b/keys/model_ddiupload_response.go @@ -1,7 +1,7 @@ /* DDI Keys API -The DDI Keys application is a BloxOne DDI service for managing TSIG keys and GSS-TSIG (Kerberos) keys which are used by other BloxOne DDI applications. It is part of the full-featured, DDI cloud solution that enables customers to deploy large numbers of protocol servers to deliver DNS and DHCP throughout their enterprise network. +The DDI Keys application is a BloxOne DDI service for managing TSIG keys and GSS-TSIG (Kerberos) keys which are used by other BloxOne DDI applications. It is part of the full-featured, DDI cloud solution that enables customers to deploy large numbers of protocol servers to deliver DNS and DHCP throughout their enterprise network. API version: v1 */ @@ -106,7 +106,7 @@ func (o *DdiuploadResponse) SetWarning(v string) { } func (o DdiuploadResponse) MarshalJSON() ([]byte, error) { - toSerialize, err := o.ToMap() + toSerialize,err := o.ToMap() if err != nil { return []byte{}, err } @@ -159,3 +159,5 @@ func (v *NullableDdiuploadResponse) UnmarshalJSON(src []byte) error { v.isSet = true return json.Unmarshal(src, &v.value) } + + diff --git a/keys/model_kerberos_key.go b/keys/model_kerberos_key.go index ee036c9..4285f1e 100644 --- a/keys/model_kerberos_key.go +++ b/keys/model_kerberos_key.go @@ -1,7 +1,7 @@ /* DDI Keys API -The DDI Keys application is a BloxOne DDI service for managing TSIG keys and GSS-TSIG (Kerberos) keys which are used by other BloxOne DDI applications. It is part of the full-featured, DDI cloud solution that enables customers to deploy large numbers of protocol servers to deliver DNS and DHCP throughout their enterprise network. +The DDI Keys application is a BloxOne DDI service for managing TSIG keys and GSS-TSIG (Kerberos) keys which are used by other BloxOne DDI applications. It is part of the full-featured, DDI cloud solution that enables customers to deploy large numbers of protocol servers to deliver DNS and DHCP throughout their enterprise network. API version: v1 */ @@ -311,7 +311,7 @@ func (o *KerberosKey) SetVersion(v int64) { } func (o KerberosKey) MarshalJSON() ([]byte, error) { - toSerialize, err := o.ToMap() + toSerialize,err := o.ToMap() if err != nil { return []byte{}, err } @@ -382,3 +382,5 @@ func (v *NullableKerberosKey) UnmarshalJSON(src []byte) error { v.isSet = true return json.Unmarshal(src, &v.value) } + + diff --git a/keys/model_kerberos_keys.go b/keys/model_kerberos_keys.go index 1c06064..78817e6 100644 --- a/keys/model_kerberos_keys.go +++ b/keys/model_kerberos_keys.go @@ -1,7 +1,7 @@ /* DDI Keys API -The DDI Keys application is a BloxOne DDI service for managing TSIG keys and GSS-TSIG (Kerberos) keys which are used by other BloxOne DDI applications. It is part of the full-featured, DDI cloud solution that enables customers to deploy large numbers of protocol servers to deliver DNS and DHCP throughout their enterprise network. +The DDI Keys application is a BloxOne DDI service for managing TSIG keys and GSS-TSIG (Kerberos) keys which are used by other BloxOne DDI applications. It is part of the full-featured, DDI cloud solution that enables customers to deploy large numbers of protocol servers to deliver DNS and DHCP throughout their enterprise network. API version: v1 */ @@ -72,7 +72,7 @@ func (o *KerberosKeys) SetItems(v []KerberosKey) { } func (o KerberosKeys) MarshalJSON() ([]byte, error) { - toSerialize, err := o.ToMap() + toSerialize,err := o.ToMap() if err != nil { return []byte{}, err } @@ -122,3 +122,5 @@ func (v *NullableKerberosKeys) UnmarshalJSON(src []byte) error { v.isSet = true return json.Unmarshal(src, &v.value) } + + diff --git a/keys/model_keys_create_tsig_key_response.go b/keys/model_keys_create_tsig_key_response.go index edd0da5..bfe51e4 100644 --- a/keys/model_keys_create_tsig_key_response.go +++ b/keys/model_keys_create_tsig_key_response.go @@ -1,7 +1,7 @@ /* DDI Keys API -The DDI Keys application is a BloxOne DDI service for managing TSIG keys and GSS-TSIG (Kerberos) keys which are used by other BloxOne DDI applications. It is part of the full-featured, DDI cloud solution that enables customers to deploy large numbers of protocol servers to deliver DNS and DHCP throughout their enterprise network. +The DDI Keys application is a BloxOne DDI service for managing TSIG keys and GSS-TSIG (Kerberos) keys which are used by other BloxOne DDI applications. It is part of the full-featured, DDI cloud solution that enables customers to deploy large numbers of protocol servers to deliver DNS and DHCP throughout their enterprise network. API version: v1 */ @@ -72,7 +72,7 @@ func (o *KeysCreateTSIGKeyResponse) SetResult(v KeysTSIGKey) { } func (o KeysCreateTSIGKeyResponse) MarshalJSON() ([]byte, error) { - toSerialize, err := o.ToMap() + toSerialize,err := o.ToMap() if err != nil { return []byte{}, err } @@ -122,3 +122,5 @@ func (v *NullableKeysCreateTSIGKeyResponse) UnmarshalJSON(src []byte) error { v.isSet = true return json.Unmarshal(src, &v.value) } + + diff --git a/keys/model_keys_generate_tsig_response.go b/keys/model_keys_generate_tsig_response.go index 85f10e4..5a6ee49 100644 --- a/keys/model_keys_generate_tsig_response.go +++ b/keys/model_keys_generate_tsig_response.go @@ -1,7 +1,7 @@ /* DDI Keys API -The DDI Keys application is a BloxOne DDI service for managing TSIG keys and GSS-TSIG (Kerberos) keys which are used by other BloxOne DDI applications. It is part of the full-featured, DDI cloud solution that enables customers to deploy large numbers of protocol servers to deliver DNS and DHCP throughout their enterprise network. +The DDI Keys application is a BloxOne DDI service for managing TSIG keys and GSS-TSIG (Kerberos) keys which are used by other BloxOne DDI applications. It is part of the full-featured, DDI cloud solution that enables customers to deploy large numbers of protocol servers to deliver DNS and DHCP throughout their enterprise network. API version: v1 */ @@ -72,7 +72,7 @@ func (o *KeysGenerateTSIGResponse) SetResult(v KeysGenerateTSIGResult) { } func (o KeysGenerateTSIGResponse) MarshalJSON() ([]byte, error) { - toSerialize, err := o.ToMap() + toSerialize,err := o.ToMap() if err != nil { return []byte{}, err } @@ -122,3 +122,5 @@ func (v *NullableKeysGenerateTSIGResponse) UnmarshalJSON(src []byte) error { v.isSet = true return json.Unmarshal(src, &v.value) } + + diff --git a/keys/model_keys_generate_tsig_result.go b/keys/model_keys_generate_tsig_result.go index 4f6b49d..9b7dab8 100644 --- a/keys/model_keys_generate_tsig_result.go +++ b/keys/model_keys_generate_tsig_result.go @@ -1,7 +1,7 @@ /* DDI Keys API -The DDI Keys application is a BloxOne DDI service for managing TSIG keys and GSS-TSIG (Kerberos) keys which are used by other BloxOne DDI applications. It is part of the full-featured, DDI cloud solution that enables customers to deploy large numbers of protocol servers to deliver DNS and DHCP throughout their enterprise network. +The DDI Keys application is a BloxOne DDI service for managing TSIG keys and GSS-TSIG (Kerberos) keys which are used by other BloxOne DDI applications. It is part of the full-featured, DDI cloud solution that enables customers to deploy large numbers of protocol servers to deliver DNS and DHCP throughout their enterprise network. API version: v1 */ @@ -73,7 +73,7 @@ func (o *KeysGenerateTSIGResult) SetSecret(v string) { } func (o KeysGenerateTSIGResult) MarshalJSON() ([]byte, error) { - toSerialize, err := o.ToMap() + toSerialize,err := o.ToMap() if err != nil { return []byte{}, err } @@ -123,3 +123,5 @@ func (v *NullableKeysGenerateTSIGResult) UnmarshalJSON(src []byte) error { v.isSet = true return json.Unmarshal(src, &v.value) } + + diff --git a/keys/model_keys_list_kerberos_key_response.go b/keys/model_keys_list_kerberos_key_response.go index 5966a99..31006cc 100644 --- a/keys/model_keys_list_kerberos_key_response.go +++ b/keys/model_keys_list_kerberos_key_response.go @@ -1,7 +1,7 @@ /* DDI Keys API -The DDI Keys application is a BloxOne DDI service for managing TSIG keys and GSS-TSIG (Kerberos) keys which are used by other BloxOne DDI applications. It is part of the full-featured, DDI cloud solution that enables customers to deploy large numbers of protocol servers to deliver DNS and DHCP throughout their enterprise network. +The DDI Keys application is a BloxOne DDI service for managing TSIG keys and GSS-TSIG (Kerberos) keys which are used by other BloxOne DDI applications. It is part of the full-featured, DDI cloud solution that enables customers to deploy large numbers of protocol servers to deliver DNS and DHCP throughout their enterprise network. API version: v1 */ @@ -73,7 +73,7 @@ func (o *KeysListKerberosKeyResponse) SetResults(v []KerberosKey) { } func (o KeysListKerberosKeyResponse) MarshalJSON() ([]byte, error) { - toSerialize, err := o.ToMap() + toSerialize,err := o.ToMap() if err != nil { return []byte{}, err } @@ -123,3 +123,5 @@ func (v *NullableKeysListKerberosKeyResponse) UnmarshalJSON(src []byte) error { v.isSet = true return json.Unmarshal(src, &v.value) } + + diff --git a/keys/model_keys_list_tsig_key_response.go b/keys/model_keys_list_tsig_key_response.go index 2a6d699..5d90120 100644 --- a/keys/model_keys_list_tsig_key_response.go +++ b/keys/model_keys_list_tsig_key_response.go @@ -1,7 +1,7 @@ /* DDI Keys API -The DDI Keys application is a BloxOne DDI service for managing TSIG keys and GSS-TSIG (Kerberos) keys which are used by other BloxOne DDI applications. It is part of the full-featured, DDI cloud solution that enables customers to deploy large numbers of protocol servers to deliver DNS and DHCP throughout their enterprise network. +The DDI Keys application is a BloxOne DDI service for managing TSIG keys and GSS-TSIG (Kerberos) keys which are used by other BloxOne DDI applications. It is part of the full-featured, DDI cloud solution that enables customers to deploy large numbers of protocol servers to deliver DNS and DHCP throughout their enterprise network. API version: v1 */ @@ -73,7 +73,7 @@ func (o *KeysListTSIGKeyResponse) SetResults(v []KeysTSIGKey) { } func (o KeysListTSIGKeyResponse) MarshalJSON() ([]byte, error) { - toSerialize, err := o.ToMap() + toSerialize,err := o.ToMap() if err != nil { return []byte{}, err } @@ -123,3 +123,5 @@ func (v *NullableKeysListTSIGKeyResponse) UnmarshalJSON(src []byte) error { v.isSet = true return json.Unmarshal(src, &v.value) } + + diff --git a/keys/model_keys_read_kerberos_key_response.go b/keys/model_keys_read_kerberos_key_response.go index dce9578..daeeb0c 100644 --- a/keys/model_keys_read_kerberos_key_response.go +++ b/keys/model_keys_read_kerberos_key_response.go @@ -1,7 +1,7 @@ /* DDI Keys API -The DDI Keys application is a BloxOne DDI service for managing TSIG keys and GSS-TSIG (Kerberos) keys which are used by other BloxOne DDI applications. It is part of the full-featured, DDI cloud solution that enables customers to deploy large numbers of protocol servers to deliver DNS and DHCP throughout their enterprise network. +The DDI Keys application is a BloxOne DDI service for managing TSIG keys and GSS-TSIG (Kerberos) keys which are used by other BloxOne DDI applications. It is part of the full-featured, DDI cloud solution that enables customers to deploy large numbers of protocol servers to deliver DNS and DHCP throughout their enterprise network. API version: v1 */ @@ -72,7 +72,7 @@ func (o *KeysReadKerberosKeyResponse) SetResult(v KerberosKey) { } func (o KeysReadKerberosKeyResponse) MarshalJSON() ([]byte, error) { - toSerialize, err := o.ToMap() + toSerialize,err := o.ToMap() if err != nil { return []byte{}, err } @@ -122,3 +122,5 @@ func (v *NullableKeysReadKerberosKeyResponse) UnmarshalJSON(src []byte) error { v.isSet = true return json.Unmarshal(src, &v.value) } + + diff --git a/keys/model_keys_read_tsig_key_response.go b/keys/model_keys_read_tsig_key_response.go index fdc725c..3eee404 100644 --- a/keys/model_keys_read_tsig_key_response.go +++ b/keys/model_keys_read_tsig_key_response.go @@ -1,7 +1,7 @@ /* DDI Keys API -The DDI Keys application is a BloxOne DDI service for managing TSIG keys and GSS-TSIG (Kerberos) keys which are used by other BloxOne DDI applications. It is part of the full-featured, DDI cloud solution that enables customers to deploy large numbers of protocol servers to deliver DNS and DHCP throughout their enterprise network. +The DDI Keys application is a BloxOne DDI service for managing TSIG keys and GSS-TSIG (Kerberos) keys which are used by other BloxOne DDI applications. It is part of the full-featured, DDI cloud solution that enables customers to deploy large numbers of protocol servers to deliver DNS and DHCP throughout their enterprise network. API version: v1 */ @@ -72,7 +72,7 @@ func (o *KeysReadTSIGKeyResponse) SetResult(v KeysTSIGKey) { } func (o KeysReadTSIGKeyResponse) MarshalJSON() ([]byte, error) { - toSerialize, err := o.ToMap() + toSerialize,err := o.ToMap() if err != nil { return []byte{}, err } @@ -122,3 +122,5 @@ func (v *NullableKeysReadTSIGKeyResponse) UnmarshalJSON(src []byte) error { v.isSet = true return json.Unmarshal(src, &v.value) } + + diff --git a/keys/model_keys_tsig_key.go b/keys/model_keys_tsig_key.go index 12c1ea5..2e98702 100644 --- a/keys/model_keys_tsig_key.go +++ b/keys/model_keys_tsig_key.go @@ -1,7 +1,7 @@ /* DDI Keys API -The DDI Keys application is a BloxOne DDI service for managing TSIG keys and GSS-TSIG (Kerberos) keys which are used by other BloxOne DDI applications. It is part of the full-featured, DDI cloud solution that enables customers to deploy large numbers of protocol servers to deliver DNS and DHCP throughout their enterprise network. +The DDI Keys application is a BloxOne DDI service for managing TSIG keys and GSS-TSIG (Kerberos) keys which are used by other BloxOne DDI applications. It is part of the full-featured, DDI cloud solution that enables customers to deploy large numbers of protocol servers to deliver DNS and DHCP throughout their enterprise network. API version: v1 */ @@ -13,7 +13,8 @@ package keys import ( "encoding/json" "time" - + "bytes" + "fmt" ) // checks if the KeysTSIGKey type satisfies the MappedNullable interface at compile time @@ -39,9 +40,10 @@ type KeysTSIGKey struct { Tags map[string]interface{} `json:"tags,omitempty"` // Time when the object has been updated. Equals to _created_at_ if not updated after creation. UpdatedAt *time.Time `json:"updated_at,omitempty"` - res interface{} } +type _KeysTSIGKey KeysTSIGKey + // NewKeysTSIGKey instantiates a new KeysTSIGKey object // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments @@ -334,7 +336,7 @@ func (o *KeysTSIGKey) SetUpdatedAt(v time.Time) { } func (o KeysTSIGKey) MarshalJSON() ([]byte, error) { - toSerialize, err := o.ToMap() + toSerialize,err := o.ToMap() if err != nil { return []byte{}, err } @@ -369,6 +371,44 @@ func (o KeysTSIGKey) ToMap() (map[string]interface{}, error) { return toSerialize, nil } +func (o *KeysTSIGKey) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "name", + "secret", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err; + } + + for _, requiredProperty := range(requiredProperties) { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varKeysTSIGKey := _KeysTSIGKey{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varKeysTSIGKey) + + if err != nil { + return err + } + + *o = KeysTSIGKey(varKeysTSIGKey) + + return err +} + type NullableKeysTSIGKey struct { value *KeysTSIGKey isSet bool @@ -404,3 +444,5 @@ func (v *NullableKeysTSIGKey) UnmarshalJSON(src []byte) error { v.isSet = true return json.Unmarshal(src, &v.value) } + + diff --git a/keys/model_keys_update_kerberos_key_response.go b/keys/model_keys_update_kerberos_key_response.go index 9e83ae5..189d271 100644 --- a/keys/model_keys_update_kerberos_key_response.go +++ b/keys/model_keys_update_kerberos_key_response.go @@ -1,7 +1,7 @@ /* DDI Keys API -The DDI Keys application is a BloxOne DDI service for managing TSIG keys and GSS-TSIG (Kerberos) keys which are used by other BloxOne DDI applications. It is part of the full-featured, DDI cloud solution that enables customers to deploy large numbers of protocol servers to deliver DNS and DHCP throughout their enterprise network. +The DDI Keys application is a BloxOne DDI service for managing TSIG keys and GSS-TSIG (Kerberos) keys which are used by other BloxOne DDI applications. It is part of the full-featured, DDI cloud solution that enables customers to deploy large numbers of protocol servers to deliver DNS and DHCP throughout their enterprise network. API version: v1 */ @@ -72,7 +72,7 @@ func (o *KeysUpdateKerberosKeyResponse) SetResult(v KerberosKey) { } func (o KeysUpdateKerberosKeyResponse) MarshalJSON() ([]byte, error) { - toSerialize, err := o.ToMap() + toSerialize,err := o.ToMap() if err != nil { return []byte{}, err } @@ -122,3 +122,5 @@ func (v *NullableKeysUpdateKerberosKeyResponse) UnmarshalJSON(src []byte) error v.isSet = true return json.Unmarshal(src, &v.value) } + + diff --git a/keys/model_keys_update_tsig_key_response.go b/keys/model_keys_update_tsig_key_response.go index dc1acd7..2082989 100644 --- a/keys/model_keys_update_tsig_key_response.go +++ b/keys/model_keys_update_tsig_key_response.go @@ -1,7 +1,7 @@ /* DDI Keys API -The DDI Keys application is a BloxOne DDI service for managing TSIG keys and GSS-TSIG (Kerberos) keys which are used by other BloxOne DDI applications. It is part of the full-featured, DDI cloud solution that enables customers to deploy large numbers of protocol servers to deliver DNS and DHCP throughout their enterprise network. +The DDI Keys application is a BloxOne DDI service for managing TSIG keys and GSS-TSIG (Kerberos) keys which are used by other BloxOne DDI applications. It is part of the full-featured, DDI cloud solution that enables customers to deploy large numbers of protocol servers to deliver DNS and DHCP throughout their enterprise network. API version: v1 */ @@ -72,7 +72,7 @@ func (o *KeysUpdateTSIGKeyResponse) SetResult(v KeysTSIGKey) { } func (o KeysUpdateTSIGKeyResponse) MarshalJSON() ([]byte, error) { - toSerialize, err := o.ToMap() + toSerialize,err := o.ToMap() if err != nil { return []byte{}, err } @@ -122,3 +122,5 @@ func (v *NullableKeysUpdateTSIGKeyResponse) UnmarshalJSON(src []byte) error { v.isSet = true return json.Unmarshal(src, &v.value) } + + diff --git a/keys/model_protobuf_field_mask.go b/keys/model_protobuf_field_mask.go index c76ddb4..33973a0 100644 --- a/keys/model_protobuf_field_mask.go +++ b/keys/model_protobuf_field_mask.go @@ -1,7 +1,7 @@ /* DDI Keys API -The DDI Keys application is a BloxOne DDI service for managing TSIG keys and GSS-TSIG (Kerberos) keys which are used by other BloxOne DDI applications. It is part of the full-featured, DDI cloud solution that enables customers to deploy large numbers of protocol servers to deliver DNS and DHCP throughout their enterprise network. +The DDI Keys application is a BloxOne DDI service for managing TSIG keys and GSS-TSIG (Kerberos) keys which are used by other BloxOne DDI applications. It is part of the full-featured, DDI cloud solution that enables customers to deploy large numbers of protocol servers to deliver DNS and DHCP throughout their enterprise network. API version: v1 */ @@ -73,7 +73,7 @@ func (o *ProtobufFieldMask) SetPaths(v []string) { } func (o ProtobufFieldMask) MarshalJSON() ([]byte, error) { - toSerialize, err := o.ToMap() + toSerialize,err := o.ToMap() if err != nil { return []byte{}, err } @@ -123,3 +123,5 @@ func (v *NullableProtobufFieldMask) UnmarshalJSON(src []byte) error { v.isSet = true return json.Unmarshal(src, &v.value) } + + diff --git a/keys/model_upload_content_type.go b/keys/model_upload_content_type.go index dbdf50c..4052062 100644 --- a/keys/model_upload_content_type.go +++ b/keys/model_upload_content_type.go @@ -1,7 +1,7 @@ /* DDI Keys API -The DDI Keys application is a BloxOne DDI service for managing TSIG keys and GSS-TSIG (Kerberos) keys which are used by other BloxOne DDI applications. It is part of the full-featured, DDI cloud solution that enables customers to deploy large numbers of protocol servers to deliver DNS and DHCP throughout their enterprise network. +The DDI Keys application is a BloxOne DDI service for managing TSIG keys and GSS-TSIG (Kerberos) keys which are used by other BloxOne DDI applications. It is part of the full-featured, DDI cloud solution that enables customers to deploy large numbers of protocol servers to deliver DNS and DHCP throughout their enterprise network. API version: v1 */ @@ -21,7 +21,7 @@ type UploadContentType string // List of uploadContentType const ( UPLOADCONTENTTYPE_UNKNOWN UploadContentType = "UNKNOWN" - UPLOADCONTENTTYPE_KEYTAB UploadContentType = "KEYTAB" + UPLOADCONTENTTYPE_KEYTAB UploadContentType = "KEYTAB" ) // All allowed values of UploadContentType enum @@ -108,3 +108,4 @@ func (v *NullableUploadContentType) UnmarshalJSON(src []byte) error { v.isSet = true return json.Unmarshal(src, &v.value) } + diff --git a/keys/model_upload_request.go b/keys/model_upload_request.go index bb985e6..351fa56 100644 --- a/keys/model_upload_request.go +++ b/keys/model_upload_request.go @@ -1,7 +1,7 @@ /* DDI Keys API -The DDI Keys application is a BloxOne DDI service for managing TSIG keys and GSS-TSIG (Kerberos) keys which are used by other BloxOne DDI applications. It is part of the full-featured, DDI cloud solution that enables customers to deploy large numbers of protocol servers to deliver DNS and DHCP throughout their enterprise network. +The DDI Keys application is a BloxOne DDI service for managing TSIG keys and GSS-TSIG (Kerberos) keys which are used by other BloxOne DDI applications. It is part of the full-featured, DDI cloud solution that enables customers to deploy large numbers of protocol servers to deliver DNS and DHCP throughout their enterprise network. API version: v1 */ @@ -12,6 +12,8 @@ package keys import ( "encoding/json" + "bytes" + "fmt" ) // checks if the UploadRequest type satisfies the MappedNullable interface at compile time @@ -22,13 +24,15 @@ type UploadRequest struct { // The description for uploaded content. May contain 0 to 1024 characters. Can include UTF-8. Comment *string `json:"comment,omitempty"` // Base64 encoded content. - Content string `json:"content"` - Fields *ProtobufFieldMask `json:"fields,omitempty"` + Content string `json:"content"` + Fields *ProtobufFieldMask `json:"fields,omitempty"` // The tags for uploaded content in JSON format. Tags map[string]interface{} `json:"tags,omitempty"` - Type UploadContentType `json:"type"` + Type UploadContentType `json:"type"` } +type _UploadRequest UploadRequest + // NewUploadRequest instantiates a new UploadRequest object // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments @@ -195,7 +199,7 @@ func (o *UploadRequest) SetType(v UploadContentType) { } func (o UploadRequest) MarshalJSON() ([]byte, error) { - toSerialize, err := o.ToMap() + toSerialize,err := o.ToMap() if err != nil { return []byte{}, err } @@ -218,6 +222,44 @@ func (o UploadRequest) ToMap() (map[string]interface{}, error) { return toSerialize, nil } +func (o *UploadRequest) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "content", + "type", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err; + } + + for _, requiredProperty := range(requiredProperties) { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varUploadRequest := _UploadRequest{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varUploadRequest) + + if err != nil { + return err + } + + *o = UploadRequest(varUploadRequest) + + return err +} + type NullableUploadRequest struct { value *UploadRequest isSet bool @@ -253,3 +295,5 @@ func (v *NullableUploadRequest) UnmarshalJSON(src []byte) error { v.isSet = true return json.Unmarshal(src, &v.value) } + + diff --git a/keys/test/api_generate_tsig_test.go b/keys/test/api_generate_tsig_test.go index 8f29e45..5b5d0c3 100644 --- a/keys/test/api_generate_tsig_test.go +++ b/keys/test/api_generate_tsig_test.go @@ -13,56 +13,40 @@ import ( "bytes" "context" "encoding/json" - "github.com/stretchr/testify/require" "io" "net/http" "testing" + "github.com/stretchr/testify/require" + "github.com/infobloxopen/bloxone-go-client/internal" openapiclient "github.com/infobloxopen/bloxone-go-client/keys" ) -//type RoundTripFunc func(req *http.Request) *http.Response -// -//func (f RoundTripFunc) RoundTrip(req *http.Request) (*http.Response, error) { -// return f(req), nil -//} -// -//func NewTestClient(fn RoundTripFunc) *http.Client { -// return &http.Client{ -// Transport: RoundTripFunc(fn), -// } -//} - func Test_keys_GenerateTsigAPIService(t *testing.T) { - configuration := internal.NewConfiguration() - dummyKey := openapiclient.KeysGenerateTSIGResult{ - Secret: openapiclient.PtrString("XOJvQkcX6Og0CHFg+rQ27pqAB+EhSjVoI4Bs/JWegBc="), - } - configuration.HTTPClient = NewTestClient(func(req *http.Request) *http.Response { - require.Equal(t, "GET", req.Method) - require.Equal(t, "/api/ddi/v1/keys/generate_tsig", req.URL.Path) - require.Equal(t, "application/json", req.Header.Get("Accept")) - require.Equal(t, "hmac_sha256", req.URL.Query().Get("algorithm")) - response := openapiclient.KeysGenerateTSIGResponse{ - Result: &dummyKey, - } - body, err := json.Marshal(response) - require.NoError(t, err) - return &http.Response{ - StatusCode: 200, - Body: io.NopCloser(bytes.NewReader(body)), - Header: map[string][]string{ - "Content-Type": {"application/json"}, - }, - } + t.Run("Test GenerateTsigAPIService GenerateTsigGenerateTSIG", func(t *testing.T) { + configuration := internal.NewConfiguration() + configuration.HTTPClient = internal.NewTestClient(func(req *http.Request) *http.Response { + require.Equal(t, http.MethodGet, req.Method) + require.Equal(t, "/api/ddi/v1/keys/generate_tsig", req.URL.Path) + require.Equal(t, "application/json", req.Header.Get("Accept")) + + response := openapiclient.KeysGenerateTSIGResponse{} + body, err := json.Marshal(response) + require.NoError(t, err) + + return &http.Response{ + StatusCode: http.StatusOK, + Body: io.NopCloser(bytes.NewReader(body)), + Header: map[string][]string{"Content-Type": {"application/json"}}, + } + }) + apiClient := openapiclient.NewAPIClient(configuration) + resp, httpRes, err := apiClient.GenerateTsigAPI.GenerateTsigGenerateTSIG(context.Background()).Execute() + require.Nil(t, err) + require.NotNil(t, resp) + require.Equal(t, http.StatusOK, httpRes.StatusCode) }) - apiClient := openapiclient.NewAPIClient(configuration) - request := apiClient.GenerateTsigAPI.GenerateTsigGenerateTSIG(context.Background()).Algorithm("hmac_sha256") - response, httpRes, err := request.Execute() - require.Nil(t, err) - require.Equal(t, 200, httpRes.StatusCode) - require.NotNil(t, response) - require.Equal(t, "XOJvQkcX6Og0CHFg+rQ27pqAB+EhSjVoI4Bs/JWegBc=", *response.Result.Secret) + } diff --git a/keys/test/api_kerberos_test.go b/keys/test/api_kerberos_test.go index 6b54d87..240fe01 100644 --- a/keys/test/api_kerberos_test.go +++ b/keys/test/api_kerberos_test.go @@ -13,195 +13,145 @@ import ( "bytes" "context" "encoding/json" - "github.com/stretchr/testify/require" "io" "net/http" "testing" + "github.com/stretchr/testify/require" + "github.com/infobloxopen/bloxone-go-client/internal" openapiclient "github.com/infobloxopen/bloxone-go-client/keys" ) -//type RoundTripFunc func(req *http.Request) *http.Response -// -//func (f RoundTripFunc) RoundTrip(req *http.Request) (*http.Response, error) { -// return f(req), nil -//} -// -//func NewTestClient(fn RoundTripFunc) *http.Client { -// return &http.Client{ -// Transport: RoundTripFunc(fn), -// } -//} +var KerberosKey_Patch = openapiclient.KerberosKey{ + Id: openapiclient.PtrString("KerberosKeyPost"), +} +var KerberosKey_Post = openapiclient.KerberosKey{ + Id: openapiclient.PtrString("KerberosKeyPatch"), +} func Test_keys_KerberosAPIService(t *testing.T) { - t.Run("Test KerberosAPIService KerberosRead", func(t *testing.T) { + t.Run("Test KerberosAPIService KerberosDelete", func(t *testing.T) { + configuration := internal.NewConfiguration() + configuration.HTTPClient = internal.NewTestClient(func(req *http.Request) *http.Response { + require.Equal(t, http.MethodDelete, req.Method) + require.Equal(t, "/api/ddi/v1/keys/kerberos/"+*KerberosKey_Post.Id, req.URL.Path) - t.Skip("skip test") + return &http.Response{ + StatusCode: http.StatusOK, + Body: io.NopCloser(bytes.NewReader([]byte{})), + Header: map[string][]string{"Content-Type": {"application/json"}}, + } + }) + apiClient := openapiclient.NewAPIClient(configuration) + httpRes, err := apiClient.KerberosAPI.KerberosDelete(context.Background(), *KerberosKey_Post.Id).Execute() + require.Nil(t, err) + require.Equal(t, http.StatusOK, httpRes.StatusCode) + }) + t.Run("Test KerberosAPIService KerberosList", func(t *testing.T) { configuration := internal.NewConfiguration() - configuration.HTTPClient = NewTestClient(func(req *http.Request) *http.Response { - require.Equal(t, "GET", req.Method) - require.Equal(t, "/api/ddi/v1/keys/kerberos/dummyKey", req.URL.Path) + configuration.HTTPClient = internal.NewTestClient(func(req *http.Request) *http.Response { + require.Equal(t, http.MethodGet, req.Method) + require.Equal(t, "/api/ddi/v1/keys/kerberos", req.URL.Path) require.Equal(t, "application/json", req.Header.Get("Accept")) - response := openapiclient.KeysReadKerberosKeyResponse{ - Result: &openapiclient.KerberosKey{ - Algorithm: openapiclient.PtrString("aes256-cts-hmac-sha1-96"), - Comment: openapiclient.PtrString("Test Kerberos Key"), - Id: nil, - }, - } + response := openapiclient.KeysListKerberosKeyResponse{} body, err := json.Marshal(response) require.NoError(t, err) + return &http.Response{ - StatusCode: 200, + StatusCode: http.StatusOK, Body: io.NopCloser(bytes.NewReader(body)), - Header: map[string][]string{ - "Content-Type": {"application/json"}, - }, + Header: map[string][]string{"Content-Type": {"application/json"}}, } }) apiClient := openapiclient.NewAPIClient(configuration) - resp, httpRes, err := apiClient.KerberosAPI.KerberosRead(context.Background(), "dummyKey").Execute() - + resp, httpRes, err := apiClient.KerberosAPI.KerberosList(context.Background()).Execute() require.Nil(t, err) require.NotNil(t, resp) - require.Equal(t, 200, httpRes.StatusCode) + require.Equal(t, http.StatusOK, httpRes.StatusCode) }) - t.Run("Test KerberosAPIService KerberosKeyList", func(t *testing.T) { - - t.Skip("skip test") - + t.Run("Test KerberosAPIService KerberosRead", func(t *testing.T) { configuration := internal.NewConfiguration() - configuration.HTTPClient = NewTestClient(func(req *http.Request) *http.Response { - require.Equal(t, "GET", req.Method) - require.Equal(t, "/api/ddi/v1/keys/kerberos", req.URL.Path) + configuration.HTTPClient = internal.NewTestClient(func(req *http.Request) *http.Response { + require.Equal(t, http.MethodGet, req.Method) + require.Equal(t, "/api/ddi/v1/keys/kerberos/"+*KerberosKey_Post.Id, req.URL.Path) require.Equal(t, "application/json", req.Header.Get("Accept")) - response := openapiclient.KeysListKerberosKeyResponse{ - Results: []openapiclient.KerberosKey{ - { - Algorithm: openapiclient.PtrString("aes256-cts-hmac-sha1-96"), - Comment: openapiclient.PtrString("Test Kerberos Key"), - Id: nil, - }, - }, - } + response := openapiclient.KeysReadKerberosKeyResponse{} body, err := json.Marshal(response) require.NoError(t, err) + return &http.Response{ - StatusCode: 200, + StatusCode: http.StatusOK, Body: io.NopCloser(bytes.NewReader(body)), - Header: map[string][]string{ - "Content-Type": {"application/json"}, - }, + Header: map[string][]string{"Content-Type": {"application/json"}}, } }) apiClient := openapiclient.NewAPIClient(configuration) - resp, httpRes, err := apiClient.KerberosAPI.KerberosList(context.Background()).Execute() + resp, httpRes, err := apiClient.KerberosAPI.KerberosRead(context.Background(), *KerberosKey_Post.Id).Execute() require.Nil(t, err) require.NotNil(t, resp) - require.Equal(t, 200, httpRes.StatusCode) - require.NotEmpty(t, resp.Results) + require.Equal(t, http.StatusOK, httpRes.StatusCode) }) t.Run("Test KerberosAPIService KerberosUpdate", func(t *testing.T) { - - t.Skip("skip test") - - dummyKey := openapiclient.KerberosKey{ - Algorithm: openapiclient.PtrString("RFC 3961"), - Comment: openapiclient.PtrString("Test Update Kerberos Key"), - Id: nil, - } configuration := internal.NewConfiguration() - configuration.HTTPClient = NewTestClient(func(req *http.Request) *http.Response { - require.Equal(t, "PATCH", req.Method) - require.Equal(t, "/api/ddi/v1/keys/kerberos/dummyKey", req.URL.Path) - require.Equal(t, "application/json", req.Header.Get("Content-Type")) + configuration.HTTPClient = internal.NewTestClient(func(req *http.Request) *http.Response { + require.Equal(t, http.MethodPatch, req.Method) + require.Equal(t, "/api/ddi/v1/keys/kerberos/"+*KerberosKey_Patch.Id, req.URL.Path) + require.Equal(t, "application/json", req.Header.Get("Accept")) + var reqBody openapiclient.KerberosKey require.NoError(t, json.NewDecoder(req.Body).Decode(&reqBody)) - require.Equal(t, dummyKey, reqBody) + require.Equal(t, KerberosKey_Patch, reqBody) - response := openapiclient.KeysUpdateKerberosKeyResponse{ - Result: &dummyKey, - } + response := openapiclient.KeysUpdateKerberosKeyResponse{} body, err := json.Marshal(response) require.NoError(t, err) + return &http.Response{ - StatusCode: 200, + StatusCode: http.StatusOK, Body: io.NopCloser(bytes.NewReader(body)), - Header: map[string][]string{ - "Content-Type": {"application/json"}, - }, + Header: map[string][]string{"Content-Type": {"application/json"}}, } }) apiClient := openapiclient.NewAPIClient(configuration) - updateRequest := apiClient.KerberosAPI.KerberosUpdate(context.Background(), "dummyKey").Body(dummyKey) - resp, httpRes, err := updateRequest.Execute() + resp, httpRes, err := apiClient.KerberosAPI.KerberosUpdate(context.Background(), *KerberosKey_Patch.Id).Body(KerberosKey_Patch).Execute() require.Nil(t, err) require.NotNil(t, resp) - require.Equal(t, 200, httpRes.StatusCode) + require.Equal(t, http.StatusOK, httpRes.StatusCode) }) - t.Run("Test TsigAPIService TsigUpdate", func(t *testing.T) { - - t.Skip("skip test") - - dummyKey := openapiclient.KeysTSIGKey{ - Algorithm: openapiclient.PtrString("hmac_sha256"), - Name: "dummyKey36", - Secret: "XOJvQkcX6Og0CHFg+rQ27pqAB+EhSjVoI4Bs/JWegBc=", - } + t.Run("Test KerberosAPIService KeysKerberosPost", func(t *testing.T) { configuration := internal.NewConfiguration() - configuration.HTTPClient = NewTestClient(func(req *http.Request) *http.Response { - require.Equal(t, "PATCH", req.Method) - require.Equal(t, "/api/ddi/v1/keys/tsig/dummyKey36", req.URL.Path) + configuration.HTTPClient = internal.NewTestClient(func(req *http.Request) *http.Response { + require.Equal(t, http.MethodPost, req.Method) + require.Equal(t, "/api/ddi/v1/keys/kerberos", req.URL.Path) require.Equal(t, "application/json", req.Header.Get("Content-Type")) - var reqBody openapiclient.KeysTSIGKey + + var reqBody openapiclient.KerberosKey require.NoError(t, json.NewDecoder(req.Body).Decode(&reqBody)) - require.Equal(t, dummyKey, reqBody) + require.Equal(t, KerberosKey_Post, reqBody) - response := openapiclient.KeysUpdateTSIGKeyResponse{ - Result: &dummyKey, - } + response := openapiclient.KeysListKerberosKeyResponse{} body, err := json.Marshal(response) require.NoError(t, err) + return &http.Response{ - StatusCode: 200, + StatusCode: http.StatusOK, Body: io.NopCloser(bytes.NewReader(body)), - Header: map[string][]string{ - "Content-Type": {"application/json"}, - }, + Header: map[string][]string{"Content-Type": {"application/json"}}, } }) apiClient := openapiclient.NewAPIClient(configuration) - updateRequest := apiClient.TsigAPI.TsigUpdate(context.Background(), "dummyKey36").Body(dummyKey) - resp, httpRes, err := updateRequest.Execute() + resp, httpRes, err := apiClient.KerberosAPI.KeysKerberosPost(context.Background()).Body(KerberosKey_Post).Execute() require.Nil(t, err) require.NotNil(t, resp) - require.Equal(t, 200, httpRes.StatusCode) - }) - - t.Run("Test KerberosAPIService KerberosDelete", func(t *testing.T) { - t.Skip("skip test") - configuration := internal.NewConfiguration() - configuration.HTTPClient = NewTestClient(func(req *http.Request) *http.Response { - require.Equal(t, "DELETE", req.Method) - require.Equal(t, "/api/ddi/v1/keys/kerberos/dummyKey36", req.URL.Path) - return &http.Response{ - StatusCode: 204, - Body: io.NopCloser(bytes.NewReader([]byte{})), - Header: make(http.Header), - } - }) - apiClient := openapiclient.NewAPIClient(configuration) - httpRes, err := apiClient.KerberosAPI.KerberosDelete(context.Background(), "dummyKey36").Execute() - require.Nil(t, err) - require.Equal(t, 204, httpRes.StatusCode) + require.Equal(t, http.StatusOK, httpRes.StatusCode) }) } diff --git a/keys/test/api_tsig_test.go b/keys/test/api_tsig_test.go index 27e02c0..061e845 100644 --- a/keys/test/api_tsig_test.go +++ b/keys/test/api_tsig_test.go @@ -1,182 +1,157 @@ +/* +DDI Keys API + +Testing TsigAPIService + +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); + package keys_test import ( "bytes" "context" "encoding/json" - "github.com/infobloxopen/bloxone-go-client/internal" - openapiclient "github.com/infobloxopen/bloxone-go-client/keys" - "github.com/stretchr/testify/require" "io" "net/http" "testing" -) -type RoundTripFunc func(req *http.Request) *http.Response + "github.com/stretchr/testify/require" -func (f RoundTripFunc) RoundTrip(req *http.Request) (*http.Response, error) { - return f(req), nil -} + "github.com/infobloxopen/bloxone-go-client/internal" + openapiclient "github.com/infobloxopen/bloxone-go-client/keys" +) -func NewTestClient(fn RoundTripFunc) *http.Client { - return &http.Client{ - Transport: RoundTripFunc(fn), - } +var KeysTSIGKey_Post = openapiclient.KeysTSIGKey{ + Id: openapiclient.PtrString("KeysTsigPost"), +} +var KeysTSIGKey_Patch = openapiclient.KeysTSIGKey{ + Id: openapiclient.PtrString("KeysTsigPatch"), } func Test_keys_TsigAPIService(t *testing.T) { + t.Run("Test TsigAPIService TsigCreate", func(t *testing.T) { - dummyKey := openapiclient.KeysTSIGKey{ - Algorithm: openapiclient.PtrString("hmac_sha256"), - Name: "dummyKey36", - Secret: "XOJvQkcX6Og0CHFg+rQ27pqAB+EhSjVoI4Bs/JWegBc=", - } configuration := internal.NewConfiguration() - configuration.HTTPClient = NewTestClient(func(req *http.Request) *http.Response { - require.Equal(t, "POST", req.Method) + configuration.HTTPClient = internal.NewTestClient(func(req *http.Request) *http.Response { + require.Equal(t, http.MethodPost, req.Method) require.Equal(t, "/api/ddi/v1/keys/tsig", req.URL.Path) require.Equal(t, "application/json", req.Header.Get("Content-Type")) + var reqBody openapiclient.KeysTSIGKey require.NoError(t, json.NewDecoder(req.Body).Decode(&reqBody)) - require.Equal(t, dummyKey, reqBody) + require.Equal(t, KeysTSIGKey_Post, reqBody) - response := openapiclient.KeysCreateTSIGKeyResponse{ - Result: &dummyKey, - } + response := openapiclient.KeysCreateTSIGKeyResponse{} body, err := json.Marshal(response) require.NoError(t, err) + return &http.Response{ - StatusCode: 200, + StatusCode: http.StatusOK, Body: io.NopCloser(bytes.NewReader(body)), - Header: map[string][]string{ - "Content-Type": {"application/json"}, - }, + Header: map[string][]string{"Content-Type": {"application/json"}}, } }) apiClient := openapiclient.NewAPIClient(configuration) - resp, httpRes, err := apiClient.TsigAPI.TsigCreate(context.Background()).Body(dummyKey).Execute() + resp, httpRes, err := apiClient.TsigAPI.TsigCreate(context.Background()).Body(KeysTSIGKey_Post).Execute() require.Nil(t, err) require.NotNil(t, resp) - require.Equal(t, 200, httpRes.StatusCode) + require.Equal(t, http.StatusOK, httpRes.StatusCode) + }) + + t.Run("Test TsigAPIService TsigDelete", func(t *testing.T) { + configuration := internal.NewConfiguration() + configuration.HTTPClient = internal.NewTestClient(func(req *http.Request) *http.Response { + require.Equal(t, http.MethodDelete, req.Method) + require.Equal(t, "/api/ddi/v1/keys/tsig/"+*KeysTSIGKey_Post.Id, req.URL.Path) + + return &http.Response{ + StatusCode: http.StatusOK, + Body: io.NopCloser(bytes.NewReader([]byte{})), + Header: map[string][]string{"Content-Type": {"application/json"}}, + } + }) + apiClient := openapiclient.NewAPIClient(configuration) + httpRes, err := apiClient.TsigAPI.TsigDelete(context.Background(), *KeysTSIGKey_Post.Id).Execute() + require.Nil(t, err) + require.Equal(t, http.StatusOK, httpRes.StatusCode) }) t.Run("Test TsigAPIService TsigList", func(t *testing.T) { configuration := internal.NewConfiguration() - configuration.HTTPClient = NewTestClient(func(req *http.Request) *http.Response { - require.Equal(t, "GET", req.Method) + configuration.HTTPClient = internal.NewTestClient(func(req *http.Request) *http.Response { + require.Equal(t, http.MethodGet, req.Method) require.Equal(t, "/api/ddi/v1/keys/tsig", req.URL.Path) require.Equal(t, "application/json", req.Header.Get("Accept")) - response := openapiclient.KeysListTSIGKeyResponse{ - Results: []openapiclient.KeysTSIGKey{ - { - Algorithm: openapiclient.PtrString("hmac_sha256"), - Name: "dummyKey36", - Secret: "XOJvQkcX6Og0CHFg+rQ27pqAB+EhSjVoI4Bs/JWegBc=", - }, - }, - } + response := openapiclient.KeysListTSIGKeyResponse{} body, err := json.Marshal(response) require.NoError(t, err) + return &http.Response{ - StatusCode: 200, + StatusCode: http.StatusOK, Body: io.NopCloser(bytes.NewReader(body)), - Header: map[string][]string{ - "Content-Type": {"application/json"}, - }, + Header: map[string][]string{"Content-Type": {"application/json"}}, } }) apiClient := openapiclient.NewAPIClient(configuration) resp, httpRes, err := apiClient.TsigAPI.TsigList(context.Background()).Execute() require.Nil(t, err) require.NotNil(t, resp) - require.Equal(t, 200, httpRes.StatusCode) - require.NotEmpty(t, resp.Results) + require.Equal(t, http.StatusOK, httpRes.StatusCode) }) t.Run("Test TsigAPIService TsigRead", func(t *testing.T) { configuration := internal.NewConfiguration() - configuration.HTTPClient = NewTestClient(func(req *http.Request) *http.Response { - require.Equal(t, "GET", req.Method) - require.Equal(t, "/api/ddi/v1/keys/tsig/dummyKey36", req.URL.Path) + configuration.HTTPClient = internal.NewTestClient(func(req *http.Request) *http.Response { + require.Equal(t, http.MethodGet, req.Method) + require.Equal(t, "/api/ddi/v1/keys/tsig/"+*KeysTSIGKey_Post.Id, req.URL.Path) require.Equal(t, "application/json", req.Header.Get("Accept")) - response := openapiclient.KeysListTSIGKeyResponse{ - Results: []openapiclient.KeysTSIGKey{ - { - Algorithm: openapiclient.PtrString("hmac_sha256"), - Name: "dummyKey36", - Secret: "XOJvQkcX6Og0CHFg+rQ27pqAB+EhSjVoI4Bs/JWegBc=", - }, - }, - } + response := openapiclient.KeysReadTSIGKeyResponse{} body, err := json.Marshal(response) require.NoError(t, err) + return &http.Response{ - StatusCode: 200, + StatusCode: http.StatusOK, Body: io.NopCloser(bytes.NewReader(body)), - Header: map[string][]string{ - "Content-Type": {"application/json"}, - }, + Header: map[string][]string{"Content-Type": {"application/json"}}, } }) apiClient := openapiclient.NewAPIClient(configuration) - resp, httpRes, err := apiClient.TsigAPI.TsigRead(context.Background(), "dummyKey36").Execute() - + resp, httpRes, err := apiClient.TsigAPI.TsigRead(context.Background(), *KeysTSIGKey_Post.Id).Execute() require.Nil(t, err) require.NotNil(t, resp) - require.Equal(t, 200, httpRes.StatusCode) + require.Equal(t, http.StatusOK, httpRes.StatusCode) }) + t.Run("Test TsigAPIService TsigUpdate", func(t *testing.T) { - dummyKey := openapiclient.KeysTSIGKey{ - Algorithm: openapiclient.PtrString("hmac_sha256"), - Name: "dummyKey36", - Secret: "XOJvQkcX6Og0CHFg+rQ27pqAB+EhSjVoI4Bs/JWegBc=", - } configuration := internal.NewConfiguration() - configuration.HTTPClient = NewTestClient(func(req *http.Request) *http.Response { - require.Equal(t, "PATCH", req.Method) - require.Equal(t, "/api/ddi/v1/keys/tsig/dummyKey36", req.URL.Path) + configuration.HTTPClient = internal.NewTestClient(func(req *http.Request) *http.Response { + require.Equal(t, http.MethodPatch, req.Method) + require.Equal(t, "/api/ddi/v1/keys/tsig/"+*KeysTSIGKey_Patch.Id, req.URL.Path) require.Equal(t, "application/json", req.Header.Get("Content-Type")) + var reqBody openapiclient.KeysTSIGKey require.NoError(t, json.NewDecoder(req.Body).Decode(&reqBody)) - require.Equal(t, dummyKey, reqBody) + require.Equal(t, KeysTSIGKey_Patch, reqBody) - response := openapiclient.KeysUpdateTSIGKeyResponse{ - Result: &dummyKey, - } + response := openapiclient.KeysUpdateTSIGKeyResponse{} body, err := json.Marshal(response) require.NoError(t, err) + return &http.Response{ - StatusCode: 200, + StatusCode: http.StatusOK, Body: io.NopCloser(bytes.NewReader(body)), - Header: map[string][]string{ - "Content-Type": {"application/json"}, - }, + Header: map[string][]string{"Content-Type": {"application/json"}}, } }) apiClient := openapiclient.NewAPIClient(configuration) - updateRequest := apiClient.TsigAPI.TsigUpdate(context.Background(), "dummyKey36").Body(dummyKey) - resp, httpRes, err := updateRequest.Execute() + resp, httpRes, err := apiClient.TsigAPI.TsigUpdate(context.Background(), *KeysTSIGKey_Patch.Id).Body(KeysTSIGKey_Patch).Execute() require.Nil(t, err) require.NotNil(t, resp) - require.Equal(t, 200, httpRes.StatusCode) + require.Equal(t, http.StatusOK, httpRes.StatusCode) }) - t.Run("Test TsigAPIService TsigDelete", func(t *testing.T) { - configuration := internal.NewConfiguration() - configuration.HTTPClient = NewTestClient(func(req *http.Request) *http.Response { - require.Equal(t, "DELETE", req.Method) - require.Equal(t, "/api/ddi/v1/keys/tsig/dummyKey36", req.URL.Path) - return &http.Response{ - StatusCode: 204, - Body: io.NopCloser(bytes.NewReader([]byte{})), - Header: make(http.Header), - } - }) - apiClient := openapiclient.NewAPIClient(configuration) - httpRes, err := apiClient.TsigAPI.TsigDelete(context.Background(), "dummyKey36").Execute() - require.Nil(t, err) - require.Equal(t, 204, httpRes.StatusCode) - }) } diff --git a/keys/test/api_upload_test.go b/keys/test/api_upload_test.go index 65676c8..a42a744 100644 --- a/keys/test/api_upload_test.go +++ b/keys/test/api_upload_test.go @@ -23,63 +23,40 @@ import ( openapiclient "github.com/infobloxopen/bloxone-go-client/keys" ) +var UploadRequest_Post = openapiclient.UploadRequest{ + Comment: openapiclient.PtrString("Upload Request"), + Content: "SGVsbG8gd29ybGQ=", // "Hello world" in base64 + Type: openapiclient.UPLOADCONTENTTYPE_KEYTAB, // Replace "your_content_type" with the actual content type +} + func Test_keys_UploadAPIService(t *testing.T) { t.Run("Test UploadAPIService UploadUpload", func(t *testing.T) { - // Assuming that UploadRequest is the request body type for the UploadUpload API - dummyRequest := openapiclient.UploadRequest{ - Comment: openapiclient.PtrString("This is a test upload"), - Content: "SGVsbG8gd29ybGQ=", // "Hello world" in base64 - //Fields: &openapiclient.ProtobufFieldMask{}, // Fill this as per your requirements - //Tags: map[string]interface{}{ - // "tag1": "value1", - // "tag2": "value2", - //}, - Type: openapiclient.UPLOADCONTENTTYPE_KEYTAB, // Replace "your_content_type" with the actual content type - } - configuration := internal.NewConfiguration() - configuration.HTTPClient = NewTestClient(func(req *http.Request) *http.Response { - require.Equal(t, "POST", req.Method) + configuration.HTTPClient = internal.NewTestClient(func(req *http.Request) *http.Response { + require.Equal(t, http.MethodPost, req.Method) require.Equal(t, "/api/ddi/v1/keys/upload", req.URL.Path) - require.Equal(t, "application/json", req.Header.Get("Accept")) + require.Equal(t, "application/json", req.Header.Get("Content-Type")) + var reqBody openapiclient.UploadRequest require.NoError(t, json.NewDecoder(req.Body).Decode(&reqBody)) - require.Equal(t, dummyRequest, reqBody) + require.Equal(t, UploadRequest_Post, reqBody) - response := openapiclient.DdiuploadResponse{ - KerberosKeys: &openapiclient.KerberosKeys{ - Items: []openapiclient.KerberosKey{ - { - Algorithm: openapiclient.PtrString("aes256-cts-hmac-sha1-96"), - Comment: openapiclient.PtrString("This is a test Kerberos key"), - Domain: openapiclient.PtrString("example.com"), - Id: openapiclient.PtrString("123"), - //Principal: openapiclient.PtrString("test_principal"), - //Tags: map[string]interface{}{"tag1": "value1", "tag2": "value2"}, - //UploadedAt: openapiclient.PtrString("2022-01-01T00:00:00Z"), - //Version: openapiclient.PtrInt64(1), - }, - }, - }, - Warning: openapiclient.PtrString("This is a test warning"), - } + response := openapiclient.DdiuploadResponse{} body, err := json.Marshal(response) require.NoError(t, err) + return &http.Response{ - StatusCode: 200, + StatusCode: http.StatusOK, Body: io.NopCloser(bytes.NewReader(body)), - Header: map[string][]string{ - "Content-Type": {"application/json"}, - }, + Header: map[string][]string{"Content-Type": {"application/json"}}, } }) - apiClient := openapiclient.NewAPIClient(configuration) - resp, httpRes, err := apiClient.UploadAPI.UploadUpload(context.Background()).Body(dummyRequest).Execute() + resp, httpRes, err := apiClient.UploadAPI.UploadUpload(context.Background()).Body(UploadRequest_Post).Execute() require.Nil(t, err) require.NotNil(t, resp) - require.Equal(t, 200, httpRes.StatusCode) + require.Equal(t, http.StatusOK, httpRes.StatusCode) }) } diff --git a/keys/utils.go b/keys/utils.go index 54647cd..ac6ed2b 100644 --- a/keys/utils.go +++ b/keys/utils.go @@ -1,7 +1,7 @@ /* DDI Keys API -The DDI Keys application is a BloxOne DDI service for managing TSIG keys and GSS-TSIG (Kerberos) keys which are used by other BloxOne DDI applications. It is part of the full-featured, DDI cloud solution that enables customers to deploy large numbers of protocol servers to deliver DNS and DHCP throughout their enterprise network. +The DDI Keys application is a BloxOne DDI service for managing TSIG keys and GSS-TSIG (Kerberos) keys which are used by other BloxOne DDI applications. It is part of the full-featured, DDI cloud solution that enables customers to deploy large numbers of protocol servers to deliver DNS and DHCP throughout their enterprise network. API version: v1 */