From 481e101c45dd3f0d2f9f1549f1958ef1399851c7 Mon Sep 17 00:00:00 2001 From: Karanjot Singh Date: Tue, 28 May 2024 13:36:18 +0530 Subject: [PATCH 1/4] Minor fix - Remove returning AtlanError while making request Signed-off-by: Karanjot Singh --- atlan/client/client.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/atlan/client/client.go b/atlan/client/client.go index 0d6c44c..8157dd2 100644 --- a/atlan/client/client.go +++ b/atlan/client/client.go @@ -233,7 +233,7 @@ func (ac *AtlanClient) makeRequest(method, path string, params map[string]interf case http.MethodGet: req, err = http.NewRequest(method, path, nil) if err != nil { - ThrowAtlanError(err, CONNECTION_ERROR, nil) + return nil, fmt.Errorf("failed to create GET request: %w", err) } case http.MethodPost, http.MethodPut: body, ok := params["data"].(io.Reader) @@ -242,7 +242,7 @@ func (ac *AtlanClient) makeRequest(method, path string, params map[string]interf } req, err = http.NewRequest(method, path, body) if err != nil { - ThrowAtlanError(err, CONNECTION_ERROR, nil) + return nil, fmt.Errorf("failed to create POST/PUT request: %w", err) } req.Header.Set("Content-Type", "application/json") case http.MethodDelete: @@ -256,7 +256,7 @@ func (ac *AtlanClient) makeRequest(method, path string, params map[string]interf } req, err = http.NewRequest(method, path, body) if err != nil { - ThrowAtlanError(err, CONNECTION_ERROR, nil) + return nil, fmt.Errorf("failed to create DELETE request: %w", err) } if body != nil { req.Header.Set("Content-Type", "application/json") From efcba5a62b26ed16f5dd6ea97aabb6ee8c045907 Mon Sep 17 00:00:00 2001 From: Karanjot Singh Date: Tue, 28 May 2024 14:09:49 +0530 Subject: [PATCH 2/4] Return instead of AtlanError in throwatlanerror Signed-off-by: Karanjot Singh --- atlan/client/client.go | 6 +++--- atlan/client/errors.go | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/atlan/client/client.go b/atlan/client/client.go index 8157dd2..ff3d8d5 100644 --- a/atlan/client/client.go +++ b/atlan/client/client.go @@ -233,16 +233,16 @@ func (ac *AtlanClient) makeRequest(method, path string, params map[string]interf case http.MethodGet: req, err = http.NewRequest(method, path, nil) if err != nil { - return nil, fmt.Errorf("failed to create GET request: %w", err) + return nil, ThrowAtlanError(err, CONNECTION_ERROR, nil) } case http.MethodPost, http.MethodPut: body, ok := params["data"].(io.Reader) if !ok { - return nil, fmt.Errorf("missing or invalid 'data' parameter for POST/PUT/DELETE request") + return nil, ThrowAtlanError(err, CONNECTION_ERROR, nil) } req, err = http.NewRequest(method, path, body) if err != nil { - return nil, fmt.Errorf("failed to create POST/PUT request: %w", err) + return nil, ThrowAtlanError(err, CONNECTION_ERROR, nil) } req.Header.Set("Content-Type", "application/json") case http.MethodDelete: diff --git a/atlan/client/errors.go b/atlan/client/errors.go index 78ce378..9f3e212 100644 --- a/atlan/client/errors.go +++ b/atlan/client/errors.go @@ -710,7 +710,7 @@ func handleApiError(response *http.Response, originalError error) error { return nil } -func ThrowAtlanError(err error, sdkError ErrorCode, suggestion *string, args ...interface{}) *AtlanError { +func ThrowAtlanError(err error, sdkError ErrorCode, suggestion *string, args ...interface{}) error { atlanError := AtlanError{ ErrorCode: errorCodes[sdkError], } From 41a0ce3bac09296a93677cef572bb448133830fd Mon Sep 17 00:00:00 2001 From: Karanjot Singh Date: Tue, 28 May 2024 14:12:06 +0530 Subject: [PATCH 3/4] Return connection error on making a delete request Signed-off-by: Karanjot Singh --- atlan/client/client.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/atlan/client/client.go b/atlan/client/client.go index ff3d8d5..3451b5f 100644 --- a/atlan/client/client.go +++ b/atlan/client/client.go @@ -238,7 +238,7 @@ func (ac *AtlanClient) makeRequest(method, path string, params map[string]interf case http.MethodPost, http.MethodPut: body, ok := params["data"].(io.Reader) if !ok { - return nil, ThrowAtlanError(err, CONNECTION_ERROR, nil) + return nil, fmt.Errorf("missing or invalid 'data' parameter for POST/PUT/DELETE request") } req, err = http.NewRequest(method, path, body) if err != nil { @@ -256,7 +256,7 @@ func (ac *AtlanClient) makeRequest(method, path string, params map[string]interf } req, err = http.NewRequest(method, path, body) if err != nil { - return nil, fmt.Errorf("failed to create DELETE request: %w", err) + return nil, ThrowAtlanError(err, CONNECTION_ERROR, nil) } if body != nil { req.Header.Set("Content-Type", "application/json") From 985f4e6593f30d0efccebbcac852fb2c1ac623a3 Mon Sep 17 00:00:00 2001 From: Karanjot Singh Date: Fri, 31 May 2024 14:35:30 +0530 Subject: [PATCH 4/4] Add generics for retrieval by guid Signed-off-by: Karanjot Singh --- atlan/client/asset.go | 38 +++++- atlan/client/glossary_client.go | 45 ------- atlan/client/glossary_client_test.go | 3 +- atlan/model/assets/asset.go | 13 +- atlan/model/assets/glossary.go | 186 +-------------------------- atlan/model/assets/glossary_term.go | 11 +- main.go | 10 +- 7 files changed, 63 insertions(+), 243 deletions(-) diff --git a/atlan/client/asset.go b/atlan/client/asset.go index f369c16..5a43f8a 100644 --- a/atlan/client/asset.go +++ b/atlan/client/asset.go @@ -7,12 +7,19 @@ import ( "github.com/atlanhq/atlan-go/atlan/model" Assets2 "github.com/atlanhq/atlan-go/atlan/model/assets" "hash/fnv" + "reflect" "strings" "time" ) +// AtlanObject is an interface that all asset types should implement type AtlanObject interface { - MarshalJSON() ([]byte, error) + MarshalJSON() ([]byte, error) // Used for CRUD operation in Assets +} + +// Asset is an interface that all asset types should implement +type Asset interface { + FromJSON(data []byte) error // Used for Retrieval of an Asset using GUID } // SearchAssets Struct to represent assets for searching @@ -740,6 +747,35 @@ func NewSearchView() *ViewFields { // Methods on assets +// GetbyGuid retrieves an asset by guid +func GetByGuid[T Asset](guid string) (T, error) { + + var asset T + + if DefaultAtlanClient == nil { + return asset, fmt.Errorf("default AtlanClient not initialized") + } + + api := &GET_ENTITY_BY_GUID + api.Path += guid + + response, err := DefaultAtlanClient.CallAPI(api, nil, nil) + if err != nil { + return asset, err + } + + // Create a new instance of T using reflection + assetType := reflect.TypeOf(asset).Elem() + newAsset := reflect.New(assetType).Interface().(T) + + err = newAsset.FromJSON(response) + if err != nil { + return asset, err + } + + return newAsset, nil +} + // RetrieveMinimal retrieves an asset by its GUID, without any of its relationships. func RetrieveMinimal(guid string) (*Assets2.Asset, error) { if DefaultAtlanClient == nil { diff --git a/atlan/client/glossary_client.go b/atlan/client/glossary_client.go index 2fe1ba0..02ead0c 100644 --- a/atlan/client/glossary_client.go +++ b/atlan/client/glossary_client.go @@ -3,7 +3,6 @@ package client import ( "encoding/json" "errors" - "fmt" "github.com/atlanhq/atlan-go/atlan" "github.com/atlanhq/atlan-go/atlan/model/assets" "time" @@ -26,50 +25,6 @@ func NewGlossaryClient(ac *AtlanClient) *GlossaryClient { return &GlossaryClient{client: ac} } -// GetGlossaryByGuid retrieves a glossary by its GUID. -func GetGlossaryByGuid(glossaryGuid string) (*assets.AtlasGlossary, error) { - if DefaultAtlanClient == nil { - return nil, fmt.Errorf("default AtlanClient not initialized") - } - - api := &GET_ENTITY_BY_GUID - api.Path += glossaryGuid - - response, err := DefaultAtlanClient.CallAPI(api, nil, nil) - if err != nil { - return nil, err - } - - g, err := assets.FromJSON(response) - if err != nil { - return nil, err - } - - return g, nil -} - -// GetGlossaryTermByGuid retrieves a glossary term by its GUID. -func GetGlossaryTermByGuid(glossaryGuid string) (*assets.AtlasGlossaryTerm, error) { - if DefaultAtlanClient == nil { - return nil, fmt.Errorf("default AtlanClient not initialized") - } - - api := &GET_ENTITY_BY_GUID - api.Path += glossaryGuid - - response, err := DefaultAtlanClient.CallAPI(api, nil, nil) - if err != nil { - return nil, err - } - - gt, err := assets.FromJSONTerm(response) - if err != nil { - return nil, err - } - - return gt, nil -} - // Creator is used to create a new glossary asset in memory. func (g *AtlasGlossary) Creator(name string, icon atlan.AtlanIcon) { g.TypeName = assets.StringPtr("AtlasGlossary") diff --git a/atlan/client/glossary_client_test.go b/atlan/client/glossary_client_test.go index aee8ca9..f55e8dd 100644 --- a/atlan/client/glossary_client_test.go +++ b/atlan/client/glossary_client_test.go @@ -3,6 +3,7 @@ package client import ( "fmt" "github.com/atlanhq/atlan-go/atlan" + "github.com/atlanhq/atlan-go/atlan/model/assets" "github.com/stretchr/testify/assert" "testing" ) @@ -58,7 +59,7 @@ func testUpdateGlossary(t *testing.T, glossaryGUID string) { } func testRetrieveGlossary(t *testing.T, glossaryGUID string) { - glossary, err := GetGlossaryByGuid(glossaryGUID) + glossary, err := GetByGuid[*assets.AtlasGlossary](glossaryGUID) if err != nil { fmt.Println("Error:", err) } diff --git a/atlan/model/assets/asset.go b/atlan/model/assets/asset.go index 869e639..7d3ee5a 100644 --- a/atlan/model/assets/asset.go +++ b/atlan/model/assets/asset.go @@ -47,8 +47,6 @@ type CertificateStatus string type PopularityInsights int -type Link string - type MCIncident string type MCMonitor string @@ -453,6 +451,17 @@ type AtlanTag struct { RestrictPropagationThroughLineage bool `json:"restrictPropagationThroughLineage"` } +type Link struct { + Guid string `json:"guid"` + TypeName string `json:"typeName"` + EntityStatus string `json:"entityStatus"` + DisplayText string `json:"displayText"` + RelationshipType string `json:"relationshipType"` + RelationshipGuid string `json:"relationshipGuid"` + RelationshipStatus string `json:"relationshipStatus"` + RelationshipAttributes map[string]interface{} `json:"relationshipAttributes"` +} + func StringPtr(s string) *string { return &s } diff --git a/atlan/model/assets/glossary.go b/atlan/model/assets/glossary.go index 9d5c780..4b3f664 100644 --- a/atlan/model/assets/glossary.go +++ b/atlan/model/assets/glossary.go @@ -89,188 +89,6 @@ func (ag *AtlasGlossary) ToJSON() ([]byte, error) { return json.MarshalIndent(ag, "", " ") } -func FromJSON(data []byte) (*AtlasGlossary, error) { - var glossaryResponse AtlasGlossary - //fmt.Println("data") - //fmt.Println(string(data)) - err := json.Unmarshal(data, &glossaryResponse) - - return &glossaryResponse, err -} - -// Glossary represents a glossary in Atlan. -type Glossary struct { - TypeName string `json:"typeName,omitempty"` - Attributes GlossaryAttributes `json:"attributes,omitempty"` - Guid string `json:"guid,omitempty"` - IsIncomplete bool `json:"isIncomplete,omitempty"` - Status string `json:"status,omitempty"` - CreatedBy string `json:"createdBy,omitempty"` - UpdatedBy string `json:"updatedBy,omitempty"` - CreateTime int64 `json:"createTime,omitempty"` - UpdateTime int64 `json:"updateTime,omitempty"` - Version int `json:"version,omitempty"` - Terms []struct { - Guid string `json:"guid"` - TypeName string `json:"typeName"` - EntityStatus string `json:"entityStatus"` - DisplayText string `json:"displayText"` - RelationshipType string `json:"relationshipType"` - RelationshipGuid string `json:"relationshipGuid"` - RelationshipStatus string `json:"relationshipStatus"` - RelationshipAttributes struct { - TypeName string `json:"typeName"` - } `json:"relationshipAttributes"` - } `json:"terms,omitempty"` - RelationshipAttributes struct { - SchemaRegistrySubjects []interface{} `json:"schemaRegistrySubjects,omitempty"` - McMonitors []interface{} `json:"mcMonitors,omitempty"` - OutputPortDataProducts []interface{} `json:"outputPortDataProducts,omitempty"` - Files []interface{} `json:"files,omitempty"` - McIncidents []interface{} `json:"mcIncidents,omitempty"` - Links []interface{} `json:"links,omitempty"` - Categories []interface{} `json:"categories,omitempty"` - Metrics []interface{} `json:"metrics,omitempty"` - Readme interface{} `json:"readme,omitempty"` - Meanings []interface{} `json:"meanings,omitempty"` - SodaChecks []interface{} `json:"sodaChecks,omitempty"` - } `json:"relationshipAttributes,omitempty"` - Labels []interface{} `json:"labels,omitempty"` -} - -// GlossaryAttributes represents the attributes of a glossary in Atlan. -type GlossaryAttributes struct { - PopularityScore float64 `json:"popularityScore,omitempty"` - AssetDbtJobLastRunQueuedDuration interface{} `json:"assetDbtJobLastRunQueuedDuration,omitempty"` - AssetMcMonitorNames []string `json:"assetMcMonitorNames,omitempty"` - Usage interface{} `json:"usage,omitempty"` - HasLineage bool `json:"__hasLineage,omitempty"` - AssetDbtTestStatus interface{} `json:"assetDbtTestStatus,omitempty"` - LastSyncRun interface{} `json:"lastSyncRun,omitempty"` - AssetSodaLastSyncRunAt int `json:"assetSodaLastSyncRunAt,omitempty"` - StarredCount int `json:"starredCount,omitempty"` - LastRowChangedAt int `json:"lastRowChangedAt,omitempty"` - SourceReadRecentUserList []interface{} `json:"sourceReadRecentUserList,omitempty"` - AssetMcIncidentQualifiedNames []interface{} `json:"assetMcIncidentQualifiedNames,omitempty"` - AssetMcIncidentTypes []interface{} `json:"assetMcIncidentTypes,omitempty"` - AssetSodaLastScanAt int `json:"assetSodaLastScanAt,omitempty"` - SourceUpdatedAt int `json:"sourceUpdatedAt,omitempty"` - AssetDbtJobLastRunArtifactsSaved bool `json:"assetDbtJobLastRunArtifactsSaved,omitempty"` - StarredDetailsList []interface{} `json:"starredDetailsList,omitempty"` - AssetDbtJobLastRunQueuedDurationHumanized interface{} `json:"assetDbtJobLastRunQueuedDurationHumanized,omitempty"` - AssetDbtJobStatus interface{} `json:"assetDbtJobStatus,omitempty"` - AssetDbtJobLastRunArtifactS3Path interface{} `json:"assetDbtJobLastRunArtifactS3Path,omitempty"` - CertificateStatusMessage interface{} `json:"certificateStatusMessage,omitempty"` - SourceCreatedAt int `json:"sourceCreatedAt,omitempty"` - AssetDbtJobLastRunDequedAt int `json:"assetDbtJobLastRunDequedAt,omitempty"` - AssetDbtTags []interface{} `json:"assetDbtTags,omitempty"` - SourceReadSlowQueryRecordList []interface{} `json:"sourceReadSlowQueryRecordList,omitempty"` - AssetDbtAccountName interface{} `json:"assetDbtAccountName,omitempty"` - SourceQueryComputeCostList []interface{} `json:"sourceQueryComputeCostList,omitempty"` - AssetDbtJobLastRunOwnerThreadId interface{} `json:"assetDbtJobLastRunOwnerThreadId,omitempty"` - AssetDbtJobLastRunNotificationsSent bool `json:"assetDbtJobLastRunNotificationsSent,omitempty"` - AssetDbtEnvironmentDbtVersion interface{} `json:"assetDbtEnvironmentDbtVersion,omitempty"` - AssetDbtMeta interface{} `json:"assetDbtMeta,omitempty"` - AssetMcMonitorTypes []interface{} `json:"assetMcMonitorTypes,omitempty"` - GlossaryType interface{} `json:"glossaryType,omitempty"` - AssetDbtJobLastRunTotalDuration interface{} `json:"assetDbtJobLastRunTotalDuration,omitempty"` - AssetSodaCheckCount int `json:"assetSodaCheckCount,omitempty"` - Examples []interface{} `json:"examples,omitempty"` - SourceLastReadAt int `json:"sourceLastReadAt,omitempty"` - AssetDbtJobLastRunTotalDurationHumanized interface{} `json:"assetDbtJobLastRunTotalDurationHumanized,omitempty"` - SubType interface{} `json:"subType,omitempty"` - AssetMcIncidentSeverities []interface{} `json:"assetMcIncidentSeverities,omitempty"` - ConnectionName interface{} `json:"connectionName,omitempty"` - AssetDbtSourceFreshnessCriteria interface{} `json:"assetDbtSourceFreshnessCriteria,omitempty"` - Metrics []interface{} `json:"metrics,omitempty"` - AdditionalAttributes interface{} `json:"additionalAttributes,omitempty"` - AssetSodaCheckStatuses interface{} `json:"assetSodaCheckStatuses,omitempty"` - CertificateStatus string `json:"certificateStatus,omitempty"` - AssetDbtJobLastRunExecutedByThreadId interface{} `json:"assetDbtJobLastRunExecutedByThreadId,omitempty"` - ReplicatedFrom interface{} `json:"replicatedFrom,omitempty"` - AssetDbtJobLastRunHasSourcesGenerated bool `json:"assetDbtJobLastRunHasSourcesGenerated,omitempty"` - DisplayName interface{} `json:"displayName,omitempty"` - SourceCostUnit interface{} `json:"sourceCostUnit,omitempty"` - AssetDbtUniqueId interface{} `json:"assetDbtUniqueId,omitempty"` - AssetSodaDQStatus interface{} `json:"assetSodaDQStatus,omitempty"` - TermType interface{} `json:"termType,omitempty"` - AssetDbtJobLastRunHasDocsGenerated bool `json:"assetDbtJobLastRunHasDocsGenerated,omitempty"` - AssetTags []interface{} `json:"assetTags,omitempty"` - AssetDbtSemanticLayerProxyUrl interface{} `json:"assetDbtSemanticLayerProxyUrl,omitempty"` - CertificateUpdatedBy string `json:"certificateUpdatedBy,omitempty"` - AssetMcMonitorQualifiedNames []interface{} `json:"assetMcMonitorQualifiedNames,omitempty"` - AssetDbtJobLastRunStartedAt int `json:"assetDbtJobLastRunStartedAt,omitempty"` - AnnouncementType interface{} `json:"announcementType,omitempty"` - ViewerUsers []interface{} `json:"viewerUsers,omitempty"` - ViewScore float64 `json:"viewScore,omitempty"` - SourceOwners interface{} `json:"sourceOwners,omitempty"` - UserDescription string `json:"userDescription,omitempty"` - AdminGroups []interface{} `json:"adminGroups,omitempty"` - AssetSodaSourceURL interface{} `json:"assetSodaSourceURL,omitempty"` - AssetDbtJobLastRunCreatedAt int `json:"assetDbtJobLastRunCreatedAt,omitempty"` - AssetDbtJobNextRun int `json:"assetDbtJobNextRun,omitempty"` - AssetCoverImage interface{} `json:"assetCoverImage,omitempty"` - Abbreviation interface{} `json:"abbreviation,omitempty"` - SourceReadPopularQueryRecordList []interface{} `json:"sourceReadPopularQueryRecordList,omitempty"` - SourceTotalCost float64 `json:"sourceTotalCost,omitempty"` - TenantId interface{} `json:"tenantId,omitempty"` - AnnouncementMessage interface{} `json:"announcementMessage,omitempty"` - SourceEmbedURL interface{} `json:"sourceEmbedURL,omitempty"` - AssetDbtJobLastRunUrl interface{} `json:"assetDbtJobLastRunUrl,omitempty"` - Name string `json:"name,omitempty"` - QualifiedName string `json:"qualifiedName,omitempty"` - AssetIcon string `json:"assetIcon,omitempty"` -} - -// GlossaryTerm represents a term in a glossary in Atlan. -type GlossaryTerm struct { - TypeName string `json:"typeName"` - Attributes GlossaryAttributes `json:"attributes"` - Guid string `json:"guid"` - IsIncomplete bool `json:"isIncomplete"` - Status string `json:"status"` - CreatedBy string `json:"createdBy"` - UpdatedBy string `json:"updatedBy"` - CreateTime int64 `json:"createTime"` - UpdateTime int64 `json:"updateTime"` - Version int `json:"version"` - ValidValuesFor []interface{} `json:"validValuesFor"` - SchemaRegistrySubjects []interface{} `json:"schemaRegistrySubjects"` - ValidValues []interface{} `json:"validValues"` - SeeAlso []interface{} `json:"seeAlso"` - IsA []interface{} `json:"isA"` - Antonyms []interface{} `json:"antonyms"` - AssignedEntities []interface{} `json:"assignedEntities"` - McIncidents []interface{} `json:"mcIncidents"` - Links []interface{} `json:"links"` - Classifies []interface{} `json:"classifies"` - Categories []interface{} `json:"categories"` - PreferredToTerms []interface{} `json:"preferredToTerms"` - PreferredTerms []interface{} `json:"preferredTerms"` - TranslationTerms []interface{} `json:"translationTerms"` - Synonyms []interface{} `json:"synonyms"` - ReplacedBy []interface{} `json:"replacedBy"` - OutputPortDataProducts []interface{} `json:"outputPortDataProducts"` - Readme interface{} `json:"readme"` - ReplacementTerms []interface{} `json:"replacementTerms"` - Meanings []interface{} `json:"meanings"` - McMonitors []interface{} `json:"mcMonitors"` - TranslatedTerms []interface{} `json:"translatedTerms"` - Files []interface{} `json:"files"` - Metrics []interface{} `json:"metrics"` - SodaChecks []interface{} `json:"sodaChecks"` - Tags []AtlanTag `json:"classifications"` - Anchor struct { - Guid string `json:"guid"` - TypeName string `json:"typeName"` - EntityStatus string `json:"entityStatus"` - DisplayText string `json:"displayText"` - RelationshipType string `json:"relationshipType"` - RelationshipGuid string `json:"relationshipGuid"` - RelationshipStatus string `json:"relationshipStatus"` - RelationshipAttributes struct { - TypeName string `json:"typeName"` - } `json:"relationshipAttributes"` - } `json:"anchor"` - Labels []interface{} `json:"labels"` +func (ag *AtlasGlossary) FromJSON(data []byte) error { + return json.Unmarshal(data, ag) } diff --git a/atlan/model/assets/glossary_term.go b/atlan/model/assets/glossary_term.go index 101265a..fbe242a 100644 --- a/atlan/model/assets/glossary_term.go +++ b/atlan/model/assets/glossary_term.go @@ -107,13 +107,10 @@ func (gt *AtlasGlossaryTerm) UnmarshalJSON(data []byte) error { return nil } -func FromJSONTerm(data []byte) (*AtlasGlossaryTerm, error) { - var glossaryResponse AtlasGlossaryTerm - err := json.Unmarshal(data, &glossaryResponse) - - return &glossaryResponse, err +func (ag *AtlasGlossaryTerm) FromJSON(data []byte) error { + return json.Unmarshal(data, ag) } -func ToJSONTerm(glossary *AtlasGlossaryTerm) ([]byte, error) { - return json.Marshal(glossary) +func (gt *AtlasGlossaryTerm) ToJSON() ([]byte, error) { + return json.Marshal(gt) } diff --git a/main.go b/main.go index 00c8cc8..9c1ed12 100644 --- a/main.go +++ b/main.go @@ -2,8 +2,8 @@ package main import ( "fmt" - "github.com/atlanhq/atlan-go/atlan" "github.com/atlanhq/atlan-go/atlan/client" + "github.com/atlanhq/atlan-go/atlan/model/assets" ) func main() { @@ -13,8 +13,12 @@ func main() { //ctx, _ := client.Context("API_KEY", "BASE_URL") ctx.SetLogger(true, "debug") - response, _ := client.Get(atlan.AtlanTypeCategoryClassification) - fmt.Println(response.AtlanTagDefs[0].GUID) + glossary, err := client.GetByGuid[*assets.AtlasGlossaryTerm]("a034e099-bbba-4c1d-84d8-ca3f3a406124") + if err != nil { + fmt.Println("Error:", err) + } else { + fmt.Println("Response:", *glossary.TypeName) + } /* client.GetAll()