@@ -18,7 +18,8 @@ type Client struct {
1818
1919type ClientOverwrites struct {
2020 // --- Lifecycle & Initialization ---
21- Close func (ctx context.Context ) error
21+ Close func (ctx context.Context ) error
22+ WithTransaction func (ctx context.Context , fn func (c client.Client ) error ) error
2223
2324 // --- PublicKey Management ---
2425 CreatePublicKey func (ctx context.Context , key string , comment string , tags []string ) (client.PublicKey , error )
@@ -39,22 +40,22 @@ type ClientOverwrites struct {
3940 IsAccountDirty func (ctx context.Context , account client.Account ) (bool , error )
4041
4142 // --- Link Management ---
42- CreateLink func (ctx context.Context , accountID client.AccountId , tagFilter string , expiresAt time.Time ) (client.Link , error )
43+ CreateLink func (ctx context.Context , accountId client.AccountId , tagFilter string , expiresAt time.Time ) (client.Link , error )
4344 GetLink func (ctx context.Context , id client.LinkId ) (client.Link , error )
4445 GetLinks func (ctx context.Context , ids ... client.LinkId ) ([]client.Link , error )
45- ListLinksAccount func (ctx context.Context , accountID client.AccountId ) ([]client.Link , error )
46- ListLinksPublicKey func (ctx context.Context , publicKeyID client.PublicKeyId ) ([]client.Link , error )
47- ListPublicKeysForAccount func (ctx context.Context , accountID client.AccountId ) ([]client.PublicKey , error )
48- ListAccountsForPublicKey func (ctx context.Context , publicKeyID client.PublicKeyId ) ([]client.Account , error )
46+ ListLinksAccount func (ctx context.Context , accountId client.AccountId ) ([]client.Link , error )
47+ ListLinksPublicKey func (ctx context.Context , publicKeyId client.PublicKeyId ) ([]client.Link , error )
48+ ListPublicKeysForAccount func (ctx context.Context , accountId client.AccountId ) ([]client.PublicKey , error )
49+ ListAccountsForPublicKey func (ctx context.Context , publicKeyId client.PublicKeyId ) ([]client.Account , error )
4950 UpdateLink func (ctx context.Context , id client.LinkId , accountId client.AccountId , tagFilter string , expiresAt time.Time ) error
5051 DeleteLinks func (ctx context.Context , ids ... client.LinkId ) error
5152
5253 // --- Other ---
5354 ListExistingTags func (ctx context.Context ) []string
5455 OnboardHost func (ctx context.Context , host string , port int /* , gateway string, plugin string */ , accountName string , deploymentKey string ) (chan client.OnboardHostProgress , error )
5556 DecommisionAccount func (ctx context.Context , id client.AccountId ) (chan client.DecommisionAccountProgress , error )
56- DeployPublicKeys func (ctx context.Context , publicKeyID ... client.PublicKeyId ) (chan client.DeployProgress , error )
57- DeployAccounts func (ctx context.Context , accountID ... client.AccountId ) (chan client.DeployProgress , error )
57+ DeployPublicKeys func (ctx context.Context , publicKeyId ... client.PublicKeyId ) (chan client.DeployProgress , error )
58+ DeployAccounts func (ctx context.Context , accountId ... client.AccountId ) (chan client.DeployProgress , error )
5859 DeployAll func (ctx context.Context ) (chan client.DeployProgress , error )
5960}
6061
@@ -112,6 +113,18 @@ func (m *Client) Close(ctx context.Context) error {
112113 panic ("Client.Close not implemented" )
113114}
114115
116+ func (m * Client ) WithTransaction (ctx context.Context , fn func (c client.Client ) error ) error {
117+ if m .Pre != nil {
118+ m .Pre ("WithTransaction" , map [string ]any {"ctx" : ctx , "fn" : fn })
119+ }
120+ if m .Overwrites .WithTransaction != nil {
121+ return m .Overwrites .WithTransaction (ctx , fn )
122+ } else if m .BaseClient != nil {
123+ return m .BaseClient .WithTransaction (ctx , fn )
124+ }
125+ panic ("Client.WithTransaction not implemented" )
126+ }
127+
115128// --- PublicKey Management ---
116129
117130func (m * Client ) CreatePublicKey (ctx context.Context , key string , comment string , tags []string ) (client.PublicKey , error ) {
@@ -292,14 +305,14 @@ func (m *Client) IsAccountDirty(ctx context.Context, account client.Account) (bo
292305
293306// --- Link Management ---
294307
295- func (m * Client ) CreateLink (ctx context.Context , accountID client.AccountId , tagFilter string , expiresAt time.Time ) (client.Link , error ) {
308+ func (m * Client ) CreateLink (ctx context.Context , accountId client.AccountId , tagFilter string , expiresAt time.Time ) (client.Link , error ) {
296309 if m .Pre != nil {
297- m .Pre ("CreateLink" , map [string ]any {"ctx" : ctx , "accountID " : accountID , "tagFilter" : tagFilter , "expiresAt" : expiresAt })
310+ m .Pre ("CreateLink" , map [string ]any {"ctx" : ctx , "accountId " : accountId , "tagFilter" : tagFilter , "expiresAt" : expiresAt })
298311 }
299312 if m .Overwrites .CreateLink != nil {
300- return m .Overwrites .CreateLink (ctx , accountID , tagFilter , expiresAt )
313+ return m .Overwrites .CreateLink (ctx , accountId , tagFilter , expiresAt )
301314 } else if m .BaseClient != nil {
302- return m .BaseClient .CreateLink (ctx , accountID , tagFilter , expiresAt )
315+ return m .BaseClient .CreateLink (ctx , accountId , tagFilter , expiresAt )
303316 }
304317 panic ("Client.CreateLink not implemented" )
305318}
@@ -328,50 +341,50 @@ func (m *Client) GetLinks(ctx context.Context, ids ...client.LinkId) ([]client.L
328341 panic ("Client.GetLinks not implemented" )
329342}
330343
331- func (m * Client ) ListLinksAccount (ctx context.Context , accountID client.AccountId ) ([]client.Link , error ) {
344+ func (m * Client ) ListLinksAccount (ctx context.Context , accountId client.AccountId ) ([]client.Link , error ) {
332345 if m .Pre != nil {
333- m .Pre ("ListLinksAccount" , map [string ]any {"ctx" : ctx , "accountID " : accountID })
346+ m .Pre ("ListLinksAccount" , map [string ]any {"ctx" : ctx , "accountId " : accountId })
334347 }
335348 if m .Overwrites .ListLinksAccount != nil {
336- return m .Overwrites .ListLinksAccount (ctx , accountID )
349+ return m .Overwrites .ListLinksAccount (ctx , accountId )
337350 } else if m .BaseClient != nil {
338- return m .BaseClient .ListLinksAccount (ctx , accountID )
351+ return m .BaseClient .ListLinksAccount (ctx , accountId )
339352 }
340353 panic ("Client.ListLinksAccount not implemented" )
341354}
342355
343- func (m * Client ) ListLinksPublicKey (ctx context.Context , publicKeyID client.PublicKeyId ) ([]client.Link , error ) {
356+ func (m * Client ) ListLinksPublicKey (ctx context.Context , publicKeyId client.PublicKeyId ) ([]client.Link , error ) {
344357 if m .Pre != nil {
345- m .Pre ("ListLinksPublicKey" , map [string ]any {"ctx" : ctx , "publicKeyID " : publicKeyID })
358+ m .Pre ("ListLinksPublicKey" , map [string ]any {"ctx" : ctx , "publicKeyId " : publicKeyId })
346359 }
347360 if m .Overwrites .ListLinksPublicKey != nil {
348- return m .Overwrites .ListLinksPublicKey (ctx , publicKeyID )
361+ return m .Overwrites .ListLinksPublicKey (ctx , publicKeyId )
349362 } else if m .BaseClient != nil {
350- return m .BaseClient .ListLinksPublicKey (ctx , publicKeyID )
363+ return m .BaseClient .ListLinksPublicKey (ctx , publicKeyId )
351364 }
352365 panic ("Client.ListLinksPublicKey not implemented" )
353366}
354367
355- func (m * Client ) ListPublicKeysForAccount (ctx context.Context , accountID client.AccountId ) ([]client.PublicKey , error ) {
368+ func (m * Client ) ListPublicKeysForAccount (ctx context.Context , accountId client.AccountId ) ([]client.PublicKey , error ) {
356369 if m .Pre != nil {
357- m .Pre ("ListPublicKeysForAccount" , map [string ]any {"ctx" : ctx , "accountID " : accountID })
370+ m .Pre ("ListPublicKeysForAccount" , map [string ]any {"ctx" : ctx , "accountId " : accountId })
358371 }
359372 if m .Overwrites .ListPublicKeysForAccount != nil {
360- return m .Overwrites .ListPublicKeysForAccount (ctx , accountID )
373+ return m .Overwrites .ListPublicKeysForAccount (ctx , accountId )
361374 } else if m .BaseClient != nil {
362- return m .BaseClient .ListPublicKeysForAccount (ctx , accountID )
375+ return m .BaseClient .ListPublicKeysForAccount (ctx , accountId )
363376 }
364377 panic ("Client.ListPublicKeysForAccount not implemented" )
365378}
366379
367- func (m * Client ) ListAccountsForPublicKey (ctx context.Context , publicKeyID client.PublicKeyId ) ([]client.Account , error ) {
380+ func (m * Client ) ListAccountsForPublicKey (ctx context.Context , publicKeyId client.PublicKeyId ) ([]client.Account , error ) {
368381 if m .Pre != nil {
369- m .Pre ("ListAccountsForPublicKey" , map [string ]any {"ctx" : ctx , "publicKeyID " : publicKeyID })
382+ m .Pre ("ListAccountsForPublicKey" , map [string ]any {"ctx" : ctx , "publicKeyId " : publicKeyId })
370383 }
371384 if m .Overwrites .ListAccountsForPublicKey != nil {
372- return m .Overwrites .ListAccountsForPublicKey (ctx , publicKeyID )
385+ return m .Overwrites .ListAccountsForPublicKey (ctx , publicKeyId )
373386 } else if m .BaseClient != nil {
374- return m .BaseClient .ListAccountsForPublicKey (ctx , publicKeyID )
387+ return m .BaseClient .ListAccountsForPublicKey (ctx , publicKeyId )
375388 }
376389 panic ("Client.ListAccountsForPublicKey not implemented" )
377390}
@@ -438,26 +451,26 @@ func (m *Client) DecommisionAccount(ctx context.Context, id client.AccountId) (c
438451 panic ("Client.DecommisionAccount not implemented" )
439452}
440453
441- func (m * Client ) DeployPublicKeys (ctx context.Context , publicKeyID ... client.PublicKeyId ) (chan client.DeployProgress , error ) {
454+ func (m * Client ) DeployPublicKeys (ctx context.Context , publicKeyId ... client.PublicKeyId ) (chan client.DeployProgress , error ) {
442455 if m .Pre != nil {
443- m .Pre ("DeployPublicKeys" , map [string ]any {"ctx" : ctx , "publicKeyID " : publicKeyID })
456+ m .Pre ("DeployPublicKeys" , map [string ]any {"ctx" : ctx , "publicKeyId " : publicKeyId })
444457 }
445458 if m .Overwrites .DeployPublicKeys != nil {
446- return m .Overwrites .DeployPublicKeys (ctx , publicKeyID ... )
459+ return m .Overwrites .DeployPublicKeys (ctx , publicKeyId ... )
447460 } else if m .BaseClient != nil {
448- return m .BaseClient .DeployPublicKeys (ctx , publicKeyID ... )
461+ return m .BaseClient .DeployPublicKeys (ctx , publicKeyId ... )
449462 }
450463 panic ("Client.DeployPublicKeys not implemented" )
451464}
452465
453- func (m * Client ) DeployAccounts (ctx context.Context , accountID ... client.AccountId ) (chan client.DeployProgress , error ) {
466+ func (m * Client ) DeployAccounts (ctx context.Context , accountId ... client.AccountId ) (chan client.DeployProgress , error ) {
454467 if m .Pre != nil {
455- m .Pre ("DeployAccounts" , map [string ]any {"ctx" : ctx , "accountID " : accountID })
468+ m .Pre ("DeployAccounts" , map [string ]any {"ctx" : ctx , "accountId " : accountId })
456469 }
457470 if m .Overwrites .DeployAccounts != nil {
458- return m .Overwrites .DeployAccounts (ctx , accountID ... )
471+ return m .Overwrites .DeployAccounts (ctx , accountId ... )
459472 } else if m .BaseClient != nil {
460- return m .BaseClient .DeployAccounts (ctx , accountID ... )
473+ return m .BaseClient .DeployAccounts (ctx , accountId ... )
461474 }
462475 panic ("Client.DeployAccounts not implemented" )
463476}
0 commit comments