Changeset 98702 in vbox for trunk/src/VBox/Frontends/VBoxManage
- Timestamp:
- Feb 23, 2023 1:34:54 PM (2 years ago)
- svn:sync-xref-src-repo-rev:
- 156002
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VBoxManage/VBoxManageCloud.cpp
r98701 r98702 441 441 442 442 /** 443 * List all available cloud vnic attachments for the specified cloud provider.444 *445 * @returns RTEXITCODE446 * @param a is the list of passed arguments447 * @param iFirst is the position of the first unparsed argument in the arguments list448 * @param pCommonOpts is a pointer to the structure CLOUDCOMMONOPT with some common449 * arguments which have been already parsed before450 */451 static RTEXITCODE listCloudVnicAttachments(HandlerArg *a, int iFirst, PCLOUDCOMMONOPT pCommonOpts)452 {453 static const RTGETOPTDEF s_aOptions[] =454 {455 { "--compartment-id", 'c', RTGETOPT_REQ_STRING },456 { "--instance-id", 'i', RTGETOPT_REQ_STRING },457 { "help", 1001, RTGETOPT_REQ_NOTHING },458 { "--help", 1002, RTGETOPT_REQ_NOTHING }459 };460 RTGETOPTSTATE GetState;461 RTGETOPTUNION ValueUnion;462 int vrc = RTGetOptInit(&GetState, a->argc, a->argv, s_aOptions, RT_ELEMENTS(s_aOptions), iFirst, 0);463 AssertRCReturn(vrc, RTEXITCODE_FAILURE);464 465 com::SafeArray<BSTR> parameters;466 Utf8Str strCompartmentId;467 Utf8Str strInstanceId;468 HRESULT hrc = S_OK;469 //470 // int c;471 // while ((c = RTGetOpt(&GetState, &ValueUnion)) != 0)472 // {473 // switch (c)474 // {475 // case 'c':476 // strCompartmentId = ValueUnion.psz;477 // Bstr(Utf8Str("compartment-id=").append(ValueUnion.psz)).detachTo(parameters.appendedRaw());478 // break;479 //480 // case 'i':481 // strInstanceId = ValueUnion.psz;482 // Bstr(Utf8Str("instance-id=").append(ValueUnion.psz)).detachTo(parameters.appendedRaw());483 // break;484 // case 1001:485 // case 1002:486 // printHelp(g_pStdOut);487 // return RTEXITCODE_SUCCESS;488 // case VINF_GETOPT_NOT_OPTION:489 // return errorUnknownSubcommand(ValueUnion.psz);490 //491 // default:492 // return errorGetOpt(c, &ValueUnion);493 // }494 // }495 //496 //497 // HRESULT hrc = S_OK;498 //499 // /* Delayed check. It allows us to print help information.*/500 // hrc = checkAndSetCommonOptions(a, pCommonOpts);501 // if (FAILED(hrc))502 // return RTEXITCODE_FAILURE;503 //504 // ComPtr<IVirtualBox> pVirtualBox = a->virtualBox;505 //506 // ComPtr<ICloudProviderManager> pCloudProviderManager;507 // CHECK_ERROR2_RET(hrc, pVirtualBox,508 // COMGETTER(CloudProviderManager)(pCloudProviderManager.asOutParam()),509 // RTEXITCODE_FAILURE);510 //511 // ComPtr<ICloudProvider> pCloudProvider;512 // CHECK_ERROR2_RET(hrc, pCloudProviderManager,513 // GetProviderByShortName(Bstr(pCommonOpts->provider.pszProviderName).raw(), pCloudProvider.asOutParam()),514 // RTEXITCODE_FAILURE);/loada515 //516 // ComPtr<ICloudProfile> pCloudProfile;517 // CHECK_ERROR2_RET(hrc, pCloudProvider,518 // GetProfileByName(Bstr(pCommonOpts->profile.pszProfileName).raw(), pCloudProfile.asOutParam()),519 // RTEXITCODE_FAILURE);520 //521 // if (strCompartmentId.isNotEmpty())522 // {523 // CHECK_ERROR2_RET(hrc, pCloudProfile,524 // SetProperty(Bstr("compartment").raw(), Bstr(strCompartmentId).raw()),\525 // RTEXITCODE_FAILURE);526 // }527 // else528 // {529 // RTPrintf(Cloud::tr("Parameter \'compartment\' is empty or absent.\n"530 // "Trying to get the compartment from the passed cloud profile \'%s\'\n"), pCommonOpts->profile.pszProfileName);531 // Bstr bStrCompartmentId;532 // CHECK_ERROR2_RET(hrc, pCloudProfile,533 // GetProperty(Bstr("compartment").raw(), bStrCompartmentId.asOutParam()),534 // RTEXITCODE_FAILURE);535 // strCompartmentId = bStrCompartmentId;536 // if (strCompartmentId.isNotEmpty())537 // RTPrintf(Cloud::tr("Found the compartment \'%s\':\n"), strCompartmentId.c_str());538 // else539 // return errorArgument(Cloud::tr("Parameter --compartment-id is required."));540 // }541 //542 // Bstr bstrProfileName;543 // pCloudProfile->COMGETTER(Name)(bstrProfileName.asOutParam());544 //545 // ComObjPtr<ICloudClient> oCloudClient;546 // CHECK_ERROR2_RET(hrc, pCloudProfile,547 // CreateCloudClient(oCloudClient.asOutParam()),548 // RTEXITCODE_FAILURE);549 //550 // ComPtr<IStringArray> pVnicAttachmentIdsHolder;551 // ComPtr<IStringArray> pVnicIdsHolder;552 // com::SafeArray<BSTR> arrayVnicAttachmentIds;553 // com::SafeArray<BSTR> arrayVnicIds;554 // ComPtr<IProgress> pProgress;555 //556 // RTPrintf(Cloud::tr("Reply is in the form \'Vnic attachment <id>\': \n\t \'Vnic <id>\'\n"));557 // CHECK_ERROR2_RET(hrc, oCloudClient,558 // ListVnicAttachments(ComSafeArrayAsInParam(parameters),559 // pVnicAttachmentIdsHolder.asOutParam(),560 // pVnicIdsHolder.asOutParam(),561 // pProgress.asOutParam()),562 // RTEXITCODE_FAILURE);563 // showProgress(pProgress);564 // CHECK_PROGRESS_ERROR_RET(pProgress, (Cloud::tr("Failed to list Vnic attachments")), RTEXITCODE_FAILURE);565 //566 // CHECK_ERROR2_RET(hrc,567 // pVnicAttachmentIdsHolder, COMGETTER(Values)(ComSafeArrayAsOutParam(arrayVnicAttachmentIds)),568 // RTEXITCODE_FAILURE);569 // CHECK_ERROR2_RET(hrc,570 // pVnicIdsHolder, COMGETTER(Values)(ComSafeArrayAsOutParam(arrayVnicIds)),571 // RTEXITCODE_FAILURE);572 //573 // RTPrintf(Cloud::tr("The list of the Vnic attachments for the cloud profile \'%ls\' \n and compartment \'%s\':\n"),574 // bstrProfileName.raw(), strCompartmentId.c_str());575 // size_t cVnicAttchIds = arrayVnicAttachmentIds.size();576 // size_t cVnicIds = arrayVnicIds.size();577 //578 // Bstr value;579 // for (size_t k = 0; k < cVnicAttchIds; k++)580 // {581 // if (k < cVnicIds)582 // value = arrayVnicIds[k];583 // RTPrintf(Cloud::tr("Vnic attachment id [%ls]:\n\t Vnic id - %ls\n"), arrayVnicAttachmentIds[k], value.raw());584 // }585 //586 // ComPtr<IStringArray> infoArray;587 // ComPtr<IProgress> pProgress1;588 // com::SafeArray<BSTR> pStrInfoArray;589 //590 // RTPrintf(Cloud::tr("Reply is in the form \'image property\' = \'value\'\n"));591 // CHECK_ERROR2_RET(hrc, oCloudClient,592 // GetVnicInfo(Bstr(value).raw(),593 // infoArray.asOutParam(),594 // pProgress1.asOutParam()),595 // RTEXITCODE_FAILURE);596 //597 // showProgress(pProgress1);598 // CHECK_PROGRESS_ERROR_RET(pProgress1, (Cloud::tr("Failed to get Vnic information")), RTEXITCODE_FAILURE);599 //600 // CHECK_ERROR2_RET(hrc,601 // infoArray, COMGETTER(Values)(ComSafeArrayAsOutParam(pStrInfoArray)),602 // RTEXITCODE_FAILURE);603 //604 // RTPrintf(Cloud::tr("General information about the vnic:\n"));605 // size_t cParamNames = pStrInfoArray.size();606 // for (size_t k = 0; k < cParamNames; k++)607 // {608 // Utf8Str data(pStrInfoArray[k]);609 // RTPrintf(Cloud::tr("\t%s\n"), data.c_str());610 // }611 612 return SUCCEEDED(hrc) ? RTEXITCODE_SUCCESS : RTEXITCODE_FAILURE;613 }614 615 /**616 443 * General function which handles the "list" commands 617 444 *
Note:
See TracChangeset
for help on using the changeset viewer.