From a767f178e08c8a983e37ffda9e6ab311f8c73ffc Mon Sep 17 00:00:00 2001 From: Karanjot Singh Date: Wed, 15 May 2024 17:47:21 +0530 Subject: [PATCH] Change DataContract struct for Marshalling Signed-off-by: Karanjot Singh --- atlan/client/client.go | 8 +++++--- atlan/model/assets/datacontract.go | 13 ++++++++++--- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/atlan/client/client.go b/atlan/client/client.go index 2aba36b..399f8a1 100644 --- a/atlan/client/client.go +++ b/atlan/client/client.go @@ -188,9 +188,11 @@ func (ac *AtlanClient) CallAPI(api *API, queryParams map[string]string, requestO response, err := ac.makeRequest(api.Method, path, params) if err != nil { - fmt.Println(err) - errorMessage, _ := ioutil.ReadAll(response.Body) - return nil, handleApiError(response, string(errorMessage)) + if response != nil && response.Body != nil { + errorMessage, _ := ioutil.ReadAll(response.Body) + return nil, handleApiError(response, string(errorMessage)) + } + return nil, err } ac.logHTTPStatus(response) diff --git a/atlan/model/assets/datacontract.go b/atlan/model/assets/datacontract.go index 8728da4..1cd0029 100644 --- a/atlan/model/assets/datacontract.go +++ b/atlan/model/assets/datacontract.go @@ -2,9 +2,9 @@ package assets type DataContract struct { Catalog - DataContractJson *string `json:"dataContractJson,omitempty"` - Version *string `json:"dataContractVersion,omitempty"` - AssetGuid *string `json:"dataContractAssetGuid,omitempty"` + Version *string `json:"dataContractVersion,omitempty"` + AssetGuid *string `json:"dataContractAssetGuid,omitempty"` + Attributes *DataContractAttributes `json:"attributes,omitempty"` // Relationships LatestCertified *[]Asset `json:"dataContractLatestCertified,omitempty"` ContractAssetCertified *[]DataContract `json:"dataContractAssetCertified,omitempty"` @@ -14,6 +14,13 @@ type DataContract struct { ContractNextVersion *[]DataContract `json:"dataContractNextVersion,omitempty"` } +type DataContractAttributes struct { + Name *string `json:"name,omitempty"` + CertificateStatus *string `json:"certificateStatus,omitempty"` + QualifiedName *string `json:"qualifiedName,omitempty"` + DataContractJson *string `json:"dataContractJson,omitempty"` +} + /* type DataContract struct { Asset