Skip to content

Fix disk grant access #1218

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 12 additions & 5 deletions resource-manager/compute/2022-03-02/disks/method_grantaccess.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ func (c DisksClient) GrantAccess(ctx context.Context, id commonids.ManagedDiskId
if resp != nil {
result.OData = resp.OData
result.HttpResponse = resp.Response

var model AccessUri
result.Model = &model
}
if err != nil {
return
Expand All @@ -62,15 +65,19 @@ func (c DisksClient) GrantAccess(ctx context.Context, id commonids.ManagedDiskId
}

// GrantAccessThenPoll performs GrantAccess then polls until it's completed
func (c DisksClient) GrantAccessThenPoll(ctx context.Context, id commonids.ManagedDiskId, input GrantAccessData) error {
result, err := c.GrantAccess(ctx, id, input)
func (c DisksClient) GrantAccessThenPoll(ctx context.Context, id commonids.ManagedDiskId, input GrantAccessData) (result GrantAccessOperationResponse, err error) {
result, err = c.GrantAccess(ctx, id, input)
if err != nil {
return fmt.Errorf("performing GrantAccess: %+v", err)
return result, fmt.Errorf("performing GrantAccess: %+v", err)
}

if err := result.Poller.PollUntilDone(ctx); err != nil {
return fmt.Errorf("polling after GrantAccess: %+v", err)
return result, fmt.Errorf("polling after GrantAccess: %+v", err)
}

if err := result.Poller.FinalResult(result.Model); err != nil {
return result, fmt.Errorf("performing FinalResult: %+v", err)
}

return nil
return
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ package disks
// Licensed under the MIT License. See NOTICE.txt in the project root for license information.

type AccessUri struct {
AccessSAS *string `json:"accessSAS,omitempty"`
SecurityDataAccessSAS *string `json:"securityDataAccessSAS,omitempty"`
StartTime *string `json:"startTime,omitempty"`
EndTime *string `json:"endTime,omitempty"`
Status *string `json:"status,omitempty"`
Name *string `json:"name,omitempty"`
Properties *AccessUriProperties `json:"properties,omitempty"`
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package disks

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

type AccessUriOutput struct {
AccessSAS *string `json:"accessSAS,omitempty"`
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package disks

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

type AccessUriProperties struct {
Output *AccessUriOutput `json:"output,omitempty"`
}