vsphere-automation-content 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Gemfile +3 -0
- data/Gemfile.lock +79 -0
- data/README.md +229 -0
- data/Rakefile +10 -0
- data/docs/ConfigurationApi.md +91 -0
- data/docs/ContentConfigurationModel.md +11 -0
- data/docs/ContentConfigurationResult.md +8 -0
- data/docs/ContentConfigurationUpdate.md +8 -0
- data/docs/ContentLibraryFind.md +8 -0
- data/docs/ContentLibraryFindResult.md +8 -0
- data/docs/ContentLibraryFindSpec.md +9 -0
- data/docs/ContentLibraryItemCopy.md +9 -0
- data/docs/ContentLibraryItemCopyResult.md +8 -0
- data/docs/ContentLibraryItemCreate.md +9 -0
- data/docs/ContentLibraryItemCreateResult.md +8 -0
- data/docs/ContentLibraryItemDownloadSessionCreate.md +9 -0
- data/docs/ContentLibraryItemDownloadSessionCreateResult.md +8 -0
- data/docs/ContentLibraryItemDownloadSessionFail.md +8 -0
- data/docs/ContentLibraryItemDownloadSessionKeepAlive.md +8 -0
- data/docs/ContentLibraryItemDownloadSessionListResult.md +8 -0
- data/docs/ContentLibraryItemDownloadSessionModel.md +14 -0
- data/docs/ContentLibraryItemDownloadSessionModelState.md +7 -0
- data/docs/ContentLibraryItemDownloadSessionResult.md +8 -0
- data/docs/ContentLibraryItemDownloadsessionFileEndpointType.md +7 -0
- data/docs/ContentLibraryItemDownloadsessionFileGet.md +8 -0
- data/docs/ContentLibraryItemDownloadsessionFileInfo.md +14 -0
- data/docs/ContentLibraryItemDownloadsessionFileListResult.md +8 -0
- data/docs/ContentLibraryItemDownloadsessionFilePrepare.md +9 -0
- data/docs/ContentLibraryItemDownloadsessionFilePrepareResult.md +8 -0
- data/docs/ContentLibraryItemDownloadsessionFilePrepareStatus.md +7 -0
- data/docs/ContentLibraryItemDownloadsessionFileResult.md +8 -0
- data/docs/ContentLibraryItemFileChecksumAlgorithm.md +7 -0
- data/docs/ContentLibraryItemFileChecksumInfo.md +9 -0
- data/docs/ContentLibraryItemFileGet.md +8 -0
- data/docs/ContentLibraryItemFileInfo.md +12 -0
- data/docs/ContentLibraryItemFileListResult.md +8 -0
- data/docs/ContentLibraryItemFileResult.md +8 -0
- data/docs/ContentLibraryItemFind.md +8 -0
- data/docs/ContentLibraryItemFindResult.md +8 -0
- data/docs/ContentLibraryItemFindSpec.md +12 -0
- data/docs/ContentLibraryItemListResult.md +8 -0
- data/docs/ContentLibraryItemModel.md +21 -0
- data/docs/ContentLibraryItemResult.md +8 -0
- data/docs/ContentLibraryItemStorageGet.md +8 -0
- data/docs/ContentLibraryItemStorageInfo.md +14 -0
- data/docs/ContentLibraryItemStorageListResult.md +8 -0
- data/docs/ContentLibraryItemStorageResult.md +8 -0
- data/docs/ContentLibraryItemTransferEndpoint.md +9 -0
- data/docs/ContentLibraryItemTransferStatus.md +7 -0
- data/docs/ContentLibraryItemUpdate.md +8 -0
- data/docs/ContentLibraryItemUpdateSessionCreate.md +9 -0
- data/docs/ContentLibraryItemUpdateSessionCreateResult.md +8 -0
- data/docs/ContentLibraryItemUpdateSessionFail.md +8 -0
- data/docs/ContentLibraryItemUpdateSessionKeepAlive.md +8 -0
- data/docs/ContentLibraryItemUpdateSessionListResult.md +8 -0
- data/docs/ContentLibraryItemUpdateSessionModel.md +16 -0
- data/docs/ContentLibraryItemUpdateSessionModelState.md +7 -0
- data/docs/ContentLibraryItemUpdateSessionResult.md +8 -0
- data/docs/ContentLibraryItemUpdateSessionUpdate.md +8 -0
- data/docs/ContentLibraryItemUpdatesessionCertificateInfo.md +11 -0
- data/docs/ContentLibraryItemUpdatesessionFileAdd.md +8 -0
- data/docs/ContentLibraryItemUpdatesessionFileAddResult.md +8 -0
- data/docs/ContentLibraryItemUpdatesessionFileAddSpec.md +12 -0
- data/docs/ContentLibraryItemUpdatesessionFileGet.md +8 -0
- data/docs/ContentLibraryItemUpdatesessionFileInfo.md +17 -0
- data/docs/ContentLibraryItemUpdatesessionFileListResult.md +8 -0
- data/docs/ContentLibraryItemUpdatesessionFileRemove.md +8 -0
- data/docs/ContentLibraryItemUpdatesessionFileResult.md +8 -0
- data/docs/ContentLibraryItemUpdatesessionFileSourceType.md +7 -0
- data/docs/ContentLibraryItemUpdatesessionFileValidateResult.md +8 -0
- data/docs/ContentLibraryItemUpdatesessionFileValidationError.md +9 -0
- data/docs/ContentLibraryItemUpdatesessionFileValidationResult.md +10 -0
- data/docs/ContentLibraryItemUpdatesessionPreviewInfo.md +10 -0
- data/docs/ContentLibraryItemUpdatesessionPreviewInfoState.md +7 -0
- data/docs/ContentLibraryItemUpdatesessionPreviewWarningInfo.md +10 -0
- data/docs/ContentLibraryItemUpdatesessionWarningBehavior.md +9 -0
- data/docs/ContentLibraryItemUpdatesessionWarningType.md +7 -0
- data/docs/ContentLibraryListResult.md +8 -0
- data/docs/ContentLibraryModel.md +20 -0
- data/docs/ContentLibraryModelLibraryType.md +7 -0
- data/docs/ContentLibraryOptimizationInfo.md +8 -0
- data/docs/ContentLibraryPublishInfo.md +14 -0
- data/docs/ContentLibraryPublishInfoAuthenticationMethod.md +7 -0
- data/docs/ContentLibraryResult.md +8 -0
- data/docs/ContentLibraryStorageBacking.md +10 -0
- data/docs/ContentLibraryStorageBackingType.md +7 -0
- data/docs/ContentLibrarySubscribedItemSync.md +8 -0
- data/docs/ContentLibrarySubscriptionInfo.md +14 -0
- data/docs/ContentLibrarySubscriptionInfoAuthenticationMethod.md +7 -0
- data/docs/ContentLibraryUpdate.md +8 -0
- data/docs/ContentLocalLibraryCreate.md +9 -0
- data/docs/ContentLocalLibraryCreateResult.md +8 -0
- data/docs/ContentLocalLibraryListResult.md +8 -0
- data/docs/ContentLocalLibraryResult.md +8 -0
- data/docs/ContentLocalLibraryUpdate.md +8 -0
- data/docs/ContentSubscribedLibraryCreate.md +9 -0
- data/docs/ContentSubscribedLibraryCreateResult.md +8 -0
- data/docs/ContentSubscribedLibraryListResult.md +8 -0
- data/docs/ContentSubscribedLibraryProbe.md +8 -0
- data/docs/ContentSubscribedLibraryProbeResult.md +10 -0
- data/docs/ContentSubscribedLibraryProbeResultStatus.md +7 -0
- data/docs/ContentSubscribedLibraryResult.md +8 -0
- data/docs/ContentSubscribedLibraryUpdate.md +8 -0
- data/docs/LibraryApi.md +181 -0
- data/docs/LibraryItemApi.md +318 -0
- data/docs/LibraryItemDownloadSessionApi.md +320 -0
- data/docs/LibraryItemDownloadsessionFileApi.md +144 -0
- data/docs/LibraryItemFileApi.md +98 -0
- data/docs/LibraryItemStorageApi.md +98 -0
- data/docs/LibraryItemUpdateSessionApi.md +408 -0
- data/docs/LibraryItemUpdatesessionFileApi.md +233 -0
- data/docs/LibrarySubscribedItemApi.md +96 -0
- data/docs/LocalLibraryApi.md +224 -0
- data/docs/SubscribedLibraryApi.md +354 -0
- data/docs/VapiStdErrorsConcurrentChange.md +9 -0
- data/docs/VapiStdErrorsConcurrentChangeError.md +9 -0
- data/docs/VapiStdErrorsInvalidArgument.md +9 -0
- data/docs/VapiStdErrorsInvalidArgumentError.md +9 -0
- data/docs/VapiStdErrorsInvalidElementConfiguration.md +9 -0
- data/docs/VapiStdErrorsInvalidElementConfigurationError.md +9 -0
- data/docs/VapiStdErrorsInvalidElementType.md +9 -0
- data/docs/VapiStdErrorsInvalidElementTypeError.md +9 -0
- data/docs/VapiStdErrorsNotAllowedInCurrentState.md +9 -0
- data/docs/VapiStdErrorsNotAllowedInCurrentStateError.md +9 -0
- data/docs/VapiStdErrorsNotFound.md +9 -0
- data/docs/VapiStdErrorsNotFoundError.md +9 -0
- data/docs/VapiStdErrorsResourceBusy.md +9 -0
- data/docs/VapiStdErrorsResourceBusyError.md +9 -0
- data/docs/VapiStdErrorsResourceInaccessible.md +9 -0
- data/docs/VapiStdErrorsResourceInaccessibleError.md +9 -0
- data/docs/VapiStdErrorsUnauthorized.md +9 -0
- data/docs/VapiStdErrorsUnauthorizedError.md +9 -0
- data/docs/VapiStdErrorsUnsupported.md +9 -0
- data/docs/VapiStdErrorsUnsupportedError.md +9 -0
- data/docs/VapiStdLocalizableMessage.md +10 -0
- data/git_push.sh +55 -0
- data/lib/vsphere-automation-content.rb +168 -0
- data/lib/vsphere-automation-content/api/configuration_api.rb +122 -0
- data/lib/vsphere-automation-content/api/library_api.rb +238 -0
- data/lib/vsphere-automation-content/api/library_item_api.rb +416 -0
- data/lib/vsphere-automation-content/api/library_item_download_session_api.rb +397 -0
- data/lib/vsphere-automation-content/api/library_item_downloadsession_file_api.rb +205 -0
- data/lib/vsphere-automation-content/api/library_item_file_api.rb +140 -0
- data/lib/vsphere-automation-content/api/library_item_storage_api.rb +140 -0
- data/lib/vsphere-automation-content/api/library_item_update_session_api.rb +505 -0
- data/lib/vsphere-automation-content/api/library_item_updatesession_file_api.rb +318 -0
- data/lib/vsphere-automation-content/api/library_subscribed_item_api.rb +131 -0
- data/lib/vsphere-automation-content/api/local_library_api.rb +289 -0
- data/lib/vsphere-automation-content/api/subscribed_library_api.rb +444 -0
- data/lib/vsphere-automation-content/api_client.rb +386 -0
- data/lib/vsphere-automation-content/api_error.rb +36 -0
- data/lib/vsphere-automation-content/configuration.rb +200 -0
- data/lib/vsphere-automation-content/models/content_configuration_model.rb +214 -0
- data/lib/vsphere-automation-content/models/content_configuration_result.rb +188 -0
- data/lib/vsphere-automation-content/models/content_configuration_update.rb +188 -0
- data/lib/vsphere-automation-content/models/content_library_find.rb +188 -0
- data/lib/vsphere-automation-content/models/content_library_find_result.rb +190 -0
- data/lib/vsphere-automation-content/models/content_library_find_spec.rb +193 -0
- data/lib/vsphere-automation-content/models/content_library_item_copy.rb +198 -0
- data/lib/vsphere-automation-content/models/content_library_item_copy_result.rb +188 -0
- data/lib/vsphere-automation-content/models/content_library_item_create.rb +198 -0
- data/lib/vsphere-automation-content/models/content_library_item_create_result.rb +188 -0
- data/lib/vsphere-automation-content/models/content_library_item_download_session_create.rb +198 -0
- data/lib/vsphere-automation-content/models/content_library_item_download_session_create_result.rb +188 -0
- data/lib/vsphere-automation-content/models/content_library_item_download_session_fail.rb +189 -0
- data/lib/vsphere-automation-content/models/content_library_item_download_session_keep_alive.rb +184 -0
- data/lib/vsphere-automation-content/models/content_library_item_download_session_list_result.rb +190 -0
- data/lib/vsphere-automation-content/models/content_library_item_download_session_model.rb +242 -0
- data/lib/vsphere-automation-content/models/content_library_item_download_session_model_state.rb +31 -0
- data/lib/vsphere-automation-content/models/content_library_item_download_session_result.rb +188 -0
- data/lib/vsphere-automation-content/models/content_library_item_downloadsession_file_endpoint_type.rb +30 -0
- data/lib/vsphere-automation-content/models/content_library_item_downloadsession_file_get.rb +189 -0
- data/lib/vsphere-automation-content/models/content_library_item_downloadsession_file_info.rb +255 -0
- data/lib/vsphere-automation-content/models/content_library_item_downloadsession_file_list_result.rb +190 -0
- data/lib/vsphere-automation-content/models/content_library_item_downloadsession_file_prepare.rb +198 -0
- data/lib/vsphere-automation-content/models/content_library_item_downloadsession_file_prepare_result.rb +188 -0
- data/lib/vsphere-automation-content/models/content_library_item_downloadsession_file_prepare_status.rb +33 -0
- data/lib/vsphere-automation-content/models/content_library_item_downloadsession_file_result.rb +188 -0
- data/lib/vsphere-automation-content/models/content_library_item_file_checksum_algorithm.rb +32 -0
- data/lib/vsphere-automation-content/models/content_library_item_file_checksum_info.rb +198 -0
- data/lib/vsphere-automation-content/models/content_library_item_file_get.rb +189 -0
- data/lib/vsphere-automation-content/models/content_library_item_file_info.rb +243 -0
- data/lib/vsphere-automation-content/models/content_library_item_file_list_result.rb +190 -0
- data/lib/vsphere-automation-content/models/content_library_item_file_result.rb +188 -0
- data/lib/vsphere-automation-content/models/content_library_item_find.rb +188 -0
- data/lib/vsphere-automation-content/models/content_library_item_find_result.rb +190 -0
- data/lib/vsphere-automation-content/models/content_library_item_find_spec.rb +224 -0
- data/lib/vsphere-automation-content/models/content_library_item_list_result.rb +190 -0
- data/lib/vsphere-automation-content/models/content_library_item_model.rb +314 -0
- data/lib/vsphere-automation-content/models/content_library_item_result.rb +188 -0
- data/lib/vsphere-automation-content/models/content_library_item_storage_get.rb +189 -0
- data/lib/vsphere-automation-content/models/content_library_item_storage_info.rb +274 -0
- data/lib/vsphere-automation-content/models/content_library_item_storage_list_result.rb +190 -0
- data/lib/vsphere-automation-content/models/content_library_item_storage_result.rb +190 -0
- data/lib/vsphere-automation-content/models/content_library_item_transfer_endpoint.rb +199 -0
- data/lib/vsphere-automation-content/models/content_library_item_transfer_status.rb +33 -0
- data/lib/vsphere-automation-content/models/content_library_item_update.rb +188 -0
- data/lib/vsphere-automation-content/models/content_library_item_update_session_create.rb +198 -0
- data/lib/vsphere-automation-content/models/content_library_item_update_session_create_result.rb +188 -0
- data/lib/vsphere-automation-content/models/content_library_item_update_session_fail.rb +189 -0
- data/lib/vsphere-automation-content/models/content_library_item_update_session_keep_alive.rb +184 -0
- data/lib/vsphere-automation-content/models/content_library_item_update_session_list_result.rb +190 -0
- data/lib/vsphere-automation-content/models/content_library_item_update_session_model.rb +263 -0
- data/lib/vsphere-automation-content/models/content_library_item_update_session_model_state.rb +32 -0
- data/lib/vsphere-automation-content/models/content_library_item_update_session_result.rb +188 -0
- data/lib/vsphere-automation-content/models/content_library_item_update_session_update.rb +188 -0
- data/lib/vsphere-automation-content/models/content_library_item_updatesession_certificate_info.rb +234 -0
- data/lib/vsphere-automation-content/models/content_library_item_updatesession_file_add.rb +188 -0
- data/lib/vsphere-automation-content/models/content_library_item_updatesession_file_add_result.rb +188 -0
- data/lib/vsphere-automation-content/models/content_library_item_updatesession_file_add_spec.rb +231 -0
- data/lib/vsphere-automation-content/models/content_library_item_updatesession_file_get.rb +189 -0
- data/lib/vsphere-automation-content/models/content_library_item_updatesession_file_info.rb +288 -0
- data/lib/vsphere-automation-content/models/content_library_item_updatesession_file_list_result.rb +190 -0
- data/lib/vsphere-automation-content/models/content_library_item_updatesession_file_remove.rb +189 -0
- data/lib/vsphere-automation-content/models/content_library_item_updatesession_file_result.rb +188 -0
- data/lib/vsphere-automation-content/models/content_library_item_updatesession_file_source_type.rb +31 -0
- data/lib/vsphere-automation-content/models/content_library_item_updatesession_file_validate_result.rb +188 -0
- data/lib/vsphere-automation-content/models/content_library_item_updatesession_file_validation_error.rb +203 -0
- data/lib/vsphere-automation-content/models/content_library_item_updatesession_file_validation_result.rb +223 -0
- data/lib/vsphere-automation-content/models/content_library_item_updatesession_preview_info.rb +209 -0
- data/lib/vsphere-automation-content/models/content_library_item_updatesession_preview_info_state.rb +32 -0
- data/lib/vsphere-automation-content/models/content_library_item_updatesession_preview_warning_info.rb +217 -0
- data/lib/vsphere-automation-content/models/content_library_item_updatesession_warning_behavior.rb +203 -0
- data/lib/vsphere-automation-content/models/content_library_item_updatesession_warning_type.rb +32 -0
- data/lib/vsphere-automation-content/models/content_library_list_result.rb +190 -0
- data/lib/vsphere-automation-content/models/content_library_model.rb +302 -0
- data/lib/vsphere-automation-content/models/content_library_model_library_type.rb +30 -0
- data/lib/vsphere-automation-content/models/content_library_optimization_info.rb +184 -0
- data/lib/vsphere-automation-content/models/content_library_publish_info.rb +243 -0
- data/lib/vsphere-automation-content/models/content_library_publish_info_authentication_method.rb +30 -0
- data/lib/vsphere-automation-content/models/content_library_result.rb +188 -0
- data/lib/vsphere-automation-content/models/content_library_storage_backing.rb +203 -0
- data/lib/vsphere-automation-content/models/content_library_storage_backing_type.rb +30 -0
- data/lib/vsphere-automation-content/models/content_library_subscribed_item_sync.rb +189 -0
- data/lib/vsphere-automation-content/models/content_library_subscription_info.rb +243 -0
- data/lib/vsphere-automation-content/models/content_library_subscription_info_authentication_method.rb +30 -0
- data/lib/vsphere-automation-content/models/content_library_update.rb +188 -0
- data/lib/vsphere-automation-content/models/content_local_library_create.rb +198 -0
- data/lib/vsphere-automation-content/models/content_local_library_create_result.rb +188 -0
- data/lib/vsphere-automation-content/models/content_local_library_list_result.rb +190 -0
- data/lib/vsphere-automation-content/models/content_local_library_result.rb +188 -0
- data/lib/vsphere-automation-content/models/content_local_library_update.rb +188 -0
- data/lib/vsphere-automation-content/models/content_subscribed_library_create.rb +198 -0
- data/lib/vsphere-automation-content/models/content_subscribed_library_create_result.rb +188 -0
- data/lib/vsphere-automation-content/models/content_subscribed_library_list_result.rb +190 -0
- data/lib/vsphere-automation-content/models/content_subscribed_library_probe.rb +188 -0
- data/lib/vsphere-automation-content/models/content_subscribed_library_probe_result.rb +215 -0
- data/lib/vsphere-automation-content/models/content_subscribed_library_probe_result_status.rb +36 -0
- data/lib/vsphere-automation-content/models/content_subscribed_library_result.rb +188 -0
- data/lib/vsphere-automation-content/models/content_subscribed_library_update.rb +188 -0
- data/lib/vsphere-automation-content/models/vapi_std_errors_concurrent_change.rb +201 -0
- data/lib/vsphere-automation-content/models/vapi_std_errors_concurrent_change_error.rb +192 -0
- data/lib/vsphere-automation-content/models/vapi_std_errors_invalid_argument.rb +201 -0
- data/lib/vsphere-automation-content/models/vapi_std_errors_invalid_argument_error.rb +192 -0
- data/lib/vsphere-automation-content/models/vapi_std_errors_invalid_element_configuration.rb +201 -0
- data/lib/vsphere-automation-content/models/vapi_std_errors_invalid_element_configuration_error.rb +192 -0
- data/lib/vsphere-automation-content/models/vapi_std_errors_invalid_element_type.rb +201 -0
- data/lib/vsphere-automation-content/models/vapi_std_errors_invalid_element_type_error.rb +192 -0
- data/lib/vsphere-automation-content/models/vapi_std_errors_not_allowed_in_current_state.rb +201 -0
- data/lib/vsphere-automation-content/models/vapi_std_errors_not_allowed_in_current_state_error.rb +192 -0
- data/lib/vsphere-automation-content/models/vapi_std_errors_not_found.rb +201 -0
- data/lib/vsphere-automation-content/models/vapi_std_errors_not_found_error.rb +192 -0
- data/lib/vsphere-automation-content/models/vapi_std_errors_resource_busy.rb +201 -0
- data/lib/vsphere-automation-content/models/vapi_std_errors_resource_busy_error.rb +192 -0
- data/lib/vsphere-automation-content/models/vapi_std_errors_resource_inaccessible.rb +201 -0
- data/lib/vsphere-automation-content/models/vapi_std_errors_resource_inaccessible_error.rb +192 -0
- data/lib/vsphere-automation-content/models/vapi_std_errors_unauthorized.rb +201 -0
- data/lib/vsphere-automation-content/models/vapi_std_errors_unauthorized_error.rb +192 -0
- data/lib/vsphere-automation-content/models/vapi_std_errors_unsupported.rb +201 -0
- data/lib/vsphere-automation-content/models/vapi_std_errors_unsupported_error.rb +192 -0
- data/lib/vsphere-automation-content/models/vapi_std_localizable_message.rb +221 -0
- data/lib/vsphere-automation-content/version.rb +15 -0
- data/spec/api/configuration_api_spec.rb +54 -0
- data/spec/api/library_api_spec.rb +77 -0
- data/spec/api/library_item_api_spec.rb +112 -0
- data/spec/api/library_item_download_session_api_spec.rb +112 -0
- data/spec/api/library_item_downloadsession_file_api_spec.rb +68 -0
- data/spec/api/library_item_file_api_spec.rb +56 -0
- data/spec/api/library_item_storage_api_spec.rb +56 -0
- data/spec/api/library_item_update_session_api_spec.rb +135 -0
- data/spec/api/library_item_updatesession_file_api_spec.rb +91 -0
- data/spec/api/library_subscribed_item_api_spec.rb +56 -0
- data/spec/api/local_library_api_spec.rb +88 -0
- data/spec/api/subscribed_library_api_spec.rb +121 -0
- data/spec/api_client_spec.rb +224 -0
- data/spec/configuration_spec.rb +40 -0
- data/spec/models/content_configuration_model_spec.rb +57 -0
- data/spec/models/content_configuration_result_spec.rb +39 -0
- data/spec/models/content_configuration_update_spec.rb +39 -0
- data/spec/models/content_library_find_result_spec.rb +39 -0
- data/spec/models/content_library_find_spec.rb +39 -0
- data/spec/models/content_library_find_spec_spec.rb +45 -0
- data/spec/models/content_library_item_copy_result_spec.rb +39 -0
- data/spec/models/content_library_item_copy_spec.rb +45 -0
- data/spec/models/content_library_item_create_result_spec.rb +39 -0
- data/spec/models/content_library_item_create_spec.rb +45 -0
- data/spec/models/content_library_item_download_session_create_result_spec.rb +39 -0
- data/spec/models/content_library_item_download_session_create_spec.rb +45 -0
- data/spec/models/content_library_item_download_session_fail_spec.rb +39 -0
- data/spec/models/content_library_item_download_session_keep_alive_spec.rb +39 -0
- data/spec/models/content_library_item_download_session_list_result_spec.rb +39 -0
- data/spec/models/content_library_item_download_session_model_spec.rb +75 -0
- data/spec/models/content_library_item_download_session_model_state_spec.rb +33 -0
- data/spec/models/content_library_item_download_session_result_spec.rb +39 -0
- data/spec/models/content_library_item_downloadsession_file_endpoint_type_spec.rb +33 -0
- data/spec/models/content_library_item_downloadsession_file_get_spec.rb +39 -0
- data/spec/models/content_library_item_downloadsession_file_info_spec.rb +75 -0
- data/spec/models/content_library_item_downloadsession_file_list_result_spec.rb +39 -0
- data/spec/models/content_library_item_downloadsession_file_prepare_result_spec.rb +39 -0
- data/spec/models/content_library_item_downloadsession_file_prepare_spec.rb +45 -0
- data/spec/models/content_library_item_downloadsession_file_prepare_status_spec.rb +33 -0
- data/spec/models/content_library_item_downloadsession_file_result_spec.rb +39 -0
- data/spec/models/content_library_item_file_checksum_algorithm_spec.rb +33 -0
- data/spec/models/content_library_item_file_checksum_info_spec.rb +45 -0
- data/spec/models/content_library_item_file_get_spec.rb +39 -0
- data/spec/models/content_library_item_file_info_spec.rb +63 -0
- data/spec/models/content_library_item_file_list_result_spec.rb +39 -0
- data/spec/models/content_library_item_file_result_spec.rb +39 -0
- data/spec/models/content_library_item_find_result_spec.rb +39 -0
- data/spec/models/content_library_item_find_spec.rb +39 -0
- data/spec/models/content_library_item_find_spec_spec.rb +63 -0
- data/spec/models/content_library_item_list_result_spec.rb +39 -0
- data/spec/models/content_library_item_model_spec.rb +117 -0
- data/spec/models/content_library_item_result_spec.rb +39 -0
- data/spec/models/content_library_item_storage_get_spec.rb +39 -0
- data/spec/models/content_library_item_storage_info_spec.rb +75 -0
- data/spec/models/content_library_item_storage_list_result_spec.rb +39 -0
- data/spec/models/content_library_item_storage_result_spec.rb +39 -0
- data/spec/models/content_library_item_transfer_endpoint_spec.rb +45 -0
- data/spec/models/content_library_item_transfer_status_spec.rb +33 -0
- data/spec/models/content_library_item_update_session_create_result_spec.rb +39 -0
- data/spec/models/content_library_item_update_session_create_spec.rb +45 -0
- data/spec/models/content_library_item_update_session_fail_spec.rb +39 -0
- data/spec/models/content_library_item_update_session_keep_alive_spec.rb +39 -0
- data/spec/models/content_library_item_update_session_list_result_spec.rb +39 -0
- data/spec/models/content_library_item_update_session_model_spec.rb +87 -0
- data/spec/models/content_library_item_update_session_model_state_spec.rb +33 -0
- data/spec/models/content_library_item_update_session_result_spec.rb +39 -0
- data/spec/models/content_library_item_update_session_update_spec.rb +39 -0
- data/spec/models/content_library_item_update_spec.rb +39 -0
- data/spec/models/content_library_item_updatesession_certificate_info_spec.rb +57 -0
- data/spec/models/content_library_item_updatesession_file_add_result_spec.rb +39 -0
- data/spec/models/content_library_item_updatesession_file_add_spec.rb +39 -0
- data/spec/models/content_library_item_updatesession_file_add_spec_spec.rb +63 -0
- data/spec/models/content_library_item_updatesession_file_get_spec.rb +39 -0
- data/spec/models/content_library_item_updatesession_file_info_spec.rb +93 -0
- data/spec/models/content_library_item_updatesession_file_list_result_spec.rb +39 -0
- data/spec/models/content_library_item_updatesession_file_remove_spec.rb +39 -0
- data/spec/models/content_library_item_updatesession_file_result_spec.rb +39 -0
- data/spec/models/content_library_item_updatesession_file_source_type_spec.rb +33 -0
- data/spec/models/content_library_item_updatesession_file_validate_result_spec.rb +39 -0
- data/spec/models/content_library_item_updatesession_file_validation_error_spec.rb +45 -0
- data/spec/models/content_library_item_updatesession_file_validation_result_spec.rb +51 -0
- data/spec/models/content_library_item_updatesession_preview_info_spec.rb +51 -0
- data/spec/models/content_library_item_updatesession_preview_info_state_spec.rb +33 -0
- data/spec/models/content_library_item_updatesession_preview_warning_info_spec.rb +51 -0
- data/spec/models/content_library_item_updatesession_warning_behavior_spec.rb +45 -0
- data/spec/models/content_library_item_updatesession_warning_type_spec.rb +33 -0
- data/spec/models/content_library_list_result_spec.rb +39 -0
- data/spec/models/content_library_model_library_type_spec.rb +33 -0
- data/spec/models/content_library_model_spec.rb +111 -0
- data/spec/models/content_library_optimization_info_spec.rb +39 -0
- data/spec/models/content_library_publish_info_authentication_method_spec.rb +33 -0
- data/spec/models/content_library_publish_info_spec.rb +75 -0
- data/spec/models/content_library_result_spec.rb +39 -0
- data/spec/models/content_library_storage_backing_spec.rb +51 -0
- data/spec/models/content_library_storage_backing_type_spec.rb +33 -0
- data/spec/models/content_library_subscribed_item_sync_spec.rb +39 -0
- data/spec/models/content_library_subscription_info_authentication_method_spec.rb +33 -0
- data/spec/models/content_library_subscription_info_spec.rb +75 -0
- data/spec/models/content_library_update_spec.rb +39 -0
- data/spec/models/content_local_library_create_result_spec.rb +39 -0
- data/spec/models/content_local_library_create_spec.rb +45 -0
- data/spec/models/content_local_library_list_result_spec.rb +39 -0
- data/spec/models/content_local_library_result_spec.rb +39 -0
- data/spec/models/content_local_library_update_spec.rb +39 -0
- data/spec/models/content_subscribed_library_create_result_spec.rb +39 -0
- data/spec/models/content_subscribed_library_create_spec.rb +45 -0
- data/spec/models/content_subscribed_library_list_result_spec.rb +39 -0
- data/spec/models/content_subscribed_library_probe_result_spec.rb +51 -0
- data/spec/models/content_subscribed_library_probe_result_status_spec.rb +33 -0
- data/spec/models/content_subscribed_library_probe_spec.rb +39 -0
- data/spec/models/content_subscribed_library_result_spec.rb +39 -0
- data/spec/models/content_subscribed_library_update_spec.rb +39 -0
- data/spec/models/vapi_std_errors_concurrent_change_error_spec.rb +45 -0
- data/spec/models/vapi_std_errors_concurrent_change_spec.rb +45 -0
- data/spec/models/vapi_std_errors_invalid_argument_error_spec.rb +45 -0
- data/spec/models/vapi_std_errors_invalid_argument_spec.rb +45 -0
- data/spec/models/vapi_std_errors_invalid_element_configuration_error_spec.rb +45 -0
- data/spec/models/vapi_std_errors_invalid_element_configuration_spec.rb +45 -0
- data/spec/models/vapi_std_errors_invalid_element_type_error_spec.rb +45 -0
- data/spec/models/vapi_std_errors_invalid_element_type_spec.rb +45 -0
- data/spec/models/vapi_std_errors_not_allowed_in_current_state_error_spec.rb +45 -0
- data/spec/models/vapi_std_errors_not_allowed_in_current_state_spec.rb +45 -0
- data/spec/models/vapi_std_errors_not_found_error_spec.rb +45 -0
- data/spec/models/vapi_std_errors_not_found_spec.rb +45 -0
- data/spec/models/vapi_std_errors_resource_busy_error_spec.rb +45 -0
- data/spec/models/vapi_std_errors_resource_busy_spec.rb +45 -0
- data/spec/models/vapi_std_errors_resource_inaccessible_error_spec.rb +45 -0
- data/spec/models/vapi_std_errors_resource_inaccessible_spec.rb +45 -0
- data/spec/models/vapi_std_errors_unauthorized_error_spec.rb +45 -0
- data/spec/models/vapi_std_errors_unauthorized_spec.rb +45 -0
- data/spec/models/vapi_std_errors_unsupported_error_spec.rb +45 -0
- data/spec/models/vapi_std_errors_unsupported_spec.rb +45 -0
- data/spec/models/vapi_std_localizable_message_spec.rb +51 -0
- data/spec/spec_helper.rb +109 -0
- data/vsphere-automation-content.gemspec +44 -0
- metadata +725 -0
@@ -0,0 +1,444 @@
|
|
1
|
+
=begin
|
2
|
+
# DO NOT MODIFY. THIS CODE IS GENERATED. CHANGES WILL BE OVERWRITTEN.
|
3
|
+
|
4
|
+
# content
|
5
|
+
|
6
|
+
# VMware vSphere® Content Library empowers vSphere Admins to effectively manage VM templates, vApps, ISO images and scripts with ease.
|
7
|
+
|
8
|
+
|
9
|
+
=end
|
10
|
+
|
11
|
+
require 'uri'
|
12
|
+
|
13
|
+
module VSphereAutomation
|
14
|
+
module Content
|
15
|
+
class SubscribedLibraryApi
|
16
|
+
attr_accessor :api_client
|
17
|
+
|
18
|
+
def initialize(api_client = ApiClient.default)
|
19
|
+
@api_client = api_client
|
20
|
+
end
|
21
|
+
# Creates a new subscribed library. <p> Once created, the subscribed library will be empty. If the {@link LibraryModel#subscriptionInfo} property is set, the Content Library Service will attempt to synchronize to the remote source. This is an asynchronous operation so the content of the published library may not immediately appear.
|
22
|
+
# @param content_subscribed_library_create
|
23
|
+
# @param [Hash] opts the optional parameters
|
24
|
+
# @return [ContentSubscribedLibraryCreateResult|VapiStdErrorsResourceInaccessibleError|]
|
25
|
+
def create(content_subscribed_library_create, opts = {})
|
26
|
+
data, _status_code, _headers = create_with_http_info(content_subscribed_library_create, opts)
|
27
|
+
data
|
28
|
+
end
|
29
|
+
|
30
|
+
# Creates a new subscribed library. <p> Once created, the subscribed library will be empty. If the {@link LibraryModel#subscriptionInfo} property is set, the Content Library Service will attempt to synchronize to the remote source. This is an asynchronous operation so the content of the published library may not immediately appear.
|
31
|
+
# @api private
|
32
|
+
# @param content_subscribed_library_create
|
33
|
+
# @param [Hash] opts the optional parameters
|
34
|
+
# @return [Array<(ContentSubscribedLibraryCreateResult|VapiStdErrorsResourceInaccessibleError|, Fixnum, Hash)>] data, response status code and response headers
|
35
|
+
def create_with_http_info(content_subscribed_library_create, opts = {})
|
36
|
+
if @api_client.config.debugging
|
37
|
+
@api_client.config.logger.debug 'Calling API: SubscribedLibraryApi.create ...'
|
38
|
+
end
|
39
|
+
# verify the required parameter 'content_subscribed_library_create' is set
|
40
|
+
if @api_client.config.client_side_validation && content_subscribed_library_create.nil?
|
41
|
+
fail ArgumentError, "Missing the required parameter 'content_subscribed_library_create' when calling SubscribedLibraryApi.create"
|
42
|
+
end
|
43
|
+
# resource path
|
44
|
+
local_var_path = '/com/vmware/content/subscribed-library'
|
45
|
+
|
46
|
+
# query parameters
|
47
|
+
query_params = {}
|
48
|
+
|
49
|
+
# header parameters
|
50
|
+
header_params = {}
|
51
|
+
# HTTP header 'Accept' (if needed)
|
52
|
+
header_params['Accept'] = @api_client.select_header_accept(['*/*'])
|
53
|
+
# HTTP header 'Content-Type'
|
54
|
+
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
|
55
|
+
|
56
|
+
# form parameters
|
57
|
+
form_params = {}
|
58
|
+
|
59
|
+
# http body (model)
|
60
|
+
post_body = @api_client.object_to_http_body(content_subscribed_library_create)
|
61
|
+
auth_names = []
|
62
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path,
|
63
|
+
:header_params => header_params,
|
64
|
+
:query_params => query_params,
|
65
|
+
:form_params => form_params,
|
66
|
+
:body => post_body,
|
67
|
+
:auth_names => auth_names,
|
68
|
+
:return_type => {
|
69
|
+
'200' => 'Content::ContentSubscribedLibraryCreateResult',
|
70
|
+
'400' => 'Content::VapiStdErrorsResourceInaccessibleError',
|
71
|
+
})
|
72
|
+
if @api_client.config.debugging
|
73
|
+
@api_client.config.logger.debug "API called: SubscribedLibraryApi#create\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
74
|
+
end
|
75
|
+
return data, status_code, headers
|
76
|
+
end
|
77
|
+
# Deletes the specified subscribed library. <p> Deleting a subscribed library will remove the entry immediately and begin an asynchronous task to remove all cached content for the library. If the asynchronous task fails, file content may remain on the storage backing. This content will require manual removal.
|
78
|
+
# @param library_id Identifier of the subscribed library to delete.
|
79
|
+
# @param [Hash] opts the optional parameters
|
80
|
+
# @return [|VapiStdErrorsInvalidElementTypeError|VapiStdErrorsNotFoundError|nil]
|
81
|
+
def delete(library_id, opts = {})
|
82
|
+
delete_with_http_info(library_id, opts)
|
83
|
+
nil
|
84
|
+
end
|
85
|
+
|
86
|
+
# Deletes the specified subscribed library. <p> Deleting a subscribed library will remove the entry immediately and begin an asynchronous task to remove all cached content for the library. If the asynchronous task fails, file content may remain on the storage backing. This content will require manual removal.
|
87
|
+
# @api private
|
88
|
+
# @param library_id Identifier of the subscribed library to delete.
|
89
|
+
# @param [Hash] opts the optional parameters
|
90
|
+
# @return [Array<(|VapiStdErrorsInvalidElementTypeError|VapiStdErrorsNotFoundError|nil, Fixnum, Hash)>] nil, response status code and response headers
|
91
|
+
def delete_with_http_info(library_id, opts = {})
|
92
|
+
if @api_client.config.debugging
|
93
|
+
@api_client.config.logger.debug 'Calling API: SubscribedLibraryApi.delete ...'
|
94
|
+
end
|
95
|
+
# verify the required parameter 'library_id' is set
|
96
|
+
if @api_client.config.client_side_validation && library_id.nil?
|
97
|
+
fail ArgumentError, "Missing the required parameter 'library_id' when calling SubscribedLibraryApi.delete"
|
98
|
+
end
|
99
|
+
# resource path
|
100
|
+
local_var_path = '/com/vmware/content/subscribed-library/id:{library_id}'.sub('{' + 'library_id' + '}', library_id.to_s)
|
101
|
+
|
102
|
+
# query parameters
|
103
|
+
query_params = {}
|
104
|
+
|
105
|
+
# header parameters
|
106
|
+
header_params = {}
|
107
|
+
# HTTP header 'Accept' (if needed)
|
108
|
+
header_params['Accept'] = @api_client.select_header_accept(['*/*'])
|
109
|
+
|
110
|
+
# form parameters
|
111
|
+
form_params = {}
|
112
|
+
|
113
|
+
# http body (model)
|
114
|
+
post_body = nil
|
115
|
+
auth_names = []
|
116
|
+
data, status_code, headers = @api_client.call_api(:DELETE, local_var_path,
|
117
|
+
:header_params => header_params,
|
118
|
+
:query_params => query_params,
|
119
|
+
:form_params => form_params,
|
120
|
+
:body => post_body,
|
121
|
+
:auth_names => auth_names)
|
122
|
+
if @api_client.config.debugging
|
123
|
+
@api_client.config.logger.debug "API called: SubscribedLibraryApi#delete\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
124
|
+
end
|
125
|
+
return data, status_code, headers
|
126
|
+
end
|
127
|
+
# Evicts the cached content of an on-demand subscribed library. <p> This {@term operation} allows the cached content of a subscribed library to be removed to free up storage capacity. This {@term operation} will only work when a subscribed library is synchronized on-demand.
|
128
|
+
# @param library_id Identifier of the subscribed library whose content should be evicted.
|
129
|
+
# @param [Hash] opts the optional parameters
|
130
|
+
# @return [|VapiStdErrorsNotAllowedInCurrentStateError|VapiStdErrorsNotFoundError|nil]
|
131
|
+
def evict(library_id, opts = {})
|
132
|
+
evict_with_http_info(library_id, opts)
|
133
|
+
nil
|
134
|
+
end
|
135
|
+
|
136
|
+
# Evicts the cached content of an on-demand subscribed library. <p> This {@term operation} allows the cached content of a subscribed library to be removed to free up storage capacity. This {@term operation} will only work when a subscribed library is synchronized on-demand.
|
137
|
+
# @api private
|
138
|
+
# @param library_id Identifier of the subscribed library whose content should be evicted.
|
139
|
+
# @param [Hash] opts the optional parameters
|
140
|
+
# @return [Array<(|VapiStdErrorsNotAllowedInCurrentStateError|VapiStdErrorsNotFoundError|nil, Fixnum, Hash)>] nil, response status code and response headers
|
141
|
+
def evict_with_http_info(library_id, opts = {})
|
142
|
+
if @api_client.config.debugging
|
143
|
+
@api_client.config.logger.debug 'Calling API: SubscribedLibraryApi.evict ...'
|
144
|
+
end
|
145
|
+
# verify the required parameter 'library_id' is set
|
146
|
+
if @api_client.config.client_side_validation && library_id.nil?
|
147
|
+
fail ArgumentError, "Missing the required parameter 'library_id' when calling SubscribedLibraryApi.evict"
|
148
|
+
end
|
149
|
+
# resource path
|
150
|
+
local_var_path = '/com/vmware/content/subscribed-library/id:{library_id}?~action=evict'.sub('{' + 'library_id' + '}', library_id.to_s)
|
151
|
+
|
152
|
+
# query parameters
|
153
|
+
query_params = {}
|
154
|
+
|
155
|
+
# header parameters
|
156
|
+
header_params = {}
|
157
|
+
# HTTP header 'Accept' (if needed)
|
158
|
+
header_params['Accept'] = @api_client.select_header_accept(['*/*'])
|
159
|
+
|
160
|
+
# form parameters
|
161
|
+
form_params = {}
|
162
|
+
|
163
|
+
# http body (model)
|
164
|
+
post_body = nil
|
165
|
+
auth_names = []
|
166
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path,
|
167
|
+
:header_params => header_params,
|
168
|
+
:query_params => query_params,
|
169
|
+
:form_params => form_params,
|
170
|
+
:body => post_body,
|
171
|
+
:auth_names => auth_names)
|
172
|
+
if @api_client.config.debugging
|
173
|
+
@api_client.config.logger.debug "API called: SubscribedLibraryApi#evict\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
174
|
+
end
|
175
|
+
return data, status_code, headers
|
176
|
+
end
|
177
|
+
# Returns a given subscribed library.
|
178
|
+
# @param library_id Identifier of the subscribed library to return.
|
179
|
+
# @param [Hash] opts the optional parameters
|
180
|
+
# @return [ContentSubscribedLibraryResult|VapiStdErrorsInvalidElementTypeError|VapiStdErrorsNotFoundError|]
|
181
|
+
def get(library_id, opts = {})
|
182
|
+
data, _status_code, _headers = get_with_http_info(library_id, opts)
|
183
|
+
data
|
184
|
+
end
|
185
|
+
|
186
|
+
# Returns a given subscribed library.
|
187
|
+
# @api private
|
188
|
+
# @param library_id Identifier of the subscribed library to return.
|
189
|
+
# @param [Hash] opts the optional parameters
|
190
|
+
# @return [Array<(ContentSubscribedLibraryResult|VapiStdErrorsInvalidElementTypeError|VapiStdErrorsNotFoundError|, Fixnum, Hash)>] data, response status code and response headers
|
191
|
+
def get_with_http_info(library_id, opts = {})
|
192
|
+
if @api_client.config.debugging
|
193
|
+
@api_client.config.logger.debug 'Calling API: SubscribedLibraryApi.get ...'
|
194
|
+
end
|
195
|
+
# verify the required parameter 'library_id' is set
|
196
|
+
if @api_client.config.client_side_validation && library_id.nil?
|
197
|
+
fail ArgumentError, "Missing the required parameter 'library_id' when calling SubscribedLibraryApi.get"
|
198
|
+
end
|
199
|
+
# resource path
|
200
|
+
local_var_path = '/com/vmware/content/subscribed-library/id:{library_id}'.sub('{' + 'library_id' + '}', library_id.to_s)
|
201
|
+
|
202
|
+
# query parameters
|
203
|
+
query_params = {}
|
204
|
+
|
205
|
+
# header parameters
|
206
|
+
header_params = {}
|
207
|
+
# HTTP header 'Accept' (if needed)
|
208
|
+
header_params['Accept'] = @api_client.select_header_accept(['*/*'])
|
209
|
+
|
210
|
+
# form parameters
|
211
|
+
form_params = {}
|
212
|
+
|
213
|
+
# http body (model)
|
214
|
+
post_body = nil
|
215
|
+
auth_names = []
|
216
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path,
|
217
|
+
:header_params => header_params,
|
218
|
+
:query_params => query_params,
|
219
|
+
:form_params => form_params,
|
220
|
+
:body => post_body,
|
221
|
+
:auth_names => auth_names,
|
222
|
+
:return_type => {
|
223
|
+
'200' => 'Content::ContentSubscribedLibraryResult',
|
224
|
+
'400' => 'Content::VapiStdErrorsInvalidElementTypeError',
|
225
|
+
'404' => 'Content::VapiStdErrorsNotFoundError',
|
226
|
+
})
|
227
|
+
if @api_client.config.debugging
|
228
|
+
@api_client.config.logger.debug "API called: SubscribedLibraryApi#get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
229
|
+
end
|
230
|
+
return data, status_code, headers
|
231
|
+
end
|
232
|
+
# Returns the identifiers of all subscribed libraries in the Content Library.
|
233
|
+
# @param [Hash] opts the optional parameters
|
234
|
+
# @return [ContentSubscribedLibraryListResult|]
|
235
|
+
def list(opts = {})
|
236
|
+
data, _status_code, _headers = list_with_http_info(opts)
|
237
|
+
data
|
238
|
+
end
|
239
|
+
|
240
|
+
# Returns the identifiers of all subscribed libraries in the Content Library.
|
241
|
+
# @api private
|
242
|
+
# @param [Hash] opts the optional parameters
|
243
|
+
# @return [Array<(ContentSubscribedLibraryListResult|, Fixnum, Hash)>] data, response status code and response headers
|
244
|
+
def list_with_http_info(opts = {})
|
245
|
+
if @api_client.config.debugging
|
246
|
+
@api_client.config.logger.debug 'Calling API: SubscribedLibraryApi.list ...'
|
247
|
+
end
|
248
|
+
# resource path
|
249
|
+
local_var_path = '/com/vmware/content/subscribed-library'
|
250
|
+
|
251
|
+
# query parameters
|
252
|
+
query_params = {}
|
253
|
+
|
254
|
+
# header parameters
|
255
|
+
header_params = {}
|
256
|
+
# HTTP header 'Accept' (if needed)
|
257
|
+
header_params['Accept'] = @api_client.select_header_accept(['*/*'])
|
258
|
+
|
259
|
+
# form parameters
|
260
|
+
form_params = {}
|
261
|
+
|
262
|
+
# http body (model)
|
263
|
+
post_body = nil
|
264
|
+
auth_names = []
|
265
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path,
|
266
|
+
:header_params => header_params,
|
267
|
+
:query_params => query_params,
|
268
|
+
:form_params => form_params,
|
269
|
+
:body => post_body,
|
270
|
+
:auth_names => auth_names,
|
271
|
+
:return_type => {
|
272
|
+
'200' => 'Content::ContentSubscribedLibraryListResult',
|
273
|
+
})
|
274
|
+
if @api_client.config.debugging
|
275
|
+
@api_client.config.logger.debug "API called: SubscribedLibraryApi#list\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
276
|
+
end
|
277
|
+
return data, status_code, headers
|
278
|
+
end
|
279
|
+
# Probes remote library subscription information, including URL, SSL certificate and password. The resulting {@link ProbeResult} {@term structure} describes whether or not the subscription configuration is successful.
|
280
|
+
# @param content_subscribed_library_probe
|
281
|
+
# @param [Hash] opts the optional parameters
|
282
|
+
# @return [ContentSubscribedLibraryProbeResult|]
|
283
|
+
def probe(content_subscribed_library_probe, opts = {})
|
284
|
+
data, _status_code, _headers = probe_with_http_info(content_subscribed_library_probe, opts)
|
285
|
+
data
|
286
|
+
end
|
287
|
+
|
288
|
+
# Probes remote library subscription information, including URL, SSL certificate and password. The resulting {@link ProbeResult} {@term structure} describes whether or not the subscription configuration is successful.
|
289
|
+
# @api private
|
290
|
+
# @param content_subscribed_library_probe
|
291
|
+
# @param [Hash] opts the optional parameters
|
292
|
+
# @return [Array<(ContentSubscribedLibraryProbeResult|, Fixnum, Hash)>] data, response status code and response headers
|
293
|
+
def probe_with_http_info(content_subscribed_library_probe, opts = {})
|
294
|
+
if @api_client.config.debugging
|
295
|
+
@api_client.config.logger.debug 'Calling API: SubscribedLibraryApi.probe ...'
|
296
|
+
end
|
297
|
+
# verify the required parameter 'content_subscribed_library_probe' is set
|
298
|
+
if @api_client.config.client_side_validation && content_subscribed_library_probe.nil?
|
299
|
+
fail ArgumentError, "Missing the required parameter 'content_subscribed_library_probe' when calling SubscribedLibraryApi.probe"
|
300
|
+
end
|
301
|
+
# resource path
|
302
|
+
local_var_path = '/com/vmware/content/subscribed-library?~action=probe'
|
303
|
+
|
304
|
+
# query parameters
|
305
|
+
query_params = {}
|
306
|
+
|
307
|
+
# header parameters
|
308
|
+
header_params = {}
|
309
|
+
# HTTP header 'Accept' (if needed)
|
310
|
+
header_params['Accept'] = @api_client.select_header_accept(['*/*'])
|
311
|
+
# HTTP header 'Content-Type'
|
312
|
+
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
|
313
|
+
|
314
|
+
# form parameters
|
315
|
+
form_params = {}
|
316
|
+
|
317
|
+
# http body (model)
|
318
|
+
post_body = @api_client.object_to_http_body(content_subscribed_library_probe)
|
319
|
+
auth_names = []
|
320
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path,
|
321
|
+
:header_params => header_params,
|
322
|
+
:query_params => query_params,
|
323
|
+
:form_params => form_params,
|
324
|
+
:body => post_body,
|
325
|
+
:auth_names => auth_names,
|
326
|
+
:return_type => {
|
327
|
+
'200' => 'Content::ContentSubscribedLibraryProbeResult',
|
328
|
+
})
|
329
|
+
if @api_client.config.debugging
|
330
|
+
@api_client.config.logger.debug "API called: SubscribedLibraryApi#probe\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
331
|
+
end
|
332
|
+
return data, status_code, headers
|
333
|
+
end
|
334
|
+
# Forces the synchronization of the subscribed library. <p> Synchronizing a subscribed library forcefully with this {@term operation} will perform the same synchronization behavior as would run periodically for the library. The {@link SubscriptionInfo#onDemand} setting is respected. Calling this {@term operation} on a library that is already in the process of synchronizing will have no effect.
|
335
|
+
# @param library_id Identifier of the subscribed library to synchronize.
|
336
|
+
# @param [Hash] opts the optional parameters
|
337
|
+
# @return [|VapiStdErrorsResourceInaccessibleError|VapiStdErrorsNotFoundError|nil]
|
338
|
+
def sync(library_id, opts = {})
|
339
|
+
sync_with_http_info(library_id, opts)
|
340
|
+
nil
|
341
|
+
end
|
342
|
+
|
343
|
+
# Forces the synchronization of the subscribed library. <p> Synchronizing a subscribed library forcefully with this {@term operation} will perform the same synchronization behavior as would run periodically for the library. The {@link SubscriptionInfo#onDemand} setting is respected. Calling this {@term operation} on a library that is already in the process of synchronizing will have no effect.
|
344
|
+
# @api private
|
345
|
+
# @param library_id Identifier of the subscribed library to synchronize.
|
346
|
+
# @param [Hash] opts the optional parameters
|
347
|
+
# @return [Array<(|VapiStdErrorsResourceInaccessibleError|VapiStdErrorsNotFoundError|nil, Fixnum, Hash)>] nil, response status code and response headers
|
348
|
+
def sync_with_http_info(library_id, opts = {})
|
349
|
+
if @api_client.config.debugging
|
350
|
+
@api_client.config.logger.debug 'Calling API: SubscribedLibraryApi.sync ...'
|
351
|
+
end
|
352
|
+
# verify the required parameter 'library_id' is set
|
353
|
+
if @api_client.config.client_side_validation && library_id.nil?
|
354
|
+
fail ArgumentError, "Missing the required parameter 'library_id' when calling SubscribedLibraryApi.sync"
|
355
|
+
end
|
356
|
+
# resource path
|
357
|
+
local_var_path = '/com/vmware/content/subscribed-library/id:{library_id}?~action=sync'.sub('{' + 'library_id' + '}', library_id.to_s)
|
358
|
+
|
359
|
+
# query parameters
|
360
|
+
query_params = {}
|
361
|
+
|
362
|
+
# header parameters
|
363
|
+
header_params = {}
|
364
|
+
# HTTP header 'Accept' (if needed)
|
365
|
+
header_params['Accept'] = @api_client.select_header_accept(['*/*'])
|
366
|
+
|
367
|
+
# form parameters
|
368
|
+
form_params = {}
|
369
|
+
|
370
|
+
# http body (model)
|
371
|
+
post_body = nil
|
372
|
+
auth_names = []
|
373
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path,
|
374
|
+
:header_params => header_params,
|
375
|
+
:query_params => query_params,
|
376
|
+
:form_params => form_params,
|
377
|
+
:body => post_body,
|
378
|
+
:auth_names => auth_names)
|
379
|
+
if @api_client.config.debugging
|
380
|
+
@api_client.config.logger.debug "API called: SubscribedLibraryApi#sync\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
381
|
+
end
|
382
|
+
return data, status_code, headers
|
383
|
+
end
|
384
|
+
# Updates the properties of a subscribed library. <p> This is an incremental update to the subscribed library. {@term Fields} that are {@term unset} in the update specification will be left unchanged.
|
385
|
+
# @param library_id Identifier of the subscribed library to update.
|
386
|
+
# @param content_subscribed_library_update
|
387
|
+
# @param [Hash] opts the optional parameters
|
388
|
+
# @return [|VapiStdErrorsConcurrentChangeError|VapiStdErrorsNotFoundError|nil]
|
389
|
+
def update(library_id, content_subscribed_library_update, opts = {})
|
390
|
+
update_with_http_info(library_id, content_subscribed_library_update, opts)
|
391
|
+
nil
|
392
|
+
end
|
393
|
+
|
394
|
+
# Updates the properties of a subscribed library. <p> This is an incremental update to the subscribed library. {@term Fields} that are {@term unset} in the update specification will be left unchanged.
|
395
|
+
# @api private
|
396
|
+
# @param library_id Identifier of the subscribed library to update.
|
397
|
+
# @param content_subscribed_library_update
|
398
|
+
# @param [Hash] opts the optional parameters
|
399
|
+
# @return [Array<(|VapiStdErrorsConcurrentChangeError|VapiStdErrorsNotFoundError|nil, Fixnum, Hash)>] nil, response status code and response headers
|
400
|
+
def update_with_http_info(library_id, content_subscribed_library_update, opts = {})
|
401
|
+
if @api_client.config.debugging
|
402
|
+
@api_client.config.logger.debug 'Calling API: SubscribedLibraryApi.update ...'
|
403
|
+
end
|
404
|
+
# verify the required parameter 'library_id' is set
|
405
|
+
if @api_client.config.client_side_validation && library_id.nil?
|
406
|
+
fail ArgumentError, "Missing the required parameter 'library_id' when calling SubscribedLibraryApi.update"
|
407
|
+
end
|
408
|
+
# verify the required parameter 'content_subscribed_library_update' is set
|
409
|
+
if @api_client.config.client_side_validation && content_subscribed_library_update.nil?
|
410
|
+
fail ArgumentError, "Missing the required parameter 'content_subscribed_library_update' when calling SubscribedLibraryApi.update"
|
411
|
+
end
|
412
|
+
# resource path
|
413
|
+
local_var_path = '/com/vmware/content/subscribed-library/id:{library_id}'.sub('{' + 'library_id' + '}', library_id.to_s)
|
414
|
+
|
415
|
+
# query parameters
|
416
|
+
query_params = {}
|
417
|
+
|
418
|
+
# header parameters
|
419
|
+
header_params = {}
|
420
|
+
# HTTP header 'Accept' (if needed)
|
421
|
+
header_params['Accept'] = @api_client.select_header_accept(['*/*'])
|
422
|
+
# HTTP header 'Content-Type'
|
423
|
+
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
|
424
|
+
|
425
|
+
# form parameters
|
426
|
+
form_params = {}
|
427
|
+
|
428
|
+
# http body (model)
|
429
|
+
post_body = @api_client.object_to_http_body(content_subscribed_library_update)
|
430
|
+
auth_names = []
|
431
|
+
data, status_code, headers = @api_client.call_api(:PATCH, local_var_path,
|
432
|
+
:header_params => header_params,
|
433
|
+
:query_params => query_params,
|
434
|
+
:form_params => form_params,
|
435
|
+
:body => post_body,
|
436
|
+
:auth_names => auth_names)
|
437
|
+
if @api_client.config.debugging
|
438
|
+
@api_client.config.logger.debug "API called: SubscribedLibraryApi#update\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
439
|
+
end
|
440
|
+
return data, status_code, headers
|
441
|
+
end
|
442
|
+
end
|
443
|
+
end
|
444
|
+
end
|
@@ -0,0 +1,386 @@
|
|
1
|
+
=begin
|
2
|
+
# DO NOT MODIFY. THIS CODE IS GENERATED. CHANGES WILL BE OVERWRITTEN.
|
3
|
+
|
4
|
+
# content
|
5
|
+
|
6
|
+
# VMware vSphere® Content Library empowers vSphere Admins to effectively manage VM templates, vApps, ISO images and scripts with ease.
|
7
|
+
|
8
|
+
|
9
|
+
=end
|
10
|
+
|
11
|
+
require 'date'
|
12
|
+
require 'json'
|
13
|
+
require 'logger'
|
14
|
+
require 'tempfile'
|
15
|
+
require 'typhoeus'
|
16
|
+
require 'uri'
|
17
|
+
|
18
|
+
module VSphereAutomation
|
19
|
+
class ApiClient
|
20
|
+
# The Configuration object holding settings to be used in the API client.
|
21
|
+
attr_accessor :config
|
22
|
+
|
23
|
+
# Defines the headers to be used in HTTP requests of all API calls by default.
|
24
|
+
#
|
25
|
+
# @return [Hash]
|
26
|
+
attr_accessor :default_headers
|
27
|
+
|
28
|
+
# Initializes the ApiClient
|
29
|
+
# @option config [Configuration] Configuration for initializing the object, default to Configuration.default
|
30
|
+
def initialize(config = Configuration.default)
|
31
|
+
@config = config
|
32
|
+
@user_agent = "OpenAPI-Generator/#{Content::VERSION}/ruby"
|
33
|
+
@default_headers = {
|
34
|
+
'Content-Type' => 'application/json',
|
35
|
+
'User-Agent' => @user_agent
|
36
|
+
}
|
37
|
+
end
|
38
|
+
|
39
|
+
def self.default
|
40
|
+
@@default ||= ApiClient.new
|
41
|
+
end
|
42
|
+
|
43
|
+
# Call an API with given options.
|
44
|
+
#
|
45
|
+
# @return [Array<(Object, Fixnum, Hash)>] an array of 3 elements:
|
46
|
+
# the data deserialized from response body (could be nil), response status code and response headers.
|
47
|
+
def call_api(http_method, path, opts = {})
|
48
|
+
request = build_request(http_method, path, opts)
|
49
|
+
response = request.run
|
50
|
+
|
51
|
+
if @config.debugging
|
52
|
+
@config.logger.debug "HTTP response body ~BEGIN~\n#{response.body}\n~END~\n"
|
53
|
+
end
|
54
|
+
|
55
|
+
unless opts.fetch(:return_type, {}).keys.include?(response.code.to_s) || response.success?
|
56
|
+
if response.timed_out?
|
57
|
+
fail ApiError.new('Connection timed out')
|
58
|
+
elsif response.code == 0
|
59
|
+
# Errors from libcurl will be made visible here
|
60
|
+
fail ApiError.new(:code => 0,
|
61
|
+
:message => response.return_message)
|
62
|
+
else
|
63
|
+
fail ApiError.new(:code => response.code,
|
64
|
+
:response_headers => response.headers,
|
65
|
+
:response_body => response.body),
|
66
|
+
response.status_message
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
if opts[:return_type]
|
71
|
+
data = deserialize(response, opts[:return_type][response.code.to_s])
|
72
|
+
else
|
73
|
+
data = nil
|
74
|
+
end
|
75
|
+
return data, response.code, response.headers
|
76
|
+
end
|
77
|
+
|
78
|
+
# Builds the HTTP request
|
79
|
+
#
|
80
|
+
# @param [String] http_method HTTP method/verb (e.g. POST)
|
81
|
+
# @param [String] path URL path (e.g. /account/new)
|
82
|
+
# @option opts [Hash] :header_params Header parameters
|
83
|
+
# @option opts [Hash] :query_params Query parameters
|
84
|
+
# @option opts [Hash] :form_params Query parameters
|
85
|
+
# @option opts [Object] :body HTTP body (JSON/XML)
|
86
|
+
# @return [Typhoeus::Request] A Typhoeus Request
|
87
|
+
def build_request(http_method, path, opts = {})
|
88
|
+
url = build_request_url(path)
|
89
|
+
http_method = http_method.to_sym.downcase
|
90
|
+
|
91
|
+
header_params = @default_headers.merge(opts[:header_params] || {})
|
92
|
+
query_params = opts[:query_params] || {}
|
93
|
+
form_params = opts[:form_params] || {}
|
94
|
+
|
95
|
+
|
96
|
+
# set ssl_verifyhosts option based on @config.verify_ssl_host (true/false)
|
97
|
+
_verify_ssl_host = @config.verify_ssl_host ? 2 : 0
|
98
|
+
|
99
|
+
req_opts = {
|
100
|
+
:method => http_method,
|
101
|
+
:headers => header_params,
|
102
|
+
:params => query_params,
|
103
|
+
:params_encoding => @config.params_encoding,
|
104
|
+
:timeout => @config.timeout,
|
105
|
+
:ssl_verifypeer => @config.verify_ssl,
|
106
|
+
:ssl_verifyhost => _verify_ssl_host,
|
107
|
+
:sslcert => @config.cert_file,
|
108
|
+
:sslkey => @config.key_file,
|
109
|
+
:verbose => @config.debugging
|
110
|
+
}
|
111
|
+
|
112
|
+
# set custom cert, if provided
|
113
|
+
req_opts[:cainfo] = @config.ssl_ca_cert if @config.ssl_ca_cert
|
114
|
+
|
115
|
+
if [:post, :patch, :put, :delete].include?(http_method)
|
116
|
+
req_body = build_request_body(header_params, form_params, opts[:body])
|
117
|
+
req_opts.update :body => req_body
|
118
|
+
if @config.debugging
|
119
|
+
@config.logger.debug "HTTP request body param ~BEGIN~\n#{req_body}\n~END~\n"
|
120
|
+
end
|
121
|
+
end
|
122
|
+
|
123
|
+
request = Typhoeus::Request.new(url, req_opts)
|
124
|
+
download_file(request) if opts[:return_type] == 'File'
|
125
|
+
request
|
126
|
+
end
|
127
|
+
|
128
|
+
# Check if the given MIME is a JSON MIME.
|
129
|
+
# JSON MIME examples:
|
130
|
+
# application/json
|
131
|
+
# application/json; charset=UTF8
|
132
|
+
# APPLICATION/JSON
|
133
|
+
# */*
|
134
|
+
# @param [String] mime MIME
|
135
|
+
# @return [Boolean] True if the MIME is application/json
|
136
|
+
def json_mime?(mime)
|
137
|
+
(mime == '*/*') || !(mime =~ /Application\/.*json(?!p)(;.*)?/i).nil?
|
138
|
+
end
|
139
|
+
|
140
|
+
# Deserialize the response to the given return type.
|
141
|
+
#
|
142
|
+
# @param [Response] response HTTP response
|
143
|
+
# @param [String] return_type some examples: "User", "Array[User]", "Hash[String,Integer]"
|
144
|
+
def deserialize(response, return_type)
|
145
|
+
body = response.body
|
146
|
+
|
147
|
+
# handle file downloading - return the File instance processed in request callbacks
|
148
|
+
# note that response body is empty when the file is written in chunks in request on_body callback
|
149
|
+
return @tempfile if return_type == 'File'
|
150
|
+
|
151
|
+
return nil if body.nil? || body.empty?
|
152
|
+
|
153
|
+
# return response body directly for String return type
|
154
|
+
return body if return_type == 'String'
|
155
|
+
|
156
|
+
# ensuring a default content type
|
157
|
+
content_type = response.headers['Content-Type'] || 'application/json'
|
158
|
+
|
159
|
+
fail "Content-Type is not supported: #{content_type}" unless json_mime?(content_type)
|
160
|
+
|
161
|
+
begin
|
162
|
+
data = JSON.parse("[#{body}]", :symbolize_names => true)[0]
|
163
|
+
rescue JSON::ParserError => e
|
164
|
+
if %w(String Date DateTime).include?(return_type)
|
165
|
+
data = body
|
166
|
+
else
|
167
|
+
raise e
|
168
|
+
end
|
169
|
+
end
|
170
|
+
|
171
|
+
convert_to_type data, return_type
|
172
|
+
end
|
173
|
+
|
174
|
+
# Convert data to the given return type.
|
175
|
+
# @param [Object] data Data to be converted
|
176
|
+
# @param [String] return_type Return type
|
177
|
+
# @return [Mixed] Data in a particular type
|
178
|
+
def convert_to_type(data, return_type)
|
179
|
+
return nil if data.nil?
|
180
|
+
case return_type
|
181
|
+
when 'String'
|
182
|
+
data.to_s
|
183
|
+
when 'Integer'
|
184
|
+
data.to_i
|
185
|
+
when 'Float'
|
186
|
+
data.to_f
|
187
|
+
when 'BOOLEAN'
|
188
|
+
data == true
|
189
|
+
when 'DateTime'
|
190
|
+
# parse date time (expecting ISO 8601 format)
|
191
|
+
DateTime.parse data
|
192
|
+
when 'Date'
|
193
|
+
# parse date time (expecting ISO 8601 format)
|
194
|
+
Date.parse data
|
195
|
+
when 'Object'
|
196
|
+
# generic object (usually a Hash), return directly
|
197
|
+
data
|
198
|
+
when /\AArray<(.+)>\z/
|
199
|
+
# e.g. Array<Pet>
|
200
|
+
sub_type = $1
|
201
|
+
data.map { |item| convert_to_type(item, sub_type) }
|
202
|
+
when /\AHash\<String, (.+)\>\z/
|
203
|
+
# e.g. Hash<String, Integer>
|
204
|
+
sub_type = $1
|
205
|
+
{}.tap do |hash|
|
206
|
+
data.each { |k, v| hash[k] = convert_to_type(v, sub_type) }
|
207
|
+
end
|
208
|
+
else
|
209
|
+
# models, e.g. Pet
|
210
|
+
VSphereAutomation.const_get(return_type).new.tap do |model|
|
211
|
+
model.build_from_hash data
|
212
|
+
end
|
213
|
+
end
|
214
|
+
end
|
215
|
+
|
216
|
+
# Save response body into a file in (the defined) temporary folder, using the filename
|
217
|
+
# from the "Content-Disposition" header if provided, otherwise a random filename.
|
218
|
+
# The response body is written to the file in chunks in order to handle files which
|
219
|
+
# size is larger than maximum Ruby String or even larger than the maximum memory a Ruby
|
220
|
+
# process can use.
|
221
|
+
#
|
222
|
+
# @see Configuration#temp_folder_path
|
223
|
+
def download_file(request)
|
224
|
+
tempfile = nil
|
225
|
+
encoding = nil
|
226
|
+
request.on_headers do |response|
|
227
|
+
content_disposition = response.headers['Content-Disposition']
|
228
|
+
if content_disposition && content_disposition =~ /filename=/i
|
229
|
+
filename = content_disposition[/filename=['"]?([^'"\s]+)['"]?/, 1]
|
230
|
+
prefix = sanitize_filename(filename)
|
231
|
+
else
|
232
|
+
prefix = 'download-'
|
233
|
+
end
|
234
|
+
prefix = prefix + '-' unless prefix.end_with?('-')
|
235
|
+
encoding = response.body.encoding
|
236
|
+
tempfile = Tempfile.open(prefix, @config.temp_folder_path, encoding: encoding)
|
237
|
+
@tempfile = tempfile
|
238
|
+
end
|
239
|
+
request.on_body do |chunk|
|
240
|
+
chunk.force_encoding(encoding)
|
241
|
+
tempfile.write(chunk)
|
242
|
+
end
|
243
|
+
request.on_complete do |response|
|
244
|
+
tempfile.close
|
245
|
+
@config.logger.info "Temp file written to #{tempfile.path}, please copy the file to a proper folder "\
|
246
|
+
"with e.g. `FileUtils.cp(tempfile.path, '/new/file/path')` otherwise the temp file "\
|
247
|
+
"will be deleted automatically with GC. It's also recommended to delete the temp file "\
|
248
|
+
"explicitly with `tempfile.delete`"
|
249
|
+
end
|
250
|
+
end
|
251
|
+
|
252
|
+
# Sanitize filename by removing path.
|
253
|
+
# e.g. ../../sun.gif becomes sun.gif
|
254
|
+
#
|
255
|
+
# @param [String] filename the filename to be sanitized
|
256
|
+
# @return [String] the sanitized filename
|
257
|
+
def sanitize_filename(filename)
|
258
|
+
filename.gsub(/.*[\/\\]/, '')
|
259
|
+
end
|
260
|
+
|
261
|
+
def build_request_url(path)
|
262
|
+
# Add leading and trailing slashes to path
|
263
|
+
path = "/#{path}".gsub(/\/+/, '/')
|
264
|
+
URI.encode(@config.base_url + path)
|
265
|
+
end
|
266
|
+
|
267
|
+
# Builds the HTTP request body
|
268
|
+
#
|
269
|
+
# @param [Hash] header_params Header parameters
|
270
|
+
# @param [Hash] form_params Query parameters
|
271
|
+
# @param [Object] body HTTP body (JSON/XML)
|
272
|
+
# @return [String] HTTP body data in the form of string
|
273
|
+
def build_request_body(header_params, form_params, body)
|
274
|
+
# http form
|
275
|
+
if header_params['Content-Type'] == 'application/x-www-form-urlencoded' ||
|
276
|
+
header_params['Content-Type'] == 'multipart/form-data'
|
277
|
+
data = {}
|
278
|
+
form_params.each do |key, value|
|
279
|
+
case value
|
280
|
+
when ::File, ::Array, nil
|
281
|
+
# let typhoeus handle File, Array and nil parameters
|
282
|
+
data[key] = value
|
283
|
+
else
|
284
|
+
data[key] = value.to_s
|
285
|
+
end
|
286
|
+
end
|
287
|
+
elsif body
|
288
|
+
data = body.is_a?(String) ? body : body.to_json
|
289
|
+
else
|
290
|
+
data = nil
|
291
|
+
end
|
292
|
+
data
|
293
|
+
end
|
294
|
+
|
295
|
+
# Update hearder and query params based on authentication settings.
|
296
|
+
#
|
297
|
+
# @param [Hash] header_params Header parameters
|
298
|
+
# @param [Hash] query_params Query parameters
|
299
|
+
# @param [String] auth_names Authentication scheme name
|
300
|
+
def update_params_for_auth!(header_params, query_params, auth_names)
|
301
|
+
Array(auth_names).each do |auth_name|
|
302
|
+
auth_setting = @config.auth_settings[auth_name]
|
303
|
+
next unless auth_setting
|
304
|
+
case auth_setting[:in]
|
305
|
+
when 'header' then header_params[auth_setting[:key]] = auth_setting[:value]
|
306
|
+
when 'query' then query_params[auth_setting[:key]] = auth_setting[:value]
|
307
|
+
else fail ArgumentError, 'Authentication token must be in `query` of `header`'
|
308
|
+
end
|
309
|
+
end
|
310
|
+
end
|
311
|
+
|
312
|
+
# Sets user agent in HTTP header
|
313
|
+
#
|
314
|
+
# @param [String] user_agent User agent (e.g. openapi-generator/ruby/1.0.0)
|
315
|
+
def user_agent=(user_agent)
|
316
|
+
@user_agent = user_agent
|
317
|
+
@default_headers['User-Agent'] = @user_agent
|
318
|
+
end
|
319
|
+
|
320
|
+
# Return Accept header based on an array of accepts provided.
|
321
|
+
# @param [Array] accepts array for Accept
|
322
|
+
# @return [String] the Accept header (e.g. application/json)
|
323
|
+
def select_header_accept(accepts)
|
324
|
+
return nil if accepts.nil? || accepts.empty?
|
325
|
+
# use JSON when present, otherwise use all of the provided
|
326
|
+
json_accept = accepts.find { |s| json_mime?(s) }
|
327
|
+
json_accept || accepts.join(',')
|
328
|
+
end
|
329
|
+
|
330
|
+
# Return Content-Type header based on an array of content types provided.
|
331
|
+
# @param [Array] content_types array for Content-Type
|
332
|
+
# @return [String] the Content-Type header (e.g. application/json)
|
333
|
+
def select_header_content_type(content_types)
|
334
|
+
# use application/json by default
|
335
|
+
return 'application/json' if content_types.nil? || content_types.empty?
|
336
|
+
# use JSON when present, otherwise use the first one
|
337
|
+
json_content_type = content_types.find { |s| json_mime?(s) }
|
338
|
+
json_content_type || content_types.first
|
339
|
+
end
|
340
|
+
|
341
|
+
# Convert object (array, hash, object, etc) to JSON string.
|
342
|
+
# @param [Object] model object to be converted into JSON string
|
343
|
+
# @return [String] JSON string representation of the object
|
344
|
+
def object_to_http_body(model)
|
345
|
+
return model if model.nil? || model.is_a?(String)
|
346
|
+
local_body = nil
|
347
|
+
if model.is_a?(Array)
|
348
|
+
local_body = model.map { |m| object_to_hash(m) }
|
349
|
+
else
|
350
|
+
local_body = object_to_hash(model)
|
351
|
+
end
|
352
|
+
local_body.to_json
|
353
|
+
end
|
354
|
+
|
355
|
+
# Convert object(non-array) to hash.
|
356
|
+
# @param [Object] obj object to be converted into JSON string
|
357
|
+
# @return [String] JSON string representation of the object
|
358
|
+
def object_to_hash(obj)
|
359
|
+
if obj.respond_to?(:to_hash)
|
360
|
+
obj.to_hash
|
361
|
+
else
|
362
|
+
obj
|
363
|
+
end
|
364
|
+
end
|
365
|
+
|
366
|
+
# Build parameter value according to the given collection format.
|
367
|
+
# @param [String] collection_format one of :csv, :ssv, :tsv, :pipes and :multi
|
368
|
+
def build_collection_param(param, collection_format)
|
369
|
+
case collection_format
|
370
|
+
when :csv
|
371
|
+
param.join(',')
|
372
|
+
when :ssv
|
373
|
+
param.join(' ')
|
374
|
+
when :tsv
|
375
|
+
param.join("\t")
|
376
|
+
when :pipes
|
377
|
+
param.join('|')
|
378
|
+
when :multi
|
379
|
+
# return the array directly as typhoeus will handle it as expected
|
380
|
+
param
|
381
|
+
else
|
382
|
+
fail "unknown collection format: #{collection_format.inspect}"
|
383
|
+
end
|
384
|
+
end
|
385
|
+
end
|
386
|
+
end
|