[Certificates] Remove `RawResponse` (#17225)

* updating azcerts

* removing example

* formatting

* removing RawResponse

* comments on empty response/options

* consistent comments

* show import'
This commit is contained in:
Sean Kane 2022-03-04 16:49:46 -05:00 коммит произвёл GitHub
Родитель 085ea93b52
Коммит 9bab6b4207
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
5 изменённых файлов: 151 добавлений и 208 удалений

Просмотреть файл

@ -1,6 +1,6 @@
# Release History
## 0.2.0 (Unreleased)
## 0.2.0 (2022-03-08)
### Features Added
@ -8,6 +8,7 @@
* Changed pager APIs for `ListCertificatesPager`, `ListDeletedCertificatesPager`, `ListPropertiesOfIssuersPager`, and `ListCertificateVersionsPager`
* Use the `More()` method to determine if there are more pages to fetch
* Use the `NextPage(context.Context)` to fetch the next page of results
* Removed all `RawResponse *http.Response` fields from response structs.
### Bugs Fixed

Просмотреть файл

@ -385,6 +385,24 @@ log.SetClassifications(log.Request, log.Response)
> CAUTION: logs from credentials contain sensitive information.
> These logs must be protected to avoid compromising account security.
### Accessing `http.Response`
You can access the raw `*http.Response` returned by the service using the `runtime.WithCaptureResponse` method and a context passed to any client method.
```go
import "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime"
func GetHTTPResponse() {
var respFromCtx *http.Response
ctx := runtime.WithCaptureResponse(context.Background(), &respFromCtx)
_, err = client.GetCertificate(ctx, "myCertName", nil)
if err != nil {
panic(err)
}
// Do something with *http.Response
fmt.Println(respFromCtx.StatusCode)
}
```
### Additional Documentation
For more extensive documentation on Azure Key Vault, see the [API reference documentation][reference_docs].

Просмотреть файл

@ -28,7 +28,7 @@ type Client struct {
vaultURL string
}
// ClientOptions are the optional parameters for the NewClient function
// ClientOptions are optional parameters for NewClient
type ClientOptions struct {
azcore.ClientOptions
}
@ -66,7 +66,7 @@ func NewClient(vaultURL string, credential azcore.TokenCredential, options *Clie
}, nil
}
// Optional parameters for the Client.BeginCreateCertificate function
// BeginCreateCertificateOptions contains optional parameters for Client.BeginCreateCertificate
type BeginCreateCertificateOptions struct {
// The attributes of the certificate (optional).
CertificateAttributes *CertificateProperties `json:"attributes,omitempty"`
@ -79,12 +79,9 @@ func (b BeginCreateCertificateOptions) toGenerated() *generated.KeyVaultClientCr
return &generated.KeyVaultClientCreateCertificateOptions{}
}
// CreateCertificateResponse contains the response from method Client.BeginCreateCertificate.
// CreateCertificateResponse contains response fields for Client.BeginCreateCertificate
type CreateCertificateResponse struct {
CertificateOperation
// RawResponse contains the underlying HTTP response.
RawResponse *http.Response
}
// the poller returned by the Client.BeginCreateCertificate
@ -95,7 +92,7 @@ type CreateCertificatePoller struct {
client *generated.KeyVaultClient
createResponse CreateCertificateResponse
lastResponse generated.KeyVaultClientGetCertificateResponse
RawResponse *http.Response
rawResponse *http.Response
}
// Done returns true if the LRO has reached a terminal state
@ -123,7 +120,7 @@ func (b *CreateCertificatePoller) Poll(ctx context.Context) (*http.Response, err
}
// There was an error in this operation, return the original raw response and the error
return b.createResponse.RawResponse, err
return nil, err
}
// FinalResponse returns the final response after the operations has finished
@ -138,7 +135,7 @@ func (b *CreateCertificatePoller) pollUntilDone(ctx context.Context, t time.Dura
if err != nil {
return CreateCertificateResponse{}, err
}
b.RawResponse = resp
b.rawResponse = resp
if b.Done() {
break
}
@ -147,16 +144,13 @@ func (b *CreateCertificatePoller) pollUntilDone(ctx context.Context, t time.Dura
return b.createResponse, nil
}
// CreateCertificatePollerResponse contains the response from the Client.BeginCreateCertificate method
// CreateCertificatePollerResponse contains response fields for Client.BeginCreateCertificate
type CreateCertificatePollerResponse struct {
// PollUntilDone will poll the service endpoint until a terminal state is reached or an error occurs
PollUntilDone func(context.Context, time.Duration) (CreateCertificateResponse, error)
// Poller contains an initialized WidgetPoller
Poller CreateCertificatePoller
// RawResponse contains the underlying HTTP response.
RawResponse *http.Response
}
// BeginCreateCertificate creates a new certificate resource, if a certificate with this name already exists, a new version is created. This operation requires the certificates/create permission.
@ -187,7 +181,6 @@ func (c *Client) BeginCreateCertificate(ctx context.Context, certName string, po
vaultURL: c.vaultURL,
client: c.genClient,
createResponse: CreateCertificateResponse{
RawResponse: resp.RawResponse,
CertificateOperation: CertificateOperation{
CancellationRequested: resp.CancellationRequested,
Csr: resp.Csr,
@ -205,22 +198,18 @@ func (c *Client) BeginCreateCertificate(ctx context.Context, certName string, po
return CreateCertificatePollerResponse{
Poller: p,
RawResponse: resp.RawResponse,
PollUntilDone: p.pollUntilDone,
}, nil
}
// GetCertificateOptions contains the optional parameters for the Client.GetCertificate method.
// GetCertificateOptions contains optional parameters for Client.GetCertificate
type GetCertificateOptions struct {
Version string
}
// GetCertificateResponse contains the result from method Client.GetCertificate.
// GetCertificateResponse contains response fields for Client.GetCertificate
type GetCertificateResponse struct {
KeyVaultCertificateWithPolicy
// RawResponse contains the underlying HTTP response.
RawResponse *http.Response
}
// GetCertificate gets information about a specific certificate. This operation requires the certificates/get permission.
@ -235,7 +224,6 @@ func (c *Client) GetCertificate(ctx context.Context, certName string, options *G
}
return GetCertificateResponse{
RawResponse: resp.RawResponse,
KeyVaultCertificateWithPolicy: KeyVaultCertificateWithPolicy{
Properties: certificateAttributesFromGenerated(resp.Attributes),
Cer: resp.Cer,
@ -250,19 +238,18 @@ func (c *Client) GetCertificate(ctx context.Context, certName string, options *G
}, nil
}
// GetCertificateOperationOptions contains the optional parameters for the Client.GetCertificateOperation method.
type GetCertificateOperationOptions struct{}
// GetCertificateOperationOptions contains optional parameters for Client.GetCertificateOperation
type GetCertificateOperationOptions struct {
// placeholder for future optional parameters.
}
func (g *GetCertificateOperationOptions) toGenerated() *generated.KeyVaultClientGetCertificateOperationOptions {
return &generated.KeyVaultClientGetCertificateOperationOptions{}
}
// GetCertificateOperationResponse contains the result from method Client.GetCertificateOperation.
// GetCertificateOperationResponse contains response field for Client.GetCertificateOperation
type GetCertificateOperationResponse struct {
CertificateOperation
// RawResponse contains the underlying HTTP response.
RawResponse *http.Response
}
// GetCertificateOperation gets the creation operation associated with a specified certificate. This operation requires the certificates/get permission.
@ -273,7 +260,6 @@ func (c *Client) GetCertificateOperation(ctx context.Context, certName string, o
}
return GetCertificateOperationResponse{
RawResponse: resp.RawResponse,
CertificateOperation: CertificateOperation{
CancellationRequested: resp.CancellationRequested,
Csr: resp.Csr,
@ -288,20 +274,19 @@ func (c *Client) GetCertificateOperation(ctx context.Context, certName string, o
}, nil
}
// BeginDeleteCertificateOptions contains the optional parameters for the Client.BeginDeleteCertificate method.
type BeginDeleteCertificateOptions struct{}
// BeginDeleteCertificateOptions contains optional parameters for Client.BeginDeleteCertificate
type BeginDeleteCertificateOptions struct {
// placeholder for future optional parameters.
}
// convert public options to generated options struct
func (b *BeginDeleteCertificateOptions) toGenerated() *generated.KeyVaultClientDeleteCertificateOptions {
return &generated.KeyVaultClientDeleteCertificateOptions{}
}
// DeleteCertificateResponse contains the response structure for the BeginDeleteCertificatePoller.FinalResponse function
// DeleteCertificateResponse contains response fields for BeginDeleteCertificatePoller.FinalResponse
type DeleteCertificateResponse struct {
DeletedCertificate
// RawResponse contains the underlying HTTP response.
RawResponse *http.Response
}
func deleteCertificateResponseFromGenerated(g *generated.KeyVaultClientDeleteCertificateResponse) DeleteCertificateResponse {
@ -309,7 +294,6 @@ func deleteCertificateResponseFromGenerated(g *generated.KeyVaultClientDeleteCer
return DeleteCertificateResponse{}
}
return DeleteCertificateResponse{
RawResponse: g.RawResponse,
DeletedCertificate: DeletedCertificate{
RecoveryID: g.RecoveryID,
DeletedDate: g.DeletedDate,
@ -334,7 +318,7 @@ type DeleteCertificatePoller struct {
client *generated.KeyVaultClient
deleteResponse generated.KeyVaultClientDeleteCertificateResponse
lastResponse generated.KeyVaultClientGetDeletedCertificateResponse
RawResponse *http.Response
rawResponse *http.Response
}
// Done returns true if the LRO has reached a terminal state
@ -376,7 +360,7 @@ func (s *DeleteCertificatePoller) pollUntilDone(ctx context.Context, t time.Dura
if err != nil {
return DeleteCertificateResponse{}, err
}
s.RawResponse = resp
s.rawResponse = resp
if s.Done() {
break
}
@ -385,16 +369,13 @@ func (s *DeleteCertificatePoller) pollUntilDone(ctx context.Context, t time.Dura
return deleteCertificateResponseFromGenerated(&s.deleteResponse), nil
}
// DeleteCertificatePollerResponse contains the response from the Client.BeginDeleteCertificate method
// DeleteCertificatePollerResponse contains response fields for Client.BeginDeleteCertificate
type DeleteCertificatePollerResponse struct {
// PollUntilDone will poll the service endpoint until a terminal state is reached or an error occurs
PollUntilDone func(context.Context, time.Duration) (DeleteCertificateResponse, error)
// Poller contains an initialized WidgetPoller
Poller DeleteCertificatePoller
// RawResponse contains the underlying HTTP response.
RawResponse *http.Response
}
// BeginDeleteCertificate deletes a certificate from the keyvault. Delete cannot be applied to an individual version of a certificate. This operation
@ -427,50 +408,47 @@ func (c *Client) BeginDeleteCertificate(ctx context.Context, certificateName str
return DeleteCertificatePollerResponse{
Poller: s,
RawResponse: resp.RawResponse,
PollUntilDone: s.pollUntilDone,
}, nil
}
// Optional parameters for the Client.PurgeDeletedCertificateOptions function
type PurgeDeletedCertificateOptions struct{}
// PurgeDeletedCertificateOptions contains optional parameters for Client.PurgeDeletedCertificateOptions
type PurgeDeletedCertificateOptions struct {
// placeholder for future optional parameters.
}
func (p *PurgeDeletedCertificateOptions) toGenerated() *generated.KeyVaultClientPurgeDeletedCertificateOptions {
return &generated.KeyVaultClientPurgeDeletedCertificateOptions{}
}
// PurgeDeletedCertificateResponse contains the response from method Client.PurgeDeletedCertificate.
// PurgeDeletedCertificateResponse contains response fields for Client.PurgeDeletedCertificate
type PurgeDeletedCertificateResponse struct {
// RawResponse contains the underlying HTTP response.
RawResponse *http.Response
// placeholder for future reponse fields
}
// PurgeDeletedCertificate operation performs an irreversible deletion of the specified certificate, without possibility for recovery. The operation
// is not available if the recovery level does not specify 'Purgeable'. This operation requires the certificate/purge permission.
func (c *Client) PurgeDeletedCertificate(ctx context.Context, certName string, options *PurgeDeletedCertificateOptions) (PurgeDeletedCertificateResponse, error) {
resp, err := c.genClient.PurgeDeletedCertificate(ctx, c.vaultURL, certName, options.toGenerated())
_, err := c.genClient.PurgeDeletedCertificate(ctx, c.vaultURL, certName, options.toGenerated())
if err != nil {
return PurgeDeletedCertificateResponse{}, err
}
return PurgeDeletedCertificateResponse{
RawResponse: resp.RawResponse,
}, nil
return PurgeDeletedCertificateResponse{}, nil
}
// Optional parameters for the Client.GetDeletedCertificate function
type GetDeletedCertificateOptions struct{}
// GetDeletedCertificateOptions contains optional parameters for Client.GetDeletedCertificate
type GetDeletedCertificateOptions struct {
// placeholder for future optional parameters.
}
func (g *GetDeletedCertificateOptions) toGenerated() *generated.KeyVaultClientGetDeletedCertificateOptions {
return &generated.KeyVaultClientGetDeletedCertificateOptions{}
}
// GetDeletedCertificateResponse is the response struct for the Client.GetDeletedCertificate function.
// GetDeletedCertificateResponse contains response field for Client.GetDeletedCertificate
type GetDeletedCertificateResponse struct {
DeletedCertificate
// RawResponse contains the underlying HTTP response.
RawResponse *http.Response
}
// GetDeletedCertificate retrieves the deleted certificate information plus its attributes, such as retention interval, scheduled permanent deletion
@ -482,7 +460,6 @@ func (c *Client) GetDeletedCertificate(ctx context.Context, certName string, opt
}
return GetDeletedCertificateResponse{
RawResponse: resp.RawResponse,
DeletedCertificate: DeletedCertificate{
RecoveryID: resp.RecoveryID,
DeletedDate: resp.DeletedDate,
@ -500,20 +477,19 @@ func (c *Client) GetDeletedCertificate(ctx context.Context, certName string, opt
}, nil
}
// Optional parameters for the Client.BackupCertificateOptions function
type BackupCertificateOptions struct{}
// BackupCertificateOptions contains optional parameters for Client.BackupCertificateOptions
type BackupCertificateOptions struct {
// placeholder for future optional parameters.
}
func (b *BackupCertificateOptions) toGenerated() *generated.KeyVaultClientBackupCertificateOptions {
return &generated.KeyVaultClientBackupCertificateOptions{}
}
// BackupCertificateResponse contains the response from method Client.BackupCertificate.
// BackupCertificateResponse contains response field for Client.BackupCertificate
type BackupCertificateResponse struct {
// READ-ONLY; The backup blob containing the backed up certificate.
Value []byte `json:"value,omitempty" azure:"ro"`
// RawResponse contains the underlying HTTP response.
RawResponse *http.Response
}
// BackupCertificate requests that a backup of the specified certificate be downloaded to the client. All versions of the certificate will be downloaded.
@ -525,12 +501,11 @@ func (c *Client) BackupCertificate(ctx context.Context, certName string, options
}
return BackupCertificateResponse{
RawResponse: resp.RawResponse,
Value: resp.Value,
Value: resp.Value,
}, nil
}
// ImportCertificateOptions contains the optional parameters for the Client.ImportCertificate function.
// ImportCertificateOptions contains optional parameters for Client.ImportCertificate
type ImportCertificateOptions struct {
// The attributes of the certificate (optional).
CertificateAttributes *CertificateProperties `json:"attributes,omitempty"`
@ -549,12 +524,9 @@ func (i *ImportCertificateOptions) toGenerated() *generated.KeyVaultClientImport
return &generated.KeyVaultClientImportCertificateOptions{}
}
// ImportCertificateResponse is the response struct for the Client.ImportCertificate function.
// ImportCertificateResponse contains response fields for Client.ImportCertificate
type ImportCertificateResponse struct {
KeyVaultCertificateWithPolicy
// RawResponse contains the underlying HTTP response.
RawResponse *http.Response
}
// ImportCertificate imports an existing valid certificate, containing a private key, into Azure Key Vault. This operation requires the
@ -582,7 +554,6 @@ func (c *Client) ImportCertificate(ctx context.Context, certName string, base64E
}
return ImportCertificateResponse{
RawResponse: resp.RawResponse,
KeyVaultCertificateWithPolicy: KeyVaultCertificateWithPolicy{
Properties: certificateAttributesFromGenerated(resp.Attributes),
Cer: resp.Cer,
@ -656,16 +627,15 @@ func (l *ListCertificatesPager) NextPage(ctx context.Context) (ListCertificatesP
return listKeysPageFromGenerated(result), nil
}
// ListCertificatesOptions contains the optional parameters for the Client.ListCertificates method
type ListCertificatesOptions struct{}
// ListCertificatesOptions contains optional parameters for Client.ListCertificates
type ListCertificatesOptions struct {
// placeholder for future optional parameters.
}
// ListCertificatesPageResponse contains the current page of results for the Client.ListSecrets operation
// ListCertificatesPageResponse contains response fields for ListCertificatesPager.NextPage
type ListCertificatesPageResponse struct {
// READ-ONLY; A response message containing a list of certificates in the key vault along with a link to the next page of certificates.
Certificates []*CertificateItem `json:"value,omitempty" azure:"ro"`
// RawResponse contains the underlying HTTP response.
RawResponse *http.Response
}
// convert internal Response to ListCertificatesPage
@ -682,7 +652,6 @@ func listKeysPageFromGenerated(i generated.KeyVaultClientGetCertificatesResponse
}
return ListCertificatesPageResponse{
RawResponse: i.RawResponse,
Certificates: vals,
}
}
@ -760,18 +729,15 @@ func (l *ListCertificateVersionsPager) NextPage(ctx context.Context) (ListCertif
return listCertificateVersionsPageFromGenerated(result), nil
}
// ListCertificateVersionsOptions contains the options for the ListCertificateVersions operations
// ListCertificateVersionsOptions contains optional parameters for Client.ListCertificateVersions
type ListCertificateVersionsOptions struct {
// placeholder for future optional parameters.
}
// ListCertificateVersionsPageResponse contains the current page from a ListCertificateVersionsPager.PageResponse method
// ListCertificateVersionsPageResponse contains response fields for ListCertificateVersionsPager.NextPage
type ListCertificateVersionsPageResponse struct {
// READ-ONLY; A response message containing a list of certificates in the key vault along with a link to the next page of certificates.
Certificates []*CertificateItem `json:"value,omitempty" azure:"ro"`
// RawResponse contains the underlying HTTP response.
RawResponse *http.Response
}
// create ListCertificatesPage from generated pager
@ -787,7 +753,6 @@ func listCertificateVersionsPageFromGenerated(i generated.KeyVaultClientGetCerti
}
return ListCertificateVersionsPageResponse{
RawResponse: i.RawResponse,
Certificates: vals,
}
}
@ -804,7 +769,7 @@ func (c *Client) ListCertificateVersions(certificateName string, options *ListCe
}
}
// CreateIssuerOptions contains the optional parameters for the Client.CreateIssuer function
// CreateIssuerOptions contains optional parameters for Client.CreateIssuer
type CreateIssuerOptions struct {
// Determines whether the issuer is enabled.
Enabled *bool `json:"enabled,omitempty"`
@ -823,11 +788,9 @@ func (c *CreateIssuerOptions) toGenerated() *generated.KeyVaultClientSetCertific
return &generated.KeyVaultClientSetCertificateIssuerOptions{}
}
// CreateIssuerResponse is the response struct for the Client.CreateIssuer function
// CreateIssuerResponse contains response fields for Client.CreateIssuer
type CreateIssuerResponse struct {
CertificateIssuer
// RawResponse contains the underlying HTTP response.
RawResponse *http.Response
}
// CreateIssuer adds or updates the specified certificate issuer. This operation requires the certificates/setissuers permission.
@ -874,7 +837,7 @@ func (c *Client) CreateIssuer(ctx context.Context, issuerName string, provider s
return CreateIssuerResponse{}, err
}
cr := CreateIssuerResponse{RawResponse: resp.RawResponse}
cr := CreateIssuerResponse{}
cr.CertificateIssuer = CertificateIssuer{
Credentials: issuerCredentialsFromGenerated(resp.Credentials),
Provider: resp.Provider,
@ -906,18 +869,18 @@ func (c *Client) CreateIssuer(ctx context.Context, issuerName string, provider s
return cr, nil
}
// GetIssuerOptions contains the optional parameters for the Client.GetIssuer function
type GetIssuerOptions struct{}
// GetIssuerOptions contains optional parameters for Client.GetIssuer
type GetIssuerOptions struct {
// placeholder for future optional parameters.
}
func (g *GetIssuerOptions) toGenerated() *generated.KeyVaultClientGetCertificateIssuerOptions {
return &generated.KeyVaultClientGetCertificateIssuerOptions{}
}
// GetIssuerResponse contains the response from method Client.GetIssuer.
// GetIssuerResponse contains response fields for ClientGetIssuer
type GetIssuerResponse struct {
CertificateIssuer
// RawResponse contains the underlying HTTP response.
RawResponse *http.Response
}
// GetIssuer returns the specified certificate issuer resources in the specified key vault. This operation
@ -928,7 +891,7 @@ func (c *Client) GetIssuer(ctx context.Context, issuerName string, options *GetI
return GetIssuerResponse{}, err
}
g := GetIssuerResponse{RawResponse: resp.RawResponse}
g := GetIssuerResponse{}
g.CertificateIssuer = CertificateIssuer{
ID: resp.ID,
Provider: resp.Provider,
@ -1019,18 +982,15 @@ func (l *ListPropertiesOfIssuersPager) NextPage(ctx context.Context) (ListIssuer
return listIssuersPageFromGenerated(result), nil
}
// ListPropertiesOfIssuersOptions contains the optional parameters for the Client.ListIssuers method
// ListPropertiesOfIssuersOptions contains optional parameters for Client.ListIssuers
type ListPropertiesOfIssuersOptions struct {
// placeholder for future optional parameters
}
// ListIssuersPropertiesOfIssuersPageResponse contains the current page of results for the Client.ListSecrets operation
// ListIssuersPropertiesOfIssuersPageResponse contains response fields for ListPropertiesOfIssuersPager.NextPage
type ListIssuersPropertiesOfIssuersPageResponse struct {
// READ-ONLY; A response message containing a list of certificates in the key vault along with a link to the next page of certificates.
Issuers []*CertificateIssuerItem `json:"value,omitempty" azure:"ro"`
// RawResponse contains the underlying HTTP response.
RawResponse *http.Response
}
// convert internal Response to ListPropertiesOfIssuersPage
@ -1041,10 +1001,7 @@ func listIssuersPageFromGenerated(i generated.KeyVaultClientGetCertificateIssuer
vals = append(vals, certificateIssuerItemFromGenerated(v))
}
return ListIssuersPropertiesOfIssuersPageResponse{
RawResponse: i.RawResponse,
Issuers: vals,
}
return ListIssuersPropertiesOfIssuersPageResponse{Issuers: vals}
}
// ListPropertiesOfIssuers returns a pager that can be used to get the set of certificate issuer resources in the specified key vault. This operation
@ -1057,18 +1014,18 @@ func (c *Client) ListPropertiesOfIssuers(options *ListPropertiesOfIssuersOptions
}
}
// DeleteIssuerOptions contains the optional parameters for the Client.DeleteIssuer function
type DeleteIssuerOptions struct{}
// DeleteIssuerOptions contains optional parameters for Client.DeleteIssuer
type DeleteIssuerOptions struct {
// placeholder for future optional parameters.
}
func (d *DeleteIssuerOptions) toGenerated() *generated.KeyVaultClientDeleteCertificateIssuerOptions {
return &generated.KeyVaultClientDeleteCertificateIssuerOptions{}
}
// DeleteIssuerResponse contains the response from method Client.DeleteIssuer.
// DeleteIssuerResponse contains response fields for Client.DeleteIssuer
type DeleteIssuerResponse struct {
CertificateIssuer
// RawResponse contains the underlying HTTP response.
RawResponse *http.Response
}
// DeleteIssuer permanently removes the specified certificate issuer from the vault. This operation requires the certificates/manageissuers/deleteissuers permission.
@ -1078,7 +1035,7 @@ func (c *Client) DeleteIssuer(ctx context.Context, issuerName string, options *D
return DeleteIssuerResponse{}, err
}
d := DeleteIssuerResponse{RawResponse: resp.RawResponse}
d := DeleteIssuerResponse{}
d.CertificateIssuer = CertificateIssuer{
ID: resp.ID,
Provider: resp.Provider,
@ -1110,7 +1067,7 @@ func (c *Client) DeleteIssuer(ctx context.Context, issuerName string, options *D
return d, nil
}
// UpdateIssuerOptions contains the optional parameters for the Client.UpdateIssuer function
// UpdateIssuerOptions contains optional parameters for Client.UpdateIssuer
type UpdateIssuerOptions struct {
// Determines whether the issuer is enabled.
Enabled *bool `json:"enabled,omitempty"`
@ -1167,12 +1124,9 @@ func (u *UpdateIssuerOptions) toUpdateParameters() generated.CertificateIssuerUp
}
}
// UpdateIssuerResponse contains the response from method Client.UpdateIssuer.
// UpdateIssuerResponse contains response fields for Client.UpdateIssuer
type UpdateIssuerResponse struct {
CertificateIssuer
// RawResponse contains the underlying HTTP response.
RawResponse *http.Response
}
// UpdateIssuer performs an update on the specified certificate issuer entity. This operation requires
@ -1189,7 +1143,7 @@ func (c *Client) UpdateIssuer(ctx context.Context, issuerName string, options *U
return UpdateIssuerResponse{}, err
}
u := UpdateIssuerResponse{RawResponse: resp.RawResponse}
u := UpdateIssuerResponse{}
u.CertificateIssuer = CertificateIssuer{
ID: resp.ID,
Provider: resp.Provider,
@ -1221,18 +1175,18 @@ func (c *Client) UpdateIssuer(ctx context.Context, issuerName string, options *U
return u, nil
}
// SetContactsOptions contains the optional parameters for the Client.CreateContacts function
type SetContactsOptions struct{}
// SetContactsOptions contains optional parameters for Client.CreateContacts
type SetContactsOptions struct {
// placeholder for future optional parameters.
}
func (s *SetContactsOptions) toGenerated() *generated.KeyVaultClientSetCertificateContactsOptions {
return &generated.KeyVaultClientSetCertificateContactsOptions{}
}
// SetContactsResponse contains the response from method Client.CreateContacts.
// SetContactsResponse contains response fields for Client.CreateContacts
type SetContactsResponse struct {
Contacts
// RawResponse contains the underlying HTTP response.
RawResponse *http.Response
}
// SetCertificateContacts sets the certificate contacts for the specified key vault. This operation requires the certificates/managecontacts permission.
@ -1249,7 +1203,6 @@ func (c *Client) SetContacts(ctx context.Context, contacts Contacts, options *Se
}
return SetContactsResponse{
RawResponse: resp.RawResponse,
Contacts: Contacts{
ID: resp.ID,
ContactList: contactListFromGenerated(resp.ContactList),
@ -1257,19 +1210,18 @@ func (c *Client) SetContacts(ctx context.Context, contacts Contacts, options *Se
}, nil
}
// GetContactsOptions contains the optional parameters for the Client.GetContacts function
type GetContactsOptions struct{}
// GetContactsOptions contains optional parameters for Client.GetContacts
type GetContactsOptions struct {
// placeholder for future optional parameters.
}
func (g *GetContactsOptions) toGenerated() *generated.KeyVaultClientGetCertificateContactsOptions {
return &generated.KeyVaultClientGetCertificateContactsOptions{}
}
// GetContactsResponse contains the response from method Client.GetContacts.
// GetContactsResponse contains response fields for Client.GetContacts
type GetContactsResponse struct {
Contacts
// RawResponse contains the underlying HTTP response.
RawResponse *http.Response
}
// GetCertificateContacts returns the set of certificate contact resources in the specified key vault. This operation
@ -1281,7 +1233,6 @@ func (c *Client) GetContacts(ctx context.Context, options *GetContactsOptions) (
}
return GetContactsResponse{
RawResponse: resp.RawResponse,
Contacts: Contacts{
ID: resp.ID,
ContactList: contactListFromGenerated(resp.ContactList),
@ -1289,19 +1240,18 @@ func (c *Client) GetContacts(ctx context.Context, options *GetContactsOptions) (
}, nil
}
// DeleteContactsOptions contains the optional parameters for the Client.DeleteContacts function
type DeleteContactsOptions struct{}
// DeleteContactsOptions contains optional parameters for Client.DeleteContacts
type DeleteContactsOptions struct {
// placeholder for future optional parameters.
}
func (d *DeleteContactsOptions) toGenerated() *generated.KeyVaultClientDeleteCertificateContactsOptions {
return &generated.KeyVaultClientDeleteCertificateContactsOptions{}
}
// DeleteContactsResponse contains the response from method Client.DeleteContacts.
// DeleteContactsResponse contains response field for Client.DeleteContacts
type DeleteContactsResponse struct {
Contacts
// RawResponse contains the underlying HTTP response.
RawResponse *http.Response
}
// DeleteContacts deletes the certificate contacts for a specified key vault certificate. This operation requires the certificates/managecontacts permission.
@ -1312,7 +1262,6 @@ func (c *Client) DeleteContacts(ctx context.Context, options *DeleteContactsOpti
}
return DeleteContactsResponse{
RawResponse: resp.RawResponse,
Contacts: Contacts{
ContactList: contactListFromGenerated(resp.ContactList),
ID: resp.ID,
@ -1320,19 +1269,18 @@ func (c *Client) DeleteContacts(ctx context.Context, options *DeleteContactsOpti
}, nil
}
// UpdateCertificatePolicyOptions contains the optional parameters for the Client.UpdateCertificatePolicy method.
type UpdateCertificatePolicyOptions struct{}
// UpdateCertificatePolicyOptions contains optional parameters for Client.UpdateCertificatePolicy
type UpdateCertificatePolicyOptions struct {
// placeholder for future optional parameters.
}
func (u *UpdateCertificatePolicyOptions) toGenerated() *generated.KeyVaultClientUpdateCertificatePolicyOptions {
return &generated.KeyVaultClientUpdateCertificatePolicyOptions{}
}
// UpdateCertificatePolicyResponse contains the response from method Client.UpdateCertificatePolicy.
// UpdateCertificatePolicyResponse contains response fields for Client.UpdateCertificatePolicy
type UpdateCertificatePolicyResponse struct {
CertificatePolicy
// RawResponse contains the underlying HTTP response.
RawResponse *http.Response
}
// UpdateCertificatePolicy sets specified members in the certificate policy, leave others as null. This operation requires the certificates/update permission.
@ -1350,24 +1298,22 @@ func (c *Client) UpdateCertificatePolicy(ctx context.Context, certName string, p
}
return UpdateCertificatePolicyResponse{
RawResponse: resp.RawResponse,
CertificatePolicy: *certificatePolicyFromGenerated(&resp.CertificatePolicy),
}, nil
}
// GetCertificatePolicyOptions contains the optional parameters for the method Client.GetCertificatePolicy.
type GetCertificatePolicyOptions struct{}
// GetCertificatePolicyOptions contains optional parameters for Client.GetCertificatePolicy
type GetCertificatePolicyOptions struct {
// placeholder for future optional parameters.
}
func (g *GetCertificatePolicyOptions) toGenerated() *generated.KeyVaultClientGetCertificatePolicyOptions {
return &generated.KeyVaultClientGetCertificatePolicyOptions{}
}
// GetCertificatePolicyResponse contains the response from method Client.GetCertificatePolicy.
// GetCertificatePolicyResponse contains response fields for Client.GetCertificatePolicy
type GetCertificatePolicyResponse struct {
CertificatePolicy
// RawResponse contains the underlying HTTP response.
RawResponse *http.Response
}
// GetCertificatePolicy returns the specified certificate policy resources in the specified key vault. This operation requires the certificates/get permission.
@ -1383,12 +1329,11 @@ func (c *Client) GetCertificatePolicy(ctx context.Context, certName string, opti
}
return GetCertificatePolicyResponse{
RawResponse: resp.RawResponse,
CertificatePolicy: *certificatePolicyFromGenerated(&resp.CertificatePolicy),
}, nil
}
// UpdateCertificatePropertiesOptions contains the optional parameters for the Client.UpdateCertificateProperties function
// UpdateCertificatePropertiesOptions contains optional parameters for Client.UpdateCertificateProperties
type UpdateCertificatePropertiesOptions struct {
// The version of the certificate to update
Version string
@ -1407,11 +1352,9 @@ func (u *UpdateCertificatePropertiesOptions) toGenerated() *generated.KeyVaultCl
return &generated.KeyVaultClientUpdateCertificateOptions{}
}
// UpdateCertificatePropertiesResponse contains the result from method Client.UpdateCertificateProperties.
// UpdateCertificatePropertiesResponse contains response fields for Client.UpdateCertificateProperties
type UpdateCertificatePropertiesResponse struct {
KeyVaultCertificate
// RawResponse contains the underlying HTTP response.
RawResponse *http.Response
}
// UpdateCertificate applies the specified update on the given certificate; the only elements updated are the certificate's
@ -1436,12 +1379,11 @@ func (c *Client) UpdateCertificateProperties(ctx context.Context, certName strin
return UpdateCertificatePropertiesResponse{}, err
}
return UpdateCertificatePropertiesResponse{
RawResponse: resp.RawResponse,
KeyVaultCertificate: certificateFromGenerated(&resp.CertificateBundle),
}, nil
}
// MergeCertificateOptions contains the optional parameters for the Client.MergeCertificate function.
// MergeCertificateOptions contains optional parameters for Client.MergeCertificate
type MergeCertificateOptions struct {
// The attributes of the certificate (optional).
CertificateAttributes *CertificateProperties `json:"attributes,omitempty"`
@ -1454,12 +1396,9 @@ func (m *MergeCertificateOptions) toGenerated() *generated.KeyVaultClientMergeCe
return &generated.KeyVaultClientMergeCertificateOptions{}
}
// MergeCertificateResponse contains the response from method Client.MergeCertificate.
// MergeCertificateResponse contains response fields for Client.MergeCertificate
type MergeCertificateResponse struct {
KeyVaultCertificateWithPolicy
// RawResponse contains the underlying HTTP response.
RawResponse *http.Response
}
// The MergeCertificate operation performs the merging of a certificate or certificate chain with a key pair currently available in the service. This operation requires the certificates/create permission.
@ -1482,7 +1421,6 @@ func (c *Client) MergeCertificate(ctx context.Context, certName string, certific
}
return MergeCertificateResponse{
RawResponse: resp.RawResponse,
KeyVaultCertificateWithPolicy: KeyVaultCertificateWithPolicy{
Properties: certificateAttributesFromGenerated(resp.Attributes),
Cer: resp.Cer,
@ -1497,19 +1435,18 @@ func (c *Client) MergeCertificate(ctx context.Context, certName string, certific
}, nil
}
// RestoreCertificateBackupOptions contains the optional parameters for the Client.RestoreCertificateBackup method
type RestoreCertificateBackupOptions struct{}
// RestoreCertificateBackupOptions contains optional parameters for Client.RestoreCertificateBackup
type RestoreCertificateBackupOptions struct {
// placeholder for future optional parameters.
}
func (r *RestoreCertificateBackupOptions) toGenerated() *generated.KeyVaultClientRestoreCertificateOptions {
return &generated.KeyVaultClientRestoreCertificateOptions{}
}
// RestoreCertificateBackupResponse contains the response from method Client.RestoreCertificateBackup
// RestoreCertificateBackupResponse contains response fields for Client.RestoreCertificateBackup
type RestoreCertificateBackupResponse struct {
KeyVaultCertificateWithPolicy
// RawResponse contains the underlying HTTP response.
RawResponse *http.Response
}
// The RecoverDeletedCertificate operation performs the reversal of the Delete operation. The operation is applicable in vaults
@ -1527,7 +1464,6 @@ func (c *Client) RestoreCertificateBackup(ctx context.Context, certificateBackup
}
return RestoreCertificateBackupResponse{
RawResponse: resp.RawResponse,
KeyVaultCertificateWithPolicy: KeyVaultCertificateWithPolicy{
Properties: certificateAttributesFromGenerated(resp.Attributes),
Cer: resp.Cer,
@ -1542,8 +1478,10 @@ func (c *Client) RestoreCertificateBackup(ctx context.Context, certificateBackup
}, nil
}
// BeginRecoverDeletedCertificateOptions contains the optional parameters for the Client.BeginRecoverDeletedCertificate function
type BeginRecoverDeletedCertificateOptions struct{}
// BeginRecoverDeletedCertificateOptions contains optional parameters for Client.BeginRecoverDeletedCertificate
type BeginRecoverDeletedCertificateOptions struct {
// placeholder for future optional parameters.
}
func (b *BeginRecoverDeletedCertificateOptions) toGenerated() *generated.KeyVaultClientRecoverDeletedCertificateOptions {
return &generated.KeyVaultClientRecoverDeletedCertificateOptions{}
@ -1556,12 +1494,12 @@ type RecoverDeletedCertificatePoller struct {
client *generated.KeyVaultClient
recoverResponse generated.KeyVaultClientRecoverDeletedCertificateResponse
lastResponse generated.KeyVaultClientGetCertificateResponse
RawResponse *http.Response
rawResponse *http.Response
}
// Done returns true when the polling operation is completed
func (b *RecoverDeletedCertificatePoller) Done() bool {
return b.RawResponse.StatusCode == http.StatusOK
return b.rawResponse.StatusCode == http.StatusOK
}
// Poll fetches the latest state of the LRO. It returns an HTTP response or error.
@ -1587,43 +1525,36 @@ func (b *RecoverDeletedCertificatePoller) pollUntilDone(ctx context.Context, t t
for {
resp, err := b.Poll(ctx)
if err != nil {
b.RawResponse = resp
b.rawResponse = resp
}
if b.Done() {
break
}
b.RawResponse = resp
b.rawResponse = resp
time.Sleep(t)
}
return recoverDeletedCertificateResponseFromGenerated(b.recoverResponse), nil
}
// RecoverDeletedCertificateResponse is the response object for the Client.RecoverDeletedCertificate operation.
// RecoverDeletedCertificateResponse contains response fields for Client.RecoverDeletedCertificate
type RecoverDeletedCertificateResponse struct {
KeyVaultCertificate
// RawResponse contains the underlying HTTP response.
RawResponse *http.Response
}
// change recover deleted certificate reponse to the generated version.
func recoverDeletedCertificateResponseFromGenerated(i generated.KeyVaultClientRecoverDeletedCertificateResponse) RecoverDeletedCertificateResponse {
return RecoverDeletedCertificateResponse{
KeyVaultCertificate: certificateFromGenerated(&i.CertificateBundle),
RawResponse: i.RawResponse,
}
}
// RecoverDeletedCertificatePollerResponse contains the response of the Client.BeginRecoverDeletedCertificate operations
// RecoverDeletedCertificatePollerResponse contains response fields for Client.BeginRecoverDeletedCertificate
type RecoverDeletedCertificatePollerResponse struct {
// PollUntilDone will poll the service endpoint until a terminal state is reached or an error occurs
PollUntilDone func(context.Context, time.Duration) (RecoverDeletedCertificateResponse, error)
// Poller contains an initialized RecoverDeletedCertificatePoller
Poller RecoverDeletedCertificatePoller
// RawResponse cotains the underlying HTTP response
RawResponse *http.Response
}
// BeginRecoverDeletedCertificate recovers the deleted certificate in the specified vault to the latest version.
@ -1651,13 +1582,12 @@ func (c *Client) BeginRecoverDeletedCertificate(ctx context.Context, certName st
client: c.genClient,
vaultUrl: c.vaultURL,
recoverResponse: resp,
RawResponse: getResp.RawResponse,
rawResponse: getResp.RawResponse,
}
return RecoverDeletedCertificatePollerResponse{
PollUntilDone: p.pollUntilDone,
Poller: p,
RawResponse: getResp.RawResponse,
}, nil
}
@ -1720,13 +1650,10 @@ func (l *ListDeletedCertificatesPager) NextPage(ctx context.Context) (ListDelete
return listDeletedCertsPageFromGenerated(result), nil
}
// ListDeletedCertificatesPageResponse holds the data for a single page.
// ListDeletedCertificatesPageResponse contains response field for ListDeletedCertificatesPager.NextPage
type ListDeletedCertificatesPageResponse struct {
// READ-ONLY; A response message containing a list of deleted certificates in the vault along with a link to the next page of deleted certificates
Certificates []*DeletedCertificateItem `json:"value,omitempty" azure:"ro"`
// RawResponse contains the underlying HTTP response.
RawResponse *http.Response
}
func listDeletedCertsPageFromGenerated(g generated.KeyVaultClientGetDeletedCertificatesResponse) ListDeletedCertificatesPageResponse {
@ -1749,12 +1676,11 @@ func listDeletedCertsPageFromGenerated(g generated.KeyVaultClientGetDeletedCerti
}
return ListDeletedCertificatesPageResponse{
RawResponse: g.RawResponse,
Certificates: certs,
}
}
// ListDeletedCertificatesOptions contains the optional parameters for the Client.ListDeletedCertificates operation.
// ListDeletedCertificatesOptions contains optional parameters for Client.ListDeletedCertificates
type ListDeletedCertificatesOptions struct {
// placeholder for future optional parameters
}
@ -1770,19 +1696,18 @@ func (c *Client) ListDeletedCertificates(options *ListDeletedCertificatesOptions
}
}
// CancelCertificateOperationOptions contains the optional parameters for the Client.CancelCertificateOperation function
type CancelCertificateOperationOptions struct{}
// CancelCertificateOperationOptions contains optional parameters for Client.CancelCertificateOperation
type CancelCertificateOperationOptions struct {
// placeholder for future optional parameters.
}
func (c *CancelCertificateOperationOptions) toGenerated() *generated.KeyVaultClientUpdateCertificateOperationOptions {
return &generated.KeyVaultClientUpdateCertificateOperationOptions{}
}
// CancelCertificateOperationResponse contains the response models for the Client.CancelCertificateOperation function
// CancelCertificateOperationResponse contains response fields for Client.CancelCertificateOperation
type CancelCertificateOperationResponse struct {
CertificateOperation
// RawResponse contains the underlying HTTP response.
RawResponse *http.Response
}
// CancelCertificateOperation cancels a certificate creation operation that is already in progress. This operation requires the certificates/update permission.
@ -1801,23 +1726,22 @@ func (c *Client) CancelCertificateOperation(ctx context.Context, certName string
}
return CancelCertificateOperationResponse{
RawResponse: resp.RawResponse,
CertificateOperation: certificateOperationFromGenerated(resp.CertificateOperation),
}, nil
}
// DeleteCertificateOperationsOptions contains the optional parameters for the Client.DeleteCertificateOperation function.
type DeleteCertificateOperationOptions struct{}
// DeleteCertificateOperationsOptions contains optional parameters for Client.DeleteCertificateOperation
type DeleteCertificateOperationOptions struct {
// placeholder for future optional parameters.
}
func (d *DeleteCertificateOperationOptions) toGenerated() *generated.KeyVaultClientDeleteCertificateOperationOptions {
return &generated.KeyVaultClientDeleteCertificateOperationOptions{}
}
// DeleteCertificateOperationResponse contains the response for the Client.DeleteCertificateOperation function.
// DeleteCertificateOperationResponse contains response fields for Client.DeleteCertificateOperation
type DeleteCertificateOperationResponse struct {
CertificateOperation
// RawResponse contains the underlying HTTP response.
RawResponse *http.Response
}
// DeleteCertificateOperation deletes the creation operation for a specified certificate that is in the process of being created. The certificate is no
@ -1835,7 +1759,6 @@ func (c *Client) DeleteCertificateOperation(ctx context.Context, certName string
}
return DeleteCertificateOperationResponse{
RawResponse: resp.RawResponse,
CertificateOperation: certificateOperationFromGenerated(resp.CertificateOperation),
}, nil
}

Просмотреть файл

@ -3,7 +3,7 @@ module github.com/Azure/azure-sdk-for-go/sdk/keyvault/azcertificates
go 1.17
require (
github.com/Azure/azure-sdk-for-go/sdk/azcore v0.21.0
github.com/Azure/azure-sdk-for-go/sdk/azcore v0.22.0
github.com/Azure/azure-sdk-for-go/sdk/azidentity v0.13.0
github.com/Azure/azure-sdk-for-go/sdk/internal v0.9.1
github.com/Azure/azure-sdk-for-go/sdk/keyvault/internal v0.2.1

Просмотреть файл

@ -1,6 +1,7 @@
github.com/Azure/azure-sdk-for-go/sdk/azcore v0.20.0/go.mod h1:ZPW/Z0kLCTdDZaDbYTetxc9Cxl/2lNqxYHYNOF2bti0=
github.com/Azure/azure-sdk-for-go/sdk/azcore v0.21.0 h1:8wVJL0HUP5yDFXvotdewORTw7Yu88JbreWN/mobSvsQ=
github.com/Azure/azure-sdk-for-go/sdk/azcore v0.21.0/go.mod h1:fBF9PQNqB8scdgpZ3ufzaLntG0AG7C1WjPMsiFOmfHM=
github.com/Azure/azure-sdk-for-go/sdk/azcore v0.22.0 h1:zBJcBJwte0x6PcPK7XaWDMvK2o2ZM2f1sMaqNNavQ5g=
github.com/Azure/azure-sdk-for-go/sdk/azcore v0.22.0/go.mod h1:fBF9PQNqB8scdgpZ3ufzaLntG0AG7C1WjPMsiFOmfHM=
github.com/Azure/azure-sdk-for-go/sdk/azidentity v0.13.0 h1:bLRntPH25SkY1uZ/YZW+dmxNky9r1fAHvDFrzluo+4Q=
github.com/Azure/azure-sdk-for-go/sdk/azidentity v0.13.0/go.mod h1:TmXReXZ9yPp5D5TBRMTAtyz+UyOl15Py4hL5E5p6igQ=
github.com/Azure/azure-sdk-for-go/sdk/internal v0.8.1/go.mod h1:KLF4gFr6DcKFZwSuH8w8yEK6DpFl3LP5rhdvAb7Yz5I=