Skip to content

Commit

Permalink
[azadmin] convert to typespec (#23906)
Browse files Browse the repository at this point in the history
* generate

* update typespec and copyright

* fix

* charles feedback

* update typespec commit
  • Loading branch information
gracewilcox authored Jan 16, 2025
1 parent f529968 commit af2aacb
Show file tree
Hide file tree
Showing 39 changed files with 233 additions and 464 deletions.
103 changes: 0 additions & 103 deletions sdk/security/keyvault/azadmin/backup/autorest.md

This file was deleted.

41 changes: 22 additions & 19 deletions sdk/security/keyvault/azadmin/backup/client.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 1 addition & 4 deletions sdk/security/keyvault/azadmin/backup/client_test.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
//go:build go1.18
// +build go1.18

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Licensed under the MIT License. See License.txt in the project root for license information.

package backup_test

Expand Down
21 changes: 13 additions & 8 deletions sdk/security/keyvault/azadmin/backup/custom_client.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
//go:build go1.18
// +build go1.18

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.

Expand Down Expand Up @@ -56,7 +53,7 @@ func NewClient(vaultURL string, credential azcore.TokenCredential, options *Clie
if err != nil {
return nil, err
}
return &Client{endpoint: vaultURL, internal: azcoreClient}, nil
return &Client{vaultBaseUrl: vaultURL, internal: azcoreClient}, nil
}

// ErrorInfo - Internal error from Azure Key Vault server.
Expand Down Expand Up @@ -98,17 +95,21 @@ func (client *Client) beginFullRestore(ctx context.Context, restoreBlobDetails R
if err != nil {
return nil, err
}
return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[FullRestoreResponse]{
poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[FullRestoreResponse]{
FinalStateVia: runtime.FinalStateViaAzureAsyncOp,
Handler: handler,
Tracer: client.internal.Tracer(),
})
return poller, err
} else {
handler, err := pollers.NewRestorePoller[FullRestoreResponse](client.internal.Pipeline(), nil, runtime.FinalStateViaAzureAsyncOp)
if err != nil {
return nil, err
}
return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[FullRestoreResponse]{Handler: handler})
return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[FullRestoreResponse]{
Handler: handler,
Tracer: client.internal.Tracer(),
})
}
}

Expand All @@ -124,16 +125,20 @@ func (client *Client) beginSelectiveKeyRestore(ctx context.Context, keyName stri
if err != nil {
return nil, err
}
return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[SelectiveKeyRestoreResponse]{
poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[SelectiveKeyRestoreResponse]{
FinalStateVia: runtime.FinalStateViaAzureAsyncOp,
Handler: handler,
Tracer: client.internal.Tracer(),
})
return poller, err
} else {
handler, err := pollers.NewRestorePoller[SelectiveKeyRestoreResponse](client.internal.Pipeline(), nil, runtime.FinalStateViaAzureAsyncOp)
if err != nil {
return nil, err
}
return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[SelectiveKeyRestoreResponse]{Handler: handler})
return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[SelectiveKeyRestoreResponse]{
Handler: handler,
Tracer: client.internal.Tracer(),
})
}
}
2 changes: 1 addition & 1 deletion sdk/security/keyvault/azadmin/backup/example_test.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Licensed under the MIT License. See License.txt in the project root for license information.

package backup_test

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
//go:build go1.18
// +build go1.18

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.

Expand Down
19 changes: 7 additions & 12 deletions sdk/security/keyvault/azadmin/backup/models.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 2 additions & 6 deletions sdk/security/keyvault/azadmin/backup/models_serde.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit af2aacb

Please sign in to comment.