-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #802 from akutz/feature/deploy-ovf-activation-id
🌱 Use VAPI ActivationID with DeployOVF
- Loading branch information
Showing
3 changed files
with
37 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// Copyright (c) 2024 VMware, Inc. All Rights Reserved. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
package util | ||
|
||
import ( | ||
"context" | ||
"net/http" | ||
|
||
"github.com/vmware/govmomi/vapi/rest" | ||
) | ||
|
||
// vapiActivationIDHeader is the HTTP header to pass to a VAPI API in order | ||
// to influence the activationID of the vim.Task spawned by the VAPI API. | ||
const vapiActivationIDHeader = "vapi-ctx-actid" | ||
|
||
// WithVAPIActivationID adds the specified id to the context to be used as the | ||
// VAPI REST client's activation ID -- the value assigned to the activationId | ||
// field to the vim.Task the VAPI API may spawn. | ||
func WithVAPIActivationID( | ||
ctx context.Context, | ||
client *rest.Client, | ||
id string) context.Context { | ||
|
||
return client.WithHeader( | ||
ctx, | ||
http.Header{vapiActivationIDHeader: []string{id}}, | ||
) | ||
} |