|
1 |
| -/* |
2 |
| -Copyright (c) 2024-2024 VMware, Inc. All Rights Reserved. |
3 |
| -
|
4 |
| -Licensed under the Apache License, Version 2.0 (the "License"); |
5 |
| -you may not use this file except in compliance with the License. |
6 |
| -You may obtain a copy of the License at |
7 |
| -
|
8 |
| -http://www.apache.org/licenses/LICENSE-2.0 |
9 |
| -
|
10 |
| -Unless required by applicable law or agreed to in writing, software |
11 |
| -distributed under the License is distributed on an "AS IS" BASIS, |
12 |
| -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
13 |
| -See the License for the specific language governing permissions and |
14 |
| -limitations under the License. |
15 |
| -*/ |
| 1 | +// © Broadcom. All Rights Reserved. |
| 2 | +// The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. |
| 3 | +// SPDX-License-Identifier: Apache-2.0 |
16 | 4 |
|
17 | 5 | package kms
|
18 | 6 |
|
19 | 7 | import (
|
20 | 8 | "context"
|
21 | 9 | "flag"
|
22 | 10 | "fmt"
|
| 11 | + "net/url" |
23 | 12 |
|
24 | 13 | "github.com/vmware/govmomi/cli"
|
25 | 14 | "github.com/vmware/govmomi/cli/flags"
|
@@ -80,6 +69,15 @@ func (cmd *export) Run(ctx context.Context, f *flag.FlagSet) error {
|
80 | 69 | return fmt.Errorf("unsupported export type: %s", export.Type)
|
81 | 70 | }
|
82 | 71 |
|
| 72 | + // Rewrite URL to use the host we connected to vCenter with |
| 73 | + u, err := url.Parse(export.Location.URL) |
| 74 | + if err != nil { |
| 75 | + return err |
| 76 | + } |
| 77 | + |
| 78 | + u.Host = rc.URL().Host |
| 79 | + export.Location.URL = u.String() |
| 80 | + |
83 | 81 | req, err := m.KmsProviderExportRequest(ctx, export.Location)
|
84 | 82 | if err != nil {
|
85 | 83 | return err
|
|
0 commit comments